Changeset 1628 in Sophya
- Timestamp:
- Aug 7, 2001, 6:23:37 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/XAstroPack/xastropack.cc
r1515 r1628 3 3 #include "xastropack.h" 4 4 5 /*! 6 \defgroup XAstroPack XAstroPack module 7 This module contains simple programs to perform various 8 astronomical computation (based on the libastro of Xephem). 9 10 \verbatim 5 11 // TEMPS: modified Julian date (mjd) (number of days elapsed since 1900 jan 0.5) 6 12 // jour [1,31] (dy) … … 24 30 // (angle + vers l'ouest, - vers l'est) 25 31 // latitude en degres [-90,90] (north>0) (geolat) 26 32 \endverbatim 33 */ 34 35 /*! \ingroup XAstroPack 36 \brief Compute true Julian day from MJD 37 */ 27 38 double TrueJDfrMJD(double mjd) 28 39 { … … 30 41 } 31 42 43 /*! \ingroup XAstroPack 44 \brief Compute MJD from true Julian day 45 */ 32 46 double MJDfrTrueJD(double jd) 33 47 { … … 35 49 } 36 50 51 /*! \ingroup XAstroPack 52 \brief Compute MJD from date 53 */ 37 54 double MJDfrDate(double dy,int mn,int yr) 38 55 { … … 42 59 } 43 60 61 /*! \ingroup XAstroPack 62 \brief Compute date from MJD 63 */ 44 64 void DatefrMJD(double mjd,double *dy,int *mn,int *yr) 45 65 { … … 47 67 } 48 68 49 /* given a mjd, return the year as a double. */ 69 /*! \ingroup XAstroPack 70 \brief Given a mjd, return the year as a double. 71 */ 50 72 double YearfrMJD(double mjd) 51 73 { … … 55 77 } 56 78 57 /* given a decimal year, return mjd */ 79 /*! \ingroup XAstroPack 80 \brief Given a decimal year, return mjd 81 */ 58 82 double MJDfrYear(double yr) 59 83 { … … 63 87 } 64 88 65 /* given a mjd, return the year and number of days since 00:00 Jan 1 */ 66 /* Attention: si mjd = 2 Janvier -> number of days = 1 */ 89 /*! \ingroup XAstroPack 90 \brief Given a mjd, return the year and number of days since 00:00 Jan 1 91 \warning: if mjd = 2 January -> number of days = 1 92 */ 67 93 void YDfrMJD(double mjd,double *dy,int *yr) 68 94 { … … 70 96 } 71 97 72 /* given a modified julian date, mjd, and a universally coordinated time, utc, 73 * return greenwich mean siderial time, *gst. 74 * N.B. mjd must be at the beginning of the day. 75 */ 98 /*! \ingroup XAstroPack 99 \brief Give GST from UTC 100 \verbatim 101 Given a modified julian date, mjd, and a universally coordinated time, utc, 102 return greenwich mean siderial time, *gst. 103 N.B. mjd must be at the beginning of the day. 104 \endverbatim 105 */ 76 106 double GSTfrUTC(double mjd0,double utc) 77 107 { … … 81 111 } 82 112 83 /* given a modified julian date, mjd, and a greenwich mean siderial time, gst, 84 * return universally coordinated time, *utc. 85 * N.B. mjd must be at the beginning of the day. 86 */ 113 /*! \ingroup XAstroPack 114 \brief Give UTC from GST 115 \verbatim 116 Given a modified julian date, mjd, and a greenwich mean siderial time, gst, 117 return universally coordinated time, *utc. 118 N.B. mjd must be at the beginning of the day. 119 \endverbatim 120 */ 87 121 double UTCfrGST(double mjd0,double gst) 88 122 { … … 92 126 } 93 127 94 /* gmst0() - return Greenwich Mean Sidereal Time at 0h UT */ 95 /* mjd = date at 0h UT in julian days since MJD0 */ 128 /*! \ingroup XAstroPack 129 \brief gmst0() - return Greenwich Mean Sidereal Time at 0h UT 130 \param mjd = date at 0h UT in julian days since MJD0 131 */ 96 132 double GST0(double mjd0) 97 133 /* Copie depuis le code de Xephem car pas prototype */ … … 106 142 } 107 143 144 /*! \ingroup XAstroPack 145 \brief Compute precession between 2 dates. 146 */ 108 147 void Precess(double mjd1,double mjd2,double ra1,double dec1,double *ra2,double *dec2) 109 148 { … … 115 154 } 116 155 117 /* given apparent altitude find airmass. */ 156 /*! \ingroup XAstroPack 157 \brief Given apparent altitude find airmass. 158 */ 118 159 double AirmassfrAlt(double alt) 119 160 { … … 124 165 } 125 166 126 /* donne l'angle horaire a partir du temps sideral et de l'ascension droite */ 167 /*! \ingroup XAstroPack 168 \brief Give the hour angle from sideral time and right ascencion 169 */ 127 170 double HafrRaTS(double gst,double ra) 128 171 { … … 135 178 } 136 179 137 void HMSfrHdec(double hd,int *h,int *mn,double *s) 180 /*! \ingroup XAstroPack 181 \brief Give a time in h:mn:s from a decimal hour 182 \verbatim 138 183 // INPUT: hd 139 184 // OUTPUT: h mn s (h,mn,s >=< 0) … … 141 186 // EX: 12.51 -> h=12 mn=30 s=10 ; 142 187 // -12.51 -> h=-12 mn=-30 s=-10 ; 188 \endverbatim 189 */ 190 void HMSfrHdec(double hd,int *h,int *mn,double *s) 143 191 { 144 192 int sgn=1; … … 155 203 } 156 204 157 double HdecfrHMS(int h,int mn,double s) 205 /*! \ingroup XAstroPack 206 \brief Give a decimal hour from a time in h:mn:s 207 \verbatim 158 208 // INPUT: h , mn , s (h,mn,s >=< 0) 159 209 // RETURN: en heures decimales 160 210 // REMARQUE: pour avoir hd=-12.51 <- h=-12 mn=-30 s=-10 211 \endverbatim 212 */ 213 double HdecfrHMS(int h,int mn,double s) 161 214 { 162 215 return ((double)h + (double)mn/60. + s/3600.); 163 216 } 164 217 165 string ToStringHMS(int h,int mn,double s) 218 /*! \ingroup XAstroPack 219 \brief Give a time string from a time in h:mn:s 220 \verbatim 166 221 // INPUT: h , mn , s (h,mn,s >=< 0) 167 222 // RETURN: string h:mn:s 223 \endverbatim 224 */ 225 string ToStringHMS(int h,int mn,double s) 168 226 { 169 227 double hd = HdecfrHMS(h,mn,s); // put in range … … 178 236 } 179 237 238 /*! \ingroup XAstroPack 239 \brief Give a time string from a decimal hour 240 */ 180 241 string ToStringHdec(double hd) 181 242 { … … 185 246 } 186 247 248 /*! \ingroup XAstroPack 249 \brief Convert equatorial coordinates into galactic coordinates 250 */ 187 251 void EqtoGal(double mjd,double ra,double dec, double *glng,double *glat) 188 252 // Coordonnees equatoriales -> Coordonnees galactiques … … 196 260 } 197 261 262 /*! \ingroup XAstroPack 263 \brief Convert galactic coordinates into equatorial coordinates 264 */ 198 265 void GaltoEq(double mjd,double glng,double glat,double *ra,double *dec) 199 266 // Coordonnees galactiques -> Coordonnees equatoriales … … 206 273 } 207 274 275 /*! \ingroup XAstroPack 276 \brief Convert equatorial coordinates into horizontal coordinates 277 */ 208 278 void EqtoHor(double geolat,double ha,double dec,double *az,double *alt) 209 279 // Coordonnees equatoriales -> Coordonnees horizontales … … 217 287 } 218 288 289 /*! \ingroup XAstroPack 290 Convert horizontal coordinates into equatorial coordinates 291 */ 219 292 void HortoEq(double geolat,double az,double alt,double *ha,double *dec) 220 293 // Coordonnees horizontales -> Coordonnees equatoriales … … 229 302 } 230 303 304 /*! \ingroup XAstroPack 305 \brief Convert equatorial coordinates into ecliptic coordinates 306 */ 231 307 // Attention, j'ai modifie eq_ecl.c pour proteger NaN 232 308 // dans ecleq_aux : … … 243 319 } 244 320 321 /*! \ingroup XAstroPack 322 \brief Convert ecliptic coordinates into equatorial coordinates 323 */ 245 324 void EcltoEq(double mjd,double eclng,double eclat,double *ra,double *dec) 246 325 // Coordonnees ecliptiques -> Coordonnees equatoriales … … 253 332 } 254 333 255 /* given the modified JD, mjd, return the true geocentric ecliptic longitude 256 * of the sun for the mean equinox of the date, *lsn, in radians, the 257 * sun-earth distance, *rsn, in AU, and the latitude *bsn, in radians 258 * (since this is always <= 1.2 arcseconds, in can be neglected by 259 * calling with bsn = NULL). */ 334 /*! \ingroup XAstroPack 335 \brief Give Sun position 336 \verbatim 337 given the modified JD, mjd, return the true geocentric ecliptic longitude 338 of the sun for the mean equinox of the date, *lsn, in radians, the 339 sun-earth distance, *rsn, in AU, and the latitude *bsn, in radians 340 (since this is always <= 1.2 arcseconds, in can be neglected by 341 calling with bsn = NULL). 342 \endverbatim 343 */ 260 344 void SunPos(double mjd,double *eclsn,double *ecbsn) 261 345 { … … 266 350 } 267 351 268 /* given the mjd, find the geocentric ecliptic longitude, lam, and latitude, 269 * bet, and geocentric distance, rho in a.u. for the moon. also return 270 * the sun's mean anomaly, *msp, and the moon's mean anomaly, *mdp. 271 * (for the mean equinox) */ 352 /*! \ingroup XAstroPack 353 \brief Give Moon position 354 \verbatim 355 given the mjd, find the geocentric ecliptic longitude, lam, and latitude, 356 bet, and geocentric distance, rho in a.u. for the moon. also return 357 the sun's mean anomaly, *msp, and the moon's mean anomaly, *mdp. 358 (for the mean equinox) 359 \endverbatim 360 */ 272 361 void MoonPos(double mjd,double *eclmn,double *ecbmn) 273 362 { … … 278 367 } 279 368 280 void PlanetPos(double mjd,int numplan,double *ecl,double *ecb,double *diamang) 281 /* given a modified Julian date, mjd, and a planet, p, find: 369 /*! \ingroup XAstroPack 370 \brief Give planet position 371 \verbatim 372 * given a modified Julian date, mjd, and a planet, p, find: 282 373 * lpd0: heliocentric longitude, 283 374 * psi0: heliocentric latitude, … … 292 383 * dia: angular diameter in arcsec at 1 AU, 293 384 * mag: visual magnitude when 1 AU from sun and earth at 0 phase angle. 294 * (for the mean equinox) */ 385 * (for the mean equinox) 386 \endverbatim 387 */ 388 void PlanetPos(double mjd,int numplan,double *ecl,double *ecb,double *diamang) 295 389 { 296 390 double lpd0,psi0,rp0,rho0,mag; … … 300 394 } 301 395 396 /*! \ingroup XAstroPack 397 \brief Give Jupiter position 398 */ 302 399 void JupiterPos(double mjd,double *ecl,double *ecb,double *diamang) 303 400 { … … 305 402 } 306 403 404 /*! \ingroup XAstroPack 405 \brief Give Saturn position 406 */ 307 407 void SaturnPos(double mjd,double *ecl,double *ecb,double *diamang) 308 408 { … … 310 410 } 311 411 312 /* Given a coordinate type "typ", convert to standard for astropack */ 412 /*! \ingroup XAstroPack 413 \brief Given a coordinate type "typ", convert to standard for astropack 414 \verbatim 415 // Return : 0 = OK 416 // 1 = Unknown type of coordinates 417 // 2 = bad range for coord1 418 // 4 = bad range for coord2 419 // 6 = bad range for coord1 et coord2 420 \endverbatim 421 */ 313 422 int CoordConvertToStd(TypAstroCoord typ,double& coord1,double& coord2) 314 // Return : 0 = OK315 // 1 = Type de coordonnees non connu316 // 2 = Mauvais range pour coord1317 // 4 = Mauvais range pour coord2318 // 6 = Mauvais range pour coord1 et coord2319 423 { 320 424 int rc = 0;
Note:
See TracChangeset
for help on using the changeset viewer.