LoadToQuantize.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2024 by Andrew Jameson and Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Signal/General/dsp/LoadToQuantize.h
10 
11 #ifndef __dsp_LoadToQuantize_h
12 #define __dsp_LoadToQuantize_h
13 
14 #include "dsp/BitSeries.h"
15 #include "dsp/ChanPolSelect.h"
16 #include "dsp/GenericVoltageDigitizer.h"
17 #include "dsp/Rescale.h"
18 #include "dsp/SingleThread.h"
19 #include "dsp/Sink.h"
20 
21 namespace dsp {
22 
24 
25  class LoadToQuantize : public SingleThread
26  {
27 
28  public:
29 
31  class Config;
32 
34  void set_configuration(Config*);
35 
37  LoadToQuantize(Sink<BitSeries>* sink, Config* config = 0);
38 
40  void construct() override;
41 
43  void prepare() override;
44 
46  void finish() override;
47 
48  private:
49 
51  friend class LoadToQuantizeN;
52 
54  Reference::To<Config> config;
55 
57  Reference::To<ChanPolSelect> chanpolselect;
58 
60  Reference::To<Rescale> rescale;
61 
64 
66  Reference::To<BitSeries> quantized;
67 
69  Sink<BitSeries>* output;
70 
72  unsigned output_npol = 0;
73 
75  unsigned output_nchan = 0;
76 
78  unsigned output_nbit = 0;
79 
80  };
81 
84  {
85  public:
86 
87  // Sets default values
88  Config() = default;
89 
90  Config(const std::string& _channel_range, const std::string& _pol_range, unsigned _output_nbit)
91  {
92  channel_range = _channel_range;
93  pol_range = _pol_range;
94  output_nbit = _output_nbit;
95  }
96 
98  void add_options(CommandLine::Menu&) override;
99 
101  std::pair<uint32_t, uint32_t> parse_range(const std::string &range, uint32_t max_range);
102 
104  unsigned output_nbit = 8;
105 
107  std::string channel_range;
108 
110  std::string pol_range;
111 
112  };
113 
114 } // namespace dsp
115 
116 #endif // !defined(__dsp_LoadToQuantize_h)
std::string channel_range
Output channel range (inclusive) to select with format first:last.
Definition: LoadToQuantize.h:112
LoadToQuantize(Sink< BitSeries > *sink, Config *config=0)
Default constructor with optional configuration parameters.
Definition: LoadToQuantize.C:15
void set_number_of_channels_to_keep(unsigned nchan)
set the number_of_channels_to_keep
Definition: ChanPolSelect.C:34
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
void set_input(const In *input)
Set the container from which input data will be read.
Definition: Transformation.h:258
unsigned get_ndim() const
Return the dimension of each datum.
Definition: Observation.h:80
void add_options(CommandLine::Menu &) override
Add command line options.
Definition: LoadToQuantize.C:108
Rescale all channels and polaristions indepdenently to a zero mean and unit variance.
Definition: Rescale.h:29
void set_nbit(int) override
Get the number of bits per sample (FITS BITPIX convention)
Definition: GenericVoltageDigitizer.C:17
void set_start_channel_index(unsigned channel_index)
set the start_channel_index
Definition: ChanPolSelect.C:22
Per-thread configuration options.
Definition: SingleThread.h:185
void construct() override
Create the pipeline.
Definition: LoadToQuantize.C:32
unsigned get_npol() const
Return the number of polarizations.
Definition: Observation.h:90
Stores information about digital, band-limited, time-varying signals.
Definition: Observation.h:33
void set_number_of_polarizations_to_keep(unsigned npol)
set the number_of_polarizations_to_keep
Definition: ChanPolSelect.C:58
void set_start_polarization_index(unsigned polarization_index)
set the start_polarization_index
Definition: ChanPolSelect.C:46
void finish() override
Finish after run.
Definition: LoadToQuantize.C:173
static bool verbose
Global verbosity flag.
Definition: Operation.h:48
A container for storing digitized (generally not floating point) data
Definition: BitSeries.h:35
virtual void add(Item *)
std::pair< uint32_t, uint32_t > parse_range(const std::string &range, uint32_t max_range)
parse a command line string of form a:b into a pair of integers
Definition: LoadToQuantize.C:127
void set_configuration(Config *)
Set the configuration parameters.
Definition: LoadToQuantize.C:26
void set_output(Out *output)
Set the container into which output data will be written.
Definition: Transformation.h:275
friend class LoadToQuantizeN
If we decide to implement a multi-threaded pipeline ...
Definition: LoadToQuantize.h:61
Digitizer that converts FTP or TFP ordered TimeSeries to TFP-ordered, Twos Complement BitSeries.
Definition: GenericVoltageDigitizer.h:24
unsigned output_nbit
Number of bits per sample in output.
Definition: LoadToQuantize.h:109
std::string pol_range
Output polarisation range (inclusive) to select with format first:last.
Definition: LoadToQuantize.h:115
void prepare() override
Prepare before run.
Definition: LoadToQuantize.C:162
LoadToQuantize configuration.
Definition: LoadToQuantize.h:88
ChanPolSelect Transformation that selects the specified, contiguous channels and polarisations from t...
Definition: ChanPolSelect.h:29
unsigned get_nchan() const
Return the number of channels into which the band is divided.
Definition: Observation.h:85

Generated using doxygen 1.8.17