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