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

Metadata for TimeFrequency and FrequencyTime classes. More...

#include <cheetah/data/TimeFrequencyMetadata.h>

Collaboration diagram for ska::cheetah::data::TimeFrequencyMetadata:
Collaboration graph

Public Types

typedef boost::units::quantity< MegaHertz, double > FrequencyType
 
typedef boost::units::quantity< boost::units::si::time, double > TimeIntervalType
 
typedef cheetah::utils::ModifiedJulianClock::time_point TimePointType
 

Public Member Functions

 TimeFrequencyMetadata (TimeFrequencyMetadata const &copy)
 
TimeFrequencyMetadataoperator= (TimeFrequencyMetadata const &copy)
 
TimeIntervalType const & sample_interval () const
 
void sample_interval (TimeIntervalType dt)
 
std::vector< FrequencyType > const & channel_frequencies () const
 
std::pair< FrequencyType, FrequencyType > low_high_frequencies () const
 
template<class InputIterator >
void channel_frequencies (InputIterator begin, InputIterator const end)
 
void channel_frequencies_const_width (FrequencyType const &start, FrequencyType const &delta, pss::astrotypes::DimensionSize< Frequency >)
 Set the frequency index based on evenly spaced channels. More...
 
TimePointType const & start_time () const
 
TimePointType start_time (std::size_t offset) const
 
void start_time (TimePointType const &start_time)
 Set the start time of the instance. More...
 

Detailed Description

Metadata for TimeFrequency and FrequencyTime classes.

Definition at line 46 of file TimeFrequencyMetadata.h.

Member Function Documentation

◆ channel_frequencies() [1/2]

std::vector< typename TimeFrequencyMetadata::FrequencyType > const & ska::cheetah::data::TimeFrequencyMetadata::channel_frequencies ( ) const
Returns
a vector of frequencies that are represented in each time sample

Definition at line 60 of file TimeFrequencyMetadata.cpp.

61 {
62  return this->_frequency_index;
63 }

◆ channel_frequencies() [2/2]

template<class InputIterator >
void ska::cheetah::data::TimeFrequencyMetadata::channel_frequencies ( InputIterator  begin,
InputIterator const  end 
)

Set the frequency index based on arbitary channels

Definition at line 38 of file TimeFrequencyMetadata.cpp.

38  {
39  std::transform(begin,end,std::back_inserter(this->_frequency_index), convert_freq<FrequencyType, typename std::decay<decltype(*begin)>::type> );
40 }

◆ channel_frequencies_const_width()

void ska::cheetah::data::TimeFrequencyMetadata::channel_frequencies_const_width ( TimeFrequencyMetadata::FrequencyType const &  start,
TimeFrequencyMetadata::FrequencyType const &  delta,
pss::astrotypes::DimensionSize< Frequency >  number_of_channels 
)

Set the frequency index based on evenly spaced channels.

Assumes that the number_of_channels has already been set pss::astrotypes::DimensionSize<Frequency> is the number of frequency channels

Definition at line 76 of file TimeFrequencyMetadata.cpp.

79 {
80  _frequency_index.resize(number_of_channels);
81  for(unsigned i=0U; i < number_of_channels; ++i) {
82  _frequency_index[i]= start + delta * (double)i;
83  }
84 }

◆ low_high_frequencies()

std::pair< FrequencyType, FrequencyType > ska::cheetah::data::TimeFrequencyMetadata::low_high_frequencies ( ) const
Returns
returns the lowest and highest frequencies represented in channel_frequenceis

Definition at line 65 of file TimeFrequencyMetadata.cpp.

66 {
67  if(_frequency_index.empty())
68  return std::pair<FrequencyType, FrequencyType>(FrequencyType(0.0 * hz) , FrequencyType(0.0 * hz) );
69  if(this->_frequency_index[0] > this->_frequency_index.back()) {
70  return std::make_pair(_frequency_index.back(), _frequency_index.front());
71  } else {
72  return std::make_pair(_frequency_index[0], _frequency_index.back());
73  }
74 }

◆ sample_interval() [1/2]

TimeFrequencyMetadata::TimeIntervalType const & ska::cheetah::data::TimeFrequencyMetadata::sample_interval ( ) const
Returns
the sample interval in seconds

Definition at line 50 of file TimeFrequencyMetadata.cpp.

51 {
52  return _sample_interval;
53 }

◆ sample_interval() [2/2]

void ska::cheetah::data::TimeFrequencyMetadata::sample_interval ( TimeFrequencyMetadata::TimeIntervalType  dt)

the sample interval in seconds

Definition at line 55 of file TimeFrequencyMetadata.cpp.

56 {
57  this->_sample_interval = dt;
58 }

◆ start_time() [1/3]

TimeFrequencyMetadata::TimePointType const & ska::cheetah::data::TimeFrequencyMetadata::start_time ( ) const
Returns
the absolute time the first time sample corresponds to.

Definition at line 86 of file TimeFrequencyMetadata.cpp.

87 {
88  return this->_start_time;
89 }

◆ start_time() [2/3]

TimeFrequencyMetadata::TimePointType ska::cheetah::data::TimeFrequencyMetadata::start_time ( std::size_t  offset) const
Returns
the absolute time the Nth time sample corresponds to.

Definition at line 91 of file TimeFrequencyMetadata.cpp.

92 {
93  return this->_start_time + std::chrono::duration<double>(sample_interval().value() * offset);
94 }
TimeIntervalType const & sample_interval() const
Here is the call graph for this function:

◆ start_time() [3/3]

void ska::cheetah::data::TimeFrequencyMetadata::start_time ( TimePointType const &  start_time)

Set the start time of the instance.

Parameters
start_timeThe start time (MJD) of the instance

Definition at line 96 of file TimeFrequencyMetadata.cpp.

97 {
98  this->_start_time = start_time;
99 }
Here is the call graph for this function:

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