casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef MEASURES_PRECESSION_H
27#define MEASURES_PRECESSION_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Quanta/Euler.h>
32#include <casacore/scimath/Functionals/Polynomial.h>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36//# Forward Declarations
37
38// <summary> Precession class and calculations </summary>
39
40// <use visibility=export>
41
42// <reviewed reviewer="Tim Cornwell" date="1996/07/01" tests="tMeasMath"
43// demos="">
44// </reviewed>
45
46// <prerequisite>
47// <li> <linkto class=Measure>Measure</linkto> class for use
48// <li> <linkto class=Euler>Euler</linkto> class for format
49// <li> <linkto class=MeasData>MeasData</linkto> class for constants
50// <li> <linkto class=MeasTable>MeasTable</linkto> class for other data
51// </prerequisite>
52//
53// <etymology>
54// Precession
55// </etymology>
56//
57// <synopsis>
58// Precession forms the class for precession calculations. It is a simple
59// container with the selected method, and the mean epoch. It acts as a cache
60// for values and their derivatives, to enable fast calculations for time
61// epochs close together (see the <em>aipsrc</em> variable
62// <em>measures.precession.d_interval</em>. <br>
63// The calculation method is selected from one of the following:
64// <ul>
65// <li> Precession::STANDARD (at 1995/09/04 the IAU1976 definition,
66// at 2004/01/01 the IAU2000 defeinition))
67// <li> Precession::NONE (precession of zero returned
68// <li> Precession::IAU1976
69// <li> Precession::B1950
70// <li> Precession::IAU2000
71// </ul>
72// Epochs can be specified as the MJD (with defined constants
73// MeasData::MJD2000 and MeasData::MJD1950 or the actual MJD),
74// leading to the following constructors:
75// <ul>
76// <li> Precession() default; assuming JD2000, STANDARD
77// <li> Precession(method) assuming the correct default epoch of
78// JD2000 or JD1950 depending on method
79// <li> Precession(method,epoch) with epoch Double(MJD) (Note: not
80// valid for IAU2000: in that case always JD2000 assumed)
81// </ul>
82// Actual precession for a certain Epoch (TT for IAU2000) is calculated by
83// the () operator
84// as Precession(epoch), with epoch Double MJD. Values returned as an
85// <linkto class=Euler>Euler</linkto>.
86// The derivative (d<sup>-1</sup>) can be obtained as well by
87// derivative(epoch). <br>
88// A Precession can be re-initialed with a different method and/or zero
89// epoch with the <src>init()</src> functions (same format as constructors).
90// To bypass the full calculation actual returned values are calculated
91// using the derivative if within about 2 hours (error less than about
92// 10<sup>-5</sup> mas). A call to refresh() will re-initiate calculations
93// from scratch.<br>
94// The following details can be set with the
95// <linkto class=Aipsrc>Aipsrc</linkto> mechanism:
96// <ul>
97// <li> measures.precession.d_interval: approximation interval as time
98// (fraction of days is default unit) over which linear approximation
99// is used (default is 0.1 day).
100// </ul>
101// </synopsis>
102//
103// <example>
104// <srcblock>
105// #include <casacore/measures/Measures.h>
106// MVDirection pos(Quantity(10,"degree"),Quantity(-10.5,"degree"));
107// // direction RA=10; DEC=-10.5
108// Precession mine(Precession::IAU1976); // define precession type
109// RotMatrix rotat(mine(45837.0)); // rotation matrix for 84/05/17
110// MVDirection new = rotat*pos; // apply precession
111// rotat = RotMatrix(mine(45839.0)); // interpolate new precession
112// // assuming d_interval set large
113// </srcblock>
114// </example>
115//
116// <motivation>
117// To calculate the precession angles. An alternate route could have been
118// a global function, but having a simple container allows caching of some
119// calculations for speed.<br>
120// Using MJD (JD-2400000.5) rather than JD is for precision reasons.
121// </motivation>
122//
123// <todo asof="2003/09/18">
124// <li> Adjust on 2004/01/01
125// </todo>
126
128 public:
129 //# Constants
130 // Default interval to be used for linear approximation (in days)
131 static const Double INTV;
132
133 //# Enumerations
134 // Types of known precession calculations (at 1995/09/04 STANDARD ==
135 // IAU1976), from 2004/01/01 will be IAU2000)
136
141
142 //# Constructors
143 // Default constructor, generates default J2000 precession identification
145 // Copy constructor (deep copy)
146 Precession(const Precession &other);
147 // Constructor with epoch in Julian days
148 explicit Precession(PrecessionTypes type, Double catepoch=0);
149 // Copy assignment (deep copy)
151
152 //# Destructor
154
155 //# Operators
156 // Return the precession angles (for IAU2000 including
157 // the IAU 2000 corrections) at the specified epoch (in MJD; TT for IAU2000).
158 const Euler &operator()(Double epoch);
159
160 //# General Member Functions
161 // Return derivative of precession (d<sup>-1</sup>)
162 const Euler &derivative(Double epoch);
163 // Re-initialise Precession object
164 // <group>
165 void init();
166 void init(PrecessionTypes type, Double catepoch=0);
167 // </group>
168 // Refresh calculations
169 void refresh();
170
171 private:
172 //# Data members
173 // Method to be used
175 // Fixed epoch to be used (MJD)
177 // Fixed epoch in centuries from base epoch
179 // Length of century (depending on Bessel or Julian days)
181 // Reference epoch;
183 // Check epoch
185 // Polynomial coefficients for zeta,z,theta
187 // Cached calculated angles
189 // Cached derivatives
191 // To reference results, and use a few in interim calculations, results are
192 // saced in a circular buffer.
193 // Current result pointer
195 // Last calculation
197 // Interpolation interval aipsrc registration
199
200 //# Member functions
201 // Make a copy
202 void copy(const Precession &other);
203 // Create correct default fixedEpoch and catalogue epoch data
204 void fillEpoch();
205 // Calculate precession angles for time t
207};
208
209
210} //# NAMESPACE CASACORE - END
211
212#endif
void init()
Re-initialise Precession object.
Euler result_p[4]
Last calculation.
Definition Precession.h:196
Precession(PrecessionTypes type, Double catepoch=0)
Constructor with epoch in Julian days.
Double cent_p
Length of century (depending on Bessel or Julian days)
Definition Precession.h:180
void calcPrec(Double t)
Calculate precession angles for time t.
void copy(const Precession &other)
Make a copy.
void refresh()
Refresh calculations.
PrecessionTypes
Types of known precession calculations (at 1995/09/04 STANDARD == IAU1976), from 2004/01/01 will be I...
Definition Precession.h:137
Int lres_p
To reference results, and use a few in interim calculations, results are saced in a circular buffer.
Definition Precession.h:194
static uInt myInterval_reg
Interpolation interval aipsrc registration.
Definition Precession.h:198
static const Double INTV
Default interval to be used for linear approximation (in days)
Definition Precession.h:131
Precession()
Default constructor, generates default J2000 precession identification.
void fillEpoch()
Create correct default fixedEpoch and catalogue epoch data.
Double pval_p[3]
Cached calculated angles.
Definition Precession.h:188
Double T_p
Fixed epoch in centuries from base epoch.
Definition Precession.h:178
void init(PrecessionTypes type, Double catepoch=0)
Double refEpoch_p
Reference epoch;.
Definition Precession.h:182
Precession(const Precession &other)
Copy constructor (deep copy)
const Euler & operator()(Double epoch)
Return the precession angles (for IAU2000 including the IAU 2000 corrections) at the specified epoch ...
Double fixedEpoch_p
Fixed epoch to be used (MJD)
Definition Precession.h:176
Double dval_p[3]
Cached derivatives.
Definition Precession.h:190
const Euler & derivative(Double epoch)
Return derivative of precession (d-1)
PrecessionTypes method_p
Method to be used.
Definition Precession.h:174
Polynomial< Double > zeta_p[3]
Polynomial coefficients for zeta,z,theta.
Definition Precession.h:186
Double checkEpoch_p
Check epoch.
Definition Precession.h:184
Precession & operator=(const Precession &other)
Copy assignment (deep copy)
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
double Double
Definition aipstype.h:53