Pulsar Observation Database. More...

#include <Database.h>

Inheritance diagram for Pulsar::Database:
Reference::Able Reference::HeapTracked

Classes

class  Criteria
 Describes Database matching criteria. More...
 
class  Entry
 Pulsar Database Entry. More...
 

Public Types

enum  Sequence { Any, CalibratorBefore, CalibratorAfter }
 Calibrator matching sequence. More...
 

Public Member Functions

 Database ()
 Null constructor.
 
 Database (const std::string &path, const std::string &metafile)
 Construct a database from archives in a metafile.
 
 Database (const std::string &path, const std::vector< std::string > &exts)
 Construct a database from archives in a directory. More...
 
 Database (const std::string &filename)
 Construct a database from a pre-built ascii file.
 
 ~Database ()
 Destructor.
 
void merge (const Database *)
 Merge with another database.
 
void construct (const std::vector< std::string > &filenames)
 Construct from the list of filenames.
 
void unload (const std::string &dbase_filename)
 Write a text file representing the database to disk for storage. More...
 
void load (const std::string &dbase_filename)
 Read a text file summary and construct a database. More...
 
void add (const Pulsar::Archive *archive)
 Add the given Archive to the database.
 
PolnCalibratorgeneratePolnCalibrator (Archive *, const Calibrator::Type *m)
 Return a pointer to a new PolnCalibrator for the given archive. More...
 
FluxCalibratorgenerateFluxCalibrator (Archive *, bool allow_raw=false)
 Return a pointer to a new FluxCalibrator for the given archive. More...
 
HybridCalibratorgenerateHybridCalibrator (ReferenceCalibrator *, Archive *)
 Return a pointer to a new HybridCalibrator.
 
void set_feed (MEAL::Complex2 *xform)
 Set the feed transformation to be incorporated into PolnCalibrator.
 
std::string get_path () const
 Returns the full path to the database summary file. More...
 
unsigned size () const
 Returns the number of entries in the database.
 
const Entrybest_match (const Criteria &) const
 Returns the best Entry that matches the given Criteria.
 
void all_matching (const Criteria &, std::vector< const Entry * > &matches) const
 Fills a vector with Entry instances that match the given Criteria.
 
Criteria criteria (const Pulsar::Archive *arch, Signal::Source obsType) const
 Return the Criteria for the specified Pulsar::Archive.
 
Criteria criteria (const Pulsar::Archive *archive, const Calibrator::Type *calType) const
 Return the Criteria for the specified Pulsar::Archive. More...
 
std::string get_filename (const Entry *) const
 Returns the full pathname of the Entry filename.
 
void add (Entry *entry)
 Add the given entry to the database. More...
 
void shorten_filename (Entry *entry)
 Remove the preceding path from the Entry filename, if applicable.
 
void expand_filename (Entry *entry)
 Add path to Entry filename, if applicable.
 
std::string get_closest_match_report () const
 Get the closest match report.
 
- 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 Member Functions

static Criteria get_default_criteria ()
 Get the default matching criteria for all observations. More...
 
static void set_default_criteria (const Criteria &)
 Set the default matching criteria for all observations.
 
- 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 Public Attributes

static bool cache_last_cal = true
 Cache the last calibrator?
 
static bool match_verbose = false
 Print verbose matching information.
 
static Option< double > long_time_scale
 Time scale over which calibrator flux and cross-coupling remain stable. More...
 
static Option< double > short_time_scale
 Time scale over which differential gain and phase remain stable. More...
 
static Option< double > max_angular_separation
 Maximum angular separation between calibrator and pulsar. More...
 
static Option< double > max_centre_frequency_difference
 Maximum difference between calibrator and pulsar centre frequencies. More...
 
static Option< double > max_bandwidth_difference
 Maximum difference between calibrator and pulsar bandwidths. More...
 
static const Pulsar::Archiveany = 0
 Pass this to the criteria methods to retrieve any or all matches. More...
 

Protected Member Functions

FluxCalibratorrawFluxCalibrator (Archive *a)
 Return a pointer to a new FluxCalibrator for the given archive.
 
- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 

Protected Attributes

std::vector< Reference::To< Entry > > entries
 
std::string path
 
Cache< PolnCalibratorlastPolnCal
 
Cache< HybridCalibratorlastHybridCal
 
Cache< FluxCalibratorlastFluxCal
 
Reference::To< MEAL::Complex2feed
 If set, this model of the feed is incorporated into all solutions.
 
Criteria closest_match
 The criteria that last came closest to matching.
 

Detailed Description

Pulsar Observation Database.

Member Enumeration Documentation

◆ Sequence

Calibrator matching sequence.

Different level-setting strategies may dictate the policy for matching an observation with the right calibrator

Enumerator
Any 

Use the nearest calibrator (default)

CalibratorBefore 

Use only calibrators recorded before the observation.

CalibratorAfter 

Use only calibrators recorded after the observation.

Constructor & Destructor Documentation

◆ Database()

Database::Database ( const std::string &  path,
const std::vector< std::string > &  exts 
)

Construct a database from archives in a directory.

This constructor scans the given directory for calibrator files ending in the extensions specified in the second argument.

References construct(), and Pulsar::Calibrator::verbose.

Member Function Documentation

◆ add()

void Database::add ( Entry entry)

Add the given entry to the database.

Add the given Archive to the database.

References get_filename().

◆ criteria()

Database::Criteria Database::criteria ( const Pulsar::Archive archive,
const Calibrator::Type calType 
) const

◆ generateFluxCalibrator()

Pulsar::FluxCalibrator * Database::generateFluxCalibrator ( Archive arch,
bool  allow_raw = false 
)

Return a pointer to a new FluxCalibrator for the given archive.

This routine is given a pointer to a Pulsar::Archive. It scans the database for all FluxCal observations that were made within one month of the observation mid-time and uses these to construct a Pulsar::FluxCalibrator class which can then be used to perform a flux calibration of the original pulsar observation.

References best_match(), cache_last_cal, criteria(), get_filename(), Pulsar::Archive::load(), Reference::To< class, active >::release(), and Pulsar::Calibrator::verbose.

◆ generatePolnCalibrator()

Pulsar::PolnCalibrator * Database::generatePolnCalibrator ( Archive arch,
const Calibrator::Type type 
)

Return a pointer to a new PolnCalibrator for the given archive.

This routine is given a pointer to a Pulsar::Archive. It scans the database for all PolnCal observations from the same part of sky that were made within 8 hours of the observation mid-time and uses these to construct a Pulsar::PolnCalibrator class which can then be used to perform a polarisation calibration of the original pulsar observation.

References Pulsar::Database::Criteria::best(), best_match(), cache_last_cal, Signal::Calibrator, criteria(), Pulsar::ReferenceCalibrator::factory(), feed, generateHybridCalibrator(), get_closest_match_report(), get_filename(), Pulsar::Archive::load(), Signal::PolnCal, Reference::To< class, active >::release(), Signal::Unknown, and Pulsar::Calibrator::verbose.

◆ get_default_criteria()

Database::Criteria Database::get_default_criteria ( )
static

Get the default matching criteria for all observations.

Get the default matching criteria for PolnCal observations.

Referenced by criteria().

◆ get_path()

string Database::get_path ( ) const

Returns the full path to the database summary file.

Returns the full pathname of the Entry filename.

◆ load()

void Database::load ( const std::string &  dbase_filename)

Read a text file summary and construct a database.

Loads an entire database from a file.

References add(), expand_filename(), and Pulsar::Calibrator::verbose.

Referenced by Database().

◆ unload()

void Database::unload ( const std::string &  dbase_filename)

Write a text file representing the database to disk for storage.

Unloads entire database to file.

References shorten_filename().

Member Data Documentation

◆ any

const Pulsar::Archive * Database::any = 0
static

Pass this to the criteria methods to retrieve any or all matches.

This null parameter is intended only to improve code readability

◆ long_time_scale

Pulsar::Option< double > Database::long_time_scale
static

Time scale over which calibrator flux and cross-coupling remain stable.

By default, the long time scale is set to four weeks.

Referenced by criteria().

◆ max_angular_separation

Pulsar::Option< double > Database::max_angular_separation
static

Maximum angular separation between calibrator and pulsar.

By default, the maximum angular separation is 5 degrees

Referenced by Pulsar::Database::Criteria::Criteria().

◆ max_bandwidth_difference

Pulsar::Option< double > Database::max_bandwidth_difference
static

Maximum difference between calibrator and pulsar bandwidths.

By default, the maximum bandwidth difference is 1 Hz

◆ max_centre_frequency_difference

Pulsar::Option< double > Database::max_centre_frequency_difference
static

Maximum difference between calibrator and pulsar centre frequencies.

By default, the maximum centre frequency difference is 1 Hz

◆ short_time_scale

Pulsar::Option< double > Database::short_time_scale
static

Time scale over which differential gain and phase remain stable.

By default, the short time scale is set to two hours.

Referenced by Pulsar::Database::Criteria::Criteria(), and criteria().


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

Generated using doxygen 1.8.17