LoadToFoldConfig.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2007 - 2023 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Signal/Pulsar/dsp/LoadToFoldConfig.h
10 
11 #ifndef __baseband_dsp_LoadToFoldConfig_h
12 #define __baseband_dsp_LoadToFoldConfig_h
13 
14 #include <string>
15 
16 #include "dsp/LoadToFold1.h"
17 #include "dsp/FilterbankConfig.h"
18 #include "dsp/InverseFilterbankConfig.h"
19 #include "dsp/TwoBitCorrectionConfig.h"
20 
21 namespace Pulsar
22 {
23  class Parameters;
24  class Predictor;
25 }
26 
27 namespace dsp {
28 
31  {
32 
33  public:
34 
36  Config ();
37 
38  // set the name of the archive class to be used for output
39  void set_archive_class (const std::string&);
40 
41  TwoBitCorrection::Config twobit_config;
42 
43  // when unpacking FITS data, denormalize using DAT_SCL and DAT_OFFS
44  bool apply_FITS_scale_and_offset;
45 
46  // perform coherent dedispersion
47  bool coherent_dedispersion;
48 
49  // perform coherent derotation
50  bool coherent_derotation;
51 
52  // remove inter-channel dispersion delays
53  bool interchan_dedispersion;
54 
55  // dispersion measure used in coherent dedispersion
56  double dispersion_measure;
57 
58  // rotation measure used in coherent derotation
59  double rotation_measure;
60 
61  // zap RFI during convolution
62  bool zap_rfi;
63 
64  // use FFT benchmarks to choose an optimal FFT length
65  bool use_fft_bench;
66 
67  // optimize the order in which data are stored (e.g. FPT vs TFP)
68  bool optimal_order;
69 
70  // perform phase-coherent matrix convolution (calibration)
71  std::string calibrator_database_filename;
72 
73  // set fft lengths and convolution edge effect lengths
74  unsigned nsmear;
75  unsigned times_minimum_nfft;
76 
77  // phase-locked filterbank phase bins
78  unsigned plfb_nbin;
79  // phase-locked filterbank channels
80  unsigned plfb_nchan;
81 
82  // cyclic spectrum options
83  unsigned cyclic_nchan;
84  unsigned cyclic_mover;
85 
86  // compute and fold the fourth moments of the electric field
87  bool fourth_moment;
88 
89  // compute and output mean and variance for pdmp
90  bool pdmp_output;
91 
92  // apply spectral kurtosis filterbank
93  bool sk_zap;
94 
95  // load spectral kurtosis configuration from YAML file
96  std::string sk_config;
97 
98  // also produce the non-zapped version of the output
99  bool nosk_too;
100 
101  // omit SK outlier samples from any later computation of SK
102  bool sk_omit_outliers = false;
103 
104  // spectral kurtosis integration factor
105  std::vector<unsigned> sk_m;
106  void set_sk_m (std::string txt);
107 
108  // spectral kurtosis overlap factor
109  std::vector<unsigned> sk_noverlap;
110  void set_sk_noverlap (std::string txt);
111 
112  // number of stddevs to use for spectral kurtosis excision
113  std::vector<float> sk_std_devs;
114  void set_sk_std_devs (std::string txt);
115 
116  // first channel to begin SK Detection
117  unsigned sk_chan_start;
118 
119  // last channel to conduct SK Detection
120  unsigned sk_chan_end;
121 
122  // SKDetector Fscrunch feature enabled by default
123  bool sk_time = true;
124 
125  // SKDetector Tscrunch feature enabled by default
126  bool sk_freq = true;
127 
128  // SKDetector FT feature enabled by default
129  bool sk_time_freq = true;
130 
131  // number of CPU threads for spectral kurtosis filterbank
132  unsigned sk_nthreads = 1;
133 
134  // fold the spectral kurtosis filterbank output
135  bool sk_fold = false;
136 
137  unsigned npol;
138  unsigned nbin;
139  unsigned ndim;
140 
141  // Filterbank configuration options
142  Filterbank::Config filterbank;
143 
144  // Time-domain window applied in Convolution, Filterbank or InverseFilterbank
145  std::string temporal_apodization_type;
146  std::string spectral_apodization_type;
147 
148  // Inverse Filterbank configuration options
149  InverseFilterbank::Config inverse_filterbank;
150 
151  bool is_inverse_filterbank;
152 
153  // whether or not to apply deripple correction
154  bool do_deripple;
155 
156  bool force_sensible_nbin;
157 
158  // length of sub-integrations in pulse periods
159  unsigned integration_turns;
160 
161  // length of sub-integrations in seconds
162  double integration_length;
163 
164  // reference epoch = start of first sub-integration
165  std::string integration_reference_epoch;
166 
167  // minimum sub-integration length written to disk
168  double minimum_integration_length;
169 
170  // all sub-integrations written to a single file
171  bool single_archive;
172 
173  // number of sub-integrations written to a single file
174  unsigned subints_per_archive;
175 
176  // file naming convention
177  std::string filename_convention;
178 
179  void single_pulse()
180  {
181  integration_turns = 1;
182  integration_length = 0;
183  }
184 
185  /*
186  If multiple sub-integrations will be combined in a single archive,
187  then a single archiver will be required to manage the integration
188  */
189  bool single_archiver_required ()
190  {
191  return single_archive || subints_per_archive > 0;
192  }
193 
194  // multiple threads can (and should) write to disk at once
195  bool concurrent_archives ()
196  {
197  return integration_turns && !single_archiver_required();
198  }
199 
200  // there may be more than one file per UTC second
201  bool may_be_more_than_one_archive_per_second ()
202  {
203  return integration_turns;
204  }
205 
206  std::string reference_epoch;
207  double reference_phase;
208  double folding_period;
209  bool fractional_pulses;
210 
211  bool asynchronous_fold;
212 
213  /* There are three ways to fold multiple pulsars:
214 
215  1) give names: Fold will generate ephemeris and predictor
216  2) give ephemerides: Fold will generate predictors
217  3) give predictors: Fold will use them
218 
219  You may specify any combination of the above, but the highest numbered
220  information will always be used.
221 
222  */
223 
224  // additional pulsar names to be folded
225  std::vector< std::string > additional_pulsars;
226 
227  // the parameters of multiple pulsars to be folded
228  std::vector< Reference::To<Pulsar::Parameters> > ephemerides;
229 
230  // the predictors of multiple pulsars to be folded
231  std::vector< Reference::To<Pulsar::Predictor> > predictors;
232 
234  unsigned get_nfold () const;
235 
237  dsp::Filterbank::Config::When get_convolve_when() const;
238 
240  unsigned get_filterbank_nchan () const;
241 
242  // don't output dynamic extensions in the file
243  bool no_dynamic_extensions;
244 
245  // name of the output archive class
246  std::string archive_class;
247  bool archive_class_specified_by_user;
248 
249  // name of the output archive file
250  std::string archive_filename;
251 
252  // extension appended to the output archive filename
253  std::string archive_extension;
254 
255  // output archive post-processing jobs
256  std::vector<std::string> jobs;
257 
258  // command line of the calling program
259  std::string command_line;
260 
262  virtual void set_quiet ();
263 
265  virtual void set_verbose ();
266 
268  virtual void set_very_verbose ();
269  };
270 
271 }
272 
273 #endif
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
unsigned get_filterbank_nchan() const
return the number of channels produced by (Inverse)Filterbank
Definition: LoadToFoldConfig.C:153
virtual void set_quiet()
Operate in quiet mode.
Definition: LoadToFoldConfig.C:217
Config()
Default constructor.
Definition: LoadToFoldConfig.C:13
Per-thread configuration options.
Definition: SingleThread.h:185
dsp::Filterbank::Config::When get_convolve_when() const
Return when convolution is performed: before, during, or after (Inverse)Filterbank.
Definition: LoadToFoldConfig.C:137
static void set_verbosity(unsigned level)
virtual void set_very_verbose()
Operate in very verbose mode.
Definition: LoadToFoldConfig.C:231
virtual void set_verbose()
Operate in verbose mode.
Definition: LoadToFoldConfig.C:224
unsigned get_nfold() const
Return the number of folds to perform.
Definition: LoadToFoldConfig.C:127
Load, unpack, process and fold data into phase-averaged profile(s)
Definition: LoadToFoldConfig.h:30
static unsigned verbose
Verbose flag.
Definition: Archiver.h:48

Generated using doxygen 1.8.17