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