cacao  Release 0.1.03-dev
Compute And Control For Adaptive Optics
fft.c File Reference

Fourier Transform. More...

#include <stdint.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <fftw3.h>
#include "CommandLineInterface/CLIcore.h"
#include "00CORE/00CORE.h"
#include "COREMOD_memory/COREMOD_memory.h"
#include "COREMOD_iofits/COREMOD_iofits.h"
#include "COREMOD_arith/COREMOD_arith.h"
#include "COREMOD_tools/COREMOD_tools.h"
#include "fft/fft.h"
Include dependency graph for fft.c:

Macros

#define MODULE_SHORTNAME_DEFAULT   ""
 
#define MODULE_DESCRIPTION   "FFTW wrapper"
 
#define MODULE_APPLICATION   "milk"
 
#define PI   3.14159265358979323846264338328
 
#define SWAPf(x, y)
 
#define SWAPd(x, y)
 
#define CSWAPcf(x, y)
 
#define CSWAPcd(x, y)
 
#define SBUFFERSIZE   1000
 
#define FFTWOPTMODE   FFTW_ESTIMATE
 

Functions

errno_t fft_permut_cli ()
 
errno_t fft_do1dfft_cli ()
 
errno_t fft_do1drfft_cli ()
 
errno_t fft_do2dfft_cli ()
 
errno_t test_fftspeed_cli ()
 
errno_t fft_image_translate_cli ()
 
errno_t fft_correlation_cli ()
 
static errno_t init_module_CLI ()
 
static void __attribute__ ((destructor))
 
int fft_setNthreads (__attribute__((unused)) int nt)
 
errno_t import_wisdom ()
 
errno_t export_wisdom ()
 
errno_t init_fftw_plans (int mode)
 
errno_t init_fftw_plans0 ()
 
int permut (const char *ID_name)
 
int array_index (long size)
 
long FFT_do1dfft (const char *in_name, const char *out_name, int dir)
 
long do1drfft (const char *in_name, const char *out_name)
 
long do1dfft (const char *in_name, const char *out_name)
 
long do1dffti (const char *in_name, const char *out_name)
 
long FFT_do2dfft (const char *in_name, const char *out_name, int dir)
 
long do2dfft (const char *in_name, const char *out_name)
 
long do2dffti (const char *in_name, const char *out_name)
 
int pupfft (const char *ID_name_ampl, const char *ID_name_pha, const char *ID_name_ampl_out, const char *ID_name_pha_out, const char *options)
 
long FFT_do2drfft (const char *in_name, const char *out_name, int dir)
 
long do2drfft (const char *in_name, const char *out_name)
 
long do2drffti (const char *in_name, const char *out_name)
 
imageID fft_correlation (const char *ID_name1, const char *ID_name2, const char *ID_nameout)
 
int autocorrelation (const char *ID_name, const char *ID_out)
 
int fftczoom (const char *ID_name, const char *ID_out, long factor)
 
int fftzoom (const char *ID_name, const char *ID_out, long factor)
 
int test_fftspeed (int nmax)
 Test FFT speed (fftw) More...
 
imageID fft_DFT (const char *IDin_name, const char *IDinmask_name, const char *IDout_name, const char *IDoutmask_name, double Zfactor, int dir, long kin)
 
imageID fft_DFTinsertFPM (const char *pupin_name, const char *fpmz_name, double zfactor, const char *pupout_name)
 Use DFT to insert Focal Plane Mask. More...
 
imageID fft_DFTinsertFPM_re (const char *pupin_name, const char *fpmz_name, double zfactor, const char *pupout_name)
 
int fft_image_translate (const char *ID_name, const char *ID_out, double xtransl, double ytransl)
 

Variables

static int INITSTATUS_module = 0
 

Detailed Description

Fourier Transform.

Wrapper to fftw

Macro Definition Documentation

◆ CSWAPcd

#define CSWAPcd (   x,
 
)
Value:
do { \
double swaptmp = (x.re); \
x.re = y.re; \
y.re = swaptmp; \
swaptmp = x.im; \
x.im = y.im; \
y.im = swaptmp; \
} while(0)

◆ CSWAPcf

#define CSWAPcf (   x,
 
)
Value:
do { \
float swaptmp = x.re; \
x.re = y.re; \
y.re = swaptmp; \
swaptmp = x.im; \
x.im = y.im; \
y.im = swaptmp; \
} while(0)

◆ FFTWOPTMODE

#define FFTWOPTMODE   FFTW_ESTIMATE

◆ MODULE_APPLICATION

#define MODULE_APPLICATION   "milk"

◆ MODULE_DESCRIPTION

#define MODULE_DESCRIPTION   "FFTW wrapper"

◆ MODULE_SHORTNAME_DEFAULT

#define MODULE_SHORTNAME_DEFAULT   ""

◆ PI

#define PI   3.14159265358979323846264338328

◆ SBUFFERSIZE

#define SBUFFERSIZE   1000

◆ SWAPd

#define SWAPd (   x,
 
)
Value:
do { \
double swaptmp = x; \
x = y; \
y = swaptmp; \
} while(0)

◆ SWAPf

#define SWAPf (   x,
 
)
Value:
do { \
float swaptmp = x; \
x = y; \
y = swaptmp; \
} while(0)

Function Documentation

◆ __attribute__()

static void __attribute__ ( (destructor)  )
static

◆ array_index()

int array_index ( long  size)

◆ autocorrelation()

int autocorrelation ( const char *  ID_name,
const char *  ID_out 
)

◆ do1dfft()

long do1dfft ( const char *  in_name,
const char *  out_name 
)

◆ do1dffti()

long do1dffti ( const char *  in_name,
const char *  out_name 
)

◆ do1drfft()

long do1drfft ( const char *  in_name,
const char *  out_name 
)

◆ do2dfft()

long do2dfft ( const char *  in_name,
const char *  out_name 
)

◆ do2dffti()

long do2dffti ( const char *  in_name,
const char *  out_name 
)

◆ do2drfft()

long do2drfft ( const char *  in_name,
const char *  out_name 
)

◆ do2drffti()

long do2drffti ( const char *  in_name,
const char *  out_name 
)

◆ export_wisdom()

errno_t export_wisdom ( )

◆ fft_correlation()

imageID fft_correlation ( const char *  ID_name1,
const char *  ID_name2,
const char *  ID_nameout 
)

◆ fft_correlation_cli()

errno_t fft_correlation_cli ( )

◆ fft_DFT()

imageID fft_DFT ( const char *  IDin_name,
const char *  IDinmask_name,
const char *  IDout_name,
const char *  IDoutmask_name,
double  Zfactor,
int  dir,
long  kin 
)

◆ fft_DFTinsertFPM()

imageID fft_DFTinsertFPM ( const char *  pupin_name,
const char *  fpmz_name,
double  zfactor,
const char *  pupout_name 
)

Use DFT to insert Focal Plane Mask.

Pupil convolution by complex focal plane mask of limited support typically used with fpmz = zoomed copy of 1-fpm

High resolution focal plane mask using DFT

Forces computation over pixels >0.5 in _DFTmask00 if it exists

Warning
This internal test could crash the process as multiple write operations to the same filename may occurr: leave option OFF for production

◆ fft_DFTinsertFPM_re()

imageID fft_DFTinsertFPM_re ( const char *  pupin_name,
const char *  fpmz_name,
double  zfactor,
const char *  pupout_name 
)

◆ FFT_do1dfft()

long FFT_do1dfft ( const char *  in_name,
const char *  out_name,
int  dir 
)

◆ fft_do1dfft_cli()

errno_t fft_do1dfft_cli ( )

◆ fft_do1drfft_cli()

errno_t fft_do1drfft_cli ( )

◆ FFT_do2dfft()

long FFT_do2dfft ( const char *  in_name,
const char *  out_name,
int  dir 
)

◆ fft_do2dfft_cli()

errno_t fft_do2dfft_cli ( )

◆ FFT_do2drfft()

long FFT_do2drfft ( const char *  in_name,
const char *  out_name,
int  dir 
)

◆ fft_image_translate()

int fft_image_translate ( const char *  ID_name,
const char *  ID_out,
double  xtransl,
double  ytransl 
)

◆ fft_image_translate_cli()

errno_t fft_image_translate_cli ( )

◆ fft_permut_cli()

errno_t fft_permut_cli ( )

◆ fft_setNthreads()

int fft_setNthreads ( __attribute__((unused)) int  nt)

◆ fftczoom()

int fftczoom ( const char *  ID_name,
const char *  ID_out,
long  factor 
)

◆ fftzoom()

int fftzoom ( const char *  ID_name,
const char *  ID_out,
long  factor 
)

◆ import_wisdom()

errno_t import_wisdom ( )

◆ init_fftw_plans()

errno_t init_fftw_plans ( int  mode)

◆ init_fftw_plans0()

errno_t init_fftw_plans0 ( )

◆ init_module_CLI()

static errno_t init_module_CLI ( )
static

◆ permut()

int permut ( const char *  ID_name)

◆ pupfft()

int pupfft ( const char *  ID_name_ampl,
const char *  ID_name_pha,
const char *  ID_name_ampl_out,
const char *  ID_name_pha_out,
const char *  options 
)

◆ test_fftspeed()

int test_fftspeed ( int  nmax)

Test FFT speed (fftw)

◆ test_fftspeed_cli()

errno_t test_fftspeed_cli ( )

Variable Documentation

◆ INITSTATUS_module

int INITSTATUS_module = 0
static