Passband.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 // psrchive/Base/Extensions/Pulsar/Passband.h
10 
11 #ifndef __Pulsar_Passband_h
12 #define __Pulsar_Passband_h
13 
14 #include "Pulsar/ArchiveExtension.h"
15 
16 namespace Pulsar {
17 
19 
20  class Passband : public Pulsar::Archive::Extension {
21 
22  public:
23 
26 
28  Passband (const Passband& extension);
29 
31  const Passband& operator= (const Passband& extension);
32 
34  ~Passband ();
35 
37  Passband* clone () const { return new Passband( *this ); }
38 
41  class Interface;
42 
43  std::string get_short_name () const { return "band"; }
44 
46  unsigned get_nchan () const;
47 
49  unsigned get_npol () const;
50 
52  unsigned get_nband () const;
53 
55  bool has_data () const;
56 
58  void resize (unsigned nchan, unsigned npol, unsigned nband=1);
59 
61  const std::vector<float>&
62  get_passband (unsigned ipol, unsigned iband=0) const;
63 
65  void set_passband (const std::vector<float>&,
66  unsigned ipol, unsigned iband=0);
67 
69  void set_passband (const float* data, unsigned ipol, unsigned iband=0);
70 
72  void zero ();
73 
74  protected:
75 
77  unsigned nchan;
78 
80 
81  unsigned npol;
82 
84 
86  unsigned nband;
87 
89 
91  std::vector< std::vector<float> > passband;
92 
94  void range_check (unsigned ipol, unsigned iband, const char* method) const;
95 
96  };
97 
98 }
99 
100 #endif
void add(T(P::*get)() const, const char *name, const char *description=0)
void zero()
Set all passband datum (not dimensions) to zero.
Definition: Passband.C:86
~Passband()
Destructor.
Definition: Passband.C:42
Passband()
Default constructor.
Definition: Passband.C:14
static bool verbose
Instrumental passband (or bandpass)
Definition: Passband.h:25
unsigned nband
Number of frequency bands.
Definition: Passband.h:96
void set_passband(const std::vector< float > &, unsigned ipol, unsigned iband=0)
Set the specified passband.
Definition: Passband.C:102
static Archive * load(const std::string &name)
Factory returns a new instance loaded from filename.
Definition: Archive_load.C:28
virtual void set_instance(C *c)
static void set_verbosity(unsigned level)
Set the verbosity level (0 to 3)
Definition: Archive_verbose.C:19
const ScalarMath sqrt(const ScalarMath &x)
void range_check(unsigned ipol, unsigned iband, const char *method) const
Throw an exception if ipol or iband are out of range.
Definition: Passband.C:129
unsigned get_nchan() const
Get the number of frequency channels in each passband.
Definition: Passband.C:47
void shift(unsigned npts, float *arr, double shift)
const std::vector< float > & get_passband(unsigned ipol, unsigned iband=0) const
Get the specified passband.
Definition: Passband.C:95
Plots a single pulse profile.
Definition: ProfilePlot.h:26
TextInterface::Parser * get_interface()
Return a text interfaces that can be used to access this instance.
Definition: Passband.C:165
std::vector< std::vector< float > > passband
Average passbands.
Definition: Passband.h:101
unsigned get_nband() const
Get the number of bands.
Definition: Passband.C:59
bool has_data() const
Return true if nchan * npol * nband != 0.
Definition: Passband.C:64
void resize(unsigned nchan, unsigned npol, unsigned nband=1)
Set the number of channels, polarizations, and bands.
Definition: Passband.C:70
std::string get_short_name() const
Return an abbreviated name that can be typed relatively quickly.
Definition: Passband.h:53
bool verbose
Definition: timer++.C:25
Passband * clone() const
Clone method.
Definition: Passband.h:47
unsigned npol
Number of polarizations.
Definition: Passband.h:91
unsigned get_npol() const
Get the number of polarizations.
Definition: Passband.C:53
Definition: ArchiveExtension.h:28
Defines the PSRCHIVE library.
Definition: CalSource.h:17
unsigned nchan
Number of frequency channels.
Definition: Passband.h:87
const Passband & operator=(const Passband &extension)
Operator =.
Definition: Passband.C:31

Generated using doxygen 1.8.17