LALPulsar  6.1.0.1-c9a8ef6
bin/Weave/statistics.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2017 Reinhard Prix
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 _STATISTICS_H
21 #define _STATISTICS_H
22 
23 ///
24 /// \file
25 /// \ingroup lalpulsar_bin_Weave
26 /// \brief Module which defines statistics that can be computed and their parameters
27 ///
28 
29 #include "Weave.h"
30 
31 #include <lal/LineRobustStats.h>
32 #include <lal/StringVector.h>
33 #include <lal/UserInput.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 ///
40 /// Bitflags representing all possible statistics that can be computed or returned by Weave
41 ///
44  /// Per segment multi-detector F-statistic
46  /// Per segment per-detector F-statistic
48  // Maximum over segments multi-detector coherent 2F statistic
50  // Maximum over segments per-detector coherent 2F statistic
52  /// Multi-detector sum (over segments) F-statistic
54  /// Per detector sum F-statistic
56  /// Multi-detector average (over segments) F-statistic
58  /// Per detector average F-statistic
60  /// Line-robust log10(B_S/GL) statistic
62  /// (transient-)line robust log10(B_S/GLtL) statistic
64  /// (transient-)line robust log10(B_tS/GLtL) statistic
66  /// Hough number count
68  /// Hough number count per detector
70  /// Marker +1 of maximal combined valid statistics value
72 };
73 
74 ///
75 /// Names of all possible statistics
76 ///
77 #define WEAVE_STATISTIC_NAME(ws) WeaveStatisticNamesByIndex[XLAL_BIT2IDX(ws)]
78 /// \cond DONT_DOXYGEN
80 /// \endcond
81 
82 ///
83 /// User input choices for toplist ranking statistics
84 ///
85 extern const UserChoices WeaveToplistChoices;
86 
87 ///
88 /// User input help string for toplist ranking statistics
89 ///
90 extern const char *const WeaveToplistHelpString;
91 
92 ///
93 /// User input choices for all supported statistics
94 ///
96 
97 ///
98 /// User input help string for all supported statistics
99 ///
100 extern const char *const WeaveStatisticHelpString;
101 
102 ///
103 /// Struct holding all parameters and status values for computing various statistics
104 ///
106  /// ---------- elements describing output statistics [read/write from fits files]
107  /// List of detector names
109  /// Number of segments
111 
112  /// Number of per-detector F-statistics
114 
115  /// ---------- statistics dependency map
116  /// Bitflag: set of toplist-ranking statistics
118  /// Bitflag: full set of statistics requested for output. [0] = 'stage0' = toplist + extra-statistics, [1] = 'stage 1' = recalc
120 
121  /// ----- derived from the above: for internal use only [wont read/write these from fits files]
122 
123  /// Number of output results toplists
125  /// Bitflag: set of "main-loop" statistics that need to be computed on the semi-coherent "fine" grid
127  /// Bitflag: subset of "main-loop" statistics to keep around after mainloop: either because 1) needed for output, 2) needed for completionloop-stats
129  /// Bitflag: set of "completion-loop" statistics that will be computed only on the final toplist
130  /// [0] = 'stage 0' statistics that are potentially interpolating, [1] = 'stage 1' = recalc using non-interpolating statistics
132 
133  /// Bitflag: full set of all statistics we'll need to compute (toplist + extra + recalc + all dependencies)
135 
136  /// ---------- input parameters for various statistics
137  /// Reference time for phase-evolution parameters
139  /// Setup for line-robust B_*S/GL* family of statistics
140  BSGLSetup *BSGL_setup;
141 
142  /// Array of coherent setups over segments for 'stage 0' = main-loop calculation of 2F value over segments
143  WeaveCohInput **coh_input;
144  /// Array of coherent setups over segments for 'stage 1' = recalc calculation of 2F value over segments
145  WeaveCohInput **coh_input_recalc;
146 
147  /// Temporary 'workspace' storage for recalc'ed coherent 2F results over segments
148  WeaveCohResults *coh_res;
149 
150  /// Per-segment 2F threshold for computing 'Hough' number counts
152 
153 };
154 
156  /// Coherent multi-detector F-statistics (only needed for per-segment output)
158  /// Coherent per-detector F-statistics (only needed for per-detector and per-segment output)
160  /// Maximized-over-segments multi-detector F-statistic
162  /// Maximized-over-segments per-detector F-statistic
164  /// Summed multi-detector F-statistic
166  /// Summed per-detector F-statistic (only needed for per-detector output)
168  /// Mean multi-detector F-statistic
170  /// Mean per-detector F-statistic (only needed for per-detector output)
172  /// Line-robust log10(B_S/GL) statistic
174  /// Line- and transient-line robust log10(B_S/GLtL) statistic
176  /// Transient- signal and line robust log10(B_tS/GLtL) statistic
178  /// 'Hough' multi-detector number count statistic
180  /// 'Hough' per-detector number count statistic
182 };
183 
185  WeaveStatisticType *deps,
186  const WeaveStatisticType stats
187 );
188 
190  WeaveStatisticsParams *statistics_params,
191  const WeaveStatisticType toplist_stats,
192  const WeaveStatisticType extra_output_stats,
193  const WeaveStatisticType recalc_stats
194 );
195 
197  WeaveStatisticsParams *statistics_params
198 );
199 
200 #ifdef __cplusplus
201 }
202 #endif
203 
204 #endif // _STATISTICS_H
205 
206 // Local Variables:
207 // c-file-style: "linux"
208 // c-basic-offset: 2
209 // End:
enum tagWeaveStatisticType WeaveStatisticType
Definition: Weave.h:61
const char *const WeaveStatisticNamesByIndex[XLAL_BIT2IDX(WEAVE_STATISTIC_MAX)]
int XLALWeaveStatisticsParamsSetDependencyMap(WeaveStatisticsParams *statistics_params, const WeaveStatisticType toplist_stats, const WeaveStatisticType extra_output_stats, const WeaveStatisticType recalc_stats)
Fill StatisticsParams logic for given toplist and extra-output stats.
tagWeaveStatisticType
Bitflags representing all possible statistics that can be computed or returned by Weave.
@ WEAVE_STATISTIC_MEAN2F_DET
Per detector average F-statistic.
@ WEAVE_STATISTIC_COH2F
Per segment multi-detector F-statistic.
@ WEAVE_STATISTIC_MAX2F
@ WEAVE_STATISTIC_NCOUNT_DET
Hough number count per detector.
@ WEAVE_STATISTIC_COH2F_DET
Per segment per-detector F-statistic.
@ WEAVE_STATISTIC_BtSGLtL
(transient-)line robust log10(B_tS/GLtL) statistic
@ WEAVE_STATISTIC_SUM2F_DET
Per detector sum F-statistic.
@ WEAVE_STATISTIC_MAX
Marker +1 of maximal combined valid statistics value.
@ WEAVE_STATISTIC_MAX2F_DET
@ WEAVE_STATISTIC_MEAN2F
Multi-detector average (over segments) F-statistic.
@ WEAVE_STATISTIC_BSGLtL
(transient-)line robust log10(B_S/GLtL) statistic
@ WEAVE_STATISTIC_BSGL
Line-robust log10(B_S/GL) statistic.
@ WEAVE_STATISTIC_NCOUNT
Hough number count.
@ WEAVE_STATISTIC_NONE
@ WEAVE_STATISTIC_SUM2F
Multi-detector sum (over segments) F-statistic.
int XLALWeaveStatisticsSetDirectDependencies(WeaveStatisticType *deps, const WeaveStatisticType stats)
Set all bits in 'deps' corresponding to direct dependencies of the set of input statistics 'stat'.
const char *const WeaveToplistHelpString
User input help string for toplist ranking statistics.
const UserChoices WeaveToplistChoices
User input choices for toplist ranking statistics.
const char *const WeaveStatisticHelpString
User input help string for all supported statistics.
const UserChoices WeaveStatisticChoices
User input choices for all supported statistics.
void XLALWeaveStatisticsParamsDestroy(WeaveStatisticsParams *statistics_params)
Destroy a StatisticsParams struct.
uint32_t UINT4
float REAL4
#define PULSAR_MAX_DETECTORS
maximal number of detectors we can handle (for static arrays of detector quantities)
#define XLAL_BIT2IDX(b)
#define XLAL_IDX2BIT(i)
Struct holding all parameters and status values for computing various statistics.
UINT4 n2F_det[PULSAR_MAX_DETECTORS]
Number of per-detector F-statistics.
WeaveStatisticType all_statistics_to_compute
Bitflag: full set of all statistics we'll need to compute (toplist + extra + recalc + all dependencie...
REAL4 nc_2Fth
Per-segment 2F threshold for computing 'Hough' number counts.
BSGLSetup * BSGL_setup
Setup for line-robust B_*S/GL* family of statistics.
WeaveStatisticType toplist_statistics
-------— statistics dependency map Bitflag: set of toplist-ranking statistics
WeaveCohResults * coh_res
Temporary 'workspace' storage for recalc'ed coherent 2F results over segments.
WeaveStatisticType mainloop_statistics
Bitflag: set of "main-loop" statistics that need to be computed on the semi-coherent "fine" grid.
WeaveStatisticType mainloop_statistics_to_keep
Bitflag: subset of "main-loop" statistics to keep around after mainloop: either because 1) needed for...
WeaveCohInput ** coh_input
Array of coherent setups over segments for 'stage 0' = main-loop calculation of 2F value over segment...
WeaveStatisticType statistics_to_output[2]
Bitflag: full set of statistics requested for output. [0] = 'stage0' = toplist + extra-statistics,...
WeaveStatisticType completionloop_statistics[2]
Bitflag: set of "completion-loop" statistics that will be computed only on the final toplist [0] = 's...
LALStringVector * detectors
-------— elements describing output statistics [read/write from fits files] List of detector names
LIGOTimeGPS ref_time
-------— input parameters for various statistics Reference time for phase-evolution parameters
UINT4 ntoplists
--— derived from the above: for internal use only [wont read/write these from fits files]
UINT4 nsegments
Number of segments.
WeaveCohInput ** coh_input_recalc
Array of coherent setups over segments for 'stage 1' = recalc calculation of 2F value over segments.
REAL4 mean2F_det[PULSAR_MAX_DETECTORS]
Mean per-detector F-statistic (only needed for per-detector output)
REAL4 log10BtSGLtL
Transient- signal and line robust log10(B_tS/GLtL) statistic.
REAL4 max2F_det[PULSAR_MAX_DETECTORS]
Maximized-over-segments per-detector F-statistic.
REAL4 sum2F_det[PULSAR_MAX_DETECTORS]
Summed per-detector F-statistic (only needed for per-detector output)
REAL4 log10BSGL
Line-robust log10(B_S/GL) statistic.
REAL4 max2F
Maximized-over-segments multi-detector F-statistic.
REAL4 sum2F
Summed multi-detector F-statistic.
REAL4 log10BSGLtL
Line- and transient-line robust log10(B_S/GLtL) statistic.
REAL4 * coh2F_det[PULSAR_MAX_DETECTORS]
Coherent per-detector F-statistics (only needed for per-detector and per-segment output)
REAL4 ncount
'Hough' multi-detector number count statistic
REAL4 * coh2F
Coherent multi-detector F-statistics (only needed for per-segment output)
REAL4 mean2F
Mean multi-detector F-statistic.
REAL4 ncount_det[PULSAR_MAX_DETECTORS]
'Hough' per-detector number count statistic