IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36903


Ignore:
Timestamp:
Jun 17, 2014, 11:56:32 PM (12 years ago)
Author:
eugene
Message:

addstar and relastro can build; still working on psastro

Location:
branches/eam_branches/ipp-20140610/Ohana/src
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/SEDfit.c

    r34405 r36903  
    162162    }
    163163
     164    double R = incat[0].average[i].R;
     165    double D = incat[0].average[i].D;
     166
    164167    for (j = 0; valid && (j < Nmodel); j++) {
    165168      n = modelRow[j];
    166169      dvo_measure_init (&outcat[0].measure[Nmeas]);
    167       outcat[0].measure[Nmeas].dR        = 0.0;
    168       outcat[0].measure[Nmeas].dD        = 0.0;
     170      outcat[0].measure[Nmeas].R         = R;
     171      outcat[0].measure[Nmeas].D         = D;
    169172      outcat[0].measure[Nmeas].M         = table[0].row[minFit.row][0].mags[n] + minFit.Md;
    170173      outcat[0].measure[Nmeas].dM        = 0.0;
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches.c

    r36485 r36903  
    160160
    161161      // the following measure elements cannot be set until here:
    162       catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
    163       catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N].average.D);
     162      catalog[0].measure[Nmeas].R        = stars[N].average.R;
     163      catalog[0].measure[Nmeas].D        = stars[N].average.D;
    164164      catalog[0].measure[Nmeas].dbFlags  = 0;
    165165      catalog[0].measure[Nmeas].averef   = n; // this must be an absolute sequence number, if partial average is loaded
     
    167167      catalog[0].measure[Nmeas].catID    = catalog[0].catID;
    168168
     169      float dRoff = dvoOffsetR(&catalog[0].measure[Nmeas], &catalog[0].average[n]);
     170
    169171      // rationalize dR:
    170       if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) {
     172      if (dRoff > +180.0*3600.0) {
    171173          // average on high end of boundary, move star up
    172           stars[N].average.R += 360.0;
    173           catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
    174       }
    175       if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) {
     174          catalog[0].measure[Nmeas].R += 360.0;
     175          dRoff -= 360.0*3600.0;
     176      }
     177      if (dRoff < -180.0*3600.0) {
    176178          // average on low end of boundary, move star down
    177           stars[N].average.R -= 360.0;
    178           catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
    179       }
    180       if (fabs(catalog[0].measure[Nmeas].dR) > 10*RADIUS) {
     179          catalog[0].measure[Nmeas].R -= 360.0;
     180          dRoff += 360.0*3600.0;
     181      }
     182      if (dRoff > 10*RADIUS) {
    181183          fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n",
    182184                   catalog[0].average[n].R, catalog[0].average[n].D,
     
    274276
    275277      // the following measure elements cannot be set until here:
    276       catalog[0].measure[Nmeas].dR              = 0.0;
    277       catalog[0].measure[Nmeas].dD              = 0.0;
     278      catalog[0].measure[Nmeas].R               = stars[i].average.R;
     279      catalog[0].measure[Nmeas].D               = stars[i].average.D;
    278280      catalog[0].measure[Nmeas].dbFlags         = 0;
    279281      catalog[0].measure[Nmeas].averef          = Nave; // XXX EAM : must be absolute Nave if partial read
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches_closest.c

    r36485 r36903  
    187187
    188188    /** dR,dD now represent arcsec **/
    189     catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
    190     catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N].average.D);
     189    catalog[0].measure[Nmeas].R        = stars[N].average.R;
     190    catalog[0].measure[Nmeas].D        = stars[N].average.D;
    191191    catalog[0].measure[Nmeas].dbFlags  = 0;
    192192    catalog[0].measure[Nmeas].averef   = n;
     
    194194    catalog[0].measure[Nmeas].catID    = catalog[0].catID;
    195195
     196    float dRoff = dvoOffsetR(&catalog[0].measure[Nmeas], &catalog[0].average[n]);
     197
    196198    // rationalize dR
    197     if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) {
     199    if (dRoff > +180.0*3600.0) {
    198200      // average on high end of boundary, move star up
    199       stars[N].average.R += 360.0;
    200       catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
    201     }
    202     if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) {
     201      catalog[0].measure[Nmeas].R += 360.0;
     202      dRoff -= 360.0*3600.0;
     203    }
     204    if (dRoff < -180.0*3600.0) {
    203205      // average on low end of boundary, move star down
    204       stars[N].average.R -= 360.0;
    205       catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
    206     }
    207     if (fabs(catalog[0].measure[Nmeas].dR) > 10*RADIUS) {
     206      catalog[0].measure[Nmeas].R -= 360.0;
     207      dRoff += 360.0*3600.0;
     208    }
     209    if (dRoff > 10*RADIUS) {
    208210      fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n",
    209211               catalog[0].average[n].R, catalog[0].average[n].D,
     
    282284
    283285        // the following measure elements cannot be set until here:
    284         catalog[0].measure[Nmeas].dR       = 0.0; // astrometric offset, not error
    285         catalog[0].measure[Nmeas].dD       = 0.0; // astrometric offset, not error
     286        catalog[0].measure[Nmeas].R        = stars[i].average.R;
     287        catalog[0].measure[Nmeas].D        = stars[i].average.D;
    286288        catalog[0].measure[Nmeas].dbFlags  = 0;
    287289        catalog[0].measure[Nmeas].averef   = Nave;
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches_closest_refstars.c

    r36485 r36903  
    180180
    181181    /** *** dR,dD now in arcsec *** **/
    182     catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
    183     catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N][0].average.D);
     182    catalog[0].measure[Nmeas].R        = stars[N][0].average.R;
     183    catalog[0].measure[Nmeas].D        = stars[N][0].average.D;
    184184    catalog[0].measure[Nmeas].dbFlags  = 0;
    185185    catalog[0].measure[Nmeas].averef   = n;
     
    187187    catalog[0].measure[Nmeas].catID    = catalog[0].catID;
    188188
     189    float dRoff = dvoOffsetR(&catalog[0].measure[Nmeas], &catalog[0].average[n]);
     190
    189191    // rationalize dR:
    190     if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) {
     192    if (dRoff > +180.0*3600.0) {
    191193      // average on high end of boundary, move star up
    192       stars[N][0].average.R += 360.0;
    193       catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
    194     }
    195     if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) {
     194      catalog[0].measure[Nmeas].R += 360.0;
     195      dRoff -= 360.0*3600.0;
     196    }
     197    if (dRoff < -180.0*3600.0) {
    196198      // average on low end of boundary, move star down
    197       stars[N][0].average.R -= 360.0;
    198       catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
     199      catalog[0].measure[Nmeas].R -= 360.0;
     200      dRoff += 360.0*3600.0;
    199201    }
    200202
     
    290292      catalog[0].measure[Nmeas]          = stars[N][0].measure;
    291293
    292       catalog[0].measure[Nmeas].dR       = 0.0; // astrometric offset, not error
    293       catalog[0].measure[Nmeas].dD       = 0.0; // astrometric offset, not error
     294      catalog[0].measure[Nmeas].R       = catalog[0].average[Nave].R;
     295      catalog[0].measure[Nmeas].D       = catalog[0].average[Nave].D;
    294296      catalog[0].measure[Nmeas].dbFlags  = 0;
    295297      catalog[0].measure[Nmeas].averef   = Nave;
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches_refstars.c

    r36485 r36903  
    141141      catalog[0].measure[Nmeas]          = stars[N][0].measure;
    142142
    143       /** *** dR,dD now in arcsec *** **/
    144       catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
    145       catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N][0].average.D);
     143      /** measure now stores R,D **/
     144      catalog[0].measure[Nmeas].R        = stars[N][0].average.R;
     145      catalog[0].measure[Nmeas].D        = stars[N][0].average.D;
    146146      catalog[0].measure[Nmeas].dbFlags  = 0;
    147147      catalog[0].measure[Nmeas].averef   = n;
     
    149149      catalog[0].measure[Nmeas].catID    = catalog[0].catID;
    150150
     151      float dRoff = dvoOffsetR(&catalog[0].measure[Nmeas], &catalog[0].average[n]);
     152
    151153      // rationalize dR:
    152       if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) {
     154      if (dRoff > +180.0*3600.0) {
    153155          // average on high end of boundary, move star up
    154           stars[N][0].average.R += 360.0;
    155           catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
    156       }
    157       if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) {
     156          catalog[0].measure[Nmeas].R += 360.0;
     157          dRoff -= 360.0*3600.0;
     158      }
     159      if (dRoff < -180.0*3600.0) {
    158160          // average on low end of boundary, move star down
    159           stars[N][0].average.R -= 360.0;
    160           catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
     161          catalog[0].measure[Nmeas].R -= 360.0;
     162          dRoff += 360.0*3600.0;
    161163      }
    162164
     
    262264      catalog[0].measure[Nmeas]          = stars[N][0].measure;
    263265
    264       catalog[0].measure[Nmeas].dR       = 0.0;
    265       catalog[0].measure[Nmeas].dD       = 0.0;
     266      catalog[0].measure[Nmeas].R        = stars[N][0].average.R;
     267      catalog[0].measure[Nmeas].D        = stars[N][0].average.D;
    266268
    267269      catalog[0].measure[Nmeas].t        = (stars[N][0].measure.t == 0) ? TIMEREF : stars[N][0].measure.t;      /** careful : time_t vs e_time **/
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/load2mass_catalog.c

    r35416 r36903  
    1717  for (i = 0; i < Nstars; i+=3) {
    1818
     19    double R = stars[i].average.R;
     20    double D = stars[i].average.D;
     21
    1922    // construct an average object for this object
    2023    // XXX for now, the output objects will have limited astrometric interpretation...
    2124    // XXX every 3 stars represents 3 measurements and 1 average
    2225    dvo_average_init (&catalog[0].average[Nave]);
    23     catalog[0].average[Nave].R     = stars[i].average.R;
    24     catalog[0].average[Nave].D     = stars[i].average.D;
     26    catalog[0].average[Nave].R     = R;
     27    catalog[0].average[Nave].D     = D;
    2528    catalog[0].average[Nave].measureOffset = Nmeas;
    2629
     
    3336      catalog[0].measure[Nmeas]           = stars[i+j].measure;
    3437
    35       catalog[0].measure[Nmeas].dR        = 0.0;
    36       catalog[0].measure[Nmeas].dD        = 0.0;
     38      catalog[0].measure[Nmeas].R         = R;
     39      catalog[0].measure[Nmeas].D         = D;
    3740      catalog[0].measure[Nmeas].dt        = NAN_S_SHORT;
    3841
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/replace_match.c

    r26278 r36903  
    1212    j = i + m;
    1313    if (measure[j].photcode != star[0].measure.photcode) continue;
    14     measure[j].dR = 3600.0*(average[0].R - star[0].average.R);
    15     measure[j].dD = 3600.0*(average[0].D - star[0].average.D);
     14    measure[j].R = star[0].average.R;
     15    measure[j].D = star[0].average.D;
    1616    measure[j].M  = star[0].measure.M;
    1717    measure[j].dM = star[0].measure.dM;
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/update_coords.c

    r34405 r36903  
    1919      continue;
    2020    }
    21     R = measure[m].dR;
    22     D = measure[m].dD;
     21    R = measure[m].R;
     22    D = measure[m].D;
    2323    r += R;
    2424    d += D;
     
    3333  r = r / Npt;  /* these are corrections in 1/100 arcsec to RA and DEC */
    3434  d = d / Npt;
    35   average[0].R -= r / 3600.0;
    36   average[0].D -= d / 3600.0;
     35  average[0].R = r;
     36  average[0].D = d;
    3737  m = average[0].measureOffset;  /* first measurement of this star */
    38   for (i = 0; i < average[0].Nmeasure; i++) {
    39     measure[m].dR -= r;
    40     measure[m].dD -= d;
    41     m = next[m];
    42   }
    43  
     38
    4439  /* measure scatter, if possible */
    4540  if (Npt < 2) return;
     
    4742  dR2 = r2 / Npt - r*r;
    4843  dD2 = d2 / Npt - d*d;
    49   average[0].ChiSqAve = sqrt (dD2 + dR2 / SQ(cos(d*RAD_DEG)));
     44  average[0].ChiSqAve = 3600.0*sqrt (dD2 + dR2 / SQ(cos(d*RAD_DEG)));
    5045  /* ChiSqAve is supposed to be a chisq */
    5146
  • branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/BrightCatalog.c

    r36833 r36903  
    6868 
    6969    // need to create and assign to flat-field correction
    70     GET_COLUMN(dR,        "RA_OFF",     float);
    71     GET_COLUMN(dD,        "DEC_OFF",    float);
     70    GET_COLUMN(R,         "RA",         double);
     71    GET_COLUMN(D,         "DEC",        double);
    7272    GET_COLUMN(M,         "MAG_SYS",    float);
    7373    GET_COLUMN(Mcal,      "MAG_CAL",    float);
     
    9292    ALLOCATE (measure, MeasureTiny, Nrow);
    9393    for (i = 0; i < Nrow; i++) {
    94       measure[i].dR        = dR[i];
    95       measure[i].dD        = dD[i];
     94      measure[i].R         = R[i];
     95      measure[i].D         = D[i];
    9696      measure[i].M         = M[i];
    9797      measure[i].Mcal      = Mcal[i];
     
    113113    // fprintf (stderr, "loaded data for %lld measures\n", (long long) Nrow);
    114114
    115     free (dR      );
    116     free (dD      );
     115    free (R       );
     116    free (D       );
    117117    free (M       );
    118118    free (Mcal    );
     
    262262    GET_COLUMN(Ncode, "NCODE",    short);
    263263    GET_COLUMN(Nused, "NUSED",    short);
    264     GET_COLUMN(M_20,  "MAG_20",   short);
    265     GET_COLUMN(M_80,  "MAG_80",   short);
     264    GET_COLUMN(Mmin,  "MAG_MIN",  float);
     265    GET_COLUMN(Mmax,  "MAG_MAX",  float);
    266266    gfits_free_header (&theader);
    267267    gfits_free_table  (&ftable);
     
    276276      secfilt[i].Ncode = Ncode[i];
    277277      secfilt[i].Nused = Nused[i];
    278       secfilt[i].M_20  = M_20[i];
    279       secfilt[i].M_80  = M_80[i];
     278      secfilt[i].Mmin  = Mmin[i];
     279      secfilt[i].Mmax  = Mmax[i];
    280280    }
    281281    fprintf (stderr, "loaded data for %lld averages\n", (long long) Nrow);
     
    287287    free (Ncode);
    288288    free (Nused);
    289     free (M_20 );
    290     free (M_80 );
     289    free (Mmin );
     290    free (Mmax );
    291291    catalog->secfilt = secfilt;
    292292    // assert Nsecfilt * Naverage = Nrow?
     
    363363
    364364    // create intermediate storage arrays
    365     float *dR        ; ALLOCATE (dR       ,  float, catalog->Nmeasure);
    366     float *dD        ; ALLOCATE (dD       ,  float, catalog->Nmeasure);
    367     float *M         ; ALLOCATE (M        ,  float, catalog->Nmeasure);
    368     float *Mcal      ; ALLOCATE (Mcal     ,  float, catalog->Nmeasure);
    369     float *dM        ; ALLOCATE (dM       ,  float, catalog->Nmeasure);
    370     float *airmass   ; ALLOCATE (airmass  ,  float, catalog->Nmeasure);
    371     float *Xccd      ; ALLOCATE (Xccd     ,  float, catalog->Nmeasure);
    372     float *Yccd      ; ALLOCATE (Yccd     ,  float, catalog->Nmeasure);
    373     float *Xfix      ; ALLOCATE (Xfix     ,  float, catalog->Nmeasure);
    374     float *Yfix      ; ALLOCATE (Yfix     ,  float, catalog->Nmeasure);
    375     float *dt        ; ALLOCATE (dt       ,  float, catalog->Nmeasure);
    376     int   *t         ; ALLOCATE (t        ,  int  , catalog->Nmeasure);
    377     int   *averef    ; ALLOCATE (averef   ,  int  , catalog->Nmeasure);
    378     int   *imageID   ; ALLOCATE (imageID  ,  int  , catalog->Nmeasure);
    379     int   *dbFlags   ; ALLOCATE (dbFlags  ,  int  , catalog->Nmeasure);
    380     int   *photFlags ; ALLOCATE (photFlags,  int  , catalog->Nmeasure);
    381     int   *catID     ; ALLOCATE (catID    ,  int  , catalog->Nmeasure);
    382     short *photcode  ; ALLOCATE (photcode ,  short, catalog->Nmeasure);
     365    double *R         ; ALLOCATE (R        ,  double, catalog->Nmeasure);
     366    double *D         ; ALLOCATE (D        ,  double, catalog->Nmeasure);
     367    float  *M         ; ALLOCATE (M        ,  float, catalog->Nmeasure);
     368    float  *Mcal      ; ALLOCATE (Mcal     ,  float, catalog->Nmeasure);
     369    float  *dM        ; ALLOCATE (dM       ,  float, catalog->Nmeasure);
     370    float  *airmass   ; ALLOCATE (airmass  ,  float, catalog->Nmeasure);
     371    float  *Xccd      ; ALLOCATE (Xccd     ,  float, catalog->Nmeasure);
     372    float  *Yccd      ; ALLOCATE (Yccd     ,  float, catalog->Nmeasure);
     373    float  *Xfix      ; ALLOCATE (Xfix     ,  float, catalog->Nmeasure);
     374    float  *Yfix      ; ALLOCATE (Yfix     ,  float, catalog->Nmeasure);
     375    float  *dt        ; ALLOCATE (dt       ,  float, catalog->Nmeasure);
     376    int    *t         ; ALLOCATE (t        ,  int  , catalog->Nmeasure);
     377    int    *averef    ; ALLOCATE (averef   ,  int  , catalog->Nmeasure);
     378    int    *imageID   ; ALLOCATE (imageID  ,  int  , catalog->Nmeasure);
     379    int    *dbFlags   ; ALLOCATE (dbFlags  ,  int  , catalog->Nmeasure);
     380    int    *photFlags ; ALLOCATE (photFlags,  int  , catalog->Nmeasure);
     381    int    *catID     ; ALLOCATE (catID    ,  int  , catalog->Nmeasure);
     382    short  *photcode  ; ALLOCATE (photcode ,  short, catalog->Nmeasure);
    383383
    384384    // assign the storage arrays
    385385    MeasureTiny *measure = catalog->measure;
    386386    for (i = 0; i < catalog->Nmeasure; i++) {
    387       dR[i]       = measure[i].dR       ;
    388       dD[i]       = measure[i].dD       ;
     387      R[i]        = measure[i].R        ;
     388      D[i]        = measure[i].D        ;
    389389      M[i]        = measure[i].M        ;
    390390      Mcal[i]     = measure[i].Mcal     ;
     
    406406
    407407    // add the columns to the output array
    408     gfits_set_bintable_column (&theader, &ftable, "RA_OFF",     dR,        catalog->Nmeasure);
    409     gfits_set_bintable_column (&theader, &ftable, "DEC_OFF",    dD,        catalog->Nmeasure);
     408    gfits_set_bintable_column (&theader, &ftable, "RA",         R,         catalog->Nmeasure);
     409    gfits_set_bintable_column (&theader, &ftable, "DEC",        D,         catalog->Nmeasure);
    410410    gfits_set_bintable_column (&theader, &ftable, "MAG_SYS",    M,         catalog->Nmeasure);
    411411    gfits_set_bintable_column (&theader, &ftable, "MAG_CAL",    Mcal,      catalog->Nmeasure);
     
    425425    gfits_set_bintable_column (&theader, &ftable, "PHOTCODE",   photcode,  catalog->Nmeasure);
    426426
    427     free (dR      );
    428     free (dD      );
     427    free (R       );
     428    free (D       );
    429429    free (M       );
    430430    free (Mcal    );
     
    629629    gfits_define_bintable_column (&theader, "I", "NCODE",    "magnitude (err)",           NULL,    1.0, 0.0);
    630630    gfits_define_bintable_column (&theader, "I", "NUSED",    "airmass",                   NULL,    1.0, 0.0);
    631     gfits_define_bintable_column (&theader, "I", "MAG_20",   "ccd x coord",              "pix",    1.0, 0.0);
    632     gfits_define_bintable_column (&theader, "I", "MAG_80",   "ccd y coord",              "pix",    1.0, 0.0);
     631    gfits_define_bintable_column (&theader, "E", "MAG_MIN",   "ccd x coord",              "pix",    1.0, 0.0);
     632    gfits_define_bintable_column (&theader, "E", "MAG_MAX",   "ccd y coord",              "pix",    1.0, 0.0);
    633633
    634634    // generate the output array that carries the data
     
    646646    short *Ncode    ; ALLOCATE (Ncode  ,  short, Nsec);
    647647    short *Nused    ; ALLOCATE (Nused  ,  short, Nsec);
    648     short *M_20     ; ALLOCATE (M_20   ,  short, Nsec);
    649     short *M_80     ; ALLOCATE (M_80   ,  short, Nsec);
     648    float *Mmin     ; ALLOCATE (Mmin   ,  float, Nsec);
     649    float *Mmax     ; ALLOCATE (Mmax   ,  float, Nsec);
    650650
    651651    // assign the storage arrays
     
    658658      Ncode [i]       = secfilt[i]. Ncode  ;
    659659      Nused [i]       = secfilt[i]. Nused  ;
    660       M_20  [i]       = secfilt[i]. M_20   ;
    661       M_80  [i]       = secfilt[i]. M_80   ;
     660      Mmin  [i]       = secfilt[i]. Mmin   ;
     661      Mmax  [i]       = secfilt[i]. Mmax   ;
    662662    }
    663663
     
    669669    gfits_set_bintable_column (&theader, &ftable, "NCODE",    Ncode, Nsec);
    670670    gfits_set_bintable_column (&theader, &ftable, "NUSED",    Nused, Nsec);
    671     gfits_set_bintable_column (&theader, &ftable, "MAG_20",   M_20 , Nsec);
    672     gfits_set_bintable_column (&theader, &ftable, "MAG_80",   M_80 , Nsec);
     671    gfits_set_bintable_column (&theader, &ftable, "MAG_MIN",  Mmin , Nsec);
     672    gfits_set_bintable_column (&theader, &ftable, "MAG_MAX",  Mmax , Nsec);
    673673
    674674    free (M      );
     
    678678    free (Ncode  );
    679679    free (Nused  );
    680     free (M_20   );
    681     free (M_80   );
     680    free (Mmin   );
     681    free (Mmax   );
    682682
    683683    gfits_fwrite_Theader (f, &theader);
  • branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/ImageOps.c

    r36833 r36903  
    406406  for (j = 0; j < average[0].Nmeasure; j++) {
    407407    off = average[0].measureOffset + j;
    408     fprintf (stderr, "dR, dD, mag, dMag: %f, %f, %f, %f\n", measure[off].dR, measure[off].dD, measure[off].M, measure[off].dM);
     408    fprintf (stderr, "R, D, mag, dMag: %lf, %lf, %f, %f\n", measure[off].R, measure[off].D, measure[off].M, measure[off].dM);
    409409  }
    410410  return;
     
    554554
    555555    // complain if the new location is far from the old location
    556     if (fabs(csdec*(measure[0].dR - dR)) > DPOS_MAX_ASEC) {
     556    if (fabs(csdec*(measure[0].R - R)) > DPOS_MAX_ASEC) {
    557557      NoffRAori ++;
    558558      if (VERBOSE2) {
    559         fprintf (stderr, "measurement moves far from original location (R): %f %f (%f %f %f %f)\n", average[0].R, average[0].D, measure[0].dR, dR, csdec*(measure[0].dR - dR), dD);
     559        fprintf (stderr, "measurement moves far from original location (R): %f %f (%f %f %f %f)\n", average[0].R, average[0].D, measure[0].R, dR, csdec*(measure[0].R - R), dD);
    560560        dump_measures (&average[0], catalog[c].measure);
    561561      }
    562562      // abort();
    563563    }
    564     if (fabs(measure[0].dD - dD) > DPOS_MAX_ASEC) {
     564    if (fabs(measure[0].D - D) > DPOS_MAX_ASEC) {
    565565      NoffDECori ++;
    566566      if (VERBOSE2) {
    567         fprintf (stderr, "measurement moves far from original location (D): %f %f (%f %f %f)\n", average[0].R, average[0].D, dR, measure[0].dD, dD);
     567        fprintf (stderr, "measurement moves far from original location (D): %f %f (%f %f %f)\n", average[0].R, average[0].D, dR, measure[0].D, dD);
    568568        dump_measures (&average[0], catalog[c].measure);
    569569      }      // abort();
    570570    }
    571571
    572     dPos += SQ(measure[0].dR - dR) + SQ(measure[0].dD - dD);
     572    // XXX NOTE : apply csdec:
     573    dPos += SQ(measure[0].R - R) + SQ(measure[0].D - D);
    573574    nPos ++;
    574575
    575     measure[0].dR = dR;
    576     measure[0].dD = dD;
    577     measureT[0].dR = dR;
    578     measureT[0].dD = dD;
     576    measure[0].R = R;
     577    measure[0].D = D;
     578    measureT[0].R = R;
     579    measureT[0].D = D;
    579580   
    580581    // set the systematic error for this image:
     
    661662    }
    662663
    663     measure[0].dR = dR;
    664     measure[0].dD = dD;
    665 
    666     if (measure[0].dR > +180.0*3600.0) {
     664    measure[0].R = R;
     665    measure[0].D = D;
     666
     667    fprintf (stderr, "redo this\n")
     668    if (dR > +180.0*3600.0) {
    667669      // average on high end of boundary, move star up
    668670      R += 360.0;
    669       measure[0].dR = 3600.0*(catalog[c].average[n].R - R);
    670     }
    671     if (measure[0].dR < -180.0*3600.0) {
     671      measure[0].R = R;
     672    }
     673    if (dR < -180.0*3600.0) {
    672674      // average on low end of boundary, move star down
    673675      R -= 360.0;
    674       measure[0].dR = 3600.0*(catalog[c].average[n].R - R);
     676      measure[0].R = R;
    675677    }
    676678  }
     
    734736      raw[i].mask |= MARK_TOO_FEW_MEAS;
    735737    }
    736     if (!finite(measure[0].dR) || !finite(measure[0].dD)) {
     738    if (!finite(measure[0].R) || !finite(measure[0].D)) {
    737739      raw[i].mask |= MARK_NAN_POS_ERROR;
    738740    }
     
    880882      // skip measurements based on user selected criteria
    881883      if (!MeasFilterTest(&measure[k], FALSE)) continue;
    882       R[N] = measure[k].dR;
    883       D[N] = measure[k].dD;
     884      R[N] = measure[k].R;
     885      D[N] = measure[k].D;
    884886      dR[N] = GetAstromError (&measure[k], ERROR_MODE_RA);
    885887      dD[N] = GetAstromError (&measure[k], ERROR_MODE_DEC);
     
    906908      if (!MeasFilterTest(&measure[k], FALSE)) continue;
    907909     
    908       x = measure[k].dR - statsR.median;
    909       y = measure[k].dD - statsD.median;
     910      x = measure[k].R - statsR.median;
     911      y = measure[k].D - statsD.median;
    910912      theta = atan2(y,x);
    911913      if ((x*x + y*y) > (SQR(statsR.sigma * Ns * cos(theta)) +
  • branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/UpdateObjects.c

    r36833 r36903  
    149149          char *date = ohana_sec_to_date (measure[k].t);
    150150          int dbFlagsBig = measureBig ? measureBig[k].dbFlags : 0;
    151           fprintf (stderr, OFF_T_FMT" %f %f %s : 0x%08x : 0x%08x\n",  k, measure[k].dR, measure[k].dD, date, measure[k].dbFlags, dbFlagsBig);
     151          fprintf (stderr, OFF_T_FMT" %f %f %s : 0x%08x : 0x%08x\n",  k, measure[k].R, measure[k].D, date, measure[k].dbFlags, dbFlagsBig);
    152152          free (date);
    153153        }
  • branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/dvo_astrom_ops.c

    r36833 r36903  
    11# include "relastro.h"
     2/* the Measure carries the instantaneous mean position at the epoch t */
    23
    34double getMeanR (MeasureTiny *measure, Average *average, SecFilt *secfilt) {
     
    56  double ra;
    67
    7   /* the measure carries the instantaneous mean position at the epoch t */
    8   ra = average[0].R - measure[0].dR / 3600.0;
     8  // old: ra = average[0].R - measure[0].dR / 3600.0;
     9  if (!measure) return NAN;
     10  ra = measure[0].R;
     11
     12  return (ra);
     13}
     14
     15double getMeanD (MeasureTiny *measure, Average *average, SecFilt *secfilt) {
     16
     17  double dec;
     18
     19  // old: dec = average[0].D - measure[0].dD / 3600.0;
     20  if (!measure) return NAN;
     21  dec = measure[0].D;
     22
     23  return (dec);
     24}
     25
     26int setMeanR (double ra_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) {
     27
     28  // old: measure[0].dR += (ra_fit - average[0].R) * 3600.0;
     29  if (!measure) return FALSE;
     30  measure[0].R = ra_fit;
     31
     32  return (TRUE);
     33}
     34
     35int setMeanD (double dec_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) {
     36
     37  // old: measure[0].dD += (dec_fit - average[0].D) * 3600.0;
     38  if (!measure) return FALSE;
     39  measure[0].D = dec_fit;
     40
     41  return (TRUE);
     42}
     43
     44double getMeanR_Big (Measure *measure, Average *average, SecFilt *secfilt) {
     45
     46  double ra;
     47
     48  // old: ra = average[0].R - measure[0].dR / 3600.0;
     49  if (!measure) return NAN;
     50  ra = measure[0].R;
     51
     52  return (ra);
     53}
     54
     55double getMeanD_Big (Measure *measure, Average *average, SecFilt *secfilt) {
     56
     57  double dec;
     58
     59  // old: dec = average[0].D - measure[0].dD / 3600.0;
     60  if (!measure) return NAN;
     61  dec = measure[0].D;
     62
     63  return (dec);
     64}
     65
     66int setMeanR_Big (double ra_fit, Measure *measure, Average *average, SecFilt *secfilt) {
     67
     68  // old: measure[0].dR += (ra_fit - average[0].R) * 3600.0;
     69  if (!measure) return TRUE;
     70  measure[0].R = ra_fit;
     71
     72  return (TRUE);
     73}
     74
     75int setMeanD_Big (double dec_fit, Measure *measure, Average *average, SecFilt *secfilt) {
     76
     77  // measure[0].dD += (dec_fit - average[0].D) * 3600.0;
     78  if (!measure) return TRUE;
     79  measure[0].D = dec_fit;
     80
     81  return (TRUE);
     82}
    983
    1084  /* possible corrections to mean ra:
     
    1892  */
    1993
    20   return (ra);
    21 }
    22 
    23 double getMeanD (MeasureTiny *measure, Average *average, SecFilt *secfilt) {
    24 
    25   double dec;
    26 
    27   /* the measure carries the instantaneous mean position at the epoch t */
    28   dec = average[0].D - measure[0].dD / 3600.0;
    29 
    30   /* possible corrections to mean ra:
    31 
    32   - proper-motion and parallax
    33   - abberation
    34   - precession and nutation, etc
    35   - refraction
    36   - DCR
    37 
    38   */
    39 
    40   return (dec);
    41 }
    42 
    43 int setMeanR (double ra_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) {
    44 
    45   /* math to get from new fitted position to new measure offset
    46      ra_obs = average[0].R - measure[0].dR / 3600.0;
    47      measure[0].dR = (ra_fit - ra_obs) * 3600.0;
    48      measure[0].dR = (ra_fit - average[0].R + measure[0].dR/3600) * 3600.0
    49      measure[0].dR = (ra_fit - average[0].R) * 3600.0 + measure[0].dR;
    50   */
    51 
    52   /* the measure carries the instantaneous mean position at the epoch t */
    53   measure[0].dR += (ra_fit - average[0].R) * 3600.0;
    54 
    55   /* possible corrections to mean ra:
    56 
    57   - proper-motion and parallax
    58   - abberation
    59   - precession and nutation, etc
    60   - refraction
    61   - DCR
    62 
    63   */
    64 
    65   return (TRUE);
    66 }
    67 
    68 int setMeanD (double dec_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) {
    69 
    70   /* math to get from new fitted position to new measure offset
    71      dec_obs = average[0].D - measure[0].dD / 3600.0;
    72      measure[0].dD = (dec_fit - dec_obs) * 3600.0;
    73      measure[0].dD = (dec_fit - average[0].D + measure[0].dD/3600) * 3600.0
    74      measure[0].dD = (dec_fit - average[0].D) * 3600.0 + measure[0].dD;
    75   */
    76 
    77   /* the measure carries the instantaneous mean position at the epoch t */
    78   measure[0].dD += (dec_fit - average[0].D) * 3600.0;
    79 
    80   /* possible corrections to mean ra:
    81 
    82   - proper-motion and parallax
    83   - abberation
    84   - precession and nutation, etc
    85   - refraction
    86   - DCR
    87 
    88   */
    89 
    90   return (TRUE);
    91 }
    92 
    93 double getMeanR_Big (Measure *measure, Average *average, SecFilt *secfilt) {
    94 
    95   double ra;
    96 
    97   /* the measure carries the instantaneous mean position at the epoch t */
    98   ra = average[0].R - measure[0].dR / 3600.0;
    99 
    100   /* possible corrections to mean ra:
    101 
    102   - proper-motion and parallax
    103   - abberation
    104   - precession and nutation, etc
    105   - refraction
    106   - DCR
    107 
    108   */
    109 
    110   return (ra);
    111 }
    112 
    113 double getMeanD_Big (Measure *measure, Average *average, SecFilt *secfilt) {
    114 
    115   double dec;
    116 
    117   /* the measure carries the instantaneous mean position at the epoch t */
    118   dec = average[0].D - measure[0].dD / 3600.0;
    119 
    120   /* possible corrections to mean ra:
    121 
    122   - proper-motion and parallax
    123   - abberation
    124   - precession and nutation, etc
    125   - refraction
    126   - DCR
    127 
    128   */
    129 
    130   return (dec);
    131 }
    132 
    133 int setMeanR_Big (double ra_fit, Measure *measure, Average *average, SecFilt *secfilt) {
    134 
    135   if (!measure) return TRUE;
    136 
    137   /* math to get from new fitted position to new measure offset
    138      ra_obs = average[0].R - measure[0].dR / 3600.0;
    139      measure[0].dR = (ra_fit - ra_obs) * 3600.0;
    140      measure[0].dR = (ra_fit - average[0].R + measure[0].dR/3600) * 3600.0
    141      measure[0].dR = (ra_fit - average[0].R) * 3600.0 + measure[0].dR;
    142   */
    143 
    144   /* the measure carries the instantaneous mean position at the epoch t */
    145   measure[0].dR += (ra_fit - average[0].R) * 3600.0;
    146 
    147   /* possible corrections to mean ra:
    148 
    149   - proper-motion and parallax
    150   - abberation
    151   - precession and nutation, etc
    152   - refraction
    153   - DCR
    154 
    155   */
    156 
    157   return (TRUE);
    158 }
    159 
    160 int setMeanD_Big (double dec_fit, Measure *measure, Average *average, SecFilt *secfilt) {
    161 
    162   if (!measure) return TRUE;
    163 
    164   /* math to get from new fitted position to new measure offset
    165      dec_obs = average[0].D - measure[0].dD / 3600.0;
    166      measure[0].dD = (dec_fit - dec_obs) * 3600.0;
    167      measure[0].dD = (dec_fit - average[0].D + measure[0].dD/3600) * 3600.0
    168      measure[0].dD = (dec_fit - average[0].D) * 3600.0 + measure[0].dD;
    169   */
    170 
    171   /* the measure carries the instantaneous mean position at the epoch t */
    172   measure[0].dD += (dec_fit - average[0].D) * 3600.0;
    173 
    174   /* possible corrections to mean ra:
    175 
    176   - proper-motion and parallax
    177   - abberation
    178   - precession and nutation, etc
    179   - refraction
    180   - DCR
    181 
    182   */
    183 
    184   return (TRUE);
    185 }
    186 
  • branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/high_speed_objects.c

    r36482 r36903  
    241241          for(i1=0;i1<catalog[0].average[nv[l]].Nmeasure;i1++) {
    242242              catalogOut.measure[Nmatchmeas]=catalog[0].measure[m+i1];
    243               /*Set offset RA and Dec wrt correct average value*/
    244               catalogOut.measure[Nmatchmeas].dR=catalog[0].measure[m+i1].dR+3600.0*(catalog[0].average[nv[0]].R-catalog[0].average[nv[l]].R);
    245               catalogOut.measure[Nmatchmeas].dD=catalog[0].measure[m+i1].dD+3600.0*(catalog[0].average[nv[0]].D-catalog[0].average[nv[l]].D);
     243              // DROP no longer necessary to repoint R,D
     244              // catalogOut.measure[Nmatchmeas].dR=catalog[0].measure[m+i1].dR+3600.0*(catalog[0].average[nv[0]].R-catalog[0].average[nv[l]].R);
     245              // catalogOut.measure[Nmatchmeas].dD=catalog[0].measure[m+i1].dD+3600.0*(catalog[0].average[nv[0]].D-catalog[0].average[nv[l]].D);
    246246              catalogOut.measure[Nmatchmeas].averef = Nmatch;
    247247              Nmatchmeasobj++;
     
    297297  // XXX require a set or not?  assert (Nset > 0);
    298298
    299   if (!finite(measure[0].dR)) return FALSE;
    300   if (!finite(measure[0].dD)) return FALSE;
    301   if (!finite(measure[0].M))  return FALSE;
     299  if (!finite(measure[0].R)) return FALSE;
     300  if (!finite(measure[0].D)) return FALSE;
     301  if (!finite(measure[0].M)) return FALSE;
    302302 
    303303  float dX = GetAstromError (measure, ERROR_MODE_RA);
  • branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/hpm_objects.c

    r36482 r36903  
    240240      for (k = 0; k < catalog[0].average[nj].Nmeasure; k++) {
    241241        testcat.measure[Nmatchmeas] = catalog[0].measure[m+k];
    242         /* Set offset RA and Dec wrt correct average value*/
    243         testcat.measure[Nmatchmeas].dR = catalog[0].measure[m+k].dR + 3600.0*(catalog[0].average[ni].R - catalog[0].average[nj].R);
    244         testcat.measure[Nmatchmeas].dD = catalog[0].measure[m+k].dD + 3600.0*(catalog[0].average[ni].D - catalog[0].average[nj].D);
     242        // DROP: was needed when dR,dD were relative to average.R,D
     243        // testcat.measure[Nmatchmeas].R = catalog[0].measure[m+k].R;
     244        // testcat.measure[Nmatchmeas].D = catalog[0].measure[m+k].D;
    245245        testcat.measure[Nmatchmeas].averef = 0;
    246246        Nmatchmeas++;
  • branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/relastroVisual.c

    r31635 r36903  
    418418                               StatType statsR, StatType statsD, double thresh) {
    419419   
    420   float *Din, *Rin, *Dout, *Rout;
     420  double *Din, *Rin, *Dout, *Rout;
    421421  double xmin, xmax, ymin, ymax, range;
    422422  float xCirc[100], yCirc[100];
     
    451451    meas = catalog[0].measure[m];
    452452    if (!MeasFilterTest(&meas, FALSE)) continue;
    453     xmin = MIN(xmin, meas.dR);
    454     xmax = MAX(xmax, meas.dR);
    455     ymin = MIN(ymin, meas.dD);
    456     ymax = MAX(ymax, meas.dD);
     453    xmin = MIN(xmin, meas.R);
     454    xmax = MAX(xmax, meas.R);
     455    ymin = MIN(ymin, meas.D);
     456    ymax = MAX(ymax, meas.D);
    457457   
    458458    if (meas.dbFlags & ID_MEAS_POOR_ASTROM) {
    459       Rout[Nout] = (float)(meas.dR);
    460       Dout[Nout] = (float)(meas.dD);
     459      Rout[Nout] = (meas.R);
     460      Dout[Nout] = (meas.D);
    461461      fprintf(stderr, "r: %f\td: %f\t outlier: 1\n", Rout[Nout], Dout[Nout]);
    462462      Nout++;
    463463    } else {
    464       Rin[Nin] = (float)(meas.dR);
    465       Din[Nin] = (float)(meas.dD);
     464      Rin[Nin] = (meas.R);
     465      Din[Nin] = (meas.D);
    466466      fprintf(stderr, "r: %f\td: %f\t outlier: 0\n", Rin[Nin], Din[Nin]);
    467467      Nin++;
  • branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/relastro_merge_source.c

    r34088 r36903  
    100100      catalog_src.measure[m].averef = index_dst;
    101101
     102      // OLD CODE: when measure.dR,dD were relative to average.R,D it was necessary to modify them
    102103      // get the instantaneous positions:
    103       double R = catalog_src.average[index_src].R - catalog_src.measure[m].dR / 3600.0;
    104       double D = catalog_src.average[index_src].D - catalog_src.measure[m].dD / 3600.0;
     104      // DROP double R = catalog_src.average[index_src].R - catalog_src.measure[m].dR / 3600.0;
     105      // DROP double D = catalog_src.average[index_src].D - catalog_src.measure[m].dD / 3600.0;
    105106
    106107      // update the offset coordinates to match the new source
    107       catalog_src.measure[m].dR = 3600.0*(catalog_src.average[index_dst].R - R);
    108       catalog_src.measure[m].dD = 3600.0*(catalog_src.average[index_dst].D - D);
     108      // DROP catalog_src.measure[m].dR = 3600.0*(catalog_src.average[index_dst].R - R);
     109      // DROP catalog_src.measure[m].dD = 3600.0*(catalog_src.average[index_dst].D - D);
    109110    }
    110111
  • branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/BrightCatalog.c

    r36630 r36903  
    6363 
    6464    // need to create and assign to flat-field correction
    65     GET_COLUMN(dR,        "RA_OFF",     float);
    66     GET_COLUMN(dD,        "DEC_OFF",    float);
     65    GET_COLUMN(R,         "RA",         double);
     66    GET_COLUMN(D,         "DEC",        double);
    6767    GET_COLUMN(M,         "MAG_SYS",    float);
    6868    GET_COLUMN(Mcal,      "MAG_CAL",    float);
     
    8585    ALLOCATE (measure, MeasureTiny, Nrow);
    8686    for (i = 0; i < Nrow; i++) {
    87       measure[i].dR        = dR[i];
    88       measure[i].dD        = dD[i];
     87      measure[i].R         = R[i];
     88      measure[i].D         = D[i];
    8989      measure[i].M         = M[i];
    9090      measure[i].Mcal      = Mcal[i];
     
    105105    fprintf (stderr, "loaded data for %lld measure\n", (long long) Nrow);
    106106
    107     free (dR      );
    108     free (dD      );
     107    free (R       );
     108    free (D       );
    109109    free (M       );
    110110    free (Mcal    );
     
    136136 
    137137    // need to create and assign to flat-field correction
    138     GET_COLUMN(R,             "RA",        double);
    139     GET_COLUMN(D,             "DEC",       double);
     138    GET_COLUMN(R,             "RA",          double);
     139    GET_COLUMN(D,             "DEC",         double);
    140140    GET_COLUMN(Nmeasure,      "NMEAS",       int);
    141141    GET_COLUMN(measureOffset, "MEASURE_OFF", int);
     
    188188    GET_COLUMN(Ncode, "NCODE",    short);
    189189    GET_COLUMN(Nused, "NUSED",    short);
    190     GET_COLUMN(M_20,  "MAG_20",   short);
    191     GET_COLUMN(M_80,  "MAG_80",   short);
     190    GET_COLUMN(Mmin,  "MAG_MIN",  float);
     191    GET_COLUMN(Mmax,  "MAG_MAX",  float);
    192192    gfits_free_header (&theader);
    193193    gfits_free_table  (&ftable);
     
    202202      secfilt[i].Ncode = Ncode[i];
    203203      secfilt[i].Nused = Nused[i];
    204       secfilt[i].M_20  = M_20[i];
    205       secfilt[i].M_80  = M_80[i];
     204      secfilt[i].Mmin  = Mmin[i];
     205      secfilt[i].Mmax  = Mmax[i];
    206206    }
    207207    fprintf (stderr, "loaded data for %lld secfilt\n", (long long) Nrow);
     
    213213    free (Ncode);
    214214    free (Nused);
    215     free (M_20 );
    216     free (M_80 );
     215    free (Mmin );
     216    free (Mmax );
    217217    catalog->secfilt = secfilt;
    218218    // assert Nsecfilt * Naverage = Nrow?
     
    265265    gfits_create_table_header (&theader, "BINTABLE", "MEASURE_TINY");
    266266
    267     gfits_define_bintable_column (&theader, "E", "RA_OFF",   "ra offset",                  "arcsec", 1.0, 0.0);
    268     gfits_define_bintable_column (&theader, "E", "DEC_OFF",  "dec offset",                 "arcsec", 1.0, 0.0);
     267    gfits_define_bintable_column (&theader, "D", "RA",       "ra",                         "degree", 1.0, 0.0);
     268    gfits_define_bintable_column (&theader, "D", "DEC",      "dec",                        "degree", 1.0, 0.0);
    269269    gfits_define_bintable_column (&theader, "E", "MAG_SYS",  "magnitude (sys)",             NULL,    1.0, 0.0);
    270270    gfits_define_bintable_column (&theader, "E", "MAG_CAL",  "magnitude (cal)",             NULL,    1.0, 0.0);
     
    286286
    287287    // create intermediate storage arrays
    288     float *dR        ; ALLOCATE (dR       ,  float, catalog->Nmeasure);
    289     float *dD        ; ALLOCATE (dD       ,  float, catalog->Nmeasure);
    290     float *M         ; ALLOCATE (M        ,  float, catalog->Nmeasure);
    291     float *Mcal      ; ALLOCATE (Mcal     ,  float, catalog->Nmeasure);
    292     float *dM        ; ALLOCATE (dM       ,  float, catalog->Nmeasure);
    293     float *airmass   ; ALLOCATE (airmass  ,  float, catalog->Nmeasure);
    294     float *Xccd      ; ALLOCATE (Xccd     ,  float, catalog->Nmeasure);
    295     float *Yccd      ; ALLOCATE (Yccd     ,  float, catalog->Nmeasure);
    296     float *dt        ; ALLOCATE (dt       ,  float, catalog->Nmeasure);
    297     int   *t         ; ALLOCATE (t        ,  int  , catalog->Nmeasure);
    298     int   *averef    ; ALLOCATE (averef   ,  int  , catalog->Nmeasure);
    299     int   *imageID   ; ALLOCATE (imageID  ,  int  , catalog->Nmeasure);
    300     int   *dbFlags   ; ALLOCATE (dbFlags  ,  int  , catalog->Nmeasure);
    301     int   *photFlags ; ALLOCATE (photFlags,  int  , catalog->Nmeasure);
    302     int   *catID     ; ALLOCATE (catID    ,  int  , catalog->Nmeasure);
    303     short *photcode  ; ALLOCATE (photcode ,  short, catalog->Nmeasure);
     288    double *R         ; ALLOCATE (R        ,  double, catalog->Nmeasure);
     289    double *D         ; ALLOCATE (D        ,  double, catalog->Nmeasure);
     290    float  *M         ; ALLOCATE (M        ,  float, catalog->Nmeasure);
     291    float  *Mcal      ; ALLOCATE (Mcal     ,  float, catalog->Nmeasure);
     292    float  *dM        ; ALLOCATE (dM       ,  float, catalog->Nmeasure);
     293    float  *airmass   ; ALLOCATE (airmass  ,  float, catalog->Nmeasure);
     294    float  *Xccd      ; ALLOCATE (Xccd     ,  float, catalog->Nmeasure);
     295    float  *Yccd      ; ALLOCATE (Yccd     ,  float, catalog->Nmeasure);
     296    float  *dt        ; ALLOCATE (dt       ,  float, catalog->Nmeasure);
     297    int    *t         ; ALLOCATE (t        ,  int  , catalog->Nmeasure);
     298    int    *averef    ; ALLOCATE (averef   ,  int  , catalog->Nmeasure);
     299    int    *imageID   ; ALLOCATE (imageID  ,  int  , catalog->Nmeasure);
     300    int    *dbFlags   ; ALLOCATE (dbFlags  ,  int  , catalog->Nmeasure);
     301    int    *photFlags ; ALLOCATE (photFlags,  int  , catalog->Nmeasure);
     302    int    *catID     ; ALLOCATE (catID    ,  int  , catalog->Nmeasure);
     303    short  *photcode  ; ALLOCATE (photcode ,  short, catalog->Nmeasure);
    304304
    305305    // assign the storage arrays
    306306    MeasureTiny *measure = catalog->measure;
    307307    for (i = 0; i < catalog->Nmeasure; i++) {
    308       dR[i]       = measure[i].dR       ;
    309       dD[i]       = measure[i].dD       ;
     308      R[i]        = measure[i].R       ;
     309      D[i]        = measure[i].D       ;
    310310      M[i]        = measure[i].M        ;
    311311      Mcal[i]     = measure[i].Mcal     ;
     
    325325
    326326    // add the columns to the output array
    327     gfits_set_bintable_column (&theader, &ftable, "RA_OFF",     dR,        catalog->Nmeasure);
    328     gfits_set_bintable_column (&theader, &ftable, "DEC_OFF",    dD,        catalog->Nmeasure);
     327    gfits_set_bintable_column (&theader, &ftable, "RA",         R,         catalog->Nmeasure);
     328    gfits_set_bintable_column (&theader, &ftable, "DEC",        D,         catalog->Nmeasure);
    329329    gfits_set_bintable_column (&theader, &ftable, "MAG_SYS",    M,         catalog->Nmeasure);
    330330    gfits_set_bintable_column (&theader, &ftable, "MAG_CAL",    Mcal,      catalog->Nmeasure);
     
    342342    gfits_set_bintable_column (&theader, &ftable, "PHOTCODE",   photcode,  catalog->Nmeasure);
    343343
    344     free (dR      );
    345     free (dD      );
     344    free (R       );
     345    free (D       );
    346346    free (M       );
    347347    free (Mcal    );
     
    428428    gfits_create_table_header (&theader, "BINTABLE", "SECFILT");
    429429
    430     gfits_define_bintable_column (&theader, "E", "MAG",      "ra offset",                "arcsec", 1.0, 0.0);
    431     gfits_define_bintable_column (&theader, "E", "MAG_ERR",  "dec offset",               "arcsec", 1.0, 0.0);
    432     gfits_define_bintable_column (&theader, "E", "MAG_CHI",  "magnitude (sys)",           NULL,    1.0, 0.0);
    433     gfits_define_bintable_column (&theader, "J", "FLAGS",    "magnitude (cal)",           NULL,    1.0, 0.0);
    434     gfits_define_bintable_column (&theader, "I", "NCODE",    "magnitude (err)",           NULL,    1.0, 0.0);
    435     gfits_define_bintable_column (&theader, "I", "NUSED",    "airmass",                   NULL,    1.0, 0.0);
    436     gfits_define_bintable_column (&theader, "I", "MAG_20",   "ccd x coord",              "pix",    1.0, 0.0);
    437     gfits_define_bintable_column (&theader, "I", "MAG_80",   "ccd y coord",              "pix",    1.0, 0.0);
     430    gfits_define_bintable_column (&theader, "E", "MAG",      "",              "arcsec", 1.0, 0.0);
     431    gfits_define_bintable_column (&theader, "E", "MAG_ERR",  "",              "arcsec", 1.0, 0.0);
     432    gfits_define_bintable_column (&theader, "E", "MAG_CHI",  "",              NULL,    1.0, 0.0);
     433    gfits_define_bintable_column (&theader, "J", "FLAGS",    "",              NULL,    1.0, 0.0);
     434    gfits_define_bintable_column (&theader, "I", "NCODE",    "",              NULL,    1.0, 0.0);
     435    gfits_define_bintable_column (&theader, "I", "NUSED",    "",              NULL,    1.0, 0.0);
     436    gfits_define_bintable_column (&theader, "E", "MAG_MIN",  "min valid mag", "mag",   1.0, 0.0);
     437    gfits_define_bintable_column (&theader, "E", "MAG_MAX",  "max valid mag", "mag",   1.0, 0.0);
    438438
    439439    // generate the output array that carries the data
     
    451451    short *Ncode    ; ALLOCATE (Ncode  ,  short, Nsec);
    452452    short *Nused    ; ALLOCATE (Nused  ,  short, Nsec);
    453     short *M_20     ; ALLOCATE (M_20   ,  short, Nsec);
    454     short *M_80     ; ALLOCATE (M_80   ,  short, Nsec);
     453    float *Mmin     ; ALLOCATE (Mmin   ,  float, Nsec);
     454    float *Mmax     ; ALLOCATE (Mmax   ,  float, Nsec);
    455455
    456456    // assign the storage arrays
     
    463463      Ncode [i]       = secfilt[i]. Ncode  ;
    464464      Nused [i]       = secfilt[i]. Nused  ;
    465       M_20  [i]       = secfilt[i]. M_20   ;
    466       M_80  [i]       = secfilt[i]. M_80   ;
     465      Mmin  [i]       = secfilt[i]. Mmin   ;
     466      Mmax  [i]       = secfilt[i]. Mmax   ;
    467467    }
    468468
     
    474474    gfits_set_bintable_column (&theader, &ftable, "NCODE",    Ncode, Nsec);
    475475    gfits_set_bintable_column (&theader, &ftable, "NUSED",    Nused, Nsec);
    476     gfits_set_bintable_column (&theader, &ftable, "MAG_20",   M_20 , Nsec);
    477     gfits_set_bintable_column (&theader, &ftable, "MAG_80",   M_80 , Nsec);
     476    gfits_set_bintable_column (&theader, &ftable, "MAG_MIN",  Mmin , Nsec);
     477    gfits_set_bintable_column (&theader, &ftable, "MAG_MAX",  Mmax , Nsec);
    478478
    479479    free (M      );
     
    483483    free (Ncode  );
    484484    free (Nused  );
    485     free (M_20   );
    486     free (M_80   );
     485    free (Mmin   );
     486    free (Mmax   );
    487487
    488488    gfits_fwrite_Theader (f, &theader);
  • branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/MosaicOps.c

    r36630 r36903  
    17821782void plot_mosaic_fields (Catalog *catalog) {
    17831783
    1784   off_t i, j, m, c, N, ave, Nimage;
     1784  off_t i, j, m, c, N, Nimage;
    17851785  double *xlist, *ylist;
    17861786  // double Xmin, Xmax, Ymin, Ymax;
     
    18121812      if (catalog[c].measureT[m].dbFlags & (ID_MEAS_AREA | ID_MEAS_NOCAL)) continue;
    18131813
    1814       ave = catalog[c].measureT[m].averef;
    1815       xlist[N] = catalog[c].averageT[ave].R - catalog[c].measureT[m].dR / 3600.0;
    1816       ylist[N] = catalog[c].averageT[ave].D - catalog[c].measureT[m].dD / 3600.0;
     1814      // ave = catalog[c].measureT[m].averef;
     1815      xlist[N] = catalog[c].measureT[m].R;
     1816      ylist[N] = catalog[c].measureT[m].D;
    18171817      N++;
    18181818    }
  • branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/bcatalog.c

    r35416 r36903  
    5555    if (RESET) {
    5656      int Ns;
     57
     58# if (0)     
    5759      DVOSecfiltFlags secfiltBits =
    5860        ID_SECF_STAR_FEW |
     
    6668        ID_SECF_USE_UBERCAL |
    6769        ID_SECF_OBJ_EXT;
     70# endif
     71
    6872      for (Ns = 0; Ns < Nphotcodes; Ns++) {
    6973
     
    7175        int Nsec = GetPhotcodeNsec(thisCode);
    7276
    73         subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M      = NAN;
    74         subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Map    = NAN;
    75         subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].dM     = NAN;
    76         subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Mstdev = NAN_S_SHORT;
    77         subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Xm     = NAN;
    78         subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M_20   = NAN_S_SHORT;
    79         subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M_80   = NAN_S_SHORT;
    80         subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Ncode  = 0;
    81         subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Nused  = 0;
    82         subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].flags &= ~secfiltBits;
    83         subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].ubercalDist = 1000;
     77        fprintf (stderr, "really use dvo_secfilt_init?");
     78        dvo_secfilt_init (&subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec]);
     79
     80        // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M      = NAN;
     81        // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Map    = NAN;
     82        // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].dM     = NAN;
     83        // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Mstdev = NAN_S_SHORT;
     84        // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Xm     = NAN;
     85        // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M_20   = NAN_S_SHORT;
     86        // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M_80   = NAN_S_SHORT;
     87        // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Ncode  = 0;
     88        // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Nused  = 0;
     89        // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].flags &= ~secfiltBits;
     90        // subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].ubercalDist = 1000;
    8491      }
    8592    }
  • branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/setExclusions.c

    r33651 r36903  
    3535        /* select measurements by mag limit */
    3636        if (AreaSelect) {
    37           r = catalog[i].averageT[j].R + catalog[i].measureT[m].dR / 3600.0;
    38           d = catalog[i].averageT[j].D + catalog[i].measureT[m].dD / 3600.0;
     37          r = catalog[i].measureT[m].R;
     38          d = catalog[i].measureT[m].D;
    3939          if ((coords = getCoords (m, i)) == NULL) goto markbad;
    4040          RD_to_XY (&x, &y, r, d, coords);
  • branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/setMrelCatalog.c

    r36630 r36903  
    350350      secfilt[Nsec].Nused = psfstats->Nmeas;
    351351
    352       secfilt[Nsec].M_80 = 1000 * psfstats->Upper80;
    353       secfilt[Nsec].M_20 = 1000 * psfstats->Lower20;
     352      secfilt[Nsec].Mmax = 1000 * psfstats->max;
     353      secfilt[Nsec].Mmin = 1000 * psfstats->min;
    354354
    355355      // NOTE : use the modified weight for apmags as well as psf mags
     
    581581
    582582    // need to put in AB mag factor to get to Janskies (or uJy?)
    583     secfilt[Nsec].FluxPSF   = zpFactor * measure[k].FluxPSF; 
    584     secfilt[Nsec].dFluxPSF  = zpFactor * measure[k].dFluxPSF;
    585     secfilt[Nsec].FluxKron  = zpFactor * measure[k].FluxKron;
    586     secfilt[Nsec].dFluxKron = zpFactor * measure[k].dFluxKron;
     583    secfilt[Nsec].FpsfStk   = zpFactor * measure[k].FluxPSF; 
     584    secfilt[Nsec].dFpsfStk  = zpFactor * measure[k].dFluxPSF;
     585    secfilt[Nsec].FkronStk  = zpFactor * measure[k].FluxKron;
     586    secfilt[Nsec].dFkronStk = zpFactor * measure[k].dFluxKron;
    587587
    588588    secfilt[Nsec].stackDetectID = ID;
Note: See TracChangeset for help on using the changeset viewer.