PavApp.h
1 /*
2  * Copyright (c) 2007 by David Smith
3  * Licensed under the Academic Free License version 2.1
4  */
5 
6 
7 
8 
9 #ifndef PAV_APP_H_
10 #define PAV_APP_H_
11 
12 
13 
14 #include "Pulsar/PlotFactory.h"
15 #include "Pulsar/Plot.h"
16 
17 #include "Pulsar/Archive.h"
18 #include "Pulsar/Interpreter.h"
19 
20 #include "Pulsar/GaussianBaseline.h"
21 #include "Pulsar/PhaseWeight.h"
22 #include "Pulsar/Profile.h"
23 
24 #include <Pulsar/Integration.h>
25 #include <Pulsar/IntegrationOrder.h>
26 #include <Pulsar/PeriastronOrder.h>
27 #include <Pulsar/BinaryPhaseOrder.h>
28 #include <Pulsar/BinLngPeriOrder.h>
29 #include <Pulsar/BinLngAscOrder.h>
30 
31 #include <Pulsar/StokesPlot.h>
32 #include <Pulsar/StokesCylindrical.h>
33 
34 #include "TextInterface.h"
35 #include "strutil.h"
36 #include "dirutil.h"
37 #include "getopt.h"
38 #include "cpgplot.h"
39 
40 #include "ColourMap.h"
41 
42 #include <tostring.h>
43 
44 #include <cpgplot.h>
45 
46 #include <sstream>
47 
48 #include <unistd.h>
49 
50 using std::string;
51 using std::vector;
52 using Pulsar::Archive;
53 using Pulsar::Option;
54 using Pulsar::Plot;
55 using Reference::To;
56 
57 
58 
59 class PavApp
60 {
61 public:
62  PavApp();
63 
64  int run( int argc, char *argv[] );
65 private:
66 
67  static Option<string> default_plot_device;
68 
69  struct FilePlots
70  {
71  string filename;
72  Reference::To<Archive> archive;
73  vector< Reference::To<Plot> > plots;
74  };
75 
76  vector< FilePlots > plots;
77 
78  template< class PC > void SetPlotOptions( string cmd )
79  {
80  vector< FilePlots >::iterator fit;
81  for( fit = plots.begin(); fit != plots.end(); fit ++ )
82  {
83  vector< Reference::To<Plot> >::iterator pit;
84  for( pit = (*fit).plots.begin(); pit != (*fit).plots.end(); pit ++ )
85  {
86  Reference::To<PC> sp = dynamic_cast<PC*>( (*pit).get() );
87  if( sp )
88  {
89  try { sp->configure( cmd ); } catch( Error e ) {}
90  }
91  }
92  }
93  }
94 
95  std::string GetBandpassOrSpectrumPlot( Reference::To<Archive> archive );
96 
97  void PrintUsage( void );
98 
99  void SetStokesPlotToQU( void );
100  void SetPhaseZoom( double min_phase, double max_phase );
101  void SetFreqZoom( double min_freq, double max_freq );
102  void PavSpecificOptions( void );
103  void PavSpecificLabels( Pulsar::Archive* archive );
104  void CreatePlotsList( vector< string > filenames, vector< string > plot_ids );
105  void SetCmdLineOptions( vector< string > options );
106  bool CheckColour( void );
107  float PADegreesToTurns( const int deg );
108 
109  bool have_colour;
110  int ipol;
111  int fsub, lsub;
112  int isubint;
113  int ichan;
114  double rot_phase;
115  bool svp;
116  bool publn;
117  bool axes;
118  bool labels;
119  unsigned int n1, n2;
120  double min_freq;
121  double max_freq;
122  double min_phase;
123  double max_phase;
124  double reference_position_angle;
125  double position_angle_height;
126  double border;
127  bool dark;
128  double y_max;
129  double y_min;
130  double truncate_amp;
131  pgplot::ColourMap::Name colour_map;
132 
133  bool cbppo;
134  bool cbpao;
135  bool cblpo;
136  bool cblao;
137 
138  bool pa_ext;
139 
140  bool plot_error_box;
141 
142  bool freq_under_name;
143 
144  float user_character_height;
145 
146  float pa_min, pa_max;
147 
148  bool label_degrees;
149  bool centre_profile;
150  bool remove_baseline;
151 
152  unsigned int ronsub;
153 };
154 
155 #endif
156 
157 
158 
159 
160 
161 
void fit(const Pulsar::Parameters *model, std::vector< toa > &data, Pulsar::Parameters *postfit=NULL, bool track=false, Tempo::toa::State min_state=Tempo::toa::Normal)
Definition: PeriastronOrder.h:28
Definition: BinLngPeriOrder.h:28
Plots images of something as a function of pulse phase vs something.
Definition: PhaseVsTime.h:26
Plots multiple viewports.
Definition: MultiPlot.h:27
void set_Profile(const Profile *)
Set the profile from which the rise and fall will be computed.
Definition: PeakConsecutive.C:44
Definition: BinaryPhaseOrder.h:28
Plots a single pulse profile.
Definition: StokesSpherical.h:27
Instrumental passband (or bandpass)
Definition: Passband.h:25
static void agent_report()
Report on the status of the plugins.
Definition: Archive.C:120
Any quantity recorded as a function of pulse phase.
Definition: Profile.h:45
The primary interface to pulsar observational data.
Definition: Archive.h:45
Plots a single pulse profile.
Definition: StokesCylindrical.h:28
static void set_verbosity(unsigned level)
Set the verbosity level (0 to 3)
Definition: Archive_verbose.C:19
void apply()
Apply the current attributes.
Definition: ColourMap.C:47
Plots multiple viewports with pulse phase along the shared x-axis.
Definition: MultiPhase.h:25
Plot of offpulse bandpass and channel weights.
Definition: BandpassChannelWeightPlot.h:21
Type * get() const
Plots a single pulse profile.
Definition: ProfilePlot.h:26
Plots flux profiles.
Definition: FluxPlot.h:30
Array of Profiles integrated over the same time interval.
Definition: Integration.h:37
Finds pulse defined by number of consecutive points above threshold.
Definition: PeakConsecutive.h:31
void set_name(Name name)
Set the colour map name.
Definition: ColourMap.C:42
Plots the position angle of the linearly polarized radiation.
Definition: PosAngPlot.h:24
static bool verbose
Verbosity flag.
Definition: Plot.h:33
Plots a single pulse profile.
Definition: StokesCylindricalPlus.h:25
Plot pulsar signal-to-noise ratio as a func of time and freq.
Definition: DynamicSNSpectrumPlot.h:22
Simple plots with pulse phase along the x-axis.
Definition: PhasePlot.h:27
Convenience interface to a bunch of regularly used colour maps.
Definition: ColourMap.h:26
Plots images of something as a function of pulse phase vs something.
Definition: PhaseVsPlot.h:27
virtual void organise(Archive *, unsigned)=0
Re-order the Integrations into the desired state.
Plot * construct(std::string name)
Return a new instance of the named plot.
Definition: PlotFactory.C:169
Plots images of something as a function of pulse phase vs something.
Definition: PhaseVsFrequency.h:26
void set(Archive *data)
set the current Archive
Definition: Interpreter.C:441
Estimates the on-pulse region between a rise and a fall.
Definition: RiseFall.h:24
Provides a text interface to create new plots.
Definition: PlotFactory.h:27
Name
Available colour map names.
Definition: ColourMap.h:35
Base class of all plotters.
Definition: Plot.h:28
void get_indeces(int &rise, int &fall) const
Get the pulse phase bin indeces of the rise and fall.
Definition: PeakConsecutive.C:272
Alternative ways of ordering Integration instances.
Definition: IntegrationOrder.h:29
Pulsar data processing command language interpreter.
Definition: Interpreter.h:57
Definition: BinLngAscOrder.h:28

Generated using doxygen 1.8.17