Ignore:
Timestamp:
05/09/09 13:48:12 (15 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/catalog
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/catalog/SlaPlanets.cc

    r8376 r9439  
    4040    double ra, dec, diam;
    4141
    42     // One can use TT instead of TDB for all plenets
     42    // One can use TT instead of TDB for all planets
    4343    // (except the moon)
    4444    // TDB, planet, elong, phi, *ra, *dec, *diam
  • trunk/MagicSoft/Cosy/catalog/SlaStars.cc

    r8847 r9439  
    4949             0, 0,                         // polar motion x, y-coordinate (radians)
    5050             // 273.155, 1013.25, 0.5,     // temp, pressure, humidity
    51              273.155+20, 1013.25, 0.5,     // temp, pressure, humidity
     51             273.155+10, 780.0, 0.25,     // temp, pressure, humidity
    5252             // 0.2, 0.0065,               // wavelength, tropo lapse rate
    5353             0.55, 0.0065,                 // wavelength, tropo lapse rate
  • trunk/MagicSoft/Cosy/catalog/Slalib.cc

    r8847 r9439  
    1818Double_t Slalib::Trunc(Double_t val)
    1919{
    20     /* dint(A) - truncate to nearest whole number towards zero (double) */
     20    // dint(A) - truncate to nearest whole number towards zero (double)
    2121    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);
    2822}
    2923
     
    4034    SetMjd(fTime.GetMjd()+offset/(24*60*60));
    4135}
    42 
    4336
    4437ZdAz Slalib::XYZ2ZdAz(double coord[3]) const
  • trunk/MagicSoft/Cosy/catalog/Slalib.h

    r8847 r9439  
    1919    double fAlpha;
    2020
    21     static Double_t Round(Double_t val);
    2221    static Double_t Trunc(Double_t val);
    2322
  • trunk/MagicSoft/Cosy/catalog/StarCatalog.cc

    r8848 r9439  
    1717using namespace std;
    1818
    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)
     19StarCatalog::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)
    2020{
    2121    fAstro = new MAstroCatalog;
     
    3232{
    3333    // pixsize [arcsec/pixel]
    34     fPixSize = D2PI/360.0*pixsize/3600; // [rad / (deg*pixel)]
     34    fPixSize = TMath::DegToRad()*pixsize/3600; // [rad / (deg*pixel)]
    3535    fAstro->SetRadiusFOV(pixsize, 768, 576);
     36    // fov = hypot(768, 576)/2*pixsize/3600;
    3637}
    3738
    3839double StarCatalog::GetPixSize() const
    3940{
    40     return fPixSize*3600*360.0/D2PI;
     41    return fPixSize*3600*TMath::RadToDeg();
    4142}
    4243
     
    5556void StarCatalog::SetAltAz(const AltAz &altaz)
    5657{
    57     fAltAz = altaz * D2PI/360.0;
     58    fAltAz = altaz * TMath::DegToRad();
    5859    fRaDec = CalcRaDec(fAltAz);
    5960
     
    7273void StarCatalog::SetRaDec(const RaDec &radec)
    7374{
    74     const RaDec rd = fRaDec*360.0/D2PI;;
     75    const RaDec rd = fRaDec*TMath::RadToDeg();
    7576
    7677    const Bool_t same =
     
    7879        rd.Dec()>radec.Dec()-1e-5 && rd.Dec()<radec.Dec()+1e-5;
    7980
    80     fRaDec = radec * D2PI/360.0;
     81    fRaDec = radec * TMath::DegToRad();
    8182    fAltAz = CalcAltAz(fRaDec);
    8283
     
    153154
    154155void 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;
    164160
    165161    // Allow catalog stars to be a bit outside [0.2deg] of the
    166162    // 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;
    169166
    170167    // CalcStars flips the picture in X defaultwise now
    171168    // 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/*
    172174    const int x0 = TMath::Max((768-xc)-box,   -offset);
    173     const int y0 = TMath::Max(yc-box,         -offset);
    174175    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/*
    177182    // Align stars into telescope system
    178183    // (Move the telescope to pointing position)
     
    181186    align.RotateY(-(TMath::Pi()/2-fAltAz.Alt()));
    182187    align.RotateZ(TMath::Pi()/2);
     188 */
     189
     190    TRotation rot;
     191    rot.RotateY(-(TMath::Pi()/2-fAltAz.Alt()));
    183192
    184193    // Get List of stars from catalog
     
    200209        const ZdAz  za(CalcZdAz(rd));
    201210
     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/*
    202231        // Virtually move telescope to pointing position
    203232        TVector3 loc;
     
    215244
    216245        // 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*/
    219251        // if (loc.Mod2()>fRadiusFOV*fRadiusFOV)
    220252        //     continue;
    221253
     254
    222255        // Rotate by the rotation angle of the video camera
    223256        // 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;
    226259
    227260        // Check if the resulting star is in the
     
    235268}
    236269
     270/*
    237271AltAz StarCatalog::CalcAltAzFromPix(Double_t pixx, Double_t pixy) const
    238272{
     
    251285    return AltAz(-dec, ha+fAltAz.Az());
    252286}
     287*/
     288
     289ZdAz 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  
    4141
    4242    void   SetRaDec(const RaDec &radec);
    43     void   SetAltAz(const AltAz &altaz);
    4443
    45     int    fBox;
     44    int    fBoxX;
     45    int    fBoxY;
    4646
    4747public:
    4848    StarCatalog(MObservatory::LocationName_t key);
    4949    virtual ~StarCatalog();
     50
     51    void   SetAltAz(const AltAz &altaz);
    5052
    5153    void GetImg(byte *img, byte *cimg, MStarList &list) const;
     
    6567    double GetPixSize() const;
    6668
    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;
    6871
    6972    virtual void SetMjd(double mjd);
     
    7578
    7679    //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;
    7881    static void DrawStars(MStarList &list, byte *img);
    7982
    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; }
    8185
    8286    ClassDef(StarCatalog, 0)
Note: See TracChangeset for help on using the changeset viewer.