psrephem.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 1999 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/Util/tempo/psrephem.h
10
11#ifndef __PSREPHEM_H
12#define __PSREPHEM_H
13
14#include "Pulsar/Parameters.h"
15
16#include "MJD.h"
17#include "sky_coord.h"
18
19#include "Error.h"
20
21#include <vector>
22#include <string>
23
24namespace Legacy {
25
26class psrephem : public Pulsar::Parameters
27{
28 friend class psrParams;
29
30 public:
31
33 Parameters* clone () const;
34
36 bool equals (const Parameters* that) const;
37
39 void load (FILE*);
40
42 void unload (FILE*) const;
43
45 std::string get_name () const;
46
48 sky_coord get_coordinates () const;
49
51 double get_dispersion_measure () const;
52
54 double get_rotation_measure () const;
55
56 // makes tex_descriptor return short_tex_descriptor
57 static bool short_tex;
58
59 int* parmStatus;
60 std::string* value_str;
61 double* value_double;
62 int* value_integer;
63 double* error_double;
64
65 bool tempo11;
66 std::string nontempo11;
67
68 psrephem();
69 ~psrephem();
70
71 psrephem (const psrephem &);
72
73 psrephem (const char* filename);
74
75 psrephem& operator = (const psrephem &);
76
77 void zero ();
78
79 int load (const std::string& filename);
80 int unload (const std::string& fname) const;
81
82 int load (std::string* str);
83 int unload (std::string* str) const;
84
85 // set fitting attributes
86 void nofit();
87 void fitall();
88
89 // update all parameters to the new_epoch
90 void set_epoch (const MJD& new_epoch, bool binary = false);
91
92 // multiply all errors by efac
93 void efac (float efac);
94
95 // return the value
96 std::string get_string (int ephind);
97 double get_double (int ephind);
98 MJD get_MJD (int ephind);
99 Angle get_Angle (int ephind);
100 int get_integer (int ephind);
101
102 // set value
103 void set_string (int ephind, const std::string&);
104 void set_double (int ephind, double );
105 void set_MJD (int ephind, const MJD&);
106 void set_Angle (int ephind, const Angle&);
107 void set_integer (int ephind, int);
108
109 double p() const;
110 double p_err() const;
111
112 // return some values
113 std::string psrname() const;
114
115 double get_dm() const;
116 void set_dm (double dm);
117
118 double jra() const;
119 double jdec() const;
120 double omega() const;
121 double omdot() const;
122 double ecc() const;
123 double t0() const;
124 double a1() const;
125 double pb() const;
126
127 // these functions return 0 if no error, -1 on error
128 //
129 // return galactic latitude and longitude in radians (slalib)
130 int galactic (double& l, double& b);
131 // return galactic height (z) in parsec
132 int galactic_z (double& z);
133
134 // returns the acceleration along the line of sight arising
135 // from differential galactic rotation in km/s
136 int acc_diffrot (double& beta);
137
138 // returns the sine of the inclination angle
139 int sini (double& si, double& si_err) const;
140 // returns the simple calculation based on Pb and x
141 int mass_function (double& mf, double& mf_err) const;
142 // returns m1 mass based on mass function, sin(i), and m2
143 int m1 (double& m1, double& m1_err) const;
144 // inverts the above to return m2, given m1
145 int m2 (double& m2, double m1) const;
146
147 // returns the composite proper motion
148 int pm (double& pm, double& pm_err) const;
149 // returns the proper motion celestial position angle
150 int phi (double& phi, double& phi_err) const;
151
152 // returns the proper motion contribution to xdot (Kopeikin 1996)
153 int pm_x_dot (double& xdot, double& xdot_err) const;
154 // returns the proper motion contribution to omdot in degrees per year
155 int pm_omega_dot (double& omdot, double& omdot_err) const;
156
157 // returns the limit on i derived from proper motion and xdot
158 int imax_pm_xdot (double& imax, double& imax_err) const;
159
160 // returns the limit on i derived from proper motion and omdot
161 int imax_pm_omdot (double& imax, double& imax_err) const;
162
163 // returns the orbital period in seconds
164 int P (double& p, double& p_err) const;
165 // returns the orbital period derivative
166 int P_dot (double& pdot, double& pdot_err) const;
167 // returns the second orbital period derivative in seconds^-1
168 int P_ddot (double& pddot, double& pddot_err) const;
169
170 // returns the characteristic age in Gyr
171 int characteristic_age (double& age, double age_err);
172
173 // stability parameter of antt94
174 int Delta_t (double& delta_t) const;
175
176 // returns the transverse quadratic Doppler shift due to the apparent
177 // acceleration along the line of sight that arises from proper motion
178 int quadratic_Doppler (double& beta, double& beta_err) const;
179
180 int corrected_P_dot (double& p_dot_int, double& p_dot_int_err) const;
181 int corrected_characteristic_age (double& age, double& age_err) const;
182
183 int pdot_distance (double& dist, double& dist_err) const;
184 int pdot_mu (double& mu, double& mu_err) const;
185
186 int cubic_Doppler (double& gamma, double& gamma_err,
187 double pmrv, double pmrv_err) const;
188
189 int Doppler_P_dotdot (double& P_dotdot, double& P_dotdot_err,
190 double pmrv, double pmrv_err) const;
191
192 int Doppler_F2 (double& f2, double& f2_err,
193 double pmrv, double pmrv_err) const;
194
195 int intrinsic_P_dotdot (double& P_dotdot, double& P_dotdot_err,
196 float braking_index=3) const;
197
198 // returns the intrinsic x_dot due to gravitational wave emission
199 int GR_x_dot (double& x_dot) const;
200
201 // returns the intrinsic Pb_dot due to gravitational wave emission
202 int GR_Pb_dot (double& Pb_dot) const;
203
204 // returns the intrinsic Pb_dot due to gravitational wave emission
205 int GR_omega_dot (double& w_dot) const;
206
207 // given omega_dot from par file, returns the total mass
208 int GR_omega_dot_mtot (double& mtot, double& mtot_err) const;
209
210 // uses the above and sin(i) and f(M) to derive m2
211 int GR_omega_dot_m2 (double& m2, double& m2_err) const;
212
213 // returns the general relativistic prediction of gamma
214 int GR_gamma (double& gamma) const;
215
216 // used by the above
217 int GR_f_e (double& f_e) const;
218
219 // returns spin-orbit coupling rate of precession
220 int GR_Omega_p (double& Omp) const;
221
222 // //////////////////////////////////////////////////////////////////////
223 // to use the following two functions, you will need to link with
224 // -lpsrinfo
225
226 // returns a block of LaTeX formatted text suitable for use in tables
227 std::string tex () const;
228
229 // returns the LaTeX formatted pulsar name
230 std::string tex_name () const;
231 // returns the a LaTeX formatted string for the parameter at ephind
232 std::string tex_val (int ephind, double fac=1.0, unsigned precision=1) const;
233
234 // returns a LateX formatted string suitable for labelling the parameter
235 static const char* tex_descriptor (int ephind);
236
237 // returns a LateX formatted string suitable for short labels
238 static const char* short_tex_descriptor (int ephind);
239
240 // returns a block of LaTeX formatted text suitable for use in tables
241 static std::string tex (std::vector<psrephem>& vals, bool dots=false);
242
243 // returns the directory path in which psrinfo will be run
244 std::string get_directory ();
245
246 // this is specifically for the older style ephemeris file
247 // inserts the ephemeris values into the val_str, val_double,
248 // and val_int depending on the type of each ephemeris value.
249 void read_old_ephem_str (std::vector<std::string>& lines,
250 int *pstatus,
251 std::string *val_str,
252 double *val_double,
253 int *val_int);
254
255 protected:
256
257 void init ();
258 void size_dataspace();
259 void destroy ();
260 void zero_work ();
261
262 int old_load (const std::string& filename);
263 int old_unload (const std::string& filename) const;
264
265};
266
267}
268
269bool operator == (const Legacy::psrephem&, const Legacy::psrephem&);
270bool operator != (const Legacy::psrephem&, const Legacy::psrephem&);
271
272std::ostream& operator<< (std::ostream& ostr, const Legacy::psrephem& eph);
273
274#endif
275
virtual std::string get_name() const
Return the pulsar name.
Definition Parameters.C:34
virtual Parameters * clone() const =0
Return a new, copy constructed instance of self.

Generated using doxygen 1.14.0