TestInput.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2003 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Kernel/Classes/dsp/TestInput.h
10 
11 #ifndef __TestInput_h
12 #define __TestInput_h
13 
14 #include "environ.h"
15 
16 namespace dsp {
17 
18  class BitSeries;
19  class Input;
20 
22 
25  class TestInput {
26 
27  public:
28 
29  static bool verbose;
30 
32  TestInput ();
33 
35  ~TestInput ();
36 
38  void runtest (Input* input_a, Input* input_b);
39 
41  unsigned get_errors () const { return errors; }
42 
44  uint64_t get_block_size () const { return block_size; }
46  void set_block_size (uint64_t _size) { block_size = _size; }
47 
48  protected:
49 
51  uint64_t block_size;
52 
54  unsigned errors;
55 
56  };
57 
58 }
59 
60 #endif // !defined(__TestInput_h)
const ScalarMath exp(const ScalarMath &x)
virtual void open(const std::string &id)
Prepare the appropriate Input and Unpacker.
Definition: IOManager.C:38
virtual void set_nchan(unsigned nchan)
Set the number of channels into which the data will be divided.
Definition: OptimalFFT.C:24
unsigned get_resolution() const
Get the time sample resolution of the data source.
Definition: Input.h:125
virtual void prepare()
Prepare to fold the input TimeSeries.
Definition: Fold.C:110
virtual void match(const Response *response)
Match the frequency response to another Response.
Definition: Response.C:237
const Observation * get_info() const override
Get the Observation attributes that describe the source.
Definition: InputSource.h:49
void set_nbin(unsigned _nbin)
Set the number of phase bins into which data will be folded.
Definition: Fold.h:82
Produces TimeSeries data by integrating an Input with an Unpacker.
Definition: IOManager.h:26
void add_response(Response *response)
Add a response to the product.
Definition: ResponseProduct.C:47
Pure virtual base class of all objects that can load BitSeries data.
Definition: Input.h:31
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
Detects phase-coherent TimeSeries data.
Definition: Detection.h:38
static File * create(const char *filename)
Return a pointer to a new instance of the appropriate sub-class.
Definition: File.C:67
static bool verbose
Verbosity flag.
Definition: Observation.h:39
void set_type(const std::string &)
Set the type of window function by name.
Definition: Apodization.C:34
const ScalarMath erf(const ScalarMath &x)
Serves data from a number of MPIRoot instances.
Definition: MPIServer.h:24
Data as a function of pulse phase.
Definition: PhaseSeries.h:28
virtual void check(float min=-10.0, float max=10.0)
Check that each floating point value is roughly as expected.
Definition: TimeSeries.C:657
Signal::State get_state() const
Return the state of the signal.
Definition: Observation.h:70
unsigned errors
The number of errors in runtest.
Definition: TestInput.h:59
static bool verbose
void set(Pulsar::Archive *archive, const PhaseSeries *phase)
Set the Pulsar::Archive with the PhaseSeries data.
Definition: Archiver.C:477
void build()
Build the specified window.
Definition: Apodization.C:44
Chooses the optimal FFT length for Filterbank and/or Convolution.
Definition: OptimalFFT.h:24
void dump(const std::string &filename)
Write the window to a text file.
Definition: Apodization.C:208
Describes a frequency (or impulse) response.
Definition: Response.h:34
virtual void load(TimeSeries *data)
Load and convert the next block of data.
Definition: UnpackerSource.h:254
static void set_verbosity(unsigned level)
uint64_t get_ndat() const
Return the number of time samples in container.
Definition: Observation.h:107
Fold TimeSeries data into phase-averaged profile(s)
Definition: Fold.h:34
const ScalarMath sqrt(const ScalarMath &x)
void serve()
Serve the data from the managed MPIRoot instances.
Definition: MPIServer.C:28
void set_simultaneous(bool flag)
Set true when convolution is performed during filterbank synthesis.
Definition: OptimalFFT.C:30
static bool record_time
Global flag enables stopwatch to record the time spent operating.
Definition: Operation.h:42
Loads BitSeries data using the MPI communications protocol.
Definition: MPIRoot.h:21
virtual void set_dispersion_measure(double dm)
Set the pulsar dispersion mesure.
Definition: Observation.h:202
std::string get_name() const
Return the unique name of this operation.
Definition: Operation.h:95
virtual void open(const char *filename)
Open the file.
Definition: File.C:120
void set_folding_period(double folding_period)
Set the period at which to fold data for all sources.
Definition: Fold.C:413
Mask samples in the input TimeSeries that are spanned by time intervals.
Definition: MaskTimes.h:24
Container of weighted time-major order floating point data.
Definition: WeightedTimeSeries.h:26
Stores information about digital, band-limited, time-varying signals.
Definition: Observation.h:33
virtual void set_source(const std::string &name)
Set the source name.
Definition: Observation.h:120
virtual void set_output(BitSeries *data)
Set the BitSeries to which data will be loaded.
Definition: Input.C:203
bool is_valid(const char *filename) const
Returns true if filename appears to name a valid Spigot file.
Definition: SpigotFile.C:35
void match(const Observation *input, unsigned nchan)
Create a product to match the input.
Definition: ResponseProduct.C:23
virtual bool operate()
Call this method to operate on data Returns false on failure.
Definition: Operation.C:90
TestInput()
Constructor.
Definition: TestInput.C:16
virtual bool eod() const =0
End of data.
Arrays of consecutive samples for each polarization and frequency channel.
Definition: TimeSeries.h:29
void zero()
Reset all phase bin totals to zero.
Definition: PhaseSeries.C:268
unsigned get_errors() const
Get the number of errors encountered during runtest.
Definition: TestInput.h:46
unsigned get_ndat() const
Get the number of datum in each of the nchan*npol divisions.
Definition: Shape.h:58
A class used for testing in both test_Input.C and test_MPIRoot.C.
Definition: TestInput.h:30
void runtest(Input *input_a, Input *input_b)
Run test using two Input instances that refer to the same data.
Definition: TestInput.C:27
~TestInput()
Destructor.
Definition: TestInput.C:22
bool get_detected() const
Returns true if state is Detected, Coherence, or Stokes.
Definition: Observation.C:144
std::string get_source() const
Return the source name.
Definition: Observation.h:122
unsigned get_nfft(unsigned nfilt) const
Definition: OptimalFFT.C:80
static bool verbose
Global verbosity flag.
Definition: Operation.h:48
A container for storing digitized (generally not floating point) data
Definition: BitSeries.h:35
uint64_t block_size
The number of time samples to load on each load_block.
Definition: TestInput.h:56
void set_size(unsigned)
Set the number of samples in the window.
Definition: Apodization.C:29
bool verbose
static bool complete_abort
Class to unload PhaseSeries data in a Pulsar::Archive.
Definition: Archiver.h:43
void set_block_size(uint64_t _size)
Set the number of time samples to load on each load_block.
Definition: TestInput.h:51
void set_output(Out *output)
Set the container into which output data will be written.
Definition: Transformation.h:275
unsigned get_nchan() const
Get the number of frequency channels.
Definition: Shape.h:55
Loads BitSeries data from a Spigot data file.
Definition: SpigotFile.h:25
void detect(Profile *input)
void set_input(const TimeSeries *input)
Overload Transformation::set_input to set weighted_input.
Definition: Fold.C:486
Various apodizing (window) functions.
Definition: Apodization.h:28
uint64_t get_block_size() const
Return the number of time samples to load on each load_block.
Definition: TestInput.h:49
void load(const std::string &filename)
Load intervals to be masked from file.
Definition: MaskTimes.C:65
const Pulsar::Parameters * get_pulsar_ephemeris() const
Get the ephemeris used to create the phase model.
Definition: Fold.C:481
const InputType * get_input() const
Return pointer to the appropriate InputType.
Definition: UnpackerSource.h:77
Represents a product of Response instances.
Definition: ResponseProduct.h:33
void manage(MPIRoot *root)
Manage the MPIRoot instance.
Definition: MPIServer.C:22
static unsigned verbose
Verbose flag.
Definition: Archiver.h:48
const UnpackerType * get_unpacker() const
Return pointer to the appropriate UnpackerType.
Definition: UnpackerSource.h:242
Phase-coherent dispersion removal frequency response function.
Definition: Dedispersion.h:25
virtual void set_block_size(uint64_t _size)
Set the number of time samples to load on each load_block.
Definition: Input.C:399
virtual void set_dispersion_measure(double dm)
double get_total_time() const
Return the total time spent on this Operation in seconds.
Definition: Operation.C:115
unsigned nthread
An iterator that strides non-contiguous blocks of data.
Definition: BlockIterator.h:16
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