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

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