Loading [MathJax]/extensions/TeX/AMSmath.js
LALPulsar 7.1.1.1-6c6b863
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
templates.h File Reference

Prototypes

TwoSpectTemplatecreateTwoSpectTemplate (const UINT4 length)
 Allocate a new TwoSpectTemplate. More...
 
void resetTwoSpectTemplate (TwoSpectTemplate *template)
 Reset the values in a TwoSpectTemplate. More...
 
void destroyTwoSpectTemplate (TwoSpectTemplate *template)
 Free a TwoSpectTemplate. More...
 
TwoSpectTemplateVectorcreateTwoSpectTemplateVector (const UINT4 numTemplates, const UINT4 templateLength)
 Create a TwoSpectTemplateVector. More...
 
void destroyTwoSpectTemplateVector (TwoSpectTemplateVector *vector)
 Free a TwoSpectTemplateVector. More...
 
TwoSpectTemplateVectorgenerateTwoSpectTemplateVector (const REAL8 Pmin, const REAL8 Pmax, const REAL8 dfmin, const REAL8 dfmax, const REAL8 Tsft, const REAL8 SFToverlap, const REAL8 Tobs, const UINT4 maxvectorlength, const UINT4 minTemplateLength, const UINT4 maxTemplateLength, const UINT4 vectormathflag, const BOOLEAN exactflag)
 Generate a TwoSpectTemplateVector containing the template data. More...
 
INT4 writeTwoSpectTemplateVector (const TwoSpectTemplateVector *vector, const CHAR *filename)
 Write a TwoSpectTemplateVector to binary file. More...
 
TwoSpectTemplateVectorreadTwoSpectTemplateVector (const CHAR *filename)
 Read a TwoSpectTemplateVector from a binary file. More...
 
INT4 convertTemplateForSpecificFbin (TwoSpectTemplate *output, const TwoSpectTemplate *input, const REAL8 freq, const UserInput_t *params)
 Convert an arbitrary frequency bin template into a template for a specific frequency bin. More...
 
INT4 makeTemplateGaussians (TwoSpectTemplate *output, const candidate input, const UserInput_t *params)
 Make an estimated template based on FFT of train of Gaussians. More...
 
INT4 makeTemplateGaussians2 (TwoSpectTemplate *output, const REAL8 offset, const REAL8 P, const REAL8 deltaf, const REAL8 Tsft, const REAL8 SFToverlap, const REAL8 Tobs, const UINT4 minTemplateLength, const UINT4 vectormathflag)
 Make an estimated template based on FFT of train of Gaussians. More...
 
INT4 makeTemplate (TwoSpectTemplate *output, const candidate intput, const UserInput_t *params, const REAL4FFTPlan *plan)
 Make an template based on FFT of sinc squared functions. More...
 
INT4 makeTemplate2 (TwoSpectTemplate *output, const REAL8 offset, const REAL8 P, const REAL8 deltaf, const REAL8 Tsft, const REAL8 SFToverlap, const REAL8 Tobs, const UINT4 minTemplateLength, const UINT4 vectormathflag, const REAL4FFTPlan *plan)
 Make an template based on FFT of sinc squared functions. More...
 
void insertionSort_template (TwoSpectTemplate *output, const REAL4 weight, const INT4 pixelloc)
 Insertion sort for the template weights. More...
 
REAL8 sincxoverxsqminusone (const REAL8 x)
 Calculate sin(pi*x)/(pi*x)/(x^2-1) More...
 
REAL8 sqsincxoverxsqminusone (const REAL8 x)
 Calculate [sin(pi*x)/(pi*x)/(x^2-1)]^2. More...
 

Go to the source code of this file.

Function Documentation

◆ createTwoSpectTemplate()

TwoSpectTemplate * createTwoSpectTemplate ( const UINT4  length)

Allocate a new TwoSpectTemplate.

Parameters
[in]lengthLength of the template
Returns
Pointer to TwoSpectTemplate

Definition at line 35 of file templates.c.

◆ resetTwoSpectTemplate()

void resetTwoSpectTemplate ( TwoSpectTemplate template)

Reset the values in a TwoSpectTemplate.

Parameters
[in]templatePointer to a TwoSpectTemplate

Definition at line 60 of file templates.c.

◆ destroyTwoSpectTemplate()

void destroyTwoSpectTemplate ( TwoSpectTemplate template)

Free a TwoSpectTemplate.

Parameters
[in]templatePointer to a TwoSpectTemplate

Definition at line 78 of file templates.c.

◆ createTwoSpectTemplateVector()

TwoSpectTemplateVector * createTwoSpectTemplateVector ( const UINT4  length,
const UINT4  templateLength 
)

Create a TwoSpectTemplateVector.

Parameters
[in]lengthThe number of templates in the vector
[in]templateLengthThe maximum number of pixels in a template
Returns
Pointer to a TwoSpectTemplateVector

Definition at line 94 of file templates.c.

◆ destroyTwoSpectTemplateVector()

void destroyTwoSpectTemplateVector ( TwoSpectTemplateVector vector)

Free a TwoSpectTemplateVector.

Parameters
[in]vectorPointer to the TwoSpectTemplateVector

Definition at line 120 of file templates.c.

◆ generateTwoSpectTemplateVector()

TwoSpectTemplateVector * generateTwoSpectTemplateVector ( const REAL8  Pmin,
const REAL8  Pmax,
const REAL8  dfmin,
const REAL8  dfmax,
const REAL8  Tsft,
const REAL8  SFToverlap,
const REAL8  Tobs,
const UINT4  maxvectorlength,
const UINT4  minTemplateLength,
const UINT4  maxTemplateLength,
const UINT4  vectormathflag,
const BOOLEAN  exactflag 
)

Generate a TwoSpectTemplateVector containing the template data.

Parameters
[in]PminMinimum orbital period (s)
[in]PmaxMaximum orbital period (s)
[in]dfminMinimum modulation depth (Hz)
[in]dfmaxMaximum modulation depth (Hz)
[in]TsftTimespan of SFTs (s)
[in]SFToverlapOverlap of SFTs (s)
[in]TobsObservation time (s)
[in]maxvectorlengthLimit the number of templates generated to be the maximum value specified here
[in]minTemplateLengthThe minimum number of pixels in a template
[in]maxTemplateLengthThe maximum number of pixels in a template
[in]vectormathflagFlag specifying what type of vector math to use: 0 = none, 1 = SSE, 2 = AVX (for SSE and AVX, must compile using correct flags and instructions allowed on the CPU)
[in]exactflagFlag specifying to use exact templates: 1 = enabled, 0 = disabled
Returns
Pointer to a TwoSpectTemplateVector

Definition at line 156 of file templates.c.

◆ writeTwoSpectTemplateVector()

INT4 writeTwoSpectTemplateVector ( const TwoSpectTemplateVector vector,
const CHAR filename 
)

Write a TwoSpectTemplateVector to binary file.

Parameters
[in]vectorPointer to the TwoSpectTemplateVector
[in]filenameString of the filename
Returns
Status value

Definition at line 222 of file templates.c.

◆ readTwoSpectTemplateVector()

TwoSpectTemplateVector * readTwoSpectTemplateVector ( const CHAR filename)

Read a TwoSpectTemplateVector from a binary file.

Parameters
[in]filenameString of the filename
Returns
Pointer to a new TwoSpectTemplateVector

Definition at line 250 of file templates.c.

◆ convertTemplateForSpecificFbin()

INT4 convertTemplateForSpecificFbin ( TwoSpectTemplate output,
const TwoSpectTemplate input,
const REAL8  freq,
const UserInput_t params 
)

Convert an arbitrary frequency bin template into a template for a specific frequency bin.

When using this function, the input template should be generated first using makeTemplate*2 functions. Then call this function with a specific bin center frequency. The input template can contain an offset up to half a frequency bin in order to generate any frequency of a template. The output template must be at most as long as the input template. For shorter lengths, only the first output->templatedata->length values are kept

Parameters
[in,out]outputPointer to a TwoSpectTemplate for a specific frequency bin
[in]inputPointer to a TwoSpectTemplate for an arbitrary frequency bin
[in]freqFrequency of a bin centered signal
[in]paramsPointer to a UserInput_t struct

Definition at line 330 of file templates.c.

◆ makeTemplateGaussians()

INT4 makeTemplateGaussians ( TwoSpectTemplate output,
const candidate  input,
const UserInput_t params 
)

Make an estimated template based on FFT of train of Gaussians.

This is eq. 18 of E. Goetz and K. Riles (2011). This handles spillages of power into neighboring frequency bins a little more gracefully. Numerical stability issues mean that we need to compute exp(log(eq. 18)) = eq. 18 exp(log(eq. 18)) = exp(log(4*pi*sigma^2) - sigma^2*omegapr^2) * (1+cos(delta*omegapr)) * exp(log(1-cos(N*P*omegapr))-log(P*omegapr))

Parameters
[out]outputPointer to TwoSpectTemplate
[in]inputAn input candidate structure
[in]paramsPointer to UserInput_t
Returns
Status value

Definition at line 289 of file templates.c.

◆ makeTemplateGaussians2()

INT4 makeTemplateGaussians2 ( TwoSpectTemplate output,
const REAL8  offset,
const REAL8  P,
const REAL8  deltaf,
const REAL8  Tsft,
const REAL8  SFToverlap,
const REAL8  Tobs,
const UINT4  minTemplateLength,
const UINT4  vectormathflag 
)

Make an estimated template based on FFT of train of Gaussians.

This is eq. 18 of E. Goetz and K. Riles (2011). This handles spillages of power into neighboring frequency bins a little more gracefully. Numerical stability issues mean that we need to compute exp(log(eq. 18)) = eq. 18 exp(log(eq. 18)) = exp(log(4*pi*sigma^2) - sigma^2*omegapr^2) * (1+cos(delta*omegapr)) * exp(log(1-cos(N*P*omegapr))-log(P*omegapr))

Parameters
[in,out]outputPointer to TwoSpectTemplate
[in]offsetAmount of offset from bin centered signal (-0.5 <= offset <= 0.5)
[in]POrbital period (seconds)
[in]deltafModulation depth of the signal (Hz)
[in]TsftLength of an SFT (s)
[in]SFToverlapSFT overlap (s)
[in]TobsObservation time (s)
[in]minTemplateLengthMinimum number of pixels in a template
[in]vectormathflagFlag indicating to use vector math: 0 = none, 1 = SSE, 2 = AVX (must compile for vector math appropriately and CPU must have those instructions)
Returns
Status value

Definition at line 374 of file templates.c.

◆ makeTemplate()

INT4 makeTemplate ( TwoSpectTemplate output,
const candidate  input,
const UserInput_t params,
const REAL4FFTPlan *  plan 
)

Make an template based on FFT of sinc squared functions.

This is eq. 20 of E. Goetz and K. Riles (2011)

Parameters
[out]outputPointer to TwoSpectTemplate
[in]inputAn input candidate structure
[in]paramsPointer to UserInput_t
[in]planPointer to REAL4FFTPlan
Returns
Status value

Definition at line 727 of file templates.c.

◆ makeTemplate2()

INT4 makeTemplate2 ( TwoSpectTemplate output,
const REAL8  offset,
const REAL8  P,
const REAL8  deltaf,
const REAL8  Tsft,
const REAL8  SFToverlap,
const REAL8  Tobs,
const UINT4  minTemplateLength,
const UINT4  vectormathflag,
const REAL4FFTPlan *  plan 
)

Make an template based on FFT of sinc squared functions.

This is eq. 20 of E. Goetz and K. Riles (2011)

Parameters
[in,out]outputPointer to TwoSpectTemplate
[in]offsetAmount of offset from bin centered signal (-0.5 <= offset <= 0.5)
[in]POrbital period (seconds)
[in]deltafModulation depth of the signal (Hz)
[in]TsftLength of an SFT (s)
[in]SFToverlapSFT overlap (s)
[in]TobsObservation time (s)
[in]minTemplateLengthMinimum number of pixels in a template
[in]vectormathflagFlag indicating to use vector math: 0 = none, 1 = SSE, 2 = AVX (must compile for vector math appropriately and CPU must have those instructions)
[in]planPointer to REAL4FFTPlan
Returns
Status value

Definition at line 771 of file templates.c.

◆ insertionSort_template()

void insertionSort_template ( TwoSpectTemplate output,
const REAL4  weight,
const INT4  pixelloc 
)

Insertion sort for the template weights.

Parameters
[out]outputPointer to TwoSpectTemplate
[in]weightPixel weight
[in]pixellocIndex of the pixel in the REAL4VectorAligned of the frequency-frequency plane

Definition at line 938 of file templates.c.

◆ sincxoverxsqminusone()

REAL8 sincxoverxsqminusone ( const REAL8  x)

Calculate sin(pi*x)/(pi*x)/(x^2-1)

Parameters
xValue from which to compute

Definition at line 963 of file templates.c.

◆ sqsincxoverxsqminusone()

REAL8 sqsincxoverxsqminusone ( const REAL8  x)

Calculate [sin(pi*x)/(pi*x)/(x^2-1)]^2.

Parameters
xValue from which to compute

Definition at line 988 of file templates.c.