Reads and writes the timer archive file format. More...

#include <TimerArchive.h>

Inheritance diagram for Pulsar::TimerArchive:
Pulsar::Archive Pulsar::IntegrationManager Pulsar::Container Reference::Able Reference::HeapTracked Pulsar::BasebandArchive Pulsar::ScintArchive

Public Member Functions

 TimerArchive ()
 Default constructor.
 
 TimerArchive (const TimerArchive &archive)
 Copy constructor.
 
 ~TimerArchive ()
 Destructor.
 
const TimerArchiveoperator= (const TimerArchive &archive)
 Assignment operator.
 
 TimerArchive (const Archive &archive)
 Base copy constructor.
 
void copy (const Archive &archive)
 Copy all of the class attributes and the selected Integration data.
 
TimerArchiveclone () const
 Return a pointer to a new copy constructed instance equal to this.
 
virtual std::string get_telescope () const
 Get the telescope name.
 
virtual void set_telescope (const std::string &telescope)
 Set the telescope name.
 
virtual Signal::State get_state () const
 Get the state of the profiles.
 
virtual void set_state (Signal::State state)
 Set the state of the profiles.
 
virtual Signal::Scale get_scale () const
 Get the scale of the profiles.
 
virtual void set_scale (Signal::Scale scale)
 Set the scale of the profiles.
 
virtual Signal::Source get_type () const
 Get the observation type (psr, cal)
 
virtual void set_type (Signal::Source type)
 Set the observation type (psr, cal)
 
virtual std::string get_source () const
 Get the source name.
 
virtual void set_source (const std::string &source)
 Set the source name.
 
virtual sky_coord get_coordinates () const
 Get the coordinates of the source.
 
virtual void set_coordinates (const sky_coord &coordinates)
 Set the coordinates of the source.
 
virtual unsigned get_nbin () const
 Get the number of pulsar phase bins used. More...
 
virtual unsigned get_nchan () const
 Get the number of frequency channels used. More...
 
virtual unsigned get_npol () const
 Get the number of frequency channels used. More...
 
virtual unsigned get_nsubint () const
 Get the number of sub-integrations stored in the file. More...
 
virtual double get_bandwidth () const
 Get the overall bandwidth of the observation.
 
virtual void set_bandwidth (double bw)
 Set the overall bandwidth of the observation.
 
virtual double get_centre_frequency () const
 Get the centre frequency of the observation.
 
virtual void set_centre_frequency (double cf)
 Set the centre frequency of the observation.
 
virtual double get_dispersion_measure () const
 Get the dispersion measure (in ${\rm pc\, cm}^{-3}$) More...
 
virtual void set_dispersion_measure (double dm)
 Set the dispersion measure (in ${\rm pc\, cm}^{-3}$) More...
 
virtual double get_rotation_measure () const
 Get the rotation measure (in ${\rm rad\, m}^{-2}$)
 
virtual void set_rotation_measure (double rm)
 Set the rotation measure (in ${\rm rad\, m}^{-2}$)
 
virtual bool get_dedispersed () const
 Inter-channel dispersion delay has been removed.
 
virtual void set_dedispersed (bool done=true)
 Set true when the inter-channel dispersion delay has been removed.
 
virtual bool get_faraday_corrected () const
 Data has been corrected for ISM faraday rotation.
 
virtual void set_faraday_corrected (bool done=true)
 Set the status of the ISM RM flag.
 
virtual bool get_poln_calibrated () const
 Data has been poln calibrated.
 
virtual void set_poln_calibrated (bool done=true)
 Set the status of the poln calibrated flag.
 
int hydra_obstype ()
 Returns the Hydra observation type, given the coordinates.
 
virtual void correct ()
 Set various redundant parameters in the timer and mini headers.
 
- Public Member Functions inherited from Pulsar::Archive
 Archive ()
 Default constructor.
 
 Archive (const Archive &archive)
 Copy constructor. More...
 
virtual ~Archive ()
 Destructor.
 
Archiveoperator= (const Archive &a)
 Assignment operator. More...
 
template<class T >
const T * get () const
 
template<class T >
T * get ()
 
template<class T >
T * getadd ()
 
void copy (const Archive &)
 Copy all base class attributes, Extensions, and Integrations.
 
void copy (const Archive *)
 Copy all base class attributes, Extensions, and Integrations.
 
Archivetotal (bool tscrunch=true) const
 Return pointer to a new fscrunched, tscrunched and pscrunched clone. More...
 
Archivetscrunched () const
 Return pointer to a new tscrunched clone. More...
 
Archiveextract (std::vector< unsigned > &subints) const
 Return pointer to a new instance with only the specified subints.
 
Profileget_Profile (unsigned subint, unsigned pol, unsigned chan)
 Return pointer to the specified profile. More...
 
const Profileget_Profile (unsigned subint, unsigned pol, unsigned chan) const
 Return pointer to the specified profile.
 
void set_ephemeris (const Parameters *ephemeris, bool update=true)
 Install the given ephemeris and call update_model. More...
 
const Parametersget_ephemeris () const
 Return a pointer to the current archive ephemeris.
 
bool has_ephemeris () const
 Return true if the Archive has an ephemeris.
 
void set_model (const Predictor *model, bool apply=true)
 Install the given predictor and shift profiles to align.
 
const Predictorget_model () const
 Return a pointer to the current phase predictor.
 
bool has_model () const
 Returns true if the Archive has a model.
 
void update_model ()
 Create a new predictor and align the Integrations to the new model. More...
 
void bscrunch (unsigned nscrunch)
 Integrate pulse profiles in phase. More...
 
void fold (unsigned nfold)
 Integrate neighbouring sections of the pulse profiles. More...
 
void pscrunch ()
 Integrate profiles in polarization. More...
 
void fscrunch (unsigned nscrunch=0)
 Integrate profiles in frequency. More...
 
void tscrunch (unsigned nscrunch=0)
 Integrate profiles in time. More...
 
void rotate (double time)
 Phase rotate each profile by time seconds.
 
void rotate_phase (double phase)
 Rotate each profile by phase.
 
void append (const Archive *archive)
 Append the Integrations from the specifed archive. More...
 
void remove_chan (unsigned first, unsigned last)
 Delete the specified inclusive channel range from the Archive.
 
void update_centre_frequency ()
 Update the centre frequency.
 
void centre (double phase_offset=0.5)
 Phase rotate pulsar Integrations so that pulse phase zero is centred. More...
 
void centre_max_bin (double phase_offset=0.5)
 Phase rotate pulsar Integrations so centre the maximum amplitude. More...
 
void convert_state (Signal::State state)
 Convert data to the specified state. More...
 
Signal::Basis get_basis () const
 Convenience interface to Receiver::get_basis.
 
void dedisperse ()
 Rotate the Profiles to remove dispersion delays b/w chans. More...
 
void defaraday ()
 Correct the Faraday rotation of Q into U. More...
 
void transform (const Jones< float > &)
 Perform the transformation on each polarimetric profile.
 
void transform (const std::vector< Jones< float > > &)
 Perform frequency response on each polarimetric profile.
 
void transform (const std::vector< std::vector< Jones< float > > > &)
 Perform the time and frequency response on each polarimetric profile.
 
void invint ()
 Transform Stokes I,Q,U,V into the polarimetric invariant interval.
 
PhaseWeightbaseline () const
 Return a new PhaseWeight instance with the baseline phase bins masked.
 
void remove_baseline ()
 Remove the baseline from all profiles.
 
void uniform_weight (float new_weight=1.0)
 Set the weight of each profile to the given number.
 
bool standard_match (const Archive *arch, std::string &reason) const
 Test if arch matches (enough for a pulsar - standard match)
 
bool calibrator_match (const Archive *arch, std::string &reason) const
 Test if arch matches (enough for a pulsar - calibrator match)
 
bool processing_match (const Archive *arch, std::string &reason) const
 Test if arch matches (enough for a pulsar - pulsar match)
 
bool mixable (const Archive *arch, std::string &reason) const
 Test if arch is mixable (enough for append)
 
double weighted_frequency (unsigned ichan, unsigned start, unsigned end) const
 Computes the weighted channel frequency over an Integration interval. More...
 
void bscrunch_to_nbin (unsigned new_nbin)
 Call bscrunch with the appropriate value. More...
 
void fscrunch_to_nchan (unsigned new_nchan)
 Call fscrunch with the appropriate value. More...
 
void tscrunch_to_nsub (unsigned new_nsub)
 Call tscrunch with the appropriate value. More...
 
MJD start_time () const
 Return the MJD at the start of the first sub-integration.
 
MJD end_time () const
 Return the MJD at the end of the last sub-integration.
 
double integration_length () const
 Returns the total time integrated into all Integrations (in seconds)
 
bool type_is_cal () const
 Return true if the observation is a calibrator.
 
void find_transitions (int &hi2lo, int &lo2hi, int &buffer) const
 Find the transitions between high and low states in total intensity. More...
 
void find_peak_edges (int &rise, int &fall) const
 Find the bins in which the total intensity exceeds a threshold. More...
 
float find_max_phase () const
 Returns the centre phase of the region with maximum total intensity. More...
 
float find_min_phase (float dc=0.15) const
 Returns the centre phase of the region with minimum total intensity. More...
 
float rms_baseline (float dc=0.4)
 Returns geometric mean of baseline RMS for each Integration. More...
 
virtual Interfaceget_interface ()
 Return a text interface that can be used to access this instance.
 
void unload (const char *filename=0) const
 Write the archive to filename. More...
 
void unload (const std::string &filename) const
 Convenience interface to Archive::unload (const char*)
 
std::string get_filename () const
 Get the name of the file to which the archive will be unloaded.
 
void set_filename (const std::string &filename)
 Set the filename of the Archive. More...
 
void update ()
 Update the current archive, saving current Integration data.
 
void refresh ()
 Completely reload the archive, deleting all data.
 
virtual void resize (unsigned nsubint, unsigned npol=0, unsigned nchan=0, unsigned nbin=0)
 Resize the Integration vector with new_Integration instances. More...
 
virtual void erase (unsigned isubint)
 Remove the specified sub-integration.
 
void reverse_chan ()
 Reverse the order of frequency channels.
 
virtual unsigned get_nextension () const
 Return the number of extensions available.
 
virtual const Extensionget_extension (unsigned iextension) const
 Return a pointer to the specified extension. More...
 
virtual Extensionget_extension (unsigned iextension)
 Return a pointer to the specified extension. More...
 
template<class ExtensionType >
const ExtensionType * get () const
 Template method searches for an Extension of the specified type.
 
template<class ExtensionType >
ExtensionType * get ()
 Template method searches for an Extension of the specified type.
 
template<class ExtensionType >
ExtensionType * getadd ()
 Template method returns an Extension of the specified type.
 
virtual void add_extension (Extension *extension)
 Add an Extension to the Archive instance. More...
 
Expertexpert ()
 Provide access to the expert interface.
 
const Expertexpert () const
 The default baseline removal strategy.
 
const Matchget_standard_match () const
 Policy determines if a standard/template matches an observation.
 
void set_standard_match (Match *)
 The default baseline removal strategy.
 
const Matchget_calibrator_match () const
 Policy determines if a calibrator matches an observation.
 
void set_calibrator_match (Match *)
 The default baseline removal strategy.
 
const Matchget_processing_match () const
 Policy determines if data were processed identically.
 
void set_processing_match (Match *)
 The default baseline removal strategy.
 
const Matchget_mixable () const
 Policy determines if data can be combined/integrated.
 
void set_mixable (Match *)
 The default baseline removal strategy.
 
StrategySet * get_strategy () const
 Returns the strategy manager.
 
- Public Member Functions inherited from Pulsar::IntegrationManager
 IntegrationManager ()
 null constructor
 
 IntegrationManager (const IntegrationManager &archive)
 copy constructor
 
IntegrationManageroperator= (const IntegrationManager &archive)
 operator =
 
virtual ~IntegrationManager ()
 destructor
 
Integrationget_Integration (unsigned subint)
 Return pointer to the specified Integration. More...
 
Integrationget_last_Integration ()
 Return a pointer to the last Integration.
 
Integrationget_first_Integration ()
 Return a pointer to the first Integration.
 
const Integrationget_Integration (unsigned subint) const
 Return const pointer to the specified Integration.
 
const Integrationget_last_Integration () const
 Return a const pointer to the last Integration.
 
const Integrationget_first_Integration () const
 Return a const pointer to the first Integration.
 
template<class StrictWeakOrdering >
void sort (StrictWeakOrdering comp=temporal_order)
 Sort the Integrations according to the specified order.
 
void shuffle ()
 Randomly rearrange the sub-integrations.
 
Expertexpert ()
 Provide access to the expert interface. More...
 
- 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
 

Static Public Attributes

static bool big_endian = true
 files are big endian by default
 
- Static Public Attributes inherited from Pulsar::Archive
static Functor< void(Archive *) > remove_baseline_strategy
 The default baseline removal strategy.
 
- Static Public Attributes inherited from Pulsar::IntegrationManager
static unsigned verbose = 1
 A verbosity flag that can be set for debugging purposes.
 

Protected Member Functions

virtual void load_header (const char *filename)
 Load the header information from filename.
 
virtual Integrationload_Integration (const char *filename, unsigned subint)
 Load the specified Integration from filename, returning new instance. More...
 
bool can_unload () const
 The unload_file method is implemented.
 
virtual void unload_file (const char *filename) const
 Unload the Archive (header and Integration data) to filename.
 
virtual void set_nbin (unsigned numbins)
 Set the number of pulsar phase bins.
 
virtual void set_nchan (unsigned numchan)
 Set the number of frequency channels.
 
virtual void set_npol (unsigned numpol)
 Set the number of polarization measurements.
 
virtual void set_nsubint (unsigned nsubint)
 Set the number of sub-integrations.
 
virtual Integrationnew_Integration (const Integration *copy_this=0)
 The subints vector will point to TimerIntegrations. More...
 
void set_corrected (int code, bool done)
 set code bit in hdr.corrected
 
void set_calibrated (int code, bool done)
 set code bit in hdr.calibrated
 
void load (FILE *fptr)
 load the archive from an open file
 
void unload (FILE *fptr) const
 unload the archive to an open file
 
void hdr_load (FILE *fptr)
 load the timer header from an open file
 
virtual void backend_load (FILE *fptr)
 load the backend-specific information from an open file More...
 
void psr_load (FILE *fptr)
 load the polyco and ephemeris from an open file
 
void subint_load (FILE *fptr)
 load the sub-integrations from an open file
 
void hdr_unload (FILE *fptr) const
 unload the timer header to an open file
 
virtual void set_be_data_size ()
 set the backend data size
 
virtual void backend_unload (FILE *fptr) const
 unload the backend-specific information to an open file
 
void psr_unload (FILE *fptr) const
 unload the polyco and ephemeris from an open file
 
void subint_unload (FILE *fptr) const
 unload the sub-integrations to an open file
 
void correct_Integrations ()
 Set the state of various redundant parameters in the mini headers.
 
void unpack_extensions ()
 Unpack the Receiver and Telescope Extension classes (after loading)
 
void pack_extensions ()
 Pack the Receiver and Telescope Extension classes (before unloading)
 
void unpack (Receiver *receiver)
 Unpack the Receiver extension.
 
void pack (const Receiver *receiver)
 Pack the Receiver extension.
 
void unpack (TapeInfo *tape)
 Unpack the TapeInfo extension.
 
void pack (const TapeInfo *tape)
 Pack the TapeInfo extension.
 
void unpack (CalInfoExtension *cal)
 Unpack the CalInfoExtension.
 
- Protected Member Functions inherited from Pulsar::Archive
Integrationuse_Integration (Integration *)
 Return the given Integration ready for use.
 
void init_Integration (Integration *subint, bool check_phase=false)
 Initialize an Integration to reflect Archive attributes. More...
 
void resize_Integration (Integration *integration)
 Provide Integration::resize access to Archive-derived classes.
 
void apply_model (Integration *subint, const Predictor *old=0)
 Apply the current model to the Integration. More...
 
void update_model (unsigned old_nsubint, bool clear_model=false)
 Update the predictor model and correct the Integration set. More...
 
void update_model (const MJD &time, bool clear_model=false)
 Update the predictor to include the specifed MJD.
 
void create_updated_model (bool clear_model)
 Creates polynomials to span the Integration set. More...
 
bool good_model (const Predictor *test_model) const
 Returns true if the given model spans the Integration set. More...
 
bool zero_phase_aligned () const
 Return true if all Integration::zero_phase_aligned flags are set.
 
- Protected Member Functions inherited from Pulsar::IntegrationManager
virtual void _resize (unsigned nsubint, bool instances=true)
 Resize the Integration vector. More...
 
void append (const IntegrationManager *more_subints)
 Append new_Integration copies of Integration objects to self.
 
void manage (IntegrationManager *more_subints)
 Append use_Integration modifications of Integration objects to self.
 
void manage (Integration *integration)
 Directly append the Integration instance (no copy)
 
void insert (unsigned isubint, Integration *integration)
 Insert the Integration instance into the specified location.
 
void unmanage (const Integration *)
 Remove the Integration instance.
 
void unmanage (unsigned isubint)
 Remove the Integration at the specified index.
 
void load_all ()
 Load all sub-integrations.
 
- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 

Protected Attributes

struct timer hdr
 The original FPTM header information.
 
bool valid
 State of the TimerArchive attributes can be trusted. More...
 
double dispersion_measure
 Double-precision dispersion measure stored for runtime use.
 
double rotation_measure
 Double-precision rotation measure stored for runtime use.
 
- Protected Attributes inherited from Pulsar::Archive
std::string unload_filename
 Name of file to which the archive will be written on call to unload()
 
Reference::To< Parametersephemeris
 The pulsar ephemeris, as used by TEMPO.
 
Reference::To< Predictormodel
 The pulsar phase model, as created using TEMPO.
 
Reference::To< Expertexpert_interface
 Expert interface.
 
Reference::To< Interfacetext_interface
 Text interface.
 
Reference::To< Matchstandard_match_policy
 The pulsar ephemeris, as used by TEMPO.
 
Reference::To< Matchcalibrator_match_policy
 The pulsar ephemeris, as used by TEMPO.
 
Reference::To< Matchprocessing_match_policy
 The pulsar ephemeris, as used by TEMPO.
 
Reference::To< Matchmixable_policy
 The pulsar ephemeris, as used by TEMPO.
 

Friends

class Archive::Advocate< TimerArchive >
 

Additional Inherited Members

- Static Public Member Functions inherited from Pulsar::Archive
static Archivenew_Archive (const std::string &class_name)
 Factory returns a null-constructed instance of the named class. More...
 
static Archiveload (const std::string &name)
 Factory returns a new instance loaded from filename.
 
static unsigned get_instance_count ()
 Returns the number of Archive instances currently in existence.
 
static void agent_report ()
 Report on the status of the plugins.
 
static void agent_list ()
 List the successfully loaded plugins.
 
static void set_verbosity (unsigned level)
 Set the verbosity level (0 to 3)
 
- 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 ()
 
- Static Protected Member Functions inherited from Pulsar::Archive
static std::string get_revision (const char *revision)
 Parses the revision number out of the CVS Revision string.
 
- Static Protected Attributes inherited from Pulsar::Archive
static Option< std::string > unload_class
 Name of class to which data are converted if unload_file unimplemented.
 
static Option< bool > no_clobber
 Default policy for overwriting archive files.
 

Detailed Description

Reads and writes the timer archive file format.

Member Function Documentation

◆ backend_load()

void Pulsar::TimerArchive::backend_load ( FILE *  fptr)
protectedvirtual

load the backend-specific information from an open file

Unless this method is overloaded by the appropriate sub-class, all backend-specific information will be lost when the file is loaded.

Reimplemented in Pulsar::BasebandArchive, and Pulsar::ScintArchive.

◆ get_dispersion_measure()

double Pulsar::TimerArchive::get_dispersion_measure ( ) const
virtual

Get the dispersion measure (in ${\rm pc\, cm}^{-3}$)

Get the centre frequency of the observation.

Implements Pulsar::Archive.

◆ get_nbin()

unsigned Pulsar::TimerArchive::get_nbin ( ) const
virtual

Get the number of pulsar phase bins used.

This attribute may be set only through Archive::resize

Implements Pulsar::Archive.

◆ get_nchan()

unsigned Pulsar::TimerArchive::get_nchan ( ) const
virtual

Get the number of frequency channels used.

This attribute may be set only through Archive::resize

Implements Pulsar::Archive.

◆ get_npol()

unsigned Pulsar::TimerArchive::get_npol ( ) const
virtual

Get the number of frequency channels used.

This attribute may be set only through Archive::resize

Implements Pulsar::Archive.

◆ get_nsubint()

unsigned Pulsar::TimerArchive::get_nsubint ( ) const
virtual

Get the number of sub-integrations stored in the file.

This attribute may be set only through Archive::resize

Implements Pulsar::IntegrationManager.

◆ load_Integration()

Pulsar::Integration * Pulsar::TimerArchive::load_Integration ( const char *  filename,
unsigned  subint 
)
protectedvirtual

Load the specified Integration from filename, returning new instance.

Returns a pointer to a newly loaded TimerIntegration instance.

Implements Pulsar::Archive.

◆ new_Integration()

Pulsar::Integration * Pulsar::TimerArchive::new_Integration ( const Integration subint = 0)
protectedvirtual

The subints vector will point to TimerIntegrations.

By over-riding this funciton, inherited types may re-define the type of Integration to which the elements of the subints vector point.

Implements Pulsar::IntegrationManager.

◆ set_dispersion_measure()

void Pulsar::TimerArchive::set_dispersion_measure ( double  dm)
virtual

Set the dispersion measure (in ${\rm pc\, cm}^{-3}$)

Set the centre frequency of the observation.

Implements Pulsar::Archive.

Member Data Documentation

◆ valid

bool Pulsar::TimerArchive::valid
protected

State of the TimerArchive attributes can be trusted.

This flag is set true only when data is loaded from a file. Whenever a new TimerArchive is created in memory, the TimerArchive::correct method should be called to ensure that the state of all timer and mini header variables are properly set.

Referenced by copy().


The documentation for this class was generated from the following files:
  • TimerArchive.h
  • TimerArchive.C
  • TimerArchive_extensions.C
  • TimerArchive_load.C
  • TimerArchive_Receiver.C
  • TimerArchive_unload.C

Generated using doxygen 1.8.17