source: trunk/MagicSoft/Cosy/catalog/SlaStars.cc@ 6158

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