TimeFrequencySmooth.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2018 by Paul Demorest
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 #ifndef __Pulsar_TimeFrequencySmooth_h
10 #define __Pulsar_TimeFrequencySmooth_h
11 
12 #include "Pulsar/Algorithm.h"
13 #include "Pulsar/Archive.h"
14 
15 namespace Pulsar {
16 
18 
22  class TimeFrequencySmooth : public Algorithm
23  {
24 
25  public:
26 
28  static TimeFrequencySmooth* factory (const std::string& name);
29 
31  static const std::vector<TimeFrequencySmooth*>& children ();
32 
33  TimeFrequencySmooth();
34 
36 
42  virtual void smooth (std::vector<float> &smoothed,
43  std::vector<float> &raw, std::vector<float> &weight,
44  std::vector<float> &freqs, std::vector<float> &times) = 0;
45 
47  virtual TextInterface::Parser* get_interface () { return 0; }
48 
50  virtual TimeFrequencySmooth* clone () const = 0;
51 
52  protected:
53 
54  void check_dimensions (std::vector<float> &smoothed,
55  std::vector<float> &raw, std::vector<float> &weight,
56  std::vector<float> &freqs, std::vector<float> &times);
57 
59  unsigned idx(unsigned isubint, unsigned ichan) const {
60  return nchan*isubint + ichan;
61  }
62 
64  unsigned idx(unsigned isubint, unsigned ichan, unsigned ipol) const {
65  return nchan*npol*isubint + npol*ichan + ipol;
66  }
67 
68  // Current data dimensions
69  unsigned nsub;
70  unsigned nchan;
71  unsigned npol;
72 
73  private:
74  static void build ();
75  };
76 
77  std::ostream& operator<< (std::ostream&, TimeFrequencySmooth*);
78 
79  std::istream& operator>> (std::istream&, TimeFrequencySmooth*&);
80 
81 }
82 
83 #endif
virtual TextInterface::Parser * get_interface()
Return a text interface that can be used to configure this instance.
Definition: TimeFrequencySmooth.h:57
unsigned idx(unsigned isubint, unsigned ichan) const
Index into (nsub, nchan) arrays.
Definition: TimeFrequencySmooth.h:69
static const std::vector< TimeFrequencySmooth * > & children()
Returns a list of available TimeFrequencySmooth children.
Definition: TimeFrequencySmooth.C:60
static TimeFrequencySmooth * factory(const std::string &name)
Create a new instance of TimeFrequencySmooth based on name.
Definition: TimeFrequencySmooth.C:71
Smooth a statistic vs time freq.
Definition: TimeFrequencySmooth.h:27
virtual void smooth(std::vector< float > &smoothed, std::vector< float > &raw, std::vector< float > &weight, std::vector< float > &freqs, std::vector< float > &times)=0
Smooth the data given in raw, output to smoothed.
Defines the PSRCHIVE library.
Definition: CalSource.h:17
virtual TimeFrequencySmooth * clone() const =0
Derived types must also define clone method.

Generated using doxygen 1.8.17