1 | #include "SlaStars.h"
|
---|
2 |
|
---|
3 | #include "slalib.h"
|
---|
4 |
|
---|
5 | #include "MAstro.h"
|
---|
6 | #include "MPointing.h"
|
---|
7 |
|
---|
8 | ClassImp(SlaStars);
|
---|
9 |
|
---|
10 | SlaStars::SlaStars(MObservatory::LocationName_t key) : Slalib(key)
|
---|
11 | {
|
---|
12 | }
|
---|
13 |
|
---|
14 | void SlaStars::Set(const AltAz &altaz)
|
---|
15 | {
|
---|
16 | fAltAz = altaz * TMath::DegToRad();
|
---|
17 | fRaDec = CalcRaDec(fAltAz);
|
---|
18 | }
|
---|
19 |
|
---|
20 | void SlaStars::Set(const ZdAz &zdaz)
|
---|
21 | {
|
---|
22 | fAltAz = AltAz(TMath::Pi()/2-zdaz.Zd(), zdaz.Az()) * TMath::DegToRad();
|
---|
23 | fRaDec = CalcRaDec(fAltAz);
|
---|
24 | }
|
---|
25 |
|
---|
26 | void SlaStars::Set(const RaDec &radec)
|
---|
27 | {
|
---|
28 | double ha;
|
---|
29 |
|
---|
30 | fRaDec = radec * TMath::DegToRad();
|
---|
31 | fAltAz = CalcAltAz(fRaDec, &ha);
|
---|
32 |
|
---|
33 | fHourAngle = ha;
|
---|
34 | }
|
---|
35 |
|
---|
36 | void SlaStars::SetMjd(double mjd)
|
---|
37 | {
|
---|
38 | Slalib::SetMjd(mjd);
|
---|
39 |
|
---|
40 | fTt = GetMjd() + slaDtt(GetMjd())/60./60./24.;
|
---|
41 |
|
---|
42 | //
|
---|
43 | // ----- calculate star independent parameters ----------
|
---|
44 | //
|
---|
45 |
|
---|
46 | // prepare calculation: Mean Place to geocentric apperent
|
---|
47 | // (UTC would also do, except for the moon?)
|
---|
48 | slaMappa(2000.0, fTt, fAmprms); // Epoche, TDB
|
---|
49 |
|
---|
50 | // prepare: Apperent to observed place
|
---|
51 | slaAoppa(GetMjd(), 0, // mjd, Delta UT=UT1-UTC
|
---|
52 | GetElong(), GetPhi(), GetHeight(), // long, lat, height
|
---|
53 | 0, 0, // polar motion x, y-coordinate (radians)
|
---|
54 | // 273.155, 1013.25, 0.5, // temp, pressure, humidity
|
---|
55 | 273.155+10, 780.0, 0.25, // temp, pressure, humidity
|
---|
56 | // 0.2, 0.0065, // wavelength, tropo lapse rate
|
---|
57 | 0.55, 0.0065, // wavelength, tropo lapse rate
|
---|
58 | fAoprms);
|
---|
59 |
|
---|
60 | // Delta UT should be less than 0.9s which is its definition
|
---|
61 | // so we can fairly assume it to be neglegible
|
---|
62 | }
|
---|
63 |
|
---|
64 | RaDec SlaStars::CalcRaDec(const AltAz &altaz) const
|
---|
65 | {
|
---|
66 | return CalcRaDec(ZdAz(TMath::Pi()/2-altaz.Alt(), altaz.Az()));
|
---|
67 | }
|
---|
68 |
|
---|
69 | RaDec SlaStars::CalcRaDec(const ZdAz &zdaz) const
|
---|
70 | {
|
---|
71 | //
|
---|
72 | // -- observed to apparent --
|
---|
73 | // Workaraound for slalib: discard const
|
---|
74 | //
|
---|
75 | double r=0, d=0;
|
---|
76 | slaOapqk((char*)"A", zdaz.Az(), zdaz.Zd(), (double*)fAoprms, &r, &d);
|
---|
77 |
|
---|
78 | //
|
---|
79 | // -- apparent to mean --
|
---|
80 | // Workaraound for slalib: discard const
|
---|
81 | //
|
---|
82 | double ra, dec;
|
---|
83 | slaAmpqk(r, d, (double*)fAmprms, &ra, &dec);
|
---|
84 |
|
---|
85 | return RaDec(ra, dec);
|
---|
86 | }
|
---|
87 |
|
---|
88 | RaDec SlaStars::CalcRaDecFast(const AltAz &altaz) const
|
---|
89 | {
|
---|
90 | //
|
---|
91 | // This function does a coordinate system transformation only.
|
---|
92 | // This is very fast compared to a correct tranformation with all
|
---|
93 | // effects, but much less accurate.
|
---|
94 | //
|
---|
95 | // It transforms Altitude/Azimuth [rad] into
|
---|
96 | // Right Ascension/Declination [rad]
|
---|
97 | //
|
---|
98 | double ha, dec;
|
---|
99 | slaDh2e(altaz.Az(), altaz.Alt(), GetPhi(), &ha, &dec);
|
---|
100 | return RaDec(GetAlpha()-ha, dec);
|
---|
101 | }
|
---|
102 |
|
---|
103 | RaDec SlaStars::CalcRaDecFast(const ZdAz &zdaz) const
|
---|
104 | {
|
---|
105 | //
|
---|
106 | // This function does a coordinate system transformation only.
|
---|
107 | // This is very fast compared to a correct tranformation with all
|
---|
108 | // effects, but much less accurate.
|
---|
109 | //
|
---|
110 | // It transforms Zenith Distance/Azimuth [rad] into
|
---|
111 | // Right Ascension/Declination [rad]
|
---|
112 | //
|
---|
113 | return CalcRaDecFast(AltAz(TMath::Pi()/2-zdaz.Zd(), zdaz.Az()));
|
---|
114 | }
|
---|
115 |
|
---|
116 | ZdAz SlaStars::CalcZdAzFast(const RaDec &radec) const
|
---|
117 | {
|
---|
118 | //
|
---|
119 | // This function does a coordinate system transformation only.
|
---|
120 | // This is very fast compared to a correct tranformation with all
|
---|
121 | // effects, but much less accurate.
|
---|
122 | //
|
---|
123 | // It transforms Right Ascension/Declination [rad] into
|
---|
124 | // zenith Distance/Azimuth [rad]
|
---|
125 | //
|
---|
126 | AltAz altaz = CalcAltAzFast(radec);
|
---|
127 | return ZdAz(TMath::Pi()/2-altaz.Alt(), altaz.Az());
|
---|
128 | }
|
---|
129 |
|
---|
130 | AltAz SlaStars::CalcAltAzFast(const RaDec &radec) const
|
---|
131 | {
|
---|
132 | //
|
---|
133 | // This function does a coordinate system transformation only.
|
---|
134 | // This is very fast compared to a correct tranformation with all
|
---|
135 | // effects, but much less accurate.
|
---|
136 | //
|
---|
137 | // It transforms Right Ascension/Declination [rad] into
|
---|
138 | // Altitude/Azimuth [rad]
|
---|
139 | //
|
---|
140 | double az, el;
|
---|
141 | slaDe2h(GetAlpha()-radec.Ra(), radec.Dec(), GetPhi(), &az, &el);
|
---|
142 | return AltAz(el, az);
|
---|
143 | }
|
---|
144 |
|
---|
145 | ZdAz SlaStars::CalcZdAz(const RaDec &radec, double *ha) const
|
---|
146 | {
|
---|
147 | //
|
---|
148 | // ---- Mean to apparent ----
|
---|
149 | //
|
---|
150 |
|
---|
151 | double r=0, d=0;
|
---|
152 | slaMapqkz(radec.Ra(), radec.Dec(), (double*)fAmprms, &r, &d);
|
---|
153 | //
|
---|
154 | // Doesn't work - don't know why
|
---|
155 | //
|
---|
156 | // slaMapqk (radec.Ra(), radec.Dec(), rdpm.Ra(), rdpm.Dec(),
|
---|
157 | // 0, 0, (double*)fAmprms, &r, &d);
|
---|
158 | //
|
---|
159 |
|
---|
160 | //
|
---|
161 | // -- apparent to observed --
|
---|
162 | //
|
---|
163 | double r1=0; // ra
|
---|
164 | double d1=0; // dec
|
---|
165 | double h0=0; // ha
|
---|
166 |
|
---|
167 | double zd;
|
---|
168 | double az;
|
---|
169 | slaAopqk (r, d, (double*)fAoprms,
|
---|
170 | &az, // observed azimuth (radians: N=0,E=90) [-pi, pi]
|
---|
171 | &zd, // observed zenith distance (radians) [-pi/2, pi/2]
|
---|
172 | &h0, // observed hour angle (radians)
|
---|
173 | &d1, // observed declination (radians)
|
---|
174 | &r1); // observed right ascension (radians)
|
---|
175 |
|
---|
176 | if (ha)
|
---|
177 | *ha = h0*MAstro::RadToHor();
|
---|
178 |
|
---|
179 | return ZdAz(zd, az);
|
---|
180 | }
|
---|
181 | AltAz SlaStars::CalcAltAz(const RaDec &radec, double *ha) const
|
---|
182 | {
|
---|
183 | ZdAz zdaz = CalcZdAz(radec, ha);
|
---|
184 | return AltAz(TMath::Pi()/2-zdaz.Zd(), zdaz.Az());
|
---|
185 | }
|
---|
186 |
|
---|
187 | ZdAz SlaStars::GetApproxVel(const RaDec &radec) const // [rad/rad]
|
---|
188 | {
|
---|
189 | // radec [rad]
|
---|
190 | // GetApproxVel [rad/rad]
|
---|
191 | double az, vaz, aaz;
|
---|
192 | double el, vel, ael;
|
---|
193 | double pa, vpa, apa;
|
---|
194 | slaAltaz(GetAlpha()-radec.Ra(), radec.Dec(), GetPhi(),
|
---|
195 | &az, &vaz, &aaz,
|
---|
196 | &el, &vel, &ael,
|
---|
197 | &pa, &vpa, &apa);
|
---|
198 |
|
---|
199 | return ZdAz(-vel, vaz);
|
---|
200 | }
|
---|