30 namespace astrotypes {
33 static const SigProcLabel telescope_id_label(
"telescope_id");
34 static const SigProcLabel machine_id_label(
"machine_id");
35 static const SigProcLabel data_type_label(
"data_type");
36 static const SigProcLabel raw_data_file_label(
"raw_data_file");
37 static const SigProcLabel source_name_label(
"source_name");
38 static const SigProcLabel barycentric_label(
"barycentric");
39 static const SigProcLabel pulsarcentric_label(
"pulsarcentric");
40 static const SigProcLabel az_start_label(
"az_start");
41 static const SigProcLabel za_start_label(
"za_start");
42 static const SigProcLabel src_raj_label(
"src_raj");
43 static const SigProcLabel src_dej_label(
"src_dej");
44 static const SigProcLabel tsamp_label(
"tsamp");
45 static const SigProcLabel tstart_label(
"tstart");
46 static const SigProcLabel nbits_label(
"nbits");
47 static const SigProcLabel nsamples_label(
"nsamples");
48 static const SigProcLabel fch1_label(
"fch1");
49 static const SigProcLabel foff_label(
"foff");
50 static const SigProcLabel fchannel_label(
"fchannel");
51 static const SigProcLabel fchannel_start_label(
"FREQUENCY_START");
52 static const SigProcLabel fchannel_end_label(
"FREQUENCY_END");
53 static const SigProcLabel nchans_label(
"nchans");
54 static const SigProcLabel nifs_label(
"nifs");
55 static const SigProcLabel refdm_label(
"refdm");
56 static const SigProcLabel period_label(
"period");
58 static const SigProcLabel ibeam_label(
"ibeam");
59 static const SigProcLabel nbeams_label(
"nbeams");
62 : _telescope_id(telescope_id_label, *this)
63 , _machine_id(machine_id_label, *this)
64 , _data_type(data_type_label, *this)
65 , _raw_data_file(raw_data_file_label, *this)
66 , _source_name(source_name_label, *this)
67 , _barycentric(barycentric_label, *this)
68 , _pulsarcentric(pulsarcentric_label, *this)
69 , _az_start(az_start_label, *this)
70 , _za_start(za_start_label, *this)
71 , _src_raj(src_raj_label, *this)
72 , _src_dej(src_dej_label, *this)
73 , _tsamp(tsamp_label, *this)
74 , _tstart(tstart_label, *this, _tsamp)
75 , _n_bits(nbits_label, *this)
76 , _nsamples(nsamples_label, *this)
77 , _fch1(fch1_label, *this)
78 , _foff(foff_label, *this)
79 , _freq_channels(fchannel_start_label, fchannel_label, fchannel_end_label, *this)
80 , _n_chans(nchans_label, *this)
81 , _nifs(nifs_label, *this)
82 , _refdm(refdm_label, *this)
83 , _period(period_label, *this)
84 , _ibeam(ibeam_label, *this)
85 , _nbeams(nbeams_label, *this)
91 , _telescope_id(telescope_id_label, *this, h._telescope_id)
92 , _machine_id(machine_id_label, *this, h._machine_id)
93 , _data_type(data_type_label, *this, h._data_type)
94 , _raw_data_file(raw_data_file_label, *this, h._raw_data_file)
95 , _source_name(source_name_label, *this, h._source_name)
96 , _barycentric(barycentric_label, *this, h._barycentric)
97 , _pulsarcentric(pulsarcentric_label, *this, h._pulsarcentric)
98 , _az_start(az_start_label, *this, h._az_start)
99 , _za_start(za_start_label, *this, h._za_start)
100 , _src_raj(src_raj_label, *this, h._src_raj)
101 , _src_dej(src_dej_label, *this, h._src_dej)
102 , _tsamp(tsamp_label, *this, h._tsamp)
103 , _tstart(tstart_label, *this, _tsamp, h._tstart)
104 , _n_bits(nbits_label, *this, h._n_bits)
105 , _nsamples(nsamples_label, *this, h._nsamples)
106 , _fch1(fch1_label, *this, h._fch1)
107 , _foff(foff_label, *this, h._foff)
108 , _freq_channels(fchannel_start_label, fchannel_label, fchannel_end_label, *this, h._freq_channels)
109 , _n_chans(nchans_label, *this, h._n_chans)
110 , _nifs(nifs_label, *this, h._nifs)
111 , _refdm(refdm_label, *this, h._refdm)
112 , _period(period_label, *this, h._period)
113 , _ibeam(ibeam_label, *this, h._ibeam)
114 , _nbeams(nbeams_label, *this, h._nbeams)
123 template<
typename T,
typename Alloc>
124 Header::OStreamAdapter<astrotypes::TimeFrequency<T, Alloc>> Header::operator<<(astrotypes::TimeFrequency<T, Alloc>
const& data)
126 _n_bits =
sizeof(T) * 8;
127 _n_chans = data.template size<units::Frequency>();
128 return OStreamAdapter<astrotypes::TimeFrequency<T, Alloc>>(*
this, data);
132 Header::OStreamAdapter<T>::OStreamAdapter(
Header const& h, T
const& data)
149 return _telescope_id;
169 return _raw_data_file;
184 throw std::runtime_error(
"unknown datatype in sigproc");
195 _data_type =
static_cast<unsigned>(type);
202 if(_data_type.
is_set())
return static_cast<DataType>((
int)_data_type);
208 _raw_data_file = filename;
233 return _pulsarcentric;
273 if(_tsamp.
is_set())
return _tsamp;
274 return boost::units::quantity<units::Seconds, double>(0.0 * units::seconds);
287 inline void Header::fch1(boost::units::quantity<units::MegaHertz, double>
const& f)
297 inline void Header::foff(boost::units::quantity<units::MegaHertz, double>
const& f)
304 return *_freq_channels;
345 _n_chans =
static_cast<std::size_t
>(n);
350 if(_n_bits.
is_set())
return _n_bits;
376 if(_nifs)
return _nifs;
393 os << Info() << *
this;
396 template<
typename Stream>
397 inline Header::InfoSentry<Stream>
operator<<(Stream& os, Header::Info
const& adapter)
399 return adapter.sentry(os);
boost::units::quantity< DispersionMeasureUnit, T > DispersionMeasure
Header::InfoSentry< Stream > operator<<(Stream &os, Header::Info const &adapter)
ModifiedJulianClock::time_point ModifiedJulianDate