Fold TimeSeries data into phase-averaged profile(s) More...

#include <Fold.h>

Inheritance diagram for dsp::Fold:
dsp::Transformation< TimeSeries, PhaseSeries > dsp::Operation dsp::HasInput< TimeSeries > dsp::HasOutput< PhaseSeries > OwnStream Reference::Able Reference::HeapTracked dsp::CyclicFold

Classes

class  Engine
 Interface to alternate processing engine (e.g. GPU) More...
 

Public Member Functions

 Fold ()
 Constructor.
 
 ~Fold ()
 Destructor.
 
virtual Foldclone () const
 Create a clonse.
 
PhaseSeriesget_output () const
 
virtual void prepare ()
 Prepare to fold the input TimeSeries. More...
 
void prepare (const Observation *observation)
 Prepare to fold the given Observation. More...
 
void combine (const Operation *)
 If Operation is a Fold, integrate its PhaseSeries. More...
 
void reset ()
 Reset the PhaseSeries.
 
virtual void finish ()
 Perform any final operations.
 
uint64_t bytes_storage () const override
 The number of bytes of additional storage used by the operation.
 
PhaseSeriesget_result () const
 Before returning output, ensure that it is synchronized with Engine.
 
void set_nbin (unsigned _nbin)
 Set the number of phase bins into which data will be folded.
 
unsigned get_nbin () const
 Get the number of phase bins into which data will be folded.
 
void set_force_sensible_nbin (bool _force_sensible)
 
bool get_force_sensible_nbin ()
 
void set_ncoef (unsigned ncoef)
 Set the number of polynomial coefficients in model.
 
unsigned get_ncoef () const
 Get the number of polynomial coefficients in model.
 
void set_nspan (unsigned nspan)
 Set the number of minutes over which polynomial coefficients are valid.
 
unsigned get_nspan () const
 Get the number of minutes over which polynomial coefficients are valid.
 
void set_change (const ObservationChange *)
 Set the attributes to be changed in the output PhaseSeries. More...
 
void set_folding_period (double folding_period)
 Set the period at which to fold data for all sources. More...
 
void set_reference_epoch (const MJD &)
 Set the reference epoch that defines phase = 0 when folding_period > 0.
 
double get_folding_period () const
 Get the period at which data are being folded (in seconds) More...
 
bool has_folding_period () const
 Returns true if data will be folded at a constant period.
 
const Pulsar::Predictorget_folding_predictor () const
 Get the phase model which is currently being used to fold data.
 
bool has_folding_predictor () const
 Returns true if data will be folded using Pulsar::Predictor.
 
const Pulsar::Parametersget_pulsar_ephemeris () const
 Get the ephemeris used to create the phase model.
 
void set_folding_predictor (const Pulsar::Predictor *)
 Set the phase model with which to fold data. More...
 
bool has_pulsar_ephemeris () const
 use to see whether pulsar eph is stored
 
void set_pulsar_ephemeris (const Pulsar::Parameters *)
 Set the ephemeris with which to create a new phase model.
 
virtual void set_reference_phase (double phase)
 Set the reference phase (phase of bin zero)
 
double get_reference_phase () const
 Get the reference phase (phase of bin zero)
 
void set_input (const TimeSeries *input)
 Overload Transformation::set_input to set weighted_input.
 
unsigned choose_nbin (bool quiet=false) const
 Return an appropriate number of pulse phase bins. More...
 
virtual void set_engine (Engine *)
 
virtual void set_cerr (std::ostream &os) const
 Set output cerr stream.
 
virtual Engineget_engine ()
 
- Public Member Functions inherited from dsp::Transformation< TimeSeries, PhaseSeries >
 Transformation (const char *_name, Behaviour _type)
 All sub-classes must specify name and capacity for inplace operation.
 
virtual ~Transformation ()
 Destructor.
 
void reserve ()
 Set the size of the output to that of the input by default.
 
void set_input (const TimeSeries *input)
 Set the container from which input data will be read.
 
void set_output (PhaseSeries *output)
 Set the container into which output data will be written.
 
Behaviour get_type () const
 Return the Transformation type.
 
virtual void set_buffering_policy (BufferingPolicy *policy)
 Set the policy for buffering input and/or output data.
 
bool has_buffering_policy () const
 Returns true if buffering_policy is set.
 
BufferingPolicyget_buffering_policy () const
 
void reset_min_samps ()
 Reset minimum_samps_can_process.
 
std::string name (const std::string &function) const
 String preceding output in verbose mode.
 
- Public Member Functions inherited from dsp::Operation
 Operation (const char *name)
 All sub-classes must specify a unique name. More...
 
 Operation (const Operation &)
 Copy constructor.
 
virtual ~Operation ()
 Virtual destructor.
 
virtual bool operate ()
 Call this method to operate on data Returns false on failure. More...
 
virtual void add_extensions (Extensions *)
 Add any extensions.
 
virtual void report () const
 Report operation statistics.
 
std::string get_name () const
 Return the unique name of this operation.
 
double get_total_time () const
 Return the total time spent on this Operation in seconds.
 
double get_elapsed_time () const
 Get the time spent in the last invocation of operate()
 
virtual uint64_t get_total_weights () const
 Return the total number of timesample weights encountered. More...
 
virtual uint64_t get_discarded_weights () const
 Return the number of invalid timesample weights encountered.
 
int get_id ()
 Inquire the unique instantiation id.
 
virtual Function get_function () const
 Get the function classification of this operation.
 
virtual double get_delay_time () const
 Get the time delay of this operation, if any, in seconds.
 
virtual void set_scratch (Scratch *)
 Set the scratch space.
 
bool scratch_was_set () const
 
virtual uint64_t bytes_scratch () const
 The number of bytes of scratch space used by the operation. More...
 
- Public Member Functions inherited from OwnStream
 OwnStream (const OwnStream &)
 
const OwnStreamoperator= (const OwnStream &)
 
virtual void set_cout (std::ostream &) const
 
- Public Member Functions inherited from Reference::Able
 Able (const Able &)
 
Ableoperator= (const Able &)
 
unsigned get_reference_count () const
 
- Public Member Functions inherited from Reference::HeapTracked
 HeapTracked (const HeapTracked &)
 
HeapTrackedoperator= (const HeapTracked &)
 
bool __is_on_heap () const
 
- Public Member Functions inherited from dsp::HasInput< TimeSeries >
virtual ~HasInput ()
 Destructor.
 
const TimeSeriesget_input () const
 Return pointer to the container from which input data will be read.
 
bool has_input () const
 Returns true if input is set.
 
- Public Member Functions inherited from dsp::HasOutput< PhaseSeries >
virtual ~HasOutput ()
 Destructor.
 
virtual PhaseSeriesget_output () const
 Return pointer to the container into which output data will be written.
 
bool has_output () const
 Returns true if output is set.
 

Static Public Attributes

static unsigned maximum_nbin = 1024
 The maximum number of phase bins returned by Fold::choose_nbin. More...
 
static double minimum_bin_width = 1.2
 The minimum width of each pulse phase bin; used by Fold::choose_nbin. More...
 
static bool power_of_two = true
 Controls the number of phase bins returned by Fold::choose_nbin. More...
 
- Static Public Attributes inherited from dsp::Operation
static bool record_time = false
 Global flag enables stopwatch to record the time spent operating. More...
 
static bool report_time = true
 Global flag enables report of time spent in operation on descruction. More...
 
static bool verbose = false
 Global verbosity flag.
 
static int operation_status = 0
 Operations can set this to non-zero in operation() if they fail.
 
static bool check_state = true
 Operations should perform internal consistency checks.
 
static int instantiation_count = 0
 Counts how many Operation instantiations there have been Used for setting the unique instantiation ID. More...
 

Protected Member Functions

virtual void transformation ()
 The transformation folds the data into the profile.
 
virtual void fold (uint64_t nweights, const unsigned *weights, unsigned ndatperweight, unsigned weight_idat)
 Fold nblock blocks of data. More...
 
virtual void set_limits (const Observation *input)
 Set the idat_start and ndat_fold attributes. More...
 
virtual void check_input ()
 Check that the input state is appropriate for folding.
 
virtual void prepare_output ()
 Prepare output PhaseSeries parameters.
 
void set_idat_start (uint64_t _idat_start)
 Used by the MultiFold class.
 
uint64_t get_idat_start ()
 Used by the MultiFold class.
 
void set_ndat_fold (uint64_t _ndat_fold)
 Used by the MultiFold class.
 
uint64_t get_ndat_fold ()
 Used by the MultiFold class.
 
double get_pfold (const MJD &start_time)
 Called by fold to return pfold.
 
double get_phi (const MJD &start_time)
 Called by new_fold() to return phi.
 
void initialise ()
 Makes sure parameters are initialised. More...
 
- Protected Member Functions inherited from dsp::Transformation< TimeSeries, PhaseSeries >
virtual bool can_operate ()
 Return false if the input doesn't have enough data to proceed.
 
virtual void operation ()
 Define the Operation pure virtual method.
 
virtual void vchecks ()
 Makes sure input & output are okay before calling transformation()
 
- Protected Member Functions inherited from dsp::Operation
virtual void set_name (const std::string &_name)
 Set the name!
 
int timers_index (const std::string &op_name)
 Returns the index in the 'timers' array of a particular timer.
 
- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 

Protected Attributes

double folding_period
 Period at which to fold data.
 
Reference::To< const WeightedTimeSeriesweighted_input
 Set when Tranformation::input is a Weighted TimeSeries.
 
unsigned folding_nbin
 Number of phase bins into which the data will be integrated.
 
unsigned requested_nbin
 Number of phase bins set using set_nbin.
 
bool force_sensible_nbin
 
double reference_phase
 Reference phase (phase of bin zero)
 
MJD reference_epoch
 Reference epoch that defines phase = 0 when folding_period > 0.
 
unsigned ncoef
 Number of polynomial coefficients in model.
 
unsigned nspan
 Number of minutes over which polynomial coefficients are valid.
 
Reference::To< const ObservationChangechange
 The attributes to be changed in the output PhaseSeries.
 
bool built
 Flag that the predictor is built for the given ephemeris and input.
 
uint64_t idat_start
 INTERNAL: the time sample at which to start folding.
 
uint64_t ndat_fold
 INTERNAL: the number of time samples to fold.
 
Reference::To< Engineengine
 Interface to alternate processing engine (e.g. GPU)
 
- Protected Attributes inherited from dsp::Transformation< TimeSeries, PhaseSeries >
Reference::To< BufferingPolicybuffering_policy
 The buffering policy in place (if any)
 
int64_t minimum_samps_can_process
 If input doesn't have this many samples, operate() returns false.
 
- Protected Attributes inherited from dsp::Operation
Scratchscratch
 Shared scratch space, if needed.
 
bool set_scratch_called
 
std::string name
 Operation name.
 
uint64_t discarded_weights
 Number of time sample weights encountered that are flagged invalid.
 
uint64_t total_weights
 Total number of time sample weights encountered.
 
RealTimer optime
 Stop watch records the amount of time spent performing this operation.
 
int id
 Unique instantiation id.
 
bool prepared
 Set true when preparation optimizations are completed.
 
- Protected Attributes inherited from dsp::HasInput< TimeSeries >
Reference::To< const TimeSeriesinput
 Container from which input data will be read.
 
- Protected Attributes inherited from dsp::HasOutput< PhaseSeries >
Reference::To< PhaseSeriesoutput
 Container into which output data will be written.
 

Friends

class MultiFold
 

Additional Inherited Members

- Public Types inherited from dsp::Operation
enum  Function { Producer, Procedural, Structural }
 The function of the operator. More...
 
- Static Public Member Functions inherited from Reference::Able
static size_t get_instance_count ()
 
- Static Public Member Functions inherited from Reference::HeapTracked
static void * operator new (size_t size, void *ptr=0)
 
static void operator delete (void *location, void *ptr)
 
static void operator delete (void *location)
 
static size_t get_heap_queue_size ()
 
- Public Attributes inherited from dsp::Transformation< TimeSeries, PhaseSeries >
Callback< Transformation * > pre_transformation
 Functions called before the transformation takes place.
 
Callback< Transformation * > post_transformation
 Functions called after the transformation takes place.
 

Detailed Description

Fold TimeSeries data into phase-averaged profile(s)

This Operation does not modify the TimeSeries. Rather, it accumulates the (folded) average pulse profile data within its data structures.

Member Function Documentation

◆ choose_nbin()

unsigned dsp::Fold::choose_nbin ( bool  quiet = false) const

Return an appropriate number of pulse phase bins.

Based on both the period of the signal to be folded and the time resolution of the input TimeSeries, this method calculates a sensible number of bins into which the input data will be folded. The value returned by this method may be over-ridden by calling the Fold::set_nbin method. The maximum number of bins to be used during folding may be set through the Fold::maximum_nbin attribute.

◆ combine()

void dsp::Fold::combine ( const Operation other)
virtual

If Operation is a Fold, integrate its PhaseSeries.

Combine results with another operation.

Reimplemented from dsp::Operation.

References combine(), dsp::Operation::combine(), and get_result().

Referenced by combine().

◆ fold()

void dsp::Fold::fold ( uint64_t  nweights,
const unsigned *  weights,
unsigned  ndatperweight,
unsigned  weight_idat 
)
protectedvirtual

Fold nblock blocks of data.

This method creates a folding plan and then folds nblock arrays.

Precondition
the folding_nbin and folding_period or folding_predictor attributes must have been set prior to calling this method.
Parameters
integration_lengthreturns the time integrated
phasebase address of nblock contiguous phase blocks (of nbin*ndim)
hitsarray of nbin phase bin counts
infoObservation telling the start_time and sampling_rate of time
nblockthe number of blocks of data to be folded
timebase address of nblock contiguous time blocks (of ndat*ndim)
ndatthe number of time samples in each time block
ndimthe dimension of each time sample
weightscorresponding to each block of ndatperweight time samples
ndatperweightnumber of time samples per weight
idat_startthe time sample at which to start folding (optional)
ndat_foldthe number of time samples to be folded (optional)

References dsp::TimeSeries::get_datptr(), dsp::TimeSeries::get_dattfp(), dsp::PhaseSeries::get_nbin(), dsp::Observation::get_nchan(), dsp::Observation::get_ndim(), dsp::Observation::get_npol(), dsp::TimeSeries::get_order(), dsp::PhaseSeries::integration_length, dsp::PhaseSeries::ndat_total, and dsp::TimeSeries::OrderFPT.

◆ get_folding_period()

double dsp::Fold::get_folding_period ( ) const

Get the period at which data are being folded (in seconds)

Get the average folding period.

◆ initialise()

void dsp::Fold::initialise ( )
protected

Makes sure parameters are initialised.

Set any unititialized parameters.

References dsp::psrdisp_compatible.

◆ prepare() [1/2]

void dsp::Fold::prepare ( )
virtual

Prepare to fold the input TimeSeries.

Prepare for folding the input TimeSeries.

Reimplemented from dsp::Operation.

Reimplemented in dsp::CyclicFold.

◆ prepare() [2/2]

void dsp::Fold::prepare ( const Observation observation)

Prepare to fold the given Observation.

Prepare for folding the given Observation.

References dsp::Observation::get_calfreq(), dsp::Observation::get_source(), dsp::Observation::get_type(), and Signal::PolnCal.

◆ set_change()

void dsp::Fold::set_change ( const ObservationChange c)

Set the attributes to be changed in the output PhaseSeries.

Set the name of the source.

◆ set_folding_period()

void dsp::Fold::set_folding_period ( double  folding_period)

Set the period at which to fold data for all sources.

Set the period at which to fold data (in seconds)

Parameters
folding_periodin seconds, negative to disable

Referenced by dsp::LoadToFold::construct_phased_filterbank().

◆ set_folding_predictor()

void dsp::Fold::set_folding_predictor ( const Pulsar::Predictor _folding_predictor)

Set the phase model with which to fold data.

Set the phase polynomial(s) with which to fold data.

Referenced by dsp::LoadToFold::share().

◆ set_limits()

void dsp::Fold::set_limits ( const Observation input)
protectedvirtual

Set the idat_start and ndat_fold attributes.

sets idat_start to zero and ndat_fold to input->get_ndat()

Member Data Documentation

◆ maximum_nbin

unsigned dsp::Fold::maximum_nbin = 1024
static

The maximum number of phase bins returned by Fold::choose_nbin.

Unless over-ridden by calling the Fold::set_nbin method, this attribute determines the maximum number of pulse phase bins into which input data will be folded.

◆ minimum_bin_width

double dsp::Fold::minimum_bin_width = 1.2
static

The minimum width of each pulse phase bin; used by Fold::choose_nbin.

The minimum width of each pulse phase bin is specified in units of the time resolution of the input TimeSeries.

◆ power_of_two

bool dsp::Fold::power_of_two = true
static

Controls the number of phase bins returned by Fold::choose_nbin.

If true, the number of bins chosen by Fold::choose_nbin will be a power of two. If false, there is no constraint on the value returned.


The documentation for this class was generated from the following files:

Generated using doxygen 1.8.17