IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 316


Ignore:
Timestamp:
Mar 30, 2004, 2:41:29 PM (22 years ago)
Author:
Paul Price
Message:

Added FFT draft.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/pslib/psLibADD.tex

    r315 r316  
    482482\subsection{(Fast) Fourier Transforms}
    483483
    484 (Fast) Fourier Transforms (FFTs) shall be implemented using the FFTW
    485 package (www.fftw.org).
     484(Fast) Fourier Transforms (FFTs) shall be implemented using the {\em
     485Fastest Fourier Transform in the West} (FFTW) library
     486(\href{www.fftw.org}).
    486487
    487488\subsubsection{FFTW Plans}
     
    494495In the \PS{} IPP, we will want to perform FFTs on images of common
    495496sizes (e.g.\ $512 \times 512$) regularly.  This means that we would
    496 gain from determining a FFTW plan for each of these common sizes.
    497 PSLib should therefore maintain a library of these plans, which can be
    498 loaded and employed as required.  The location of this library on disk
    499 will be specified as a configuration variable for the IPP.
    500 
    501 A program to generate plans for a list of common image sizes should be
    502 provided.  For example:
    503 \begin{verbatim}
    504 machine01% cat myImageSizes.txt
    505 512 512
    506 256 256
    507 32 32
    508 machine01% psMakeFFTPlans myImageSizes.txt
    509 machine01% ls
    510 fftw.machine01.512.512.plan
    511 fftw.machine01.256.256.plan
    512 fftw.machine01.32.32.plan
    513 \end{verbatim}
    514 
    515 Plans should be generated using the \code{FFTW_MEASURE} flag of FFTW.
    516 
    517 The list of known plans should be read in upon initialisation of the
    518 PSLib FFT functions, and the appropriate plan should be used for
    519 transformations.
     497gain from determining an FFTW plan for each of these common sizes.
     498FFTW provides a binary, \code{fftw-wisdom} which may be used to
     499generate and save ``wisdom''.  The location of the \code{wisdom} file
     500will be specified as a configuration variable for the IPP (defaulting
     501to \code{/etc/fftw/wisdom}).  The \code{wisdom} should be read in upon
     502initialisation of the PSLib FFT functions and saved at the conclusion.
    520503
    521504\subsubsection{Function mapping}
    522505
    523 
     506The forward and reverse transforms call the corresponding
     507FFTW function to plan the transform:
     508
     509\begin{tabular}{ll}
     510  PSLib function           & Major FFTW call \\ \hline
     511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     512  psFFTForward()           & fftw_plan_dft_r2c_2d()
     513  psFFTReverse()           & fftw_plan_dft_c2r_2d()
     514\end{tabular}
     515
     516These plans should be formulated using the \code{FFTW_ESTIMATE} flag,
     517which will allow FFTW to default to a short planning time if the
     518wisdom has not been loaded.  Transforms should be performed out of
     519place to avoid the need to pad the input array.
     520
     521\subsubsection{More Complicated Functions}
     522
     523The \code{psFFTFilter} and \code{psFFTFilterComplex} functions provide
     524a means to apply a filter (purely real and imaginary multipliers,
     525respectively) to the data in the Fourier plane.  If the filter
     526function specified for \code{psFFTFilter} returns a real value, $r$,
     527then the corresponding value in the Fourier plane should be multiplied
     528by $r$.  If the real and imaginary filter functions specified for
     529\code{psFFTFilterComplex} returns the values $r$ and $s$,
     530respectively, then the corresponding value in the Fourier plane should be
     531multiplied by the complex number $(r + si)$.
     532
     533\code{psFFTCrossCorrelate()} and \code{psFFTConvolve()} both involve
     534multiplication of two Fourier transforms.  In the former, the first
     535Fourier transform is multiplied by the complex conjugate of the second
     536Fourier transform to yield the Fourier transform of the cross-correlation.
     537In the latter, the two Fourier transforms are multiplied directly to yield
     538the Fourier transform of the convolution.
     539
     540If the elements of the discrete Fourier transform are $C_k$, then the
     541the elements of the power spectrum are defined (NR 13.4):
     542\begin{eqnarray}
     543P_0     & = & \| C_0 \|^2 / N^2 \\
     544P_j     & = & \left( \| C_j \|^2 + \| C_{N-j} \|^2 \right)/ N^2 & j = 1, 2, \ldots, (N/2 - 1) \\
     545P_{N/2} & = & \| C_{N/2} \|^2 / N^2 \\
     546\end{eqnarray}
     547
     548Note that we leave the issue of ``windowing'' the data up to the
     549caller, and choose to normalise by $1/N^2$.
    524550
    525551\subsection{Astronomy Utilities}
Note: See TracChangeset for help on using the changeset viewer.