FluxPlot.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2006 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/Plotting/Pulsar/FluxPlot.h
10 
11 #ifndef __Pulsar_FluxPlot_h
12 #define __Pulsar_FluxPlot_h
13 
14 #include "Pulsar/PhasePlot.h"
15 #include "Pulsar/ProfileVectorPlotter.h"
16 #include "Pulsar/Index.h"
17 
18 namespace Pulsar {
19 
20  class Profile;
21  class PhaseWeight;
22  class InfoLabel;
23 
25  class FluxPlot : public PhasePlot {
26 
27  public:
28 
31 
33  ~FluxPlot ();
34 
37 
38  // Text interface to the FluxPlot class
39  class Interface : public TextInterface::To<FluxPlot> {
40  public:
41  Interface (FluxPlot* = 0);
42  };
43 
45  void prepare (const Archive*);
46 
48  std::string get_ylabel (const Archive*);
49 
51  virtual void get_profiles (const Archive*) = 0;
52 
54  virtual float get_phase_error (const Archive* data);
55 
57  virtual float get_flux_error (const Profile* data);
58 
60  virtual float get_flux_maximum (const Profile* data);
61 
63  virtual void plot_error_box (const Archive* data);
64 
66  virtual void auto_scale_phase (const Profile* data, float buffer);
67 
69  void set_subint (Index _isubint) { isubint = _isubint; }
70  Index get_subint () const { return isubint; }
71 
73  void set_chan (Index _ichan) { ichan = _ichan; }
74  Index get_chan () const { return ichan; }
75 
77  void set_pol (Index _ipol) { ipol = _ipol; }
78  Index get_pol () const { return ipol; }
79 
81  void set_logarithmic (int val) { logarithmic = val; }
82  int get_logarithmic () const { return logarithmic; }
83 
85  void set_peak_zoom (float zoom) { peak_zoom = zoom; }
86  float get_peak_zoom () const { return peak_zoom; }
87 
89  void set_baseline_zoom (float zoom) { baseline_zoom = zoom; }
90  float get_baseline_zoom () const { return baseline_zoom; }
91 
93  void set_info_label (bool flag = true);
94  bool get_info_label () const;
95 
97  void set_plot_error_box (int code) { plot_ebox = code; }
98  int get_plot_error_box () const { return plot_ebox; }
99 
101  void set_plot_histogram (bool f = true) { plotter.plot_histogram = f; }
102  bool get_plot_histogram () const { return plotter.plot_histogram; }
103 
105 
107  void set_original_nchan (unsigned nchan) { original_nchan = nchan; }
108  unsigned get_original_nchan () const { return original_nchan; }
109 
111  void draw (const Archive*);
112 
114 
117  void plot_profile (const Profile*);
118 
120  const ProfileVectorPlotter* get_plotter () const { return &plotter; }
121 
123  void set_selection (const PhaseWeight*);
124 
126  void set_crop( float new_crop ) { crop = new_crop; }
127 
129  float get_crop() const { return crop; }
130 
131  protected:
132 
133  ProfileVectorPlotter plotter;
134 
135  Index isubint;
136  Index ichan;
137  Index ipol;
138 
139  int logarithmic;
140 
141  int plot_ebox;
142  float peak_zoom;
143  bool peak_centre_origin;
144  float baseline_zoom;
145  unsigned original_nchan;
146 
147  float crop;
148 
149  Reference::To<InfoLabel> info_label;
151 
152  void plot_selection ();
153 
154  };
155 
156 }
157 
158 #endif
bool plot_histogram
Plot histogram style.
Definition: ProfileVectorPlotter.h:62
void set_crop(float new_crop)
Set the crop fraction.
Definition: FluxPlot.h:131
void draw(const Archive *)
Draw the profiles in the currently open window.
Definition: FluxPlot.C:174
Combines an index value and integrate flag.
Definition: Index.h:24
float get_margin(pgplot::Units) const
Get the margin in the specified metric.
Definition: PlotLabel.C:87
virtual void plot_error_box(const Archive *data)
Draw the error box.
Definition: FluxPlot.C:392
TextInterface::Parser * get_interface()
Return the text interface.
Definition: FluxPlot.C:49
void set_pol(Index _ipol)
Set the polarization to plot.
Definition: FluxPlot.h:82
virtual Signal::Scale get_scale() const =0
Get the scale in which flux density is measured.
void set_original_nchan(unsigned nchan)
Set the original number of frequency channels.
Definition: FluxPlot.h:112
Stores a weight for each Profile phase bin.
Definition: PhaseWeight.h:29
virtual void get_profiles(const Archive *)=0
Derived classes must provide the profiles.
virtual void auto_scale_phase(const Profile *data, float buffer)
Automatically scale in on the on-pulse region.
Definition: FluxPlot.C:275
std::string get_left() const
Get the label to be drawn to the left of the frame.
Definition: PlotLabel.h:49
Any quantity recorded as a function of pulse phase.
Definition: Profile.h:45
The primary interface to pulsar observational data.
Definition: Archive.h:45
Stores three labels: left, centre, and right.
Definition: PlotLabel.h:27
Estimate< double > get_variance() const
Get the weighted variance of the Profile amplitudes.
Definition: PhaseWeight.C:351
unsigned get_nbin() const
Return the number of bins.
Definition: ProfileAmps.h:50
unsigned get_nrows(const std::string &label) const
Get the number of rows in the label.
Definition: PlotLabel.C:78
Plots flux profiles.
Definition: ProfileVectorPlotter.h:27
void set_chan(Index _ichan)
Set the frequency channel to plot (where applicable)
Definition: FluxPlot.h:78
const ExtensionType * get() const
Template method searches for an Extension of the specified type.
FluxPlot()
Default constructor.
Definition: FluxPlot.C:27
void set_peak_zoom(float zoom)
Automatically zoom in on the pulse peak.
Definition: FluxPlot.h:90
void set_subint(Index _isubint)
Set the sub-integration to plot (where applicable)
Definition: FluxPlot.h:74
virtual unsigned get_nchan() const =0
Get the number of frequency channels used.
virtual PhaseWeight * operate(const Profile *)
Convenience interface.
Definition: ProfileWeightFunction.C:34
Plots flux profiles.
Definition: FluxPlot.h:30
float get_min() const
Get the minimum amplitude with non-zero weight.
Definition: PhaseWeight.C:225
virtual double get_centre_frequency() const =0
Get the centre frequency of the observation.
Integration * get_Integration(unsigned subint)
Return pointer to the specified Integration.
Definition: IntegrationManager.C:41
float max(int bin_start=0, int bin_end=0) const
Returns the maximum amplitude.
Definition: Profile.C:651
void set_info_label(bool flag=true)
Use an informative label above the plot.
Definition: FluxPlot.C:455
const ProfileVectorPlotter * get_plotter() const
Provide limited access to the plotter.
Definition: FluxPlot.h:125
void set_plot_error_box(int code)
Plot an error box on the baseline.
Definition: FluxPlot.h:102
PhaseWeight algorithms that receive an input Profile.
Definition: ProfileWeightFunction.h:26
T get_value() const
void set_logarithmic(int val)
Plot on a logarithmic scale, normalized by noise.
Definition: FluxPlot.h:86
float get_crop() const
Get the crop level.
Definition: FluxPlot.h:134
virtual double get_bandwidth() const =0
Get the overall bandwidth of the observation.
Print a label with three rows above the plot frame.
Definition: InfoLabel.h:28
void plot_profile(const Profile *)
Draw a profile in the currently open window.
Definition: FluxPlot.C:255
StrategySet * get_strategy() const
Returns the strategy manager.
Definition: StrategySet.C:182
std::string get_ylabel(const Archive *)
Get the default label for the y axis.
Definition: FluxPlot.C:316
void prepare(const Archive *)
Perform any preprocessing steps.
Definition: FluxPlot.C:64
PhaseWeight * baseline() const
Return a new PhaseWeight instance with the baseline phase bins masked.
Definition: Profile_baseline.C:15
~FluxPlot()
Destructor.
Definition: FluxPlot.C:45
void set_baseline_zoom(float zoom)
Automatically zoom in on the baseline.
Definition: FluxPlot.h:94
Defines the PSRCHIVE library.
Definition: CalSource.h:17
virtual float get_phase_error(const Archive *data)
Compute the error in phase.
Definition: FluxPlot.C:328
U get_variance() const
virtual float get_flux_error(const Profile *data)
Compute the error in flux.
Definition: FluxPlot.C:379
virtual double get_folding_period() const =0
Get the folding or topocentric pulsar period (in seconds)
virtual double get_dispersion_measure() const =0
Get the dispersion measure (in )
float get_displacement(int row, pgplot::Units) const
Get the displacement of label[irow] in the specified metric.
Definition: PlotLabel.C:96
virtual unsigned get_nbin() const =0
Get the number of pulsar phase bins used.
void set_selection(const PhaseWeight *)
Set the selected profiles.
Definition: FluxPlot.C:249
void find_peak_edges(int &rise, int &fall) const
Find the bin numbers at which the cumulative power crosses thresholds.
Definition: Profile_find_peak_edges.C:34
void set_plot_histogram(bool f=true)
Plot an error box on the baseline.
Definition: FluxPlot.h:106
virtual float get_flux_maximum(const Profile *data)
Compute the maximum flux.
Definition: FluxPlot.C:55

Generated using doxygen 1.8.17