Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Classes | Public Types | Public Member Functions | List of all members
ska::cheetah::data::DmTrialsMetadata Class Reference

Container for metadata that describes a set of dispersion measure trials. More...

#include <cheetah/data/DmTrialsMetadata.h>

Inheritance diagram for ska::cheetah::data::DmTrialsMetadata:
Inheritance graph
Collaboration diagram for ska::cheetah::data::DmTrialsMetadata:
Collaboration graph

Classes

class  Metadata
 Container for an metadata concerning a single DM trial. More...
 

Public Types

typedef DedispersionMeasureType< float > DmType
 
typedef SecondsType< double > TimeType
 

Public Member Functions

 DmTrialsMetadata (TimeType fundamental_sampling_interval, std::size_t fundamental_sample_count)
 Create a new DmTrialsMetadata instance. More...
 
void emplace_back (DmType dm, std::size_t downsampling_factor=1)
 Add a new Metadata instance containing information about a single DM trial. More...
 
ContainerType::const_reference operator[] (std::size_t n) const
 Return a const reference to a Metadata instance. More...
 
ContainerType::reference operator[] (std::size_t n)
 Return a reference to a Metadata instance. More...
 
ContainerType::iterator begin ()
 Return an iterator pointing to the first Metadata instance contained.
 
ContainerType::const_iterator begin () const
 Return an iterator pointing to the first Metadata instance contained.
 
ContainerType::const_iterator cbegin () const
 Return an const iterator pointing to the first Metadata instance contained.
 
ContainerType::iterator end ()
 Return an iterator pointing beyond the Metadata instance contained.
 
ContainerType::const_iterator end () const
 Return an iterator pointing beyond the Metadata instance contained.
 
ContainerType::const_iterator cend () const
 Return a const iterator pointing beyond the Metadata instance contained.
 
std::size_t size () const
 Return the number of Metadata instances contained.
 
bool operator== (DmTrialsMetadata const &other)
 Test if this instance is compatible with another instance. More...
 
TimeType duration () const
 Return the temporal duration of the trials. More...
 
TimeType fundamental_sampling_interval () const
 Return the fundamental_sampling_interval.
 
std::size_t total_data_size () const
 Return the total size of the data represented.
 

Detailed Description

Container for metadata that describes a set of dispersion measure trials.

The DmTrialsMetadata class is used to store information required to instantiate a DmTrials object. The emplace_back method is used to register a new DmTrial into the instance. Upon registering, the instance will update a hash value that encodes the order and number of DM values in the DmTrialsMetadata object. This hash value is used to check whether two DmTrialsMetadata objects are compatible (check via == operator.)

To generate a DmTrials object using a DmTrialsMetadata object we do the following:

//Create a new shared pointer to a DmTrialsMetadata object
auto metadata = DmTrialsMetadata::make_shared(sampling_interval,fundamental_sample_count);
//Populate with some random DM values
for (std::size_t dm_idx=0; dm_idx<ndms; ++dm_idx)
{
metadata->emplace_back(DmTrialsMetadata::DmType(dm_idx * data::parsecs_per_cube_cm), 1);
}
//Generate DmTrials object
auto trials = DmTrialsType::make_shared(metadata,epoch);

Definition at line 48 of file DmTrialsMetadata.h.

Constructor & Destructor Documentation

◆ DmTrialsMetadata()

ska::cheetah::data::DmTrialsMetadata::DmTrialsMetadata ( TimeType  fundamental_sampling_interval,
std::size_t  fundamental_sample_count 
)

Create a new DmTrialsMetadata instance.

Parameters
[in]fundamental_sampling_intervalThe fundamental sampling interval
[in]fundamental_sample_countThe fundamental sample count

The fundamental_sampling_interval and fundamental_sample_count are important, as all Metadata instances contained in this DmTrialsMetadata instances will have sampling intervals that are integer multiples of fundamental_sampling_interval and lengths that will be zero-remainder integer divisiors of fundamental_sample_count.

Definition at line 36 of file DmTrialsMetadata.cpp.

37  : _sampling_interval(fundamental_sampling_interval)
38  , _number_of_samples(fundamental_sample_count)
39  , _hash_value(0)
40 {
41  boost::hash_combine(_hash_value,_sampling_interval.value());
42 }
TimeType fundamental_sampling_interval() const
Return the fundamental_sampling_interval.

Member Function Documentation

◆ duration()

DmTrialsMetadata::TimeType ska::cheetah::data::DmTrialsMetadata::duration ( ) const

Return the temporal duration of the trials.

This is simply fundamental_sampling_interval * fundamental_sample_count

Definition at line 108 of file DmTrialsMetadata.cpp.

109 {
110  return _number_of_samples * _sampling_interval;
111 }

◆ emplace_back()

void ska::cheetah::data::DmTrialsMetadata::emplace_back ( DmType  dm,
std::size_t  downsampling_factor = 1 
)

Add a new Metadata instance containing information about a single DM trial.

Parameters
[in]dmThe dispersion measure of the trial
[in]downsampling_factorThe downsampling factor of the trial

Definition at line 49 of file DmTrialsMetadata.cpp.

50 {
51  if (_number_of_samples % downsampling_factor != 0)
52  throw panda::Error("Downsampling factor does not perfectly divide fundamental sample count.");
53  boost::hash_combine(_hash_value,dm.value());
54  boost::hash_combine(_hash_value,downsampling_factor);
55  _metadata.emplace_back(*this,dm,downsampling_factor);
56 }

◆ operator==()

bool ska::cheetah::data::DmTrialsMetadata::operator== ( DmTrialsMetadata const &  other)

Test if this instance is compatible with another instance.

Parameters
otherThe other instance against which to compare
Returns
true if compatible, false otherwise

Definition at line 103 of file DmTrialsMetadata.cpp.

104 {
105  return _hash_value == other._hash_value;
106 }

◆ operator[]() [1/2]

DmTrialsMetadata::ContainerType::const_reference ska::cheetah::data::DmTrialsMetadata::operator[] ( std::size_t  n) const

Return a const reference to a Metadata instance.

Parameters
[in]nThe index of the instance to return

Definition at line 58 of file DmTrialsMetadata.cpp.

59 {
60  return _metadata[n];
61 }

◆ operator[]() [2/2]

DmTrialsMetadata::ContainerType::reference ska::cheetah::data::DmTrialsMetadata::operator[] ( std::size_t  n)

Return a reference to a Metadata instance.

Parameters
[in]nThe index of the instance to return

Definition at line 63 of file DmTrialsMetadata.cpp.

64 {
65  return _metadata[n];
66 }

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