Changeset 9439 for trunk/MagicSoft/Cosy/catalog
- Timestamp:
- 05/09/09 13:48:12 (16 years ago)
- Location:
- trunk/MagicSoft/Cosy/catalog
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/catalog/SlaPlanets.cc
r8376 r9439 40 40 double ra, dec, diam; 41 41 42 // One can use TT instead of TDB for all pl enets42 // One can use TT instead of TDB for all planets 43 43 // (except the moon) 44 44 // TDB, planet, elong, phi, *ra, *dec, *diam -
trunk/MagicSoft/Cosy/catalog/SlaStars.cc
r8847 r9439 49 49 0, 0, // polar motion x, y-coordinate (radians) 50 50 // 273.155, 1013.25, 0.5, // temp, pressure, humidity 51 273.155+ 20, 1013.25, 0.5, // temp, pressure, humidity51 273.155+10, 780.0, 0.25, // temp, pressure, humidity 52 52 // 0.2, 0.0065, // wavelength, tropo lapse rate 53 53 0.55, 0.0065, // wavelength, tropo lapse rate -
trunk/MagicSoft/Cosy/catalog/Slalib.cc
r8847 r9439 18 18 Double_t Slalib::Trunc(Double_t val) 19 19 { 20 / * dint(A) - truncate to nearest whole number towards zero (double) */20 // dint(A) - truncate to nearest whole number towards zero (double) 21 21 return val<0 ? TMath::Ceil(val) : TMath::Floor(val); 22 }23 24 Double_t Slalib::Round(Double_t val)25 {26 /* dnint(A) - round to nearest whole number (double) */27 return val<0 ? TMath::Ceil(val-0.5) : TMath::Floor(val+0.5);28 22 } 29 23 … … 40 34 SetMjd(fTime.GetMjd()+offset/(24*60*60)); 41 35 } 42 43 36 44 37 ZdAz Slalib::XYZ2ZdAz(double coord[3]) const -
trunk/MagicSoft/Cosy/catalog/Slalib.h
r8847 r9439 19 19 double fAlpha; 20 20 21 static Double_t Round(Double_t val);22 21 static Double_t Trunc(Double_t val); 23 22 -
trunk/MagicSoft/Cosy/catalog/StarCatalog.cc
r8848 r9439 17 17 using namespace std; 18 18 19 StarCatalog::StarCatalog(MObservatory::LocationName_t key) : SlaStars(key), fW(768), fH(576), fAstro(0), /*fSao(NULL), fSrt(NULL), fEntries(0),*/ fSinAngle(0), fCosAngle(1), fBox (768)19 StarCatalog::StarCatalog(MObservatory::LocationName_t key) : SlaStars(key), fW(768), fH(576), fAstro(0), /*fSao(NULL), fSrt(NULL), fEntries(0),*/ fSinAngle(0), fCosAngle(1), fBoxX(768), fBoxY(576) 20 20 { 21 21 fAstro = new MAstroCatalog; … … 32 32 { 33 33 // pixsize [arcsec/pixel] 34 fPixSize = D2PI/360.0*pixsize/3600; // [rad / (deg*pixel)]34 fPixSize = TMath::DegToRad()*pixsize/3600; // [rad / (deg*pixel)] 35 35 fAstro->SetRadiusFOV(pixsize, 768, 576); 36 // fov = hypot(768, 576)/2*pixsize/3600; 36 37 } 37 38 38 39 double StarCatalog::GetPixSize() const 39 40 { 40 return fPixSize*3600* 360.0/D2PI;41 return fPixSize*3600*TMath::RadToDeg(); 41 42 } 42 43 … … 55 56 void StarCatalog::SetAltAz(const AltAz &altaz) 56 57 { 57 fAltAz = altaz * D2PI/360.0;58 fAltAz = altaz * TMath::DegToRad(); 58 59 fRaDec = CalcRaDec(fAltAz); 59 60 … … 72 73 void StarCatalog::SetRaDec(const RaDec &radec) 73 74 { 74 const RaDec rd = fRaDec* 360.0/D2PI;;75 const RaDec rd = fRaDec*TMath::RadToDeg(); 75 76 76 77 const Bool_t same = … … 78 79 rd.Dec()>radec.Dec()-1e-5 && rd.Dec()<radec.Dec()+1e-5; 79 80 80 fRaDec = radec * D2PI/360.0;81 fRaDec = radec * TMath::DegToRad(); 81 82 fAltAz = CalcAltAz(fRaDec); 82 83 … … 153 154 154 155 void StarCatalog::CalcStars(MStarList &list, int xc, int yc, 155 int xo, int yo) const 156 { 157 // For an apropriate unit conversion to pixels [pix/rad] 158 const Double_t scale = TMath::RadToDeg()*TMath::Sqrt(768*768 + 576*576)/(fAstro->GetRadiusFOV()*2); 159 160 // Offsets to shift [-n/2;n/2] to [0;n] and to 161 // move the stars in the counterdirection of the LEDs 162 const Int_t offx = 768/2 + xo; 163 const Int_t offy = 576/2 + yo; 156 float offx, float offy) const 157 { 158 // const Int_t offx = 768/2 + xo; 159 // const Int_t offy = 576/2 + yo; 164 160 165 161 // Allow catalog stars to be a bit outside [0.2deg] of the 166 162 // monitored window. To get the std behaviour set offset=0 167 const Int_t offset = TMath::Nint(0.2*TMath::DegToRad()*scale); 168 const Int_t box = fBox+offset; 163 const Int_t offset = TMath::Nint(0.2*TMath::DegToRad()/fPixSize); 164 const Int_t boxx = fBoxX+offset; 165 const Int_t boxy = fBoxY+offset; 169 166 170 167 // CalcStars flips the picture in X defaultwise now 171 168 // This defined the box in which stars are really returned 169 const int x0 = TMath::Max((768-xc)-boxx, -offset); 170 const int y0 = TMath::Max(yc-boxy, -offset); 171 const int x1 = TMath::Min((768-xc)+boxx, fW+offset); 172 const int y1 = TMath::Min(yc+boxy, fH+offset); 173 /* 172 174 const int x0 = TMath::Max((768-xc)-box, -offset); 173 const int y0 = TMath::Max(yc-box, -offset);174 175 const int x1 = TMath::Min((768-xc)+box, fW+offset); 175 const int y1 = TMath::Min(yc+box, fH+offset); 176 176 177 const int y0 = TMath::Max(yc-box-100, -offset); 178 const int y1 = TMath::Min(yc+box+100, fH+offset); 179 */ 180 181 /* 177 182 // Align stars into telescope system 178 183 // (Move the telescope to pointing position) … … 181 186 align.RotateY(-(TMath::Pi()/2-fAltAz.Alt())); 182 187 align.RotateZ(TMath::Pi()/2); 188 */ 189 190 TRotation rot; 191 rot.RotateY(-(TMath::Pi()/2-fAltAz.Alt())); 183 192 184 193 // Get List of stars from catalog … … 200 209 const ZdAz za(CalcZdAz(rd)); 201 210 211 TVector3 v; 212 //v.SetMagThetaPhi(1., TMath::Pi()/2-za.Alt(), za.Az()-fAltAz.Az()); 213 v.SetMagThetaPhi(1., za.Zd(), za.Az()-fAltAz.Az()); 214 v *= rot; 215 216 if (v(2)<0) 217 continue; 218 219 // Stretch such, that the Z-component is alwas the same. Now 220 // X and Y contains the intersection point between the star-light 221 // and the plain of a virtual plain screen (ccd...) 222 v *= 1./v(2); 223 224 // Do unit conversion to pixels 225 v *= 1./fPixSize; 226 227 const Double_t x = -v.Y(); 228 const Double_t y = v.X(); 229 230 /* 202 231 // Virtually move telescope to pointing position 203 232 TVector3 loc; … … 215 244 216 245 // Do an apropriate unit conversion to pixels 217 loc *= scale; 218 246 loc *= 1./fPixSize; 247 248 const Double_t x = loc.X(); 249 const Double_t y = loc.Y(); 250 */ 219 251 // if (loc.Mod2()>fRadiusFOV*fRadiusFOV) 220 252 // continue; 221 253 254 222 255 // Rotate by the rotation angle of the video camera 223 256 // and add the offsets on both axis 224 Float_t xx = loc.X()*fCosAngle - loc.Y()*fSinAngle +offx;225 Float_t yy = loc.X()*fSinAngle + loc.Y()*fCosAngle +offy;257 const Double_t xx = x*fCosAngle - y*fSinAngle + 768 - offx; 258 const Double_t yy = x*fSinAngle + y*fCosAngle + offy; 226 259 227 260 // Check if the resulting star is in the … … 235 268 } 236 269 270 /* 237 271 AltAz StarCatalog::CalcAltAzFromPix(Double_t pixx, Double_t pixy) const 238 272 { … … 251 285 return AltAz(-dec, ha+fAltAz.Az()); 252 286 } 287 */ 288 289 ZdAz StarCatalog::CalcDeltaZdAzFromPix(Double_t dpixx, Double_t dpixy) const 290 { 291 double dx = dpixx*fCosAngle + dpixy*fSinAngle; 292 double dy = -dpixx*fSinAngle + dpixy*fCosAngle; 293 294 TVector3 loc(dy, -dx, 1./fPixSize); 295 296 loc.RotateY(TMath::Pi()/2-fAltAz.Alt()); 297 298 return ZdAz(loc.Theta()-TMath::Pi()/2+fAltAz.Alt(), -loc.Phi()); 299 300 /* 301 // Align stars into telescope system 302 // (Move the telescope to pointing position) 303 TRotation align; 304 align.RotateZ(-fAltAz.Az()); 305 align.RotateY(-(TMath::Pi()/2-fAltAz.Alt())); 306 align.RotateZ(TMath::Pi()/2); 307 308 309 TVector3 loc(dx, dy, 1./fPixSize); 310 311 loc *= align.Inverse(); 312 313 cout << (TMath::Pi()/2-loc.Theta()-alt)*TMath::RadToDeg() << " " << (loc.Phi()-az)*TMath::RadToDeg() << endl; 314 315 316 317 TVector3 loc(dx, -dy, 1./fPixSize); 318 319 loc *= align.Inverse(); 320 321 return ZdAz(loc.Theta(), loc.Phi());*/ 322 } -
trunk/MagicSoft/Cosy/catalog/StarCatalog.h
r9435 r9439 41 41 42 42 void SetRaDec(const RaDec &radec); 43 void SetAltAz(const AltAz &altaz);44 43 45 int fBox; 44 int fBoxX; 45 int fBoxY; 46 46 47 47 public: 48 48 StarCatalog(MObservatory::LocationName_t key); 49 49 virtual ~StarCatalog(); 50 51 void SetAltAz(const AltAz &altaz); 50 52 51 53 void GetImg(byte *img, byte *cimg, MStarList &list) const; … … 65 67 double GetPixSize() const; 66 68 67 AltAz CalcAltAzFromPix(Double_t pixx, Double_t pixy) const; 69 //AltAz CalcAltAzFromPix(Double_t pixx, Double_t pixy) const; 70 ZdAz CalcDeltaZdAzFromPix(Double_t pixx, Double_t pixy) const; 68 71 69 72 virtual void SetMjd(double mjd); … … 75 78 76 79 //void CalcStars(MStarList &list); 77 void CalcStars(MStarList &list, int xc, int yc, int xo, int yo) const;80 void CalcStars(MStarList &list, int xc, int yc, float xo, float yo) const; 78 81 static void DrawStars(MStarList &list, byte *img); 79 82 80 void SetBox(int box) { fBox = box; } 83 void SetBox(int box) { fBoxX = fBoxY = box; } 84 void SetBox(int boxx, int boxy) { fBoxX = boxx; fBoxY=boxy; } 81 85 82 86 ClassDef(StarCatalog, 0)
Note:
See TracChangeset
for help on using the changeset viewer.