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

Last change on this file since 2615 was 2615, 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, mjd, fAmprms); // Epoche, TDB
43
44 // prepare: Apperent to observed place
45 slaAoppa(mjd, 0, // mjd, Delta UT=UT1-UTC
46 // GetElong(), GetPhi(), 148, // göttingen long, lat, height
47 GetElong(), GetPhi(), GetHeight(), // göttingen long, lat, height
48 0, 0, // polar motion x, y-coordinate (radians)
49 // 273.155, 1013.25, 0.5, // temp, pressure, humidity
50 273.155+20, 1013.25, 0.5, // temp, pressure, humidity
51 // 0.2, 0.0065, // wavelength, tropo lapse rate
52 0.55, 0.0065, // wavelength, tropo lapse rate
53 fAoprms);
54}
55
56RaDec SlaStars::CalcRaDec(const AltAz &altaz) const
57{
58 return CalcRaDec(ZdAz(kPiDiv2-altaz.Alt(), altaz.Az()));
59}
60
61RaDec SlaStars::CalcRaDec(const ZdAz &zdaz) const
62{
63 //
64 // -- observed to apparent --
65 // Workaraound for slalib: discard const
66 //
67 double r=0, d=0;
68 slaOapqk((char*)"A", zdaz.Az(), zdaz.Zd(), (double*)fAoprms, &r, &d);
69
70 //
71 // -- apparent to mean --
72 // Workaraound for slalib: discard const
73 //
74 double ra, dec;
75 slaAmpqk(r, d, (double*)fAmprms, &ra, &dec);
76
77 return RaDec(ra, dec);
78}
79
80RaDec SlaStars::CalcRaDecFast(const AltAz &altaz) const
81{
82 //
83 // This function does a coordinate system transformation only.
84 // This is very fast compared to a correct tranformation with all
85 // effects, but much less accurate.
86 //
87 // It transforms Altitude/Azimuth [rad] into
88 // Right Ascension/Declination [rad]
89 //
90 double ha, dec;
91 slaDh2e(altaz.Az(), altaz.Alt(), GetPhi(), &ha, &dec);
92 return RaDec(GetAlpha()-ha, dec);
93}
94
95RaDec SlaStars::CalcRaDecFast(const ZdAz &zdaz) const
96{
97 //
98 // This function does a coordinate system transformation only.
99 // This is very fast compared to a correct tranformation with all
100 // effects, but much less accurate.
101 //
102 // It transforms Zenith Distance/Azimuth [rad] into
103 // Right Ascension/Declination [rad]
104 //
105 return CalcRaDecFast(AltAz(kPiDiv2-zdaz.Zd(), zdaz.Az()));
106}
107
108ZdAz SlaStars::CalcZdAzFast(const RaDec &radec) const
109{
110 //
111 // This function does a coordinate system transformation only.
112 // This is very fast compared to a correct tranformation with all
113 // effects, but much less accurate.
114 //
115 // It transforms Right Ascension/Declination [rad] into
116 // zenith Distance/Azimuth [rad]
117 //
118 AltAz altaz = CalcAltAzFast(radec);
119 return ZdAz(kPiDiv2-altaz.Alt(), altaz.Az());
120}
121
122AltAz SlaStars::CalcAltAzFast(const RaDec &radec) const
123{
124 //
125 // This function does a coordinate system transformation only.
126 // This is very fast compared to a correct tranformation with all
127 // effects, but much less accurate.
128 //
129 // It transforms Right Ascension/Declination [rad] into
130 // Altitude/Azimuth [rad]
131 //
132 double az, el;
133 slaDe2h(GetAlpha()-radec.Ra(), radec.Dec(), GetPhi(), &az, &el);
134 return AltAz(el, az);
135}
136
137ZdAz SlaStars::CalcZdAz(const RaDec &radec) const
138{
139 //
140 // ---- Mean to apparent ----
141 //
142
143 double r=0, d=0;
144 slaMapqkz(radec.Ra(), radec.Dec(), (double*)fAmprms, &r, &d);
145 //
146 // Doesn't work - don't know why
147 //
148 // slaMapqk (radec.Ra(), radec.Dec(), rdpm.Ra(), rdpm.Dec(),
149 // 0, 0, (double*)fAmprms, &r, &d);
150 //
151
152 //
153 // -- apparent to observed --
154 //
155 double r1=0; // ra
156 double d1=0; // dec
157 double h0=0; // ha
158
159 double zd;
160 double az;
161 slaAopqk (r, d, (double*)fAoprms,
162 &az, // observed azimuth (radians: N=0,E=90)
163 &zd, // observed zenith distance (radians) [-pi/2, pi/2]
164 &h0, // observed hour angle (radians)
165 &d1, // observed declination (radians)
166 &r1); // observed right ascension (radians)
167
168 return ZdAz(zd, az);
169}
170AltAz SlaStars::CalcAltAz(const RaDec &radec) const
171{
172 ZdAz zdaz = CalcZdAz(radec);
173 return AltAz(kPiDiv2-zdaz.Zd(), zdaz.Az());
174}
175
176ZdAz SlaStars::GetApproxVel(const RaDec &radec) const // [rad/rad]
177{
178 double az, vaz, aaz;
179 double el, vel, ael;
180 double pa, vpa, apa;
181 slaAltaz(GetAlpha()-radec.Ra(), radec.Dec(), GetPhi(),
182 &az, &vaz, &aaz,
183 &el, &vel, &ael,
184 &pa, &vpa, &apa);
185
186 return ZdAz(-vel, vaz);
187}
Note: See TracBrowser for help on using the repository browser.