LALPulsar  6.1.0.1-b72065a
ComputeFstat.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2012--2014 David Keitel, Bernd Machenschalk, Reinhard Prix, Karl Wette
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with with program; see the file COPYING. If not, write to the
16 // Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 // MA 02110-1301 USA
18 //
19 
20 #ifndef _COMPUTEFSTAT_H
21 #define _COMPUTEFSTAT_H
22 
23 #include <lal/LALStdlib.h>
24 #include <lal/UserInputParse.h>
25 #include <lal/PulsarDataTypes.h>
26 #include <lal/LALComputeAM.h>
27 #include <lal/LALComputeAM.h>
28 #include <lal/SSBtimes.h>
29 #include <lal/CWMakeFakeData.h>
30 #include <lal/LFTandTSutils.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 ///
37 /// \defgroup ComputeFstat_h Header ComputeFstat.h
38 /// \ingroup lalpulsar_coh
39 /// \authors Badri Krishnan, Bernd Machenschalk, Chris Messenger, David Keitel, Holger Pletsch,
40 /// John T. Whelan, Karl Wette, Pinkesh Patel, Reinhard Prix, Xavier Siemens
41 ///
42 /// \brief The \f$ \mathcal{F} \f$ -statistic.
43 ///
44 /// This module provides a API for computing the \f$ \mathcal{F} \f$ -statistic \cite JKS98 , using
45 /// various different methods. All data required to compute the \f$ \mathcal{F} \f$ -statistic are
46 /// contained in the opaque structure \c FstatInput, which is shared by all methods. A function
47 /// XLALCreateFstatInput() is provided for creating an \c FstatInput structure configured
48 /// for the particular method. The \c FstatInput structure is passed to the function
49 /// XLALComputeFstat(), which computes the \f$ \mathcal{F} \f$ -statistic using the chosen method, and
50 /// fills a \c FstatResults structure with the results.
51 ///
52 /// \note The \f$ \mathcal{F} \f$ -statistic method codes are partly descended from earlier
53 /// implementations found in:
54 /// - <tt>LALDemod.[ch]</tt> by Jolien Creighton, Maria Alessandra Papa, Reinhard Prix, Steve
55 /// Berukoff, Xavier Siemens, Bruce Allen
56 /// - <tt>ComputeSky.[ch]</tt> by Jolien Creighton, Reinhard Prix, Steve Berukoff
57 /// - <tt>LALComputeAM.[ch]</tt> by Jolien Creighton, Maria Alessandra Papa, Reinhard Prix, Steve
58 /// Berukoff, Xavier Siemens
59 /// - <tt>ComputeFStatistic_resamp.c</tt> by Pinkesh Patel, Xavier Siemens, Reinhard Prix, Iraj
60 /// Gholami, Yousuke Itoh, Maria Alessandra Papa
61 ///
62 
63 /// @{
64 
65 /// default maximum allowed F-stat mismatch from SFTs being too long,
66 /// to be used in XLALFstatCheckSFTLengthMismatch()
67 /// - this value allows a search using 1800-second SFTs for isolated CW signals with frequencies <~ 2054 Hz,
68 /// while preventing a search using 1800-second SFTs for a Sco X-1-like binary CW signal
69 /// (which would require <~ 200-second SFTs)
70 #define DEFAULT_MAX_MISMATCH_FROM_SFT_LENGTH 0.05
71 
72 ///
73 /// XLALComputeFstat() input data structure. Encapsulates all data, buffers, etc. used by the
74 /// \f$ \mathcal{F} \f$ -statistic methods.
75 ///
76 typedef struct tagFstatInput FstatInput;
77 
78 ///
79 /// A vector of XLALComputeFstat() input data structures, for e.g. computing the
80 /// \f$ \mathcal{F} \f$ -statistic for multiple segments.
81 ///
82 typedef struct tagFstatInputVector {
83 #ifdef SWIG // SWIG interface directives
84  SWIGLAL( ARRAY_1D( FstatInputVector, FstatInput *, data, UINT4, length ) );
85 #endif // SWIG
86  UINT4 length; ///< Number of elements in array.
87  FstatInput **data; ///< Pointer to the data array.
89 
90 ///
91 /// Bit-field of \f$ \mathcal{F} \f$ -statistic quantities which can be computed by XLALComputeFstat().
92 /// Not all options are supported by all \f$ \mathcal{F} \f$ -statistic methods.
93 ///
94 typedef enum tagFstatQuantities {
95  FSTATQ_NONE = 0x00, ///< Do not compute \f$ \mathcal{F} \f$ -statistic, still compute buffered quantities
96  FSTATQ_2F = 0x01, ///< Compute multi-detector \f$ 2\mathcal{F} \f$ .
97  FSTATQ_FAFB = 0x02, ///< Compute multi-detector \f$ F_a \f$ and \f$ F_b \f$ .
98  FSTATQ_2F_PER_DET = 0x04, ///< Compute \f$ 2\mathcal{F} \f$ for each detector.
99  FSTATQ_FAFB_PER_DET = 0x08, ///< Compute \f$ F_a \f$ and \f$ F_b \f$ for each detector.
100  FSTATQ_ATOMS_PER_DET = 0x10, ///< Compute per-SFT \f$ \mathcal{F} \f$ -statistic atoms for each detector (\a Demod only).
101  FSTATQ_2F_CUDA = 0x20, ///< Compute multi-detector \f$ 2\mathcal{F} \f$ , store results on CUDA GPU (CUDA implementation of \a Resamp only).
102  FSTATQ_LAST = 0x80
104 
105 ///
106 /// Different methods available to compute the \f$ \mathcal{F} \f$ -statistic, falling into two broad classes:
107 /// * \a Demod: Dirichlet kernel-based demodulation \cite Williams1999 .
108 /// * \a Resamp: FFT-based resampling \cite JKS98 \cite Prix2022 \cite DunnEtAl2022 .
109 ///
110 typedef enum tagFstatMethodType {
111 
112  /// \cond DONT_DOXYGEN
113  FMETHOD_START = 1,
114  /// \endcond
115 
116  FMETHOD_DEMOD_GENERIC, ///< \a Demod: generic C hotloop, works for any number of Dirichlet kernel terms \f$ \text{Dterms} \f$
117  FMETHOD_DEMOD_OPTC, ///< \a Demod: gptimized C hotloop using Akos' algorithm, only works for \f$ \text{Dterms} \lesssim 20 \f$
118  FMETHOD_DEMOD_ALTIVEC, ///< \a Demod: Altivec hotloop variant, uses fixed \f$ \text{Dterms} = 8 \f$
119  FMETHOD_DEMOD_SSE, ///< \a Demod: SSE hotloop with precalc divisors, uses fixed \f$ \text{Dterms} = 8 \f$
120  FMETHOD_DEMOD_BEST, ///< \a Demod: best guess of the fastest available hotloop
121 
122  FMETHOD_RESAMP_GENERIC, ///< \a Resamp: generic implementation \cite Prix2022
123  FMETHOD_RESAMP_CUDA, ///< \a Resamp: CUDA resampling \cite DunnEtAl2022
124  FMETHOD_RESAMP_BEST, ///< \a Resamp: best guess of the fastest available implementation
125 
126  /// \cond DONT_DOXYGEN
127  FMETHOD_END
128  /// \endcond
129 
131 
132 ///
133 /// Struct of optional 'advanced level' and (potentially method-specific) arguments to be passed to the
134 /// \f$ \mathcal{F} \f$ -statistic setup function XLALCreateFstatInput().
135 ///
136 typedef struct tagFstatOptionalArgs {
137  UINT4 randSeed; ///< Random-number seed value used in case of fake Gaussian noise generation (\c injectSqrtSX)
138  SSBprecision SSBprec; ///< Barycentric transformation precision.
139  UINT4 Dterms; ///< Number of Dirichlet kernel terms, used by some \a Demod methods; see \c FstatMethodType.
140  UINT4 runningMedianWindow; ///< If SFT noise weights are calculated from the SFTs, the running median window length to use.
141  FstatMethodType FstatMethod; ///< Method to use for computing the \f$ \mathcal{F} \f$ -statistic.
142  PulsarParamsVector *injectSources; ///< Vector of parameters of CW signals to simulate and inject.
143  MultiNoiseFloor *injectSqrtSX; ///< Single-sided PSD values for fake Gaussian noise to be added to SFT data.
144  MultiNoiseFloor *assumeSqrtSX; ///< Single-sided PSD values to be used for computing SFT noise weights instead of from a running median of the SFTs themselves.
145  FstatInput *prevInput; ///< An \c FstatInput structure from a previous call to XLALCreateFstatInput(); may contain common workspace data than can be re-used to save memory.
146  BOOLEAN collectTiming; ///< a flag to turn on/off the collection of F-stat-method-specific timing-data
147  BOOLEAN resampFFTPowerOf2; ///< \a Resamp: round up FFT lengths to next power of 2; see \c FstatMethodType.
148  REAL8 allowedMismatchFromSFTLength; ///< Optional override for XLALFstatCheckSFTLengthMismatch().
149  REAL8 sourceDeltaT; ///< Optional source-frame sampling period for XLALCWMakeFakeData(); if zero, use the previous internal defaults.
151 
152 ///
153 /// Global initializer for setting \c FstatOptionalArgs to default values
154 ///
156 
157 ///
158 /// An \f$ \mathcal{F} \f$ -statistic 'atom', i.e. the elementary per-SFT quantities required to compute the
159 /// \f$ \mathcal{F} \f$ -statistic, for one detector X.
160 ///
161 typedef struct tagFstatAtom {
162  UINT4 timestamp; ///< SFT GPS timestamp \f$ t_i \f$ in seconds.
163  REAL4 a2_alpha; ///< Antenna-pattern factor \f$ a^2(X,t_i) \f$ .
164  REAL4 b2_alpha; ///< Antenna-pattern factor \f$ b^2(X,t_i) \f$ .
165  REAL4 ab_alpha; ///< Antenna-pattern factor \f$ a*b(X,t_i) \f$ .
166  COMPLEX8 Fa_alpha; ///< \f$ Fa^X(t_i) \f$ .
167  COMPLEX8 Fb_alpha; ///< \f$ Fb^X(t_i) \f$ .
168 } FstatAtom;
169 
170 ///
171 /// A vector of \f$ \mathcal{F} \f$ -statistic 'atoms', i.e. all per-SFT quantities required to compute
172 /// the \f$ \mathcal{F} \f$ -statistic, for one detector X.
173 ///
174 typedef struct tagFstatAtomVector {
175 #ifdef SWIG // SWIG interface directives
176  SWIGLAL( ARRAY_1D( FstatAtomVector, FstatAtom, data, UINT4, length ) );
177 #endif // SWIG
178  UINT4 length; ///< Number of per-SFT 'atoms'.
179  FstatAtom *data; ///< Array of \c FstatAtom pointers of given length.
180  UINT4 TAtom; ///< Time-baseline of 'atoms', typically \f$ T_{\mathrm{sft}} \f$ .
182 
183 ///
184 /// A multi-detector vector of \c FstatAtomVector.
185 ///
186 typedef struct tagMultiFstatAtomVector {
187 #ifdef SWIG // SWIG interface directives
188  SWIGLAL( ARRAY_1D( MultiFstatAtomVector, FstatAtomVector *, data, UINT4, length ) );
189 #endif // SWIG
190  UINT4 length; ///< Number of detectors.
191  FstatAtomVector **data; ///< Array of \c FstatAtomVector pointers, one for each detector X.
193 
194 ///
195 /// XLALComputeFstat() computed results structure.
196 ///
197 #ifdef SWIG // SWIG interface directives
198 SWIGLAL( IGNORE_MEMBERS( tagFstatResults, internalalloclen ) );
199 SWIGLAL( ARRAY_MULTIPLE_LENGTHS( tagFstatResults, numFreqBins, numDetectors ) );
200 #endif // SWIG
201 typedef struct tagFstatResults {
202 
203  /// Doppler parameters, including the starting frequency, at which the \f$ 2\mathcal{F} \f$ were
204  /// computed.
206 
207  /// For performance reasons the global phase of all returned 'Fa' and 'Fb' quantities (#Fa,#Fb,#FaPerDet,#FbPerDet, #multiFatoms),
208  /// refers to this 'phase reference time' instead of the (#doppler).refTime.
209  /// Use this to compute initial phase of signals at doppler.refTime, or if you need the correct global Fa,Fb-phase!
211 
212  /// Spacing in frequency between each computed \f$ \mathcal{F} \f$ -statistic.
214 
215  /// Number of frequencies at which the \f$ 2\mathcal{F} \f$ were computed.
217 
218  /// Number of detectors over which the \f$ 2\mathcal{F} \f$ were computed. Valid range is 1 to
219  /// #PULSAR_MAX_DETECTORS.
221 
222  /// Names of detectors over which the \f$ 2\mathcal{F} \f$ were computed. Valid range is 1 to
223  /// #PULSAR_MAX_DETECTORS.
224  CHAR detectorNames[PULSAR_MAX_DETECTORS][3];
225 
226  /// Antenna pattern matrix \f$ M_{\mu\nu} \f$ , used in computing \f$ 2\mathcal{F} \f$ .
228 
229  /// Per detector antenna pattern matrix \f$ M_{\mu\nu}^X \f$ , used in computing \f$ 2\mathcal{F}^X \f$ .
231 
232  /// Bit-field of which \f$ \mathcal{F} \f$ -statistic quantities were computed.
234 
235  /// If #whatWasComputed & FSTATQ_2F is true, the multi-detector \f$ 2\mathcal{F} \f$ values computed
236  /// at #numFreqBins frequencies spaced #dFreq apart. This array should not be accessed if
237  /// #whatWasComputed & FSTATQ_2F is false.
238 #ifdef SWIG // SWIG interface directives
239  SWIGLAL( ARRAY_1D( FstatResults, REAL4, twoF, UINT4, numFreqBins ) );
240 #endif // SWIG
242 
243 #ifndef SWIG // exclude from SWIG interface
244  /// If #whatWasComputed & FSTATQ_2F_CUDA is true, the multi-detector \f$ 2\mathcal{F} \f$ values
245  /// as for #twoF, but stored in CUDA device memory. This array should not be accessed if
246  /// #whatWasComputed & FSTATQ_2F_CUDA is false.
247  REAL4 *twoF_CUDA;
248 #endif
249 
250  /// If #whatWasComputed & FSTATQ_PARTS is true, the multi-detector \f$ F_a \f$ and \f$ F_b \f$
251  /// computed at #numFreqBins frequencies spaced #dFreq apart. This array should not be accessed
252  /// if #whatWasComputed & FSTATQ_PARTS is false.
253  /// \note global phase refers to #refTimePhase, not (#doppler).refTime
254 #ifdef SWIG // SWIG interface directives
255  SWIGLAL( ARRAY_1D( FstatResults, COMPLEX8, Fa, UINT4, numFreqBins ) );
256  SWIGLAL( ARRAY_1D( FstatResults, COMPLEX8, Fb, UINT4, numFreqBins ) );
257 #endif // SWIG
260 
261  /// If #whatWasComputed & FSTATQ_2F_PER_DET is true, the \f$ 2\mathcal{F} \f$ values computed at
262  /// #numFreqBins frequencies spaced #dFreq apart, and for #numDetectors detectors. Only the first
263  /// #numDetectors entries will be valid. This array should not be accessed if #whatWasComputed &
264  /// FSTATQ_2F_PER_DET is false.
265 #ifdef SWIG // SWIG interface directives
266  SWIGLAL( ARRAY_1D_PTR_1D( FstatResults, REAL4, twoFPerDet, UINT4, numDetectors, numFreqBins ) );
267 #endif // SWIG
269 
270  /// If #whatWasComputed & FSTATQ_PARTS_PER_DET is true, the \f$ F_a \f$ and \f$ F_b \f$ values
271  /// computed at #numFreqBins frequencies spaced #dFreq apart, and for #numDetectors detectors.
272  /// This array should not be accessed if #whatWasComputed & FSTATQ_PARTS_PER_DET is false.
273  /// \note global phase refers to #refTimePhase, not (#doppler).refTime
274 #ifdef SWIG // SWIG interface directives
275  SWIGLAL( ARRAY_1D_PTR_1D( FstatResults, COMPLEX8, FaPerDet, UINT4, numDetectors, numFreqBins ) );
276  SWIGLAL( ARRAY_1D_PTR_1D( FstatResults, COMPLEX8, FbPerDet, UINT4, numDetectors, numFreqBins ) );
277 #endif // SWIG
280 
281  /// If #whatWasComputed & FSTATQ_ATOMS_PER_DET is true, the per-SFT \f$ \mathcal{F} \f$ -statistic
282  /// multi-atoms computed at #numFreqBins frequencies spaced #dFreq apart. This array should not
283  /// be accessed if #whatWasComputed & FSTATQ_ATOMS_PER_DET is false.
284  /// \note global phase of atoms refers to #refTimePhase, not (#doppler).refTime
285 #ifdef SWIG // SWIG interface directives
286  SWIGLAL( ARRAY_1D( FstatResults, MultiFstatAtomVector *, multiFatoms, UINT4, numFreqBins ) );
287 #endif // SWIG
289 
290  /// \cond DONT_DOXYGEN
291  UINT4 internalalloclen;
292  /// \endcond
293 
294 } FstatResults;
295 
296 /// Generic F-stat timing coefficients (times in seconds)
297 /// [see https://dcc.ligo.org/LIGO-T1600531-v4 for details]
298 /// tauF_eff = tauF_core + b * tauF_buffer
299 /// where 'b' denotes the fraction of times per call to XLALComputeFstat() the buffer needed to be recomputed
300 /// ==> b = NBufferMisses / NCalls\n"
301 ///
302 /// Note: All timing numbers are averaged over repeated calls to XLALComputeFstat(for fixed-setup)
303 ///
304 #ifdef SWIG /* SWIG interface directives */
305 SWIGLAL( IMMUTABLE_MEMBERS( tagFstatTimingGeneric, help ) );
306 #endif /* SWIG */
307 typedef struct tagFstatTimingGeneric {
308  REAL4 tauF_eff; //< effective total time per F-stat call to XLALComputeFstat() per detector per output frequency
309  REAL4 tauF_core; //< core time per output frequency bin per detector, excluding time to compute the buffer
310  REAL4 tauF_buffer; //< time per detector per frequency bin to re-compute all buffered quantities once
311  UINT4 NFbin; //< (average over F-stat calls) number of F-stat output frequency bins
312  UINT4 Ndet; //< number of detectors
313  REAL4 NCalls; //< number of F-stat calls we average over
314  REAL4 NBufferMisses; //< number of times the buffer needed to be recomputed
315  const char *help; //< (static) string documenting the generic F-stat timing values
317 
318 #define TIMING_MODEL_MAX_VARS 10
319 /// Struct to carry the \f$ \mathcal{F} \f$ -statistic method-specific timing *model* in terms of
320 /// a list of variable names and corresponding REAL4 values, including a help-string documenting
321 /// the timing model variables.
322 /// See https://dcc.ligo.org/LIGO-T1600531-v4 for a more detailed discussion of the F-stat timing model.
323 #ifdef SWIG /* SWIG interface directives */
324 SWIGLAL( IMMUTABLE_MEMBERS( tagFstatTimingModel, help ) );
325 #endif /* SWIG */
326 typedef struct tagFstatTimingModel {
327  UINT4 numVariables; //< number of (method-specific) timing model variables
328  const char *names[TIMING_MODEL_MAX_VARS]; //< array of (static) timing-model variable names
329  REAL4 values[TIMING_MODEL_MAX_VARS]; //< array of timing-model variable values
330  const char *help; //< (static) help string documenting the (method-specific) Fstat timing model
332 
333 // ---------- API function prototypes ----------
334 REAL8 XLALFstatMaximumSFTLength( const REAL8 maxFreq, const REAL8 binaryMaxAsini, const REAL8 binaryMinPeriod, const REAL8 mu_SFT
335  );
336 int XLALFstatCheckSFTLengthMismatch( const REAL8 Tsft, const REAL8 maxFreq, const REAL8 binaryMaxAsini, const REAL8 binaryMinPeriod, const REAL8 allowedMismatch );
337 
339 const CHAR *XLALFstatMethodName( FstatMethodType method );
340 const UserChoices *XLALFstatMethodChoices( void );
341 
348 
349 FstatInput *
350 XLALCreateFstatInput( const SFTCatalog *SFTcatalog, const REAL8 minCoverFreq, const REAL8 maxCoverFreq, const REAL8 dFreq,
351  const EphemerisData *ephemerides, const FstatOptionalArgs *optionalArgs );
352 
353 int XLALGetFstatInputSFTBand( const FstatInput *input, REAL8 *minFreqFull, REAL8 *maxFreqFull );
354 const CHAR *XLALGetFstatInputMethodName( const FstatInput *input );
355 const MultiLALDetector *XLALGetFstatInputDetectors( const FstatInput *input );
356 const MultiLIGOTimeGPSVector *XLALGetFstatInputTimestamps( const FstatInput *input );
357 MultiNoiseWeights *XLALGetFstatInputNoiseWeights( const FstatInput *input );
358 const MultiDetectorStateSeries *XLALGetFstatInputDetectorStates( const FstatInput *input );
359 int XLALExtractResampledTimeseries( MultiCOMPLEX8TimeSeries **multiTimeSeries_SRC_a, MultiCOMPLEX8TimeSeries **multiTimeSeries_SRC_b, FstatInput *input );
360 int XLALGetFstatTiming( const FstatInput *input, FstatTimingGeneric *timingGeneric, FstatTimingModel *timingModel );
361 int XLALAppendFstatTiming2File( const FstatInput *input, FILE *fp, BOOLEAN printHeader );
362 int XLALFstatInputTimeslice( FstatInput **slice, const FstatInput *input, const LIGOTimeGPS *minStartGPS, const LIGOTimeGPS *maxStartGPS );
363 
364 #ifdef SWIG // SWIG interface directives
365 SWIGLAL( INOUT_STRUCTS( FstatResults **, Fstats ) );
366 #endif
367 int XLALComputeFstat( FstatResults **Fstats, FstatInput *input, const PulsarDopplerParams *doppler,
368  const UINT4 numFreqBins, const FstatQuantities whatToCompute );
369 
370 void XLALDestroyFstatInput( FstatInput *input );
371 void XLALDestroyFstatResults( FstatResults *Fstats );
372 
374 
375 REAL4 XLALComputeFstatFromAtoms( const MultiFstatAtomVector *multiFstatAtoms, const INT4 X );
376 
377 /// @}
378 
379 #ifdef __cplusplus
380 }
381 #endif
382 
383 #endif // _COMPUTEFSTAT_H
UINT2 A
Definition: SFTnaming.c:46
UINT2 B
Definition: SFTnaming.c:47
const char * names[]
FstatAtomVector * XLALCreateFstatAtomVector(const UINT4 length)
Create a FstatAtomVector of the given length.
Definition: ComputeFstat.c:276
const MultiLIGOTimeGPSVector * XLALGetFstatInputTimestamps(const FstatInput *input)
Returns the SFT timestamps stored in a FstatInput structure.
Definition: ComputeFstat.c:701
FstatMethodType
Different methods available to compute the -statistic, falling into two broad classes:
Definition: ComputeFstat.h:110
const MultiLALDetector * XLALGetFstatInputDetectors(const FstatInput *input)
Returns the detector information stored in a FstatInput structure.
Definition: ComputeFstat.c:687
const CHAR * XLALGetFstatInputMethodName(const FstatInput *input)
Returns the human-readable name of the -statistic method being used by a FstatInput structure.
Definition: ComputeFstat.c:672
const MultiDetectorStateSeries * XLALGetFstatInputDetectorStates(const FstatInput *input)
Returns the multi-detector state series stored in a FstatInput structure.
Definition: ComputeFstat.c:746
const FstatOptionalArgs FstatOptionalArgsDefaults
Global initializer for setting FstatOptionalArgs to default values.
Definition: ComputeFstat.c:90
int XLALFstatCheckSFTLengthMismatch(const REAL8 Tsft, const REAL8 maxFreq, const REAL8 binaryMaxAsini, const REAL8 binaryMinPeriod, const REAL8 allowedMismatch)
Check that the SFT length does not exceed the result of XLALFstatMaximumSFTLength(),...
Definition: ComputeFstat.c:203
const UserChoices * XLALFstatMethodChoices(void)
Return pointer to a static array of all (available) FstatMethodType choices.
void XLALDestroyFstatInputVector(FstatInputVector *inputs)
Free all memory associated with a FstatInputVector structure.
Definition: ComputeFstat.c:252
int XLALFstatInputTimeslice(FstatInput **slice, const FstatInput *input, const LIGOTimeGPS *minStartGPS, const LIGOTimeGPS *maxStartGPS)
Create and return an FstatInput 'timeslice' for given input FstatInput object [must be using LALDemod...
int XLALGetFstatInputSFTBand(const FstatInput *input, REAL8 *minFreqFull, REAL8 *maxFreqFull)
Returns the frequency band loaded from input SFTs.
Definition: ComputeFstat.c:650
MultiNoiseWeights * XLALGetFstatInputNoiseWeights(const FstatInput *input)
Returns the multi-detector noise weights stored in a FstatInput structure.
Definition: ComputeFstat.c:716
int XLALExtractResampledTimeseries(MultiCOMPLEX8TimeSeries **multiTimeSeries_SRC_a, MultiCOMPLEX8TimeSeries **multiTimeSeries_SRC_b, FstatInput *input)
Extracts the resampled timeseries from a given FstatInput structure (must have been initialized previ...
int XLALGetFstatTiming(const FstatInput *input, FstatTimingGeneric *timingGeneric, FstatTimingModel *timingModel)
Return measured values and details about generic F-statistic timing and method-specific timing model,...
REAL4 XLALComputeFstatFromAtoms(const MultiFstatAtomVector *multiFstatAtoms, const INT4 X)
Compute single-or multi-IFO Fstat '2F' from multi-IFO 'atoms'.
Definition: ComputeFstat.c:994
REAL8 XLALFstatMaximumSFTLength(const REAL8 maxFreq, const REAL8 binaryMaxAsini, const REAL8 binaryMinPeriod, const REAL8 mu_SFT)
Compute the maximum SFT length that can safely be used as input to XLALComputeFstat(),...
Definition: ComputeFstat.c:163
const CHAR * XLALFstatMethodName(FstatMethodType method)
Return pointer to a static string giving the name of the FstatMethodType method.
void XLALDestroyFstatInput(FstatInput *input)
Free all memory associated with a FstatInput structure.
Definition: ComputeFstat.c:885
int XLALAppendFstatTiming2File(const FstatInput *input, FILE *fp, BOOLEAN printHeader)
#define TIMING_MODEL_MAX_VARS
Definition: ComputeFstat.h:318
FstatInputVector * XLALCreateFstatInputVector(const UINT4 length)
Create a FstatInputVector of the given length, for example for setting up F-stat searches over severa...
Definition: ComputeFstat.c:231
REAL4 XLALComputeFstatFromFaFb(COMPLEX8 Fa, COMPLEX8 Fb, REAL4 A, REAL4 B, REAL4 C, REAL4 E, REAL4 Dinv)
Compute the -statistic from the complex and components and the antenna pattern matrix.
Definition: ComputeFstat.c:977
FstatQuantities
Bit-field of -statistic quantities which can be computed by XLALComputeFstat().
Definition: ComputeFstat.h:94
void XLALDestroyFstatAtomVector(FstatAtomVector *atoms)
Free all memory associated with a FstatAtomVector structure.
Definition: ComputeFstat.c:297
void XLALDestroyMultiFstatAtomVector(MultiFstatAtomVector *multiAtoms)
Free all memory associated with a MultiFstatAtomVector structure.
Definition: ComputeFstat.c:338
FstatInput * XLALCreateFstatInput(const SFTCatalog *SFTcatalog, const REAL8 minCoverFreq, const REAL8 maxCoverFreq, const REAL8 dFreq, const EphemerisData *ephemerides, const FstatOptionalArgs *optionalArgs)
Create a fully-setup FstatInput structure for computing the -statistic using XLALComputeFstat().
Definition: ComputeFstat.c:359
int XLALComputeFstat(FstatResults **Fstats, FstatInput *input, const PulsarDopplerParams *doppler, const UINT4 numFreqBins, const FstatQuantities whatToCompute)
Compute the -statistic over a band of frequencies.
Definition: ComputeFstat.c:760
int XLALFstatMethodIsAvailable(FstatMethodType method)
Return true if given FstatMethodType corresponds to a valid and available Fstat method,...
MultiFstatAtomVector * XLALCreateMultiFstatAtomVector(const UINT4 length)
Create a MultiFstatAtomVector of the given length.
Definition: ComputeFstat.c:317
void XLALDestroyFstatResults(FstatResults *Fstats)
Free all memory associated with a FstatResults structure.
Definition: ComputeFstat.c:934
@ FMETHOD_RESAMP_GENERIC
Resamp: generic implementation
Definition: ComputeFstat.h:122
@ FMETHOD_DEMOD_SSE
Demod: SSE hotloop with precalc divisors, uses fixed
Definition: ComputeFstat.h:119
@ FMETHOD_DEMOD_OPTC
Demod: gptimized C hotloop using Akos' algorithm, only works for
Definition: ComputeFstat.h:117
@ FMETHOD_DEMOD_BEST
Demod: best guess of the fastest available hotloop
Definition: ComputeFstat.h:120
@ FMETHOD_RESAMP_BEST
Resamp: best guess of the fastest available implementation
Definition: ComputeFstat.h:124
@ FMETHOD_DEMOD_GENERIC
Demod: generic C hotloop, works for any number of Dirichlet kernel terms
Definition: ComputeFstat.h:116
@ FMETHOD_RESAMP_CUDA
Resamp: CUDA resampling
Definition: ComputeFstat.h:123
@ FMETHOD_DEMOD_ALTIVEC
Demod: Altivec hotloop variant, uses fixed
Definition: ComputeFstat.h:118
@ FSTATQ_2F
Compute multi-detector .
Definition: ComputeFstat.h:96
@ FSTATQ_FAFB_PER_DET
Compute and for each detector.
Definition: ComputeFstat.h:99
@ FSTATQ_FAFB
Compute multi-detector and .
Definition: ComputeFstat.h:97
@ FSTATQ_NONE
Do not compute -statistic, still compute buffered quantities.
Definition: ComputeFstat.h:95
@ FSTATQ_LAST
Definition: ComputeFstat.h:102
@ FSTATQ_2F_CUDA
Compute multi-detector , store results on CUDA GPU (CUDA implementation of Resamp only).
Definition: ComputeFstat.h:101
@ FSTATQ_ATOMS_PER_DET
Compute per-SFT -statistic atoms for each detector (Demod only).
Definition: ComputeFstat.h:100
@ FSTATQ_2F_PER_DET
Compute for each detector.
Definition: ComputeFstat.h:98
unsigned char BOOLEAN
double REAL8
char CHAR
uint32_t UINT4
float complex COMPLEX8
int32_t INT4
float REAL4
#define PULSAR_MAX_DETECTORS
maximal number of detectors we can handle (for static arrays of detector quantities)
SSBprecision
The precision in calculating the barycentric transformation.
Definition: SSBtimes.h:45
Struct holding the "antenna-pattern" matrix , in terms of the multi-detector scalar product.
Definition: LALComputeAM.h:127
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
An -statistic 'atom', i.e.
Definition: ComputeFstat.h:161
COMPLEX8 Fa_alpha
.
Definition: ComputeFstat.h:166
REAL4 b2_alpha
Antenna-pattern factor .
Definition: ComputeFstat.h:164
UINT4 timestamp
SFT GPS timestamp in seconds.
Definition: ComputeFstat.h:162
REAL4 ab_alpha
Antenna-pattern factor .
Definition: ComputeFstat.h:165
COMPLEX8 Fb_alpha
.
Definition: ComputeFstat.h:167
REAL4 a2_alpha
Antenna-pattern factor .
Definition: ComputeFstat.h:163
A vector of -statistic 'atoms', i.e.
Definition: ComputeFstat.h:174
UINT4 TAtom
Time-baseline of 'atoms', typically .
Definition: ComputeFstat.h:180
FstatAtom * data
Array of FstatAtom pointers of given length.
Definition: ComputeFstat.h:179
UINT4 length
Number of per-SFT 'atoms'.
Definition: ComputeFstat.h:178
A vector of XLALComputeFstat() input data structures, for e.g.
Definition: ComputeFstat.h:82
FstatInput ** data
Pointer to the data array.
Definition: ComputeFstat.h:87
UINT4 length
Number of elements in array.
Definition: ComputeFstat.h:86
Struct of optional 'advanced level' and (potentially method-specific) arguments to be passed to the ...
Definition: ComputeFstat.h:136
UINT4 randSeed
Random-number seed value used in case of fake Gaussian noise generation (injectSqrtSX)
Definition: ComputeFstat.h:137
MultiNoiseFloor * injectSqrtSX
Single-sided PSD values for fake Gaussian noise to be added to SFT data.
Definition: ComputeFstat.h:143
PulsarParamsVector * injectSources
Vector of parameters of CW signals to simulate and inject.
Definition: ComputeFstat.h:142
UINT4 runningMedianWindow
If SFT noise weights are calculated from the SFTs, the running median window length to use.
Definition: ComputeFstat.h:140
MultiNoiseFloor * assumeSqrtSX
Single-sided PSD values to be used for computing SFT noise weights instead of from a running median o...
Definition: ComputeFstat.h:144
BOOLEAN resampFFTPowerOf2
Resamp: round up FFT lengths to next power of 2; see FstatMethodType.
Definition: ComputeFstat.h:147
FstatInput * prevInput
An FstatInput structure from a previous call to XLALCreateFstatInput(); may contain common workspace ...
Definition: ComputeFstat.h:145
REAL8 allowedMismatchFromSFTLength
Optional override for XLALFstatCheckSFTLengthMismatch().
Definition: ComputeFstat.h:148
REAL8 sourceDeltaT
Optional source-frame sampling period for XLALCWMakeFakeData(); if zero, use the previous internal de...
Definition: ComputeFstat.h:149
BOOLEAN collectTiming
a flag to turn on/off the collection of F-stat-method-specific timing-data
Definition: ComputeFstat.h:146
UINT4 Dterms
Number of Dirichlet kernel terms, used by some Demod methods; see FstatMethodType.
Definition: ComputeFstat.h:139
FstatMethodType FstatMethod
Method to use for computing the -statistic.
Definition: ComputeFstat.h:141
SSBprecision SSBprec
Barycentric transformation precision.
Definition: ComputeFstat.h:138
XLALComputeFstat() computed results structure.
Definition: ComputeFstat.h:201
COMPLEX8 * Fb
Definition: ComputeFstat.h:259
AntennaPatternMatrix Mmunu
Antenna pattern matrix , used in computing .
Definition: ComputeFstat.h:227
UINT4 numDetectors
Number of detectors over which the were computed.
Definition: ComputeFstat.h:220
FstatQuantities whatWasComputed
Bit-field of which -statistic quantities were computed.
Definition: ComputeFstat.h:233
REAL8 dFreq
Spacing in frequency between each computed -statistic.
Definition: ComputeFstat.h:213
UINT4 numFreqBins
Number of frequencies at which the were computed.
Definition: ComputeFstat.h:216
REAL4 * twoF
If whatWasComputed & FSTATQ_2F is true, the multi-detector values computed at numFreqBins frequencie...
Definition: ComputeFstat.h:241
COMPLEX8 * Fa
If whatWasComputed & FSTATQ_PARTS is true, the multi-detector and computed at numFreqBins frequenci...
Definition: ComputeFstat.h:258
LIGOTimeGPS refTimePhase
For performance reasons the global phase of all returned 'Fa' and 'Fb' quantities (Fa,...
Definition: ComputeFstat.h:210
PulsarDopplerParams doppler
Doppler parameters, including the starting frequency, at which the were computed.
Definition: ComputeFstat.h:205
MultiFstatAtomVector ** multiFatoms
If whatWasComputed & FSTATQ_ATOMS_PER_DET is true, the per-SFT -statistic multi-atoms computed at nu...
Definition: ComputeFstat.h:288
Generic F-stat timing coefficients (times in seconds) [see https://dcc.ligo.org/LIGO-T1600531-v4 for ...
Definition: ComputeFstat.h:307
const char * help
Definition: ComputeFstat.h:315
Struct to carry the -statistic method-specific timing model in terms of a list of variable names and...
Definition: ComputeFstat.h:326
const char * help
Definition: ComputeFstat.h:330
Multi-IFO container for COMPLEX8 resampled timeseries.
Definition: LFTandTSutils.h:52
Multi-IFO time-series of DetectorStates.
A multi-detector vector of FstatAtomVector.
Definition: ComputeFstat.h:186
FstatAtomVector ** data
Array of FstatAtomVector pointers, one for each detector X.
Definition: ComputeFstat.h:191
UINT4 length
Number of detectors.
Definition: ComputeFstat.h:190
array of detectors definitions 'LALDetector'
A collection of (multi-IFO) LIGOTimeGPSVector time-stamps vectors.
Definition: SFTfileIO.h:198
array of detector-specific 'noise floors' (ie PSD values), assumed constant over the frequency-band o...
One noise-weight (number) per SFT (therefore indexed over IFOs and SFTs.
Definition: PSDutils.h:71
Type containing the 'Doppler-parameters' affecting the time-evolution of the phase.
Straightforward vector type of N PulsarParams structs.
An "SFT-catalogue": a vector of SFTdescriptors, as returned by XLALSFTdataFind()
Definition: SFTfileIO.h:238
XLALComputeFstat() input data structure.
Definition: ComputeFstat.c:44