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