tico 0.1
Mechanical Watch Terminal Timegrapher
Functions
Myfft Library

FFT and filter utilities. More...

Functions

fftw_complex * makeFilter (size_t evalue, size_t ArrayLength)
 @ . More...
 
size_t fftfit (struct myarr input, int *total, const int *base, double *corvalue, fftw_complex *filterFFT, int verb, double *subpos)
 @ shift. More...
 
fftw_complex * convolute (struct myarr array, fftw_complex *filter)
 @ frequency domain. More...
 
size_t getmaxfftw (fftw_complex *array, size_t ArrayLength)
 @ frequency domain. More...
 
fftw_complex * crosscor (size_t ArrayLength, fftw_complex *array, fftw_complex *ref)
 Perform cross-correlation between the input array and the reference array in the frequency domain. More...
 
void writefftw (fftw_complex *arr, size_t ArrayLength, const char *file)
 Write the given array in the frequency domain to a file. More...
 
void remove50hz (size_t ArrayLength, int *array, unsigned int rate)
 Remove the 50Hz component from the input array. More...
 
void normalise (size_t ArrayLength, fftw_complex *inData)
 Normalise the input array in the frequency domain. More...
 
void rescale (int *total, size_t ArrayLength)
 Rescale the input array to fit within the range of a 16-bit signed integer. More...
 
int getshift (struct myarr xarr, struct myarr yarr)
 Get the shift between the two input arrays. More...
 

Detailed Description

FFT and filter utilities.

Function Documentation

◆ convolute()

fftw_complex * convolute ( struct myarr  array,
fftw_complex *  filter 
)

@ frequency domain.

Parameters
arrayThe input array to convolute.
filterThe filter in the frequency domain to convolute with.
Returns
A pointer to the result of the convolution in the frequency domain.

◆ crosscor()

fftw_complex * crosscor ( size_t  ArrayLength,
fftw_complex *  array,
fftw_complex *  ref 
)

Perform cross-correlation between the input array and the reference array in the frequency domain.

Parameters
ArrayLengthThe length of the input and reference arrays.
arrayThe input array in the frequency domain to cross-correlate.
refThe reference array in the frequency domain to cross-correlate with.
Returns
A pointer to the result of the cross-correlation in the frequency domain.

◆ fftfit()

size_t fftfit ( struct myarr  input,
int *  total,
const int *  base,
double *  corvalue,
fftw_complex *  filterFFT,
int  verb,
double *  subpos 
)

@ shift.

Parameters
inputThe input array to fit.
totalA pointer to an integer where the total shift will be stored.
baseA pointer to an integer where the base shift will be stored.
corvalueA pointer to a double where the correlation value will be stored.
filterFFTThe filter in the frequency domain.
verbAn integer indicating whether to print verbose output (1 for yes, 0 for no).
subposA pointer to a double where the subpixel position will be stored.
Returns
The total shift as a size_t.

◆ getmaxfftw()

size_t getmaxfftw ( fftw_complex *  array,
size_t  ArrayLength 
)

@ frequency domain.

Parameters
arrayThe input array in the frequency domain to search for the maximum value.
ArrayLengthThe length of the input array.
Returns
The maximum value found in the input array as a size_t.

◆ getshift()

int getshift ( struct myarr  xarr,
struct myarr  yarr 
)

Get the shift between the two input arrays.

Parameters
xarrThe first input array to compare.
yarrThe second input array to compare.
Returns
The shift between the two input arrays as an integer.

◆ makeFilter()

fftw_complex * makeFilter ( size_t  evalue,
size_t  ArrayLength 
)

@ .

Parameters
evalueThe evalue to use for the filter.
ArrayLengthThe length of the array to filter.
Returns
A pointer to the filter in the frequency domain.

◆ normalise()

void normalise ( size_t  ArrayLength,
fftw_complex *  inData 
)

Normalise the input array in the frequency domain.

Parameters
ArrayLengthThe length of the input array.
inDataThe input array in the frequency domain to normalise.

◆ remove50hz()

void remove50hz ( size_t  ArrayLength,
int *  array,
unsigned int  rate 
)

Remove the 50Hz component from the input array.

Parameters
ArrayLengthThe length of the input array.
arrayThe input array to remove the 50Hz component from.
rateThe sampling rate of the input array.

◆ rescale()

void rescale ( int *  total,
size_t  ArrayLength 
)

Rescale the input array to fit within the range of a 16-bit signed integer.

Parameters
totalA pointer to an integer where the total shift will be stored.
ArrayLengthThe length of the input array.

◆ writefftw()

void writefftw ( fftw_complex *  arr,
size_t  ArrayLength,
const char *  file 
)

Write the given array in the frequency domain to a file.

Parameters
arrThe input array in the frequency domain to write to a file.
ArrayLengthThe length of the input array.
fileThe name of the file to write the array to.