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

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