casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Precession.h
Go to the documentation of this file.
1 //# Precession.h: Precession class
2 //# Copyright (C) 1995,1996,1997,1998,1999,2002,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id$
28 
29 #ifndef MEASURES_PRECESSION_H
30 #define MEASURES_PRECESSION_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward Declarations
40 
41 // <summary> Precession class and calculations </summary>
42 
43 // <use visibility=export>
44 
45 // <reviewed reviewer="Tim Cornwell" date="1996/07/01" tests="tMeasMath"
46 // demos="">
47 // </reviewed>
48 
49 // <prerequisite>
50 // <li> <linkto class=Measure>Measure</linkto> class for use
51 // <li> <linkto class=Euler>Euler</linkto> class for format
52 // <li> <linkto class=MeasData>MeasData</linkto> class for constants
53 // <li> <linkto class=MeasTable>MeasTable</linkto> class for other data
54 // </prerequisite>
55 //
56 // <etymology>
57 // Precession
58 // </etymology>
59 //
60 // <synopsis>
61 // Precession forms the class for precession calculations. It is a simple
62 // container with the selected method, and the mean epoch. It acts as a cache
63 // for values and their derivatives, to enable fast calculations for time
64 // epochs close together (see the <em>aipsrc</em> variable
65 // <em>measures.precession.d_interval</em>. <br>
66 // The calculation method is selected from one of the following:
67 // <ul>
68 // <li> Precession::STANDARD (at 1995/09/04 the IAU1976 definition,
69 // at 2004/01/01 the IAU2000 defeinition))
70 // <li> Precession::NONE (precession of zero returned
71 // <li> Precession::IAU1976
72 // <li> Precession::B1950
73 // <li> Precession::IAU2000
74 // </ul>
75 // Epochs can be specified as the MJD (with defined constants
76 // MeasData::MJD2000 and MeasData::MJD1950 or the actual MJD),
77 // leading to the following constructors:
78 // <ul>
79 // <li> Precession() default; assuming JD2000, STANDARD
80 // <li> Precession(method) assuming the correct default epoch of
81 // JD2000 or JD1950 depending on method
82 // <li> Precession(method,epoch) with epoch Double(MJD) (Note: not
83 // valid for IAU2000: in that case always JD2000 assumed)
84 // </ul>
85 // Actual precession for a certain Epoch (TT for IAU2000) is calculated by
86 // the () operator
87 // as Precession(epoch), with epoch Double MJD. Values returned as an
88 // <linkto class=Euler>Euler</linkto>.
89 // The derivative (d<sup>-1</sup>) can be obtained as well by
90 // derivative(epoch). <br>
91 // A Precession can be re-initialed with a different method and/or zero
92 // epoch with the <src>init()</src> functions (same format as constructors).
93 // To bypass the full calculation actual returned values are calculated
94 // using the derivative if within about 2 hours (error less than about
95 // 10<sup>-5</sup> mas). A call to refresh() will re-initiate calculations
96 // from scratch.<br>
97 // The following details can be set with the
98 // <linkto class=Aipsrc>Aipsrc</linkto> mechanism:
99 // <ul>
100 // <li> measures.precession.d_interval: approximation interval as time
101 // (fraction of days is default unit) over which linear approximation
102 // is used (default is 0.1 day).
103 // </ul>
104 // </synopsis>
105 //
106 // <example>
107 // <srcblock>
108 // #include <casacore/measures/Measures.h>
109 // MVDirection pos(Quantity(10,"degree"),Quantity(-10.5,"degree"));
110 // // direction RA=10; DEC=-10.5
111 // Precession mine(Precession::IAU1976); // define precession type
112 // RotMatrix rotat(mine(45837.0)); // rotation matrix for 84/05/17
113 // MVDirection new = rotat*pos; // apply precession
114 // rotat = RotMatrix(mine(45839.0)); // interpolate new precession
115 // // assuming d_interval set large
116 // </srcblock>
117 // </example>
118 //
119 // <motivation>
120 // To calculate the precession angles. An alternate route could have been
121 // a global function, but having a simple container allows caching of some
122 // calculations for speed.<br>
123 // Using MJD (JD-2400000.5) rather than JD is for precision reasons.
124 // </motivation>
125 //
126 // <todo asof="2003/09/18">
127 // <li> Adjust on 2004/01/01
128 // </todo>
129 
130 class Precession {
131  public:
132  //# Constants
133  // Default interval to be used for linear approximation (in days)
134  static const Double INTV;
135 
136  //# Enumerations
137  // Types of known precession calculations (at 1995/09/04 STANDARD ==
138  // IAU1976), from 2004/01/01 will be IAU2000)
139 
143  STANDARD = IAU1976 };
144 
145  //# Constructors
146  // Default constructor, generates default J2000 precession identification
147  Precession();
148  // Copy constructor (deep copy)
149  Precession(const Precession &other);
150  // Constructor with epoch in Julian days
151  explicit Precession(PrecessionTypes type, Double catepoch=0);
152  // Copy assignment (deep copy)
153  Precession &operator=(const Precession &other);
154 
155  //# Destructor
156  ~Precession();
157 
158  //# Operators
159  // Return the precession angles (for IAU2000 including
160  // the IAU 2000 corrections) at the specified epoch (in MJD; TT for IAU2000).
161  const Euler &operator()(Double epoch);
162 
163  //# General Member Functions
164  // Return derivative of precession (d<sup>-1</sup>)
165  const Euler &derivative(Double epoch);
166  // Re-initialise Precession object
167  // <group>
168  void init();
169  void init(PrecessionTypes type, Double catepoch=0);
170  // </group>
171  // Refresh calculations
172  void refresh();
173 
174  private:
175  //# Data members
176  // Method to be used
178  // Fixed epoch to be used (MJD)
180  // Fixed epoch in centuries from base epoch
182  // Length of century (depending on Bessel or Julian days)
184  // Reference epoch;
186  // Check epoch
188  // Polynomial coefficients for zeta,z,theta
190  // Cached calculated angles
192  // Cached derivatives
194  // To reference results, and use a few in interim calculations, results are
195  // saced in a circular buffer.
196  // Current result pointer
198  // Last calculation
200  // Interpolation interval aipsrc registration
202 
203  //# Member functions
204  // Make a copy
205  void copy(const Precession &other);
206  // Create correct default fixedEpoch and catalogue epoch data
207  void fillEpoch();
208  // Calculate precession angles for time t
209  void calcPrec(Double t);
210 };
211 
212 
213 } //# NAMESPACE CASACORE - END
214 
215 #endif
int Int
Definition: aipstype.h:50
Double fixedEpoch_p
Fixed epoch to be used (MJD)
Definition: Precession.h:179
Int lres_p
To reference results, and use a few in interim calculations, results are saced in a circular buffer...
Definition: Precession.h:197
Precession()
Default constructor, generates default J2000 precession identification.
Precession & operator=(const Precession &other)
Copy assignment (deep copy)
Euler result_p[4]
Last calculation.
Definition: Precession.h:199
Double dval_p[3]
Cached derivatives.
Definition: Precession.h:193
static const Double INTV
Default interval to be used for linear approximation (in days)
Definition: Precession.h:134
void init()
Re-initialise Precession object.
Double cent_p
Length of century (depending on Bessel or Julian days)
Definition: Precession.h:183
const Euler & operator()(Double epoch)
Return the precession angles (for IAU2000 including the IAU 2000 corrections) at the specified epoch ...
void refresh()
Refresh calculations.
Precession class and calculations.
Definition: Precession.h:130
static uInt myInterval_reg
Interpolation interval aipsrc registration.
Definition: Precession.h:201
PrecessionTypes method_p
Method to be used.
Definition: Precession.h:177
PrecessionTypes
Types of known precession calculations (at 1995/09/04 STANDARD == IAU1976), from 2004/01/01 will be I...
Definition: Precession.h:140
double Double
Definition: aipstype.h:55
void calcPrec(Double t)
Calculate precession angles for time t.
void copy(const Precession &other)
Make a copy.
void fillEpoch()
Create correct default fixedEpoch and catalogue epoch data.
Polynomial< Double > zeta_p[3]
Polynomial coefficients for zeta,z,theta.
Definition: Precession.h:189
Double refEpoch_p
Reference epoch;.
Definition: Precession.h:185
Double T_p
Fixed epoch in centuries from base epoch.
Definition: Precession.h:181
Double checkEpoch_p
Check epoch.
Definition: Precession.h:187
const Euler & derivative(Double epoch)
Return derivative of precession (d-1)
Double pval_p[3]
Cached calculated angles.
Definition: Precession.h:191
unsigned int uInt
Definition: aipstype.h:51
Vector of Euler rotation angles.
Definition: Euler.h:116