FZoom.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2015 by Matthew Kerr
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 #ifndef __FZoom_h
10 #define __FZoom_h
11 
12 #include "dsp/Transformation.h"
13 #include "dsp/TimeSeries.h"
14 
15 namespace dsp {
16 
18  class FZoom : public Transformation <TimeSeries, TimeSeries>
19  {
20 
21  public:
22 
23  FZoom ();
24 
25  void set_centre_frequency ( double freq );
26  void set_bandwidth ( double bw );
27 
28  double get_centre_frequency ( ) const;
29  double get_bandwidth ( ) const;
30 
32  static void set_channel_bounds(const Observation* input,
33  double centre_frequency, double bandwidth,
34  unsigned* chan_lo, unsigned* chan_hi);
35 
36  class Engine;
37 
38  void set_engine (Engine*);
39 
40  protected:
41 
43  void set_bounds ();
44 
46  void prepare () ;
47 
49  void transformation ();
50 
51  double centre_frequency;
52  double bandwidth;
53 
54  unsigned chan_lo,chan_hi;
55  void fpt_copy(TimeSeries* dest);
56  void tfp_copy(TimeSeries* dest);
57 
58  Reference::To<Engine> engine;
59 
60  };
61 
62  class FZoom::Engine : public OwnStream
63  {
64  public:
65 
67  enum Direction {
68 
70  DeviceToHost,
71 
73  DeviceToDevice
74 
75  };
76 
77  virtual void fpt_copy (const dsp::TimeSeries * in,
78  dsp::TimeSeries * out,
79  unsigned chan_lo,
80  unsigned chan_hi) = 0;
81 
82  void set_direction (Direction);
83  Direction get_direction () {return direction;}
84 
85  protected:
86 
87  Direction direction;
88 
89  };
90 }
91 
92 #endif // !defined(__FZoom_h)
virtual void set_bandwidth(double _bandwidth)
Set the bandwidth of signal in MHz (-ve = lsb; +ve = usb)
Definition: Observation.h:145
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
void transformation()
Perform channel selection.
Definition: FZoom.C:65
float * get_datptr(unsigned ichan=0, unsigned ipol=0)
Return pointer to the specified data block.
Definition: TimeSeries.C:304
Stores information about digital, band-limited, time-varying signals.
Definition: Observation.h:33
Arrays of consecutive samples for each polarization and frequency channel.
Definition: TimeSeries.h:29
virtual void copy_configuration(const Observation *copy)
Copy the configuration of another TimeSeries instance (not the data) This doesn't copy nchan,...
Definition: TimeSeries.C:396
double get_centre_frequency() const
Return the centre frequency of the band-limited signal in MHz.
Definition: Observation.h:134
static void set_channel_bounds(const Observation *input, double centre_frequency, double bandwidth, unsigned *chan_lo, unsigned *chan_hi)
Given an input and a goal freq / bandwidth, select channel bounds.
Definition: FZoom.C:196
virtual void resize(uint64_t nsamples)
Allocate the space required to store nsamples time samples.
Definition: TimeSeries.C:146
void set_bounds()
Determine which channels to use.
Definition: FZoom.C:47
virtual void set_centre_frequency(double cf)
Set the centre frequency of the band-limited signal in MHz.
Definition: Observation.h:132
void set_nchan(unsigned)
Set the number of channels.
Definition: DataSeries.C:100
void prepare()
Set up output.
Definition: FZoom.C:58
Perform a coarse (channelized) zoom to specified freq/bw.
Definition: FZoom.h:23
Reference::To< const TimeSeries > input
Container from which input data will be read.
Definition: HasInput.h:49
@ OrderFPT
Frequency, Polarization, Time (default before 3 October 2008)
Definition: TimeSeries.h:47
@ OrderTFP
Time, Frequency, Polarization (better for many things)
Definition: TimeSeries.h:50
Order get_order() const
Get the order.
Definition: TimeSeries.C:92
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