LoadToFold1.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2007-2011 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Signal/Pulsar/dsp/LoadToFold1.h
10 
11 #ifndef __dspsr_LoadToFold_h
12 #define __dspsr_LoadToFold_h
13 
14 #include "dsp/SingleThread.h"
15 #include "dsp/Filterbank.h"
16 #include "dsp/InverseFilterbank.h"
17 
18 namespace dsp {
19 
20  class TimeSeries;
21 
22  class PlasmaResponse;
23  class Dedispersion;
24  class Derotation;
25 
26  class Convolution;
27  class Detection;
28  class Fold;
29  class Archiver;
30  class FoldManager;
31 
32  class Response;
33  class RFIFilter;
34  class ResponseProduct;
35 
36  class OperationThread;
37  class SKFilterbank;
38  class SpectralKurtosis;
39  class Resize;
40  class SampleDelay;
41  class PhaseLockedFilterbank;
42 
43  class PhaseSeriesUnloader;
44  class SignalPath;
45 
46  class LoadToFoldN;
47 
49  class LoadToFold : public SingleThread
50  {
51 
52  public:
53 
55  class Config;
56 
58  void set_configuration (Config*);
59 
61  LoadToFold (Config* config = 0);
62 
64  ~LoadToFold ();
65 
67  void construct ();
68 
70  void prepare ();
71 
73  void run ();
74 
76  void finish ();
77 
78  friend class LoadToFoldN;
79 
81  void share (SingleThread*);
82 
84  void end_of_data ();
85 
87  bool output_subints () const;
88 
91 
94 
97 
99  std::vector< Reference::To<Fold> > fold;
100 
103 
105  std::vector< Reference::To<OperationThread> > asynch_fold;
106 
108  std::vector< Reference::To<PhaseSeriesUnloader> > unloader;
109 
111  std::vector< Reference::To<SignalPath> > path;
112 
114  bool manage_archiver;
115 
118 
121 
124 
127 
130 
133 
135  // Reference::To<SKFilterbank> skfilterbank;
136 
139 
142 
145 
148 
151 
154 
157 
160 
163 
166 
168 
171 
174 
176  TimeSeries* construct_inverse_filterbank (TimeSeries*, bool run_on_gpu=false);
177 
179  TimeSeries* construct_filterbank (TimeSeries*, bool run_on_gpu=false);
180 
182  TimeSeries* construct_convolution (TimeSeries*, bool run_on_gpu=false);
183 
185  TimeSeries* construct_interchan (TimeSeries*, bool run_on_gpu=false);
186 
188  TimeSeries* construct_spectral_kurtosis (TimeSeries* data, bool run_on_gpu=false);
189 
192 
194  void build_fold (TimeSeries*);
196  void configure_fold (unsigned ifold, TimeSeries* to_fold);
197  void configure_detection (Detection*, unsigned);
198 
199  PhaseSeriesUnloader* get_unloader (unsigned ifold);
200 
202  void prepare_fold ();
203  bool fold_prepared;
204 
206  void prepare_archiver (Archiver*);
207 
209  MJD parse_epoch (const std::string&);
210  };
211 
212 }
213 
214 #endif // !defined(__LoadToFold_h)
Performs FFT at specific pulse phase windows.
Definition: PhaseLockedFilterbank.h:28
Reference::To< Filterbank::Engine > filterbank_engine
Optional filterbank engine.
Definition: LoadToFold1.h:155
Chooses the optimal FFT length for Filterbank and/or Convolution.
Definition: OptimalFilterbank.h:25
virtual void set_convention(FilenameConvention *)
Set the filename convention.
Definition: PhaseSeriesUnloader.C:46
Produces TimeSeries data by integrating an Input with an Unpacker.
Definition: IOManager.h:26
void set_nbin(unsigned nbin)
Set the number of pulse phase windows in which to compute spectra.
Definition: PhaseLockedFilterbank.C:36
virtual void set_rotation_measure(double rm)
Set the pulsar rotation mesure.
Definition: Observation.h:208
Reference::To< TimeSeries > zero_DM_time_series
Optional zero DM TimeSeries for Spectral Kurtosis.
Definition: LoadToFold1.h:146
void add_response(Response *response)
Add a response to the product.
Definition: ResponseProduct.C:47
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
Detects phase-coherent TimeSeries data.
Definition: Detection.h:38
void set_input(const In *input)
Set the container from which input data will be read.
Definition: Transformation.h:258
bool has_output() const
Returns true if output is set.
Definition: HasOutput.h:44
void set_configuration(Config *)
Set the configuration to be used in prepare and run.
Definition: LoadToFold1.C:115
MJD parse_epoch(const std::string &)
Parse the epoch string into a reference epoch.
Definition: LoadToFold1.C:901
Reference::To< PhaseLockedFilterbank > phased_filterbank
Creates a filterbank in phase with the pulsar signal.
Definition: LoadToFold1.h:175
void set_subint_turns(unsigned subint_turns)
Set the number of turns to fold into each sub-integration.
Definition: Subint.h:90
virtual void set_extension(const std::string &)
Set the extension to be added to the end of filenames.
Definition: PhaseSeriesUnloader.C:90
Reference::To< Response > passband
Integrates the passband.
Definition: LoadToFold1.h:128
void set_type(const std::string &)
Set the type of window function by name.
Definition: Apodization.C:34
TimeSeries * construct_spectral_kurtosis(TimeSeries *data, bool run_on_gpu=false)
Construct generalized spectral kurtosis estimator.
Definition: LoadToFold1.C:690
void share(SingleThread *)
Share any necessary resources with the specified thread.
Definition: LoadToFold1.C:1523
Real-time RFI mitigation using a frequency response function.
Definition: RFIFilter.h:33
void finish()
Finish everything.
Definition: LoadToFold1.C:1578
Stores information about the signal path.
Definition: SignalPath.h:24
Reference::To< Derotation > derotate
The derotation kernel.
Definition: LoadToFold1.h:101
Data as a function of pulse phase.
Definition: PhaseSeries.h:28
Reference::To< Response > frequency_response
The frequency response applied during convolution.
Definition: LoadToFold1.h:131
TimeSeries * construct_interchan(TimeSeries *, bool run_on_gpu=false)
Construct interchannel dispersive delay correction operation.
Definition: LoadToFold1.C:755
Reference::To< ResponseProduct > response_product
The product of the RFIFilter and Dedispersion kernel.
Definition: LoadToFold1.h:167
Reference::To< Apodization > spectral_apodization
Optional window applied in frequency domain before backward FFT.
Definition: LoadToFold1.h:137
Reference::To< RFIFilter > rfi_filter
The RFI filter.
Definition: LoadToFold1.h:122
void set_script(const std::vector< std::string > &jobs)
Set the post-processing script.
Definition: Archiver.C:138
Chooses the optimal FFT length for Filterbank and/or Convolution.
Definition: OptimalFFT.h:24
virtual void set_prefix(const std::string &)
Set the prefix to be added to the front of filenames.
Definition: PhaseSeriesUnloader.C:57
void construct()
Create the pipeline.
Definition: LoadToFold1.C:136
bool has_folding_predictor() const
Returns true if data will be folded using Pulsar::Predictor.
Definition: Fold.C:449
void set_source(Source *)
Set the source of the data.
Definition: RFIFilter.C:256
Describes a frequency (or impulse) response.
Definition: Response.h:34
void build_fold(TimeSeries *)
Build to fold the given TimeSeries.
Definition: LoadToFold1.C:1089
virtual void set_buffering_policy(BufferingPolicy *policy)
Set the policy for buffering input and/or output data.
Definition: Transformation.h:85
LoadToFold(Config *config=0)
Constructor.
Definition: LoadToFold1.C:97
Fold TimeSeries data into phase-averaged profile(s)
Definition: Fold.h:34
bool has_pulsar_ephemeris() const
use to see whether pulsar eph is stored
Definition: Fold.h:128
bool manage_archiver
Manage the archivers.
Definition: LoadToFold1.h:119
Reference::To< Detection > detect
Detects the phase-coherent signal.
Definition: LoadToFold1.h:178
Output filenames with a sequentially increasing index appended.
Definition: PhaseSeriesUnloader.h:132
void set_archive_class(const std::string &archive_class_name)
Set the name of the Pulsar::Archive class used to create new instances.
Definition: Archiver.C:111
void convolution_block_constraints(Pipeline *pipeline, typename Pipeline::Config *config, const std::string &app, bool report_vitals)
Configures the minimum_samples and input_overlap for LoadToFold and LoadToFITS.
Definition: convolution_block_constraints.h:24
std::vector< Reference::To< PhaseSeriesUnloader > > unloader
An unloader for each pulsar to be folded.
Definition: LoadToFold1.h:113
Type * get() const
void prepare_archiver(Archiver *)
Prepare the given Archiver.
Definition: LoadToFold1.C:1413
virtual void set_dispersion_measure(double dm)
Set the pulsar dispersion mesure.
Definition: Observation.h:202
void prepare()
Finish preparing.
Definition: LoadToFold1.C:925
Reference::To< PlasmaResponse > kernel
The dedispersion and/or derotation kernel.
Definition: LoadToFold1.h:95
void end_of_data()
Wrap up tasks at end of data.
Definition: LoadToFold1.C:1054
Reference::To< Convolution > convolution
Performs coherent dedispersion.
Definition: LoadToFold1.h:164
void set_unloader(PhaseSeriesUnloader *unloader)
Set the file unloader.
Definition: Subint.h:196
void set_folding_period(double folding_period)
Set the period at which to fold data for all sources.
Definition: Fold.C:413
Stores information about digital, band-limited, time-varying signals.
Definition: Observation.h:33
Phase-coherent birefringence removal frequency response function.
Definition: Derotation.h:28
Reference::To< Config > config
Configuration parameters.
Definition: LoadToFold1.h:125
MJD get_reference_epoch() const
Perform Spectral Kurtosis on Input Timeseries, creating output Time Series.
Definition: SpectralKurtosis.h:30
void set_pulsar_ephemeris(const Pulsar::Parameters *)
Set the ephemeris with which to create a new phase model.
Definition: Fold.C:472
Arrays of consecutive samples for each polarization and frequency channel.
Definition: TimeSeries.h:29
std::string get_name() const
TimeSeries * construct_filterbank(TimeSeries *, bool run_on_gpu=false)
Construct a filterbank.
Definition: LoadToFold1.C:572
void run()
Run through the data.
Definition: LoadToFold1.C:1566
Convolves a TimeSeries using a frequency response function.
Definition: Convolution.h:64
std::string get_value(const std::string &keyword) const
Reference::To< InverseFilterbank > inverse_filterbank
reference to inverse filterbank
Definition: LoadToFold1.h:158
Base class for things that can unload PhaseSeries data somewhere.
Definition: PhaseSeriesUnloader.h:30
TimeSeries * construct_inverse_filterbank(TimeSeries *, bool run_on_gpu=false)
Construct an inverse filterbank.
Definition: LoadToFold1.C:458
Reference::To< Apodization > temporal_apodization
Optional window applied in time domain before forward FFT.
Definition: LoadToFold1.h:134
Reference::To< Dedispersion > dedisp
The dedispersion kernel.
Definition: LoadToFold1.h:98
A single LoadToFold thread.
Definition: LoadToFold1.h:54
Output filenames based on the pulse number (for single pulses)
Definition: PhaseSeriesUnloader.h:125
bool output_subints() const
Return true if the output will be divided into sub-integrations.
Definition: LoadToFold1.C:1518
SingleThread()
Constructor.
Definition: SingleThread.C:50
void unload(const PhaseSeries *)
Unloads all available data to a Pulsar::Archive instance.
Definition: Archiver.C:198
Reference::To< SpectralKurtosis > skestimator
Optional SK filterbank.
Definition: LoadToFold1.h:143
TimeSeries * construct_convolution(TimeSeries *, bool run_on_gpu=false)
Construct a convolution operation.
Definition: LoadToFold1.C:632
void set_archive_software(std::string _archive_software)
A dspReduction extension is added to the archive with this string.
Definition: Archiver.h:111
Reference::To< Filterbank > filterbank
Creates the filterbank.
Definition: LoadToFold1.h:152
virtual void set_path_add_source(bool)
place output files in a sub-directory named by source
Definition: PhaseSeriesUnloader.C:79
Class to unload PhaseSeries data in a Pulsar::Archive.
Definition: Archiver.h:43
Unload PhaseSeries data into sub-integrations.
Definition: Subint.h:36
void set_output(Out *output)
Set the container into which output data will be written.
Definition: Transformation.h:275
void set_command_line(const std::string &)
Set the command line of the calling program.
Definition: Archiver.C:101
const Type * ptr() const
void prepare_fold()
Prepare all fold instances.
Definition: LoadToFold1.C:890
std::vector< Reference::To< Fold > > fold
A folding algorithm for each pulsar to be folded.
Definition: LoadToFold1.h:104
void detect(Profile *input)
Forms the fourth-order moments of the electric field.
Definition: FourthMoment.h:26
Output filenames based on the date/time of the observation.
Definition: PhaseSeriesUnloader.h:109
virtual std::string get_name() const
virtual void set_memory(Memory *)
Set the memory manager.
Definition: DataSeries.C:53
void set_folding_predictor(const Pulsar::Predictor *)
Set the phase model with which to fold data.
Definition: Fold.C:437
Various apodizing (window) functions.
Definition: Apodization.h:28
std::vector< Reference::To< SignalPath > > path
An unique signal path for each pulsar to be folded.
Definition: LoadToFold1.h:116
A single Pipeline thread.
Definition: SingleThread.h:32
Load, unpack, process and fold data into phase-averaged profile(s)
Definition: LoadToFoldConfig.h:30
const Pulsar::Parameters * get_pulsar_ephemeris() const
Get the ephemeris used to create the phase model.
Definition: Fold.C:481
Reference::To< InverseFilterbank::Engine > inverse_filterbank_engine
Optional inverse filterbank engine.
Definition: LoadToFold1.h:161
virtual Predictor * clone() const=0
Reference::To< Resize > skresize
Optional SK Resizer.
Definition: LoadToFold1.h:149
Represents a product of Response instances.
Definition: ResponseProduct.h:33
void add_response(PlasmaResponse *response)
Add a response to the product.
Definition: PlasmaResponseProduct.C:50
Phase-coherent dispersion removal frequency response function.
Definition: Dedispersion.h:25
Reference::To< SampleDelay > sample_delay
Removes inter-channel dispersion delays.
Definition: LoadToFold1.h:170
double get_dispersion_measure() const
void set_fractional_pulses(bool flag)
Attach methods to receive completed PhaseSeries instances.
Definition: Subint.h:96
~LoadToFold()
Destructor.
Definition: LoadToFold1.C:111
const Pulsar::Predictor * get_folding_predictor() const
Get the phase model which is currently being used to fold data.
Definition: Fold.C:444
void set_reference_epoch(const MJD &epoch)
Reference::To< FoldManager > fold_manager
Manages the execution of multiple Fold algorithms.
Definition: LoadToFold1.h:107
void set_subint_seconds(double subint_seconds)
Set the number of seconds to fold into each sub-integration.
Definition: Subint.h:75
void construct_phased_filterbank(TimeSeries *input)
Construct phase-locked filterbank.
Definition: LoadToFold1.C:794
std::vector< Reference::To< OperationThread > > asynch_fold
Wrap each folder in a separate thread of execution.
Definition: LoadToFold1.h:110
Represents a product of PlasmaResponse instances.
Definition: PlasmaResponseProduct.h:32

Generated using doxygen 1.8.17