Changeset 808 for trunk/MagicSoft/Cosy/catalog
- Timestamp:
- 05/25/01 16:51:24 (24 years ago)
- Location:
- trunk/MagicSoft/Cosy/catalog
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/catalog/StarCatalog.cc
r748 r808 16 16 17 17 // 18 // calculate observers location (goe)19 //20 int status;21 slaDaf2r(51, 38, 48.0, &fPhi, &status);22 slaDaf2r( 9, 56, 36.0, &fElong, &status);23 24 cout << "fPhi: 51ø38'48.0\" = " << 360.0/D2PI*fPhi << endl;25 cout << "fElong: 9ø56'36.0\" = " << 360.0/D2PI*fElong << endl;26 27 //28 18 // read index file 29 19 // … … 78 68 cout << " Az: " << fAltAz.Az() << endl; 79 69 80 fRaDec = AltAz2RaDec(fAltAz);70 fRaDec = sla.CalcRaDec(fAltAz); 81 71 82 72 cout << "Ra: " << 360.0/D2PI*fRaDec.Ra(); … … 87 77 } 88 78 89 RaDec StarCatalog::AltAz2RaDec(const AltAz &altaz) const 90 { 91 // 92 // -- observed to apparent -- 93 // Workaraound for slalib: discard const 94 // 95 double r=0, d=0; 96 slaOapqk ("A", altaz.Az(), DPI/2-altaz.Alt(), (double*)fAoprms, &r, &d); 97 98 // 99 // -- apparent to mean -- 100 // Workaraound for slalib: discard const 101 // 102 double ra, dec; 103 slaAmpqk(r, d, (double*)fAmprms, &ra, &dec); 104 105 return RaDec(ra, dec); 106 } 107 108 AltAz StarCatalog::RaDec2AltAz(const RaDec &radec, const RaDec &rdpm) const 109 { 110 // 111 // ---- Mean to apparent ---- 112 // 113 114 double r=0, d=0; 115 slaMapqkz(radec.Ra(), radec.Dec(), (double*)fAmprms, &r, &d); 116 // 117 // Doesn't work - don't know why 118 // 119 // slaMapqk (radec.Ra(), radec.Dec(), rdpm.Ra(), rdpm.Dec(), 120 // 0, 0, (double*)fAmprms, &r, &d); 121 // 122 123 // 124 // -- apparent to observed -- 125 // 126 double r1=0; // ra 127 double d1=0; // dec 128 double h0=0; // ha 129 130 double zd; 131 double az; 132 slaAopqk (r, d, (double*)fAoprms, 133 &az, // observed azimuth (radians: N=0,E=90) 134 &zd, // observed zenith distance (radians) [-pi/2, pi/2] 135 &h0, // observed hour angle (radians) 136 &d1, // observed declination (radians) 137 &r1); // observed right ascension (radians) 138 139 return AltAz(DPI/2-zd, az); 140 } 141 142 void StarCatalog::SetRaDec(const RaDec &radec, const RaDec &rdpm) 79 void StarCatalog::SetRaDec(const RaDec &radec) 143 80 { 144 81 fRaDec = radec; 145 82 fRaDec *= D2PI/360.0; 146 83 147 RaDec pm = rdpm * D2PI/360.0; 148 149 fAltAz = RaDec2AltAz(fRaDec, pm); 84 fAltAz = sla.CalcAltAz(fRaDec); 150 85 151 86 cout << "Alt: " << 360.0/D2PI*fAltAz.Alt() << " "; … … 158 93 void StarCatalog::CalcAltAzRange() 159 94 { 160 charfAlt0[180];95 byte fAlt0[180]; 161 96 162 97 for (int h=0; h<180; h++) … … 248 183 // check whether altaz north- or south-pole is in the visible region 249 184 // 250 charimg[768*576];185 byte img[768*576]; 251 186 if (DrawAltAz(0, img, 90, 0)) 252 187 { … … 263 198 cout << "fAltMax: " << setw(3) << fAltMax << endl; 264 199 } 200 265 201 void StarCatalog::CalcRaDecRange() 266 202 { … … 268 204 // calculate range to search in 269 205 // 270 charfDec[180];206 byte fDec[180]; 271 207 272 208 for (int h=0; h<180; h++) … … 279 215 double de0, de1; 280 216 217 const double phi = sla.GetPhi(); 218 const double alpha = sla.GetAlpha(); 281 219 // 282 220 // scan horizontal border … … 286 224 double dx, dy; 287 225 slaDh2e(DPI-x*fPixSize, -fHeight, DPI/2-fAltAz.Alt(), &dx, &dy); 288 slaDh2e(fAltAz.Az()+dx, -dy, fPhi, &ha0, &de0);226 slaDh2e(fAltAz.Az()+dx, -dy, phi, &ha0, &de0); 289 227 290 228 slaDh2e(DPI-x*fPixSize, +fHeight, DPI/2-fAltAz.Alt(), &dx, &dy); 291 slaDh2e(fAltAz.Az()+dx, -dy, fPhi, &ha1, &de1);292 293 const int h0 = ((int)(360.0/D2PI*( fAlpha-ha0))+360)%360;229 slaDh2e(fAltAz.Az()+dx, -dy, phi, &ha1, &de1); 230 231 const int h0 = ((int)(360.0/D2PI*(alpha-ha0))+360)%360; 294 232 const int d0 = (int)(360.0/D2PI*de0); 295 233 … … 299 237 fDec[d0+90] = kTRUE; 300 238 301 const int h1 = ((int)(360.0/D2PI*( fAlpha-ha1))+360)%360;239 const int h1 = ((int)(360.0/D2PI*(alpha-ha1))+360)%360; 302 240 const int d1 = (int)(360.0/D2PI*de1); 303 241 … … 315 253 double dx, dy; 316 254 slaDh2e(DPI-fWidth, -y*fPixSize, DPI/2-fAltAz.Alt(), &dx, &dy); 317 slaDh2e(fAltAz.Az()+dx, -dy, fPhi, &ha0, &de0);255 slaDh2e(fAltAz.Az()+dx, -dy, phi, &ha0, &de0); 318 256 319 257 slaDh2e(DPI+fWidth, -y*fPixSize, DPI/2-fAltAz.Alt(), &dx, &dy); 320 slaDh2e(fAltAz.Az()+dx, -dy, fPhi, &ha1, &de1);321 322 const int h0 = ((int)(360.0/D2PI*( fAlpha-ha0))+360)%360;258 slaDh2e(fAltAz.Az()+dx, -dy, phi, &ha1, &de1); 259 260 const int h0 = ((int)(360.0/D2PI*(alpha-ha0))+360)%360; 323 261 const int d0 = (int)(360.0/D2PI*de0); 324 262 … … 328 266 fDec[d0+90] = kTRUE; 329 267 330 const int h1 = ((int)(360.0/D2PI*( fAlpha-ha1))+360)%360;268 const int h1 = ((int)(360.0/D2PI*(alpha-ha1))+360)%360; 331 269 const int d1 = (int)(360.0/D2PI*de1); 332 270 … … 364 302 // check whether radec north- or south-pole is in the visible region 365 303 // 366 charimg[768*576];304 byte img[768*576]; 367 305 if (DrawRaDec(0, img, 0, 90)) 368 306 { … … 380 318 } 381 319 382 void StarCatalog::DrawSCAltAz( char*img, const int color)320 void StarCatalog::DrawSCAltAz(byte *img, const int color) 383 321 { 384 322 // … … 414 352 } 415 353 416 void StarCatalog::DrawSCRaDec( char*img, const int color)354 void StarCatalog::DrawSCRaDec(byte *img, const int color) 417 355 { 418 356 // … … 446 384 } 447 385 } 448 449 // DrawRaDec(color, img, 37.953, 89.2641, 10); 450 } 451 452 453 void StarCatalog::SetMjd(const double mjd) 454 { 455 fMjd = mjd; 456 fAlpha = slaGmst(mjd) + fElong; 457 458 cout << "UTC: " << mjd << endl; 459 460 // 461 // ----- calculate star independent parameters ---------- 462 // 463 slaMappa(2000.0, fMjd, fAmprms); 464 slaAoppa(fMjd, 0, // mjd, UT1-UTC 465 fElong, fPhi, 148, // gttingen long, lat, height 466 0, 0, // polar motion x, y-coordinate (radians) 467 273.155, 1013.25, 0.5, // temp, pressure, humidity 468 0.2, 0.0065, // wavelength, tropo lapse rate 469 fAoprms); 470 471 } 472 473 void StarCatalog::DrawCross(char *img, const int x, const int y) 386 } 387 388 void StarCatalog::DrawCross(byte *img, const int x, const int y) 474 389 { 475 390 for (int dx=-4; dx<5; dx++) … … 480 395 } 481 396 482 void StarCatalog::GetImg( char *img, char*cimg, const double utc,397 void StarCatalog::GetImg(byte *img, byte *cimg, const double utc, 483 398 const RaDec &radec) 484 399 { … … 486 401 memset(cimg, 0, 768*576); 487 402 488 SetMjd(utc);489 490 SetRaDec(radec , RaDec());403 sla.Set(utc); 404 //fAlpha = sla.GetAlpha(); 405 SetRaDec(radec); 491 406 492 407 DrawSCAltAz(cimg, 2<<4); … … 498 413 } 499 414 500 void StarCatalog::GetImg( char *img, char*cimg, const double utc,415 void StarCatalog::GetImg(byte *img, byte *cimg, const double utc, 501 416 const AltAz &altaz) 502 417 { … … 504 419 memset(cimg, 0, 768*576); 505 420 506 SetMjd(utc);507 421 sla.Set(utc); 422 //fAlpha = sla.GetAlpha(); 508 423 SetAltAz(altaz); 509 424 … … 516 431 } 517 432 518 void StarCatalog::DrawCircle(int color, char*img, int xx, int yy, int size)433 void StarCatalog::DrawCircle(int color, byte *img, int xx, int yy, int size) 519 434 { 520 435 for (int x=xx-size; x<xx+size+1; x++) … … 537 452 } 538 453 539 Bool_t StarCatalog::DrawAltAz(const int color, char*img, double alt, double az, int size)454 Bool_t StarCatalog::DrawAltAz(const int color, byte *img, double alt, double az, int size) 540 455 { 541 456 // … … 571 486 } 572 487 573 Bool_t StarCatalog::Draw(const int color, char*img, const AltAz &altaz)488 Bool_t StarCatalog::Draw(const int color, byte *img, const AltAz &altaz) 574 489 { 575 490 return DrawAltAz(color, img, altaz.Alt(), altaz.Az()); 576 491 } 577 492 578 Bool_t StarCatalog::Draw(const int color, char*img, const SaoFile *sao)493 Bool_t StarCatalog::Draw(const int color, byte *img, const SaoFile *sao) 579 494 { 580 495 // 581 496 // ---- mean to observed --- 582 497 // 583 AltAz altaz= RaDec2AltAz(sao->GetRaDec(), sao->GetRaDecPm()) * 360.0/D2PI;498 AltAz altaz=sla.CalcAltAz(sao->GetRaDec()) * 360.0/D2PI; 584 499 585 500 if (sao->MagV() > fLimitMag) … … 594 509 } 595 510 596 Bool_t StarCatalog::DrawRaDec(const int color, char*img, double ra, double dec, int size)511 Bool_t StarCatalog::DrawRaDec(const int color, byte *img, double ra, double dec, int size) 597 512 { 598 513 // … … 605 520 // radec[rad] -> hadec[rad] 606 521 // 607 const double ha = fAlpha-ra;522 const double ha = sla.GetAlpha()-ra; 608 523 609 524 // … … 611 526 // 612 527 double alt, az; 613 slaDe2h(ha, dec, fPhi, &az, &alt);528 slaDe2h(ha, dec, sla.GetPhi(), &az, &alt); 614 529 615 530 // … … 622 537 } 623 538 624 Bool_t StarCatalog::Draw(const int color, char*img, const RaDec &radec)539 Bool_t StarCatalog::Draw(const int color, byte *img, const RaDec &radec) 625 540 { 626 541 return DrawRaDec(color, img, radec.Ra(), radec.Dec()); 627 542 } 628 543 629 void StarCatalog::CalcImg( char*img)544 void StarCatalog::CalcImg(byte *img) 630 545 { 631 546 -
trunk/MagicSoft/Cosy/catalog/StarCatalog.h
r740 r808 8 8 #include "SaoFile.h" 9 9 #endif 10 #ifndef SLALIB_H 11 #include "Slalib.h" 12 #endif 10 13 11 14 #include "coord.h" 15 16 typedef unsigned char byte; 12 17 13 18 class StarCatalog … … 18 23 int fEntries; 19 24 20 double fPhi; // location of observatory 21 double fElong; 25 Slalib sla; 26 27 // double fPhi; // location of observatory 28 // double fElong; 22 29 23 30 double fPixSize; // [rad/pix] size of one pixel … … 28 35 29 36 AltAz fAltAz; // [rad] 30 charfAz0[360];37 byte fAz0[360]; 31 38 int fAltMin; 32 39 int fAltMax; … … 34 41 35 42 RaDec fRaDec; // [rad] 36 charfRa0[360];43 byte fRa0[360]; 37 44 int fRaCnt; 38 45 int fDecMin; 39 46 int fDecMax; 40 47 41 double fAlpha;42 double fMjd;43 double fAmprms[21];44 double fAoprms[14];48 // double fAlpha; 49 // double fMjd; 50 // double fAmprms[21]; 51 // double fAoprms[14]; 45 52 46 void DrawCross( char*img, const int x, const int y);47 void DrawCircle(int color, char*img, int xx, int yy, int size);53 void DrawCross(byte *img, const int x, const int y); 54 void DrawCircle(int color, byte *img, int xx, int yy, int size); 48 55 49 Bool_t DrawAltAz(const int color, char *img, double alt, double az,int size=0);50 Bool_t DrawRaDec(const int color, char*img, double ra, double dec, int size=0);56 Bool_t DrawAltAz(const int color, byte *img, double alt, double az, int size=0); 57 Bool_t DrawRaDec(const int color, byte *img, double ra, double dec, int size=0); 51 58 52 Bool_t Draw(const int color, char*img, const AltAz &altaz);53 Bool_t Draw(const int color, char*img, const RaDec &radec);54 Bool_t Draw(const int color, char*img, const SaoFile *sao);59 Bool_t Draw(const int color, byte *img, const AltAz &altaz); 60 Bool_t Draw(const int color, byte *img, const RaDec &radec); 61 Bool_t Draw(const int color, byte *img, const SaoFile *sao); 55 62 56 void CalcImg( char*);63 void CalcImg(byte *); 57 64 65 void SetRaDec(const RaDec &radec); 58 66 void SetAltAz(const AltAz &altaz); 59 void SetMjd(const double mjd); 60 void DrawSCAltAz(char *img, const int color); 61 void DrawSCRaDec(char *img, const int color); 62 void SetRaDec(const RaDec &radec, const RaDec &rdpm); 63 67 // void SetMjd(const double mjd); 68 void DrawSCAltAz(byte *img, const int color); 69 void DrawSCRaDec(byte *img, const int color); 70 64 71 void CalcRaDecRange(); 65 72 void CalcAltAzRange(); 66 73 67 RaDec AltAz2RaDec(const AltAz &altaz) const;68 AltAz RaDec2AltAz(const RaDec &radec, const RaDec &rdpm) const;74 // RaDec AltAz2RaDec(const AltAz &altaz) const; 75 // AltAz RaDec2AltAz(const RaDec &radec, const RaDec &rdpm) const; 69 76 70 77 public: … … 72 79 virtual ~StarCatalog(); 73 80 74 void GetImg( char *img, char*cimg, const double utc,81 void GetImg(byte *img, byte *cimg, const double utc, 75 82 const RaDec &radec); 76 void GetImg( char *img, char*cimg, const double utc,83 void GetImg(byte *img, byte *cimg, const double utc, 77 84 const AltAz &altaz); 78 85
Note:
See TracChangeset
for help on using the changeset viewer.