IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37038


Ignore:
Timestamp:
Jul 17, 2014, 10:14:00 AM (12 years ago)
Author:
eugene
Message:

lots of changes to replace measure.dR,dD with measure.R.D; updates to handle stack vs mean; ps1_v5 changes required

Location:
trunk/Ohana/src/relastro
Files:
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relastro/include/relastro.h

    r36833 r37038  
    55# include <assert.h>
    66# include <pthread.h>
    7 
    8 # define MARKTIME(MSG,...) {                    \
    9     gettimeofday (&stopTimer, (void *) NULL);   \
    10     float dtime = DTIME (stopTimer, startTimer);        \
    11     fprintf (stderr, MSG, __VA_ARGS__); }
    12 
    13 # define INITTIME \
    14   struct timeval startTimer, stopTimer; \
    15   gettimeofday (&startTimer, (void *) NULL);
    167
    178// choose off_t or int depending on full-scale relphot analysis resources
     
    8475  double X, Y;  /* Chip Coords   - pixels  */
    8576  float Mag;
    86   float Color;
     77  float ColorBlue;
     78  float ColorRed;
    8779  float dMag;
    8880  float dPos;
     
    218210SkyRegionSelection SELECTION;
    219211
    220 char         *DCR_COLOR_POS,    *DCR_COLOR_NEG;
    221 PhotCode     *DCR_PHOTCODE_POS, *DCR_PHOTCODE_NEG;
    222 int           DCR_NSEC_POS,      DCR_NSEC_NEG;
     212char         *DCR_BLUE_COLOR_POS,    *DCR_BLUE_COLOR_NEG;
     213PhotCode     *DCR_BLUE_PHOTCODE_POS, *DCR_BLUE_PHOTCODE_NEG;
     214int           DCR_BLUE_NSEC_POS,      DCR_BLUE_NSEC_NEG;
     215
     216char         *DCR_RED_COLOR_POS,    *DCR_RED_COLOR_NEG;
     217PhotCode     *DCR_RED_PHOTCODE_POS, *DCR_RED_PHOTCODE_NEG;
     218int           DCR_RED_NSEC_POS,      DCR_RED_NSEC_NEG;
    223219
    224220int ImagSelect;
     
    532528int select_mosaics_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage);
    533529
    534 float getColor (off_t meas, int cat);
     530float getColorBlue (off_t meas, int cat);
     531float getColorRed (off_t meas, int cat);
    535532
    536533int strextend (char *input, char *format,...);
  • trunk/Ohana/src/relastro/src/BrightCatalog.c

    r36833 r37038  
    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    );
     
    145145    if (!gfits_fread_ftable_data (f, &ftable, FALSE)) goto escape;
    146146
    147     GET_COLUMN(R,              "RA",          double);
    148     GET_COLUMN(D,              "DEC",         double);
    149     GET_COLUMN(dR,             "RA_ERR",      float);
    150     GET_COLUMN(dD,             "DEC_ERR",     float);
    151     GET_COLUMN(uR,             "U_RA",        float);
    152     GET_COLUMN(uD,             "U_DEC",       float);
    153     GET_COLUMN(duR,            "V_RA_ERR",    float);
    154     GET_COLUMN(duD,            "V_DEC_ERR",   float);
    155     GET_COLUMN(P,              "PAR",         float);
    156     GET_COLUMN(dP,             "PAR_ERR",     float);
    157     GET_COLUMN(ChiSqAve,       "CHISQ_POS",   float);
    158     GET_COLUMN(ChiSqPM,        "CHISQ_PM",    float);
    159     GET_COLUMN(ChiSqPar,       "CHISQ_PAP",   float);
    160     GET_COLUMN(Tmean,          "MEAN_EPOCH",  int);
    161     GET_COLUMN(Trange,         "TIME_RANGE",  int);
    162     GET_COLUMN(stargal,        "STARGAL_SEP", float);
    163     GET_COLUMN(Npos,           "NUMBER_POS",  short);
    164     GET_COLUMN(Nmeasure,       "NMEASURE",    short);
    165     GET_COLUMN(Nmissing,       "NMISSING",    short);
    166     GET_COLUMN(Nextend,        "NEXTEND",     short);
    167     GET_COLUMN(measureOffset,  "OFF_MEASURE", int);
    168     GET_COLUMN(missingOffset,  "OFF_MISSING", int);
    169     GET_COLUMN(refColor,   "REF_COLOR",  float);
    170     GET_COLUMN(flags,          "FLAGS",       int);
    171     GET_COLUMN(photFlagsUpper, "PHOTFLAGS_U", int);
    172     GET_COLUMN(photFlagsLower, "PHOTFLAGS_L", int);
    173     GET_COLUMN(objID,          "OBJ_ID",      int);
    174     GET_COLUMN(catID,          "CAT_ID",      int);
    175     GET_COLUMN(extID,          "EXT_ID",      int64_t);
     147    GET_COLUMN(R,              "RA",             double);
     148    GET_COLUMN(D,              "DEC",            double);
     149    GET_COLUMN(dR,             "RA_ERR",         float);
     150    GET_COLUMN(dD,             "DEC_ERR",        float);
     151    GET_COLUMN(uR,             "U_RA",           float);
     152    GET_COLUMN(uD,             "U_DEC",          float);
     153    GET_COLUMN(duR,            "V_RA_ERR",       float);
     154    GET_COLUMN(duD,            "V_DEC_ERR",      float);
     155    GET_COLUMN(P,              "PAR",            float);
     156    GET_COLUMN(dP,             "PAR_ERR",        float);
     157    GET_COLUMN(ChiSqAve,       "CHISQ_POS",      float);
     158    GET_COLUMN(ChiSqPM,        "CHISQ_PM",       float);
     159    GET_COLUMN(ChiSqPar,       "CHISQ_PAP",      float);
     160    GET_COLUMN(Tmean,          "MEAN_EPOCH",     int);
     161    GET_COLUMN(Trange,         "TIME_RANGE",     int);
     162    GET_COLUMN(stargal,        "STARGAL_SEP",    float);
     163    GET_COLUMN(Npos,           "NUMBER_POS",     short);
     164    GET_COLUMN(Nmeasure,       "NMEASURE",       short);
     165    GET_COLUMN(Nmissing,       "NMISSING",       short);
     166    GET_COLUMN(Nextend,        "NEXTEND",        short);
     167    GET_COLUMN(measureOffset,  "OFF_MEASURE",    int);
     168    GET_COLUMN(missingOffset,  "OFF_MISSING",    int);
     169    GET_COLUMN(refColorBlue,   "REF_COLOR_BLUE", float);
     170    GET_COLUMN(refColorRed,    "REF_COLOR_RED",  float);
     171    GET_COLUMN(flags,          "FLAGS",          int);
     172    GET_COLUMN(photFlagsUpper, "PHOTFLAGS_U",    int);
     173    GET_COLUMN(photFlagsLower, "PHOTFLAGS_L",    int);
     174    GET_COLUMN(objID,          "OBJ_ID",         int);
     175    GET_COLUMN(catID,          "CAT_ID",         int);
     176    GET_COLUMN(extID,          "EXT_ID",         int64_t);
    176177    gfits_free_header (&theader);
    177178    gfits_free_table  (&ftable);
     
    202203      average[i].measureOffset   = measureOffset[i]   ;
    203204      average[i].missingOffset   = missingOffset[i]   ;
    204       average[i].refColor    = refColor[i]    ; 
     205      average[i].refColorBlue    = refColorBlue[i]    ; 
     206      average[i].refColorRed     = refColorRed[i]     ; 
    205207      average[i].flags           = flags[i]           ;
    206208      average[i].photFlagsUpper  = photFlagsUpper[i]  ;
     
    234236    free (measureOffset);
    235237    free (missingOffset);
    236     free (refColor);
     238    free (refColorBlue);
     239    free (refColorRed);
    237240    free (flags);
    238241    free (photFlagsUpper);
     
    256259 
    257260    // need to create and assign to flat-field correction
    258     GET_COLUMN(M,     "MAG",      float);
    259     GET_COLUMN(dM,    "MAG_ERR",  float);
    260     GET_COLUMN(Xm,    "MAG_CHI",  float);
    261     GET_COLUMN(flags, "FLAGS",    int);
    262     GET_COLUMN(Ncode, "NCODE",    short);
    263     GET_COLUMN(Nused, "NUSED",    short);
    264     GET_COLUMN(M_20,  "MAG_20",   short);
    265     GET_COLUMN(M_80,  "MAG_80",   short);
     261    GET_COLUMN(M,      "MAG",      float);
     262    GET_COLUMN(dM,     "MAG_ERR",  float);
     263    GET_COLUMN(Mchisq, "MAG_CHI",  float);
     264    GET_COLUMN(flags,  "FLAGS",    int);
     265    GET_COLUMN(Ncode,  "NCODE",    short);
     266    GET_COLUMN(Nused,  "NUSED",    short);
     267    GET_COLUMN(Mmin,   "MAG_MIN",  float);
     268    GET_COLUMN(Mmax,   "MAG_MAX",  float);
    266269    gfits_free_header (&theader);
    267270    gfits_free_table  (&ftable);
     
    270273    ALLOCATE (secfilt, SecFilt, Nrow);
    271274    for (i = 0; i < Nrow; i++) {
    272       secfilt[i].M     = M[i];         
    273       secfilt[i].dM    = dM[i];
    274       secfilt[i].Xm    = Xm[i];
    275       secfilt[i].flags = flags[i];
    276       secfilt[i].Ncode = Ncode[i];
    277       secfilt[i].Nused = Nused[i];
    278       secfilt[i].M_20  = M_20[i];
    279       secfilt[i].M_80  = M_80[i];
     275      secfilt[i].M      = M[i];         
     276      secfilt[i].dM     = dM[i];
     277      secfilt[i].Mchisq = Mchisq[i];
     278      secfilt[i].flags  = flags[i];
     279      secfilt[i].Ncode  = Ncode[i];
     280      secfilt[i].Nused  = Nused[i];
     281      secfilt[i].Mmin   = Mmin[i];
     282      secfilt[i].Mmax   = Mmax[i];
    280283    }
    281284    fprintf (stderr, "loaded data for %lld averages\n", (long long) Nrow);
     
    283286    free (M    );
    284287    free (dM   );
    285     free (Xm   );
     288    free (Mchisq);
    286289    free (flags);
    287290    free (Ncode);
    288291    free (Nused);
    289     free (M_20 );
    290     free (M_80 );
     292    free (Mmin );
     293    free (Mmax );
    291294    catalog->secfilt = secfilt;
    292295    // assert Nsecfilt * Naverage = Nrow?
     
    351354    gfits_define_bintable_column (&theader, "E", "Y_FIX",    "ccd y fiex coord",           "pix",    1.0, 0.0);
    352355    gfits_define_bintable_column (&theader, "E", "EXPTIME",  "-2.5 * log (exposure time)", "sec",    1.0, 0.0);
    353     gfits_define_bintable_column (&theader, "J", "TIME",     "time of exp",                "sec",    1.0, 1.0*0x8000);
    354     gfits_define_bintable_column (&theader, "J", "AVE_REF",  "pointer to average table",    NULL,    1.0, 1.0*0x8000);
    355     gfits_define_bintable_column (&theader, "J", "IMAGE_ID", "image",                       NULL,    1.0, 1.0*0x8000);
    356     gfits_define_bintable_column (&theader, "J", "DB_FLAGS", "flags",                       NULL,    1.0, 1.0*0x8000);
    357     gfits_define_bintable_column (&theader, "J", "PHOT_FLAGS", "photflags",                 NULL,    1.0, 1.0*0x8000);
    358     gfits_define_bintable_column (&theader, "J", "CAT_ID",   "catalog",                     NULL,    1.0, 1.0*0x8000);
    359     gfits_define_bintable_column (&theader, "I", "PHOTCODE", "photcode",                    NULL,    1.0, 1.0*0x80);
     356    gfits_define_bintable_column (&theader, "J", "TIME",     "time of exp",                "sec",    1.0, 0.0);
     357    gfits_define_bintable_column (&theader, "J", "AVE_REF",  "pointer to average table",    NULL,    1.0, 0.0);
     358    gfits_define_bintable_column (&theader, "J", "IMAGE_ID", "image",                       NULL,    1.0, 0.0);
     359    gfits_define_bintable_column (&theader, "J", "DB_FLAGS", "flags",                       NULL,    1.0, 0.0);
     360    gfits_define_bintable_column (&theader, "J", "PHOT_FLAGS", "photflags",                 NULL,    1.0, 0.0);
     361    gfits_define_bintable_column (&theader, "J", "CAT_ID",   "catalog",                     NULL,    1.0, 0.0);
     362    gfits_define_bintable_column (&theader, "I", "PHOTCODE", "photcode",                    NULL,    1.0, 0.0);
    360363
    361364    // generate the output array that carries the data
     
    363366
    364367    // 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);
     368    double *R         ; ALLOCATE (R        ,  double, catalog->Nmeasure);
     369    double *D         ; ALLOCATE (D        ,  double, catalog->Nmeasure);
     370    float  *M         ; ALLOCATE (M        ,  float, catalog->Nmeasure);
     371    float  *Mcal      ; ALLOCATE (Mcal     ,  float, catalog->Nmeasure);
     372    float  *dM        ; ALLOCATE (dM       ,  float, catalog->Nmeasure);
     373    float  *airmass   ; ALLOCATE (airmass  ,  float, catalog->Nmeasure);
     374    float  *Xccd      ; ALLOCATE (Xccd     ,  float, catalog->Nmeasure);
     375    float  *Yccd      ; ALLOCATE (Yccd     ,  float, catalog->Nmeasure);
     376    float  *Xfix      ; ALLOCATE (Xfix     ,  float, catalog->Nmeasure);
     377    float  *Yfix      ; ALLOCATE (Yfix     ,  float, catalog->Nmeasure);
     378    float  *dt        ; ALLOCATE (dt       ,  float, catalog->Nmeasure);
     379    int    *t         ; ALLOCATE (t        ,  int  , catalog->Nmeasure);
     380    int    *averef    ; ALLOCATE (averef   ,  int  , catalog->Nmeasure);
     381    int    *imageID   ; ALLOCATE (imageID  ,  int  , catalog->Nmeasure);
     382    int    *dbFlags   ; ALLOCATE (dbFlags  ,  int  , catalog->Nmeasure);
     383    int    *photFlags ; ALLOCATE (photFlags,  int  , catalog->Nmeasure);
     384    int    *catID     ; ALLOCATE (catID    ,  int  , catalog->Nmeasure);
     385    short  *photcode  ; ALLOCATE (photcode ,  short, catalog->Nmeasure);
    383386
    384387    // assign the storage arrays
    385388    MeasureTiny *measure = catalog->measure;
    386389    for (i = 0; i < catalog->Nmeasure; i++) {
    387       dR[i]       = measure[i].dR       ;
    388       dD[i]       = measure[i].dD       ;
     390      R[i]        = measure[i].R        ;
     391      D[i]        = measure[i].D        ;
    389392      M[i]        = measure[i].M        ;
    390393      Mcal[i]     = measure[i].Mcal     ;
     
    406409
    407410    // 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);
     411    gfits_set_bintable_column (&theader, &ftable, "RA",         R,         catalog->Nmeasure);
     412    gfits_set_bintable_column (&theader, &ftable, "DEC",        D,         catalog->Nmeasure);
    410413    gfits_set_bintable_column (&theader, &ftable, "MAG_SYS",    M,         catalog->Nmeasure);
    411414    gfits_set_bintable_column (&theader, &ftable, "MAG_CAL",    Mcal,      catalog->Nmeasure);
     
    425428    gfits_set_bintable_column (&theader, &ftable, "PHOTCODE",   photcode,  catalog->Nmeasure);
    426429
    427     free (dR      );
    428     free (dD      );
     430    free (R       );
     431    free (D       );
    429432    free (M       );
    430433    free (Mcal    );
     
    454457    gfits_create_table_header (&theader, "BINTABLE", "AVERAGE");
    455458
    456     gfits_define_bintable_column (&theader, "D", "RA",          "RA",                                                     "", 1.0, 0.0);
    457     gfits_define_bintable_column (&theader, "D", "DEC",         "DEC",                                                    "", 1.0, 0.0);
    458     gfits_define_bintable_column (&theader, "E", "RA_ERR",      "RA error",                                               "", 1.0, 0.0);
    459     gfits_define_bintable_column (&theader, "E", "DEC_ERR",     "DEC error",                                              "", 1.0, 0.0);
    460     gfits_define_bintable_column (&theader, "E", "U_RA",        "RA*cos(D) proper-motion",                                "", 1.0, 0.0);
    461     gfits_define_bintable_column (&theader, "E", "U_DEC",       "DEC proper-motion",                                      "", 1.0, 0.0);
    462     gfits_define_bintable_column (&theader, "E", "V_RA_ERR",    "RA*cos(D) p-m error",                                    "", 1.0, 0.0);
    463     gfits_define_bintable_column (&theader, "E", "V_DEC_ERR",   "DEC p-m error",                                          "", 1.0, 0.0);
    464     gfits_define_bintable_column (&theader, "E", "PAR",         "parallax",                                               "", 1.0, 0.0);
    465     gfits_define_bintable_column (&theader, "E", "PAR_ERR",     "parallax error",                                         "", 1.0, 0.0);
    466     gfits_define_bintable_column (&theader, "E", "CHISQ_POS",   "astrometry analysis chisq",                              "", 1.0, 0.0);
    467     gfits_define_bintable_column (&theader, "E", "CHISQ_PM",    "astrometry analysis chisq",                              "", 1.0, 0.0);
    468     gfits_define_bintable_column (&theader, "E", "CHISQ_PAP",   "astrometry analysis chisq",                              "", 1.0, 0.0);
    469     gfits_define_bintable_column (&theader, "J", "MEAN_EPOCH",  "mean epoch (PM-PAR ref)",                                "", 1.0, 1.0*0x8000);
    470     gfits_define_bintable_column (&theader, "J", "TIME_RANGE",  "mean epoch (PM-PAR ref)",                                "", 1.0, 1.0*0x8000);
    471     gfits_define_bintable_column (&theader, "E", "STARGAL_SEP", "star/galaxy separator",                                  "", 1.0, 0.0);   
    472     gfits_define_bintable_column (&theader, "I", "NUMBER_POS",  "number of detections used for astrometry",               "", 1.0, 1.0*0x80);
    473     gfits_define_bintable_column (&theader, "I", "NMEASURE",    "number of psf measurements",                             "", 1.0, 1.0*0x80);
    474     gfits_define_bintable_column (&theader, "I", "NMISSING",    "number of missings",                                     "", 1.0, 1.0*0x80);
    475     gfits_define_bintable_column (&theader, "I", "NEXTEND",     "number of extended measurements",                        "", 1.0, 1.0*0x80);
    476     gfits_define_bintable_column (&theader, "J", "OFF_MEASURE", "offset to first psf measurement",                        "", 1.0, 1.0*0x8000);
    477     gfits_define_bintable_column (&theader, "J", "OFF_MISSING", "offset to first missing obs",                            "", 1.0, 1.0*0x8000);
    478     gfits_define_bintable_column (&theader, "E", "REF_COLOR",   "reference color",                                        "", 1.0, 0.0);
    479     gfits_define_bintable_column (&theader, "J", "FLAGS",       "average object flags (star; ghost; etc)",                "", 1.0, 1.0*0x8000);
    480     gfits_define_bintable_column (&theader, "J", "PHOTFLAGS_U", "upper bit of 2 bit summary of per-measure photflags",    "", 1.0, 1.0*0x8000);
    481     gfits_define_bintable_column (&theader, "J", "PHOTFLAGS_L", "lower bit of 2 bit summary of per-measure photflags",    "", 1.0, 1.0*0x8000);
    482     gfits_define_bintable_column (&theader, "J", "OBJ_ID",      "unique ID for object in table",                          "", 1.0, 1.0*0x8000);
    483     gfits_define_bintable_column (&theader, "J", "CAT_ID",      "unique ID for table in which object was first realized", "", 1.0, 1.0*0x8000);
    484     gfits_define_bintable_column (&theader, "K", "EXT_ID",      "external ID for object (eg PSPS objID)",                 "", 1.0, 1.0*0x80000000);
     459    gfits_define_bintable_column (&theader, "D", "RA",             "RA",                                                  "", 1.0, 0.0);
     460    gfits_define_bintable_column (&theader, "D", "DEC",            "DEC",                                                 "", 1.0, 0.0);
     461    gfits_define_bintable_column (&theader, "E", "RA_ERR",         "RA error",                                            "", 1.0, 0.0);
     462    gfits_define_bintable_column (&theader, "E", "DEC_ERR",        "DEC error",                                           "", 1.0, 0.0);
     463    gfits_define_bintable_column (&theader, "E", "U_RA",           "RA*cos(D) proper-motion",                             "", 1.0, 0.0);
     464    gfits_define_bintable_column (&theader, "E", "U_DEC",          "DEC proper-motion",                                   "", 1.0, 0.0);
     465    gfits_define_bintable_column (&theader, "E", "V_RA_ERR",       "RA*cos(D) p-m error",                                 "", 1.0, 0.0);
     466    gfits_define_bintable_column (&theader, "E", "V_DEC_ERR",      "DEC p-m error",                                       "", 1.0, 0.0);
     467    gfits_define_bintable_column (&theader, "E", "PAR",            "parallax",                                            "", 1.0, 0.0);
     468    gfits_define_bintable_column (&theader, "E", "PAR_ERR",        "parallax error",                                      "", 1.0, 0.0);
     469    gfits_define_bintable_column (&theader, "E", "CHISQ_POS",      "astrometry analysis chisq",                           "", 1.0, 0.0);
     470    gfits_define_bintable_column (&theader, "E", "CHISQ_PM",       "astrometry analysis chisq",                           "", 1.0, 0.0);
     471    gfits_define_bintable_column (&theader, "E", "CHISQ_PAP",      "astrometry analysis chisq",                           "", 1.0, 0.0);
     472    gfits_define_bintable_column (&theader, "J", "MEAN_EPOCH",     "mean epoch (PM-PAR ref)",                             "", 1.0, 0.00);
     473    gfits_define_bintable_column (&theader, "J", "TIME_RANGE",     "mean epoch (PM-PAR ref)",                             "", 1.0, 0.00);
     474    gfits_define_bintable_column (&theader, "E", "STARGAL_SEP",    "star/galaxy separator",                               "", 1.0, 0.0);   
     475    gfits_define_bintable_column (&theader, "I", "NUMBER_POS",     "number of detections used for astrometry",            "", 1.0, 0.0);
     476    gfits_define_bintable_column (&theader, "I", "NMEASURE",       "number of psf measurements",                          "", 1.0, 0.0);
     477    gfits_define_bintable_column (&theader, "I", "NMISSING",       "number of missings",                                  "", 1.0, 0.0);
     478    gfits_define_bintable_column (&theader, "I", "NEXTEND",        "number of extended measurements",                     "", 1.0, 0.0);
     479    gfits_define_bintable_column (&theader, "J", "OFF_MEASURE",    "offset to first psf measurement",                     "", 1.0, 0.0);
     480    gfits_define_bintable_column (&theader, "J", "OFF_MISSING",    "offset to first missing obs",                         "", 1.0, 0.0);
     481    gfits_define_bintable_column (&theader, "E", "REF_COLOR_BLUE", "reference color",                                     "", 1.0, 0.0);
     482    gfits_define_bintable_column (&theader, "E", "REF_COLOR_RED",  "reference color",                                     "", 1.0, 0.0);
     483    gfits_define_bintable_column (&theader, "J", "FLAGS",          "average object flags (star; ghost; etc)",             "", 1.0, 0.0);
     484    gfits_define_bintable_column (&theader, "J", "PHOTFLAGS_U",    "upper bit of 2 bit summary of per-measure photflags", "", 1.0, 0.0);
     485    gfits_define_bintable_column (&theader, "J", "PHOTFLAGS_L",    "lower bit of 2 bit summary of per-measure photflags", "", 1.0, 0.0);
     486    gfits_define_bintable_column (&theader, "J", "OBJ_ID",         "unique ID for object in table",                       "", 1.0, 0.0);
     487    gfits_define_bintable_column (&theader, "J", "CAT_ID",         "unique ID for table in which object was first realized", "", 1.0, 0.0);
     488    gfits_define_bintable_column (&theader, "K", "EXT_ID",         "external ID for object (eg PSPS objID)",              "", 1.0, 0.0);
    485489
    486490    // generate the output array that carries the data
     
    510514    int      *measureOffset ; ALLOCATE (measureOffset , int     , catalog->Naverage);
    511515    int      *missingOffset ; ALLOCATE (missingOffset , int     , catalog->Naverage);
    512     float    *refColor      ; ALLOCATE (refColor  , float     , catalog->Naverage);
     516    float    *refColorBlue  ; ALLOCATE (refColorBlue  , float   , catalog->Naverage);
     517    float    *refColorRed   ; ALLOCATE (refColorRed   , float   , catalog->Naverage);
    513518    int      *flags         ; ALLOCATE (flags         , int     , catalog->Naverage);
    514519    int      *photFlagsUpper; ALLOCATE (photFlagsUpper, int     , catalog->Naverage);
     
    543548      measureOffset[i]   = average[i].measureOffset   ;
    544549      missingOffset[i]   = average[i].missingOffset   ;
    545       refColor[i]    = average[i].refColor    ; 
     550      refColorBlue[i]    = average[i].refColorBlue    ; 
     551      refColorRed[i]     = average[i].refColorRed     ; 
    546552      flags[i]           = average[i].flags           ;
    547553      photFlagsUpper[i]  = average[i].photFlagsUpper  ;
     
    553559
    554560    // add the columns to the output array
    555     gfits_set_bintable_column (&theader, &ftable, "RA",          R,               catalog->Naverage);
    556     gfits_set_bintable_column (&theader, &ftable, "DEC",         D,               catalog->Naverage);
    557     gfits_set_bintable_column (&theader, &ftable, "RA_ERR",      dR,              catalog->Naverage);
    558     gfits_set_bintable_column (&theader, &ftable, "DEC_ERR",     dD,              catalog->Naverage);
    559     gfits_set_bintable_column (&theader, &ftable, "U_RA",        uR,              catalog->Naverage);
    560     gfits_set_bintable_column (&theader, &ftable, "U_DEC",       uD,              catalog->Naverage);
    561     gfits_set_bintable_column (&theader, &ftable, "V_RA_ERR",    duR,             catalog->Naverage);
    562     gfits_set_bintable_column (&theader, &ftable, "V_DEC_ERR",   duD,             catalog->Naverage);
    563     gfits_set_bintable_column (&theader, &ftable, "PAR",         P,               catalog->Naverage);
    564     gfits_set_bintable_column (&theader, &ftable, "PAR_ERR",     dP,              catalog->Naverage);
    565     gfits_set_bintable_column (&theader, &ftable, "CHISQ_POS",   ChiSqAve,        catalog->Naverage);
    566     gfits_set_bintable_column (&theader, &ftable, "CHISQ_PM",    ChiSqPM,         catalog->Naverage);
    567     gfits_set_bintable_column (&theader, &ftable, "CHISQ_PAP",   ChiSqPar,        catalog->Naverage);
    568     gfits_set_bintable_column (&theader, &ftable, "MEAN_EPOCH",  Tmean,           catalog->Naverage);
    569     gfits_set_bintable_column (&theader, &ftable, "TIME_RANGE",  Trange,          catalog->Naverage);
    570     gfits_set_bintable_column (&theader, &ftable, "STARGAL_SEP", stargal,         catalog->Naverage);
    571     gfits_set_bintable_column (&theader, &ftable, "NUMBER_POS",  Npos,            catalog->Naverage);
    572     gfits_set_bintable_column (&theader, &ftable, "NMEASURE",    Nmeasure,        catalog->Naverage);
    573     gfits_set_bintable_column (&theader, &ftable, "NMISSING",    Nmissing,        catalog->Naverage);
    574     gfits_set_bintable_column (&theader, &ftable, "NEXTEND",     Nextend,         catalog->Naverage);
    575     gfits_set_bintable_column (&theader, &ftable, "OFF_MEASURE", measureOffset,   catalog->Naverage);
    576     gfits_set_bintable_column (&theader, &ftable, "OFF_MISSING", missingOffset,   catalog->Naverage);
    577     gfits_set_bintable_column (&theader, &ftable, "REF_COLOR",   refColor,        catalog->Naverage);
    578     gfits_set_bintable_column (&theader, &ftable, "FLAGS",       flags,           catalog->Naverage);
    579     gfits_set_bintable_column (&theader, &ftable, "PHOTFLAGS_U", photFlagsUpper,  catalog->Naverage);
    580     gfits_set_bintable_column (&theader, &ftable, "PHOTFLAGS_L", photFlagsLower,  catalog->Naverage);
    581     gfits_set_bintable_column (&theader, &ftable, "OBJ_ID",      objID,           catalog->Naverage);
    582     gfits_set_bintable_column (&theader, &ftable, "CAT_ID",      catID,           catalog->Naverage);
    583     gfits_set_bintable_column (&theader, &ftable, "EXT_ID",      extID,           catalog->Naverage);
     561    gfits_set_bintable_column (&theader, &ftable, "RA",             R,               catalog->Naverage);
     562    gfits_set_bintable_column (&theader, &ftable, "DEC",            D,               catalog->Naverage);
     563    gfits_set_bintable_column (&theader, &ftable, "RA_ERR",         dR,              catalog->Naverage);
     564    gfits_set_bintable_column (&theader, &ftable, "DEC_ERR",        dD,              catalog->Naverage);
     565    gfits_set_bintable_column (&theader, &ftable, "U_RA",           uR,              catalog->Naverage);
     566    gfits_set_bintable_column (&theader, &ftable, "U_DEC",          uD,              catalog->Naverage);
     567    gfits_set_bintable_column (&theader, &ftable, "V_RA_ERR",       duR,             catalog->Naverage);
     568    gfits_set_bintable_column (&theader, &ftable, "V_DEC_ERR",      duD,             catalog->Naverage);
     569    gfits_set_bintable_column (&theader, &ftable, "PAR",            P,               catalog->Naverage);
     570    gfits_set_bintable_column (&theader, &ftable, "PAR_ERR",        dP,              catalog->Naverage);
     571    gfits_set_bintable_column (&theader, &ftable, "CHISQ_POS",      ChiSqAve,        catalog->Naverage);
     572    gfits_set_bintable_column (&theader, &ftable, "CHISQ_PM",       ChiSqPM,         catalog->Naverage);
     573    gfits_set_bintable_column (&theader, &ftable, "CHISQ_PAP",      ChiSqPar,        catalog->Naverage);
     574    gfits_set_bintable_column (&theader, &ftable, "MEAN_EPOCH",     Tmean,           catalog->Naverage);
     575    gfits_set_bintable_column (&theader, &ftable, "TIME_RANGE",     Trange,          catalog->Naverage);
     576    gfits_set_bintable_column (&theader, &ftable, "STARGAL_SEP",    stargal,         catalog->Naverage);
     577    gfits_set_bintable_column (&theader, &ftable, "NUMBER_POS",     Npos,            catalog->Naverage);
     578    gfits_set_bintable_column (&theader, &ftable, "NMEASURE",       Nmeasure,        catalog->Naverage);
     579    gfits_set_bintable_column (&theader, &ftable, "NMISSING",       Nmissing,        catalog->Naverage);
     580    gfits_set_bintable_column (&theader, &ftable, "NEXTEND",        Nextend,         catalog->Naverage);
     581    gfits_set_bintable_column (&theader, &ftable, "OFF_MEASURE",    measureOffset,   catalog->Naverage);
     582    gfits_set_bintable_column (&theader, &ftable, "OFF_MISSING",    missingOffset,   catalog->Naverage);
     583    gfits_set_bintable_column (&theader, &ftable, "REF_COLOR_BLUE", refColorBlue,    catalog->Naverage);
     584    gfits_set_bintable_column (&theader, &ftable, "REF_COLOR_RED",  refColorRed,     catalog->Naverage);
     585    gfits_set_bintable_column (&theader, &ftable, "FLAGS",          flags,           catalog->Naverage);
     586    gfits_set_bintable_column (&theader, &ftable, "PHOTFLAGS_U",    photFlagsUpper,  catalog->Naverage);
     587    gfits_set_bintable_column (&theader, &ftable, "PHOTFLAGS_L",    photFlagsLower,  catalog->Naverage);
     588    gfits_set_bintable_column (&theader, &ftable, "OBJ_ID",         objID,           catalog->Naverage);
     589    gfits_set_bintable_column (&theader, &ftable, "CAT_ID",         catID,           catalog->Naverage);
     590    gfits_set_bintable_column (&theader, &ftable, "EXT_ID",         extID,           catalog->Naverage);
    584591
    585592    free (R);
     
    605612    free (measureOffset);
    606613    free (missingOffset);
    607     free (refColor);
     614    free (refColorBlue);
     615    free (refColorRed);
    608616    free (flags);
    609617    free (photFlagsUpper);
     
    629637    gfits_define_bintable_column (&theader, "I", "NCODE",    "magnitude (err)",           NULL,    1.0, 0.0);
    630638    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);
     639    gfits_define_bintable_column (&theader, "E", "MAG_MIN",   "ccd x coord",              "pix",    1.0, 0.0);
     640    gfits_define_bintable_column (&theader, "E", "MAG_MAX",   "ccd y coord",              "pix",    1.0, 0.0);
    633641
    634642    // generate the output array that carries the data
     
    642650    float *M        ; ALLOCATE (M      ,  float, Nsec);
    643651    float *dM       ; ALLOCATE (dM     ,  float, Nsec);
    644     float *Xm       ; ALLOCATE (Xm    ,  float, Nsec);
     652    float *Mchisq   ; ALLOCATE (Mchisq ,  float, Nsec);
    645653    int   *flags    ; ALLOCATE (flags  ,  int,   Nsec);
    646654    short *Ncode    ; ALLOCATE (Ncode  ,  short, Nsec);
    647655    short *Nused    ; ALLOCATE (Nused  ,  short, Nsec);
    648     short *M_20     ; ALLOCATE (M_20   ,  short, Nsec);
    649     short *M_80     ; ALLOCATE (M_80   ,  short, Nsec);
     656    float *Mmin     ; ALLOCATE (Mmin   ,  float, Nsec);
     657    float *Mmax     ; ALLOCATE (Mmax   ,  float, Nsec);
    650658
    651659    // assign the storage arrays
    652660    SecFilt *secfilt = catalog->secfilt;
    653661    for (i = 0; i < Nsec; i++) {
    654       M     [i]       = secfilt[i]. M      ;
    655       dM    [i]       = secfilt[i]. dM     ;
    656       Xm    [i]       = secfilt[i]. Xm    ;
    657       flags [i]       = secfilt[i]. flags  ;
    658       Ncode [i]       = secfilt[i]. Ncode  ;
    659       Nused [i]       = secfilt[i]. Nused  ;
    660       M_20  [i]       = secfilt[i]. M_20   ;
    661       M_80  [i]       = secfilt[i]. M_80   ;
     662      M     [i]       = secfilt[i].M      ;
     663      dM    [i]       = secfilt[i].dM     ;
     664      Mchisq[i]       = secfilt[i].Mchisq ;
     665      flags [i]       = secfilt[i].flags  ;
     666      Ncode [i]       = secfilt[i].Ncode  ;
     667      Nused [i]       = secfilt[i].Nused  ;
     668      Mmin  [i]       = secfilt[i].Mmin   ;
     669      Mmax  [i]       = secfilt[i].Mmax   ;
    662670    }
    663671
    664672    // add the columns to the output array
    665     gfits_set_bintable_column (&theader, &ftable, "MAG",      M    , Nsec);
    666     gfits_set_bintable_column (&theader, &ftable, "MAG_ERR",  dM   , Nsec);
    667     gfits_set_bintable_column (&theader, &ftable, "MAG_CHI",  Xm   , Nsec);
    668     gfits_set_bintable_column (&theader, &ftable, "FLAGS",    flags, Nsec);
    669     gfits_set_bintable_column (&theader, &ftable, "NCODE",    Ncode, Nsec);
    670     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);
     673    gfits_set_bintable_column (&theader, &ftable, "MAG",      M     , Nsec);
     674    gfits_set_bintable_column (&theader, &ftable, "MAG_ERR",  dM    , Nsec);
     675    gfits_set_bintable_column (&theader, &ftable, "MAG_CHI",  Mchisq, Nsec);
     676    gfits_set_bintable_column (&theader, &ftable, "FLAGS",    flags , Nsec);
     677    gfits_set_bintable_column (&theader, &ftable, "NCODE",    Ncode , Nsec);
     678    gfits_set_bintable_column (&theader, &ftable, "NUSED",    Nused , Nsec);
     679    gfits_set_bintable_column (&theader, &ftable, "MAG_MIN",  Mmin , Nsec);
     680    gfits_set_bintable_column (&theader, &ftable, "MAG_MAX",  Mmax , Nsec);
    673681
    674682    free (M      );
    675683    free (dM     );
    676     free (Xm    );
     684    free (Mchisq );
    677685    free (flags  );
    678686    free (Ncode  );
    679687    free (Nused  );
    680     free (M_20   );
    681     free (M_80   );
     688    free (Mmin   );
     689    free (Mmax   );
    682690
    683691    gfits_fwrite_Theader (f, &theader);
  • trunk/Ohana/src/relastro/src/FitChip.c

    r36833 r37038  
    112112  }
    113113
    114   int Ncolor = 0;
     114  int Ncolor;
     115  float colorMedian;
    115116  float *colorList = NULL;
    116117  ALLOCATE (colorList, float, Nmatch);
    117118
     119  // calculate the median blue color
     120  Ncolor = 0;
    118121  for (i = 0; i < Nmatch; i++) {
    119122    if (!raw[i].mask) continue;
    120     if (!isnan(ref[i].Color)) {
    121       colorList[Ncolor] = ref[i].Color;
    122       Ncolor ++;
    123     }
     123    if (isnan(ref[i].ColorBlue)) continue;
     124    colorList[Ncolor] = ref[i].ColorBlue;
     125    Ncolor ++;
    124126  }
    125127  fsort (colorList, Ncolor);
    126   float colorMedian = (Ncolor > 0) ? colorList[(int)(0.5*Ncolor)] : NAN;
    127   image[0].refColor = colorMedian;
     128  colorMedian = (Ncolor > 0) ? colorList[(int)(0.5*Ncolor)] : NAN;
     129  image[0].refColorBlue = colorMedian;
     130
     131  // calculate the median red color
     132  Ncolor = 0;
     133  for (i = 0; i < Nmatch; i++) {
     134    if (!raw[i].mask) continue;
     135    if (isnan(ref[i].ColorRed)) continue;
     136    colorList[Ncolor] = ref[i].ColorRed;
     137    Ncolor ++;
     138  }
     139  fsort (colorList, Ncolor);
     140  colorMedian = (Ncolor > 0) ? colorList[(int)(0.5*Ncolor)] : NAN;
     141  image[0].refColorRed = colorMedian;
     142
    128143  free (colorList);
    129144
  • trunk/Ohana/src/relastro/src/ImageOps.c

    r36833 r37038  
    345345*/
    346346
    347 float getColor (off_t meas, int cat) {
     347float getColorBlue (off_t meas, int cat) {
    348348
    349349  off_t i;
     
    351351  i = MeasureToImage[cat][meas];
    352352  if (i == -1) return (NAN);
    353   return (image[i].refColor);
     353  return (image[i].refColorBlue);
     354}
     355
     356float getColorRed (off_t meas, int cat) {
     357
     358  off_t i;
     359
     360  i = MeasureToImage[cat][meas];
     361  if (i == -1) return (NAN);
     362  return (image[i].refColorRed);
    354363}
    355364
     
    406415  for (j = 0; j < average[0].Nmeasure; j++) {
    407416    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);
     417    fprintf (stderr, "R, D, mag, dMag: %lf, %lf, %f, %f\n", measure[off].R, measure[off].D, measure[off].M, measure[off].dM);
    409418  }
    410419  return;
     
    554563
    555564    // complain if the new location is far from the old location
    556     if (fabs(csdec*(measure[0].dR - dR)) > DPOS_MAX_ASEC) {
     565    if (fabs(csdec*(measure[0].R - R)) > DPOS_MAX_ASEC) {
    557566      NoffRAori ++;
    558567      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);
     568        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);
    560569        dump_measures (&average[0], catalog[c].measure);
    561570      }
    562571      // abort();
    563572    }
    564     if (fabs(measure[0].dD - dD) > DPOS_MAX_ASEC) {
     573    if (fabs(measure[0].D - D) > DPOS_MAX_ASEC) {
    565574      NoffDECori ++;
    566575      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);
     576        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);
    568577        dump_measures (&average[0], catalog[c].measure);
    569578      }      // abort();
    570579    }
    571580
    572     dPos += SQ(measure[0].dR - dR) + SQ(measure[0].dD - dD);
     581    // XXX NOTE : apply csdec:
     582    dPos += SQ(measure[0].R - R) + SQ(measure[0].D - D);
    573583    nPos ++;
    574584
    575     measure[0].dR = dR;
    576     measure[0].dD = dD;
    577     measureT[0].dR = dR;
    578     measureT[0].dD = dD;
     585    measure[0].R = R;
     586    measure[0].D = D;
     587    measureT[0].R = R;
     588    measureT[0].D = D;
    579589   
    580590    // set the systematic error for this image:
     
    601611
    602612  off_t i, m, c, n;
    603   double X, Y, L, M, P, Q, R, D, dR, dD;
     613  double X, Y, L, M, P, Q, R, D;
    604614
    605615  Mosaic *mosaic;
     
    649659    n = measure[0].averef;
    650660
    651     dR = dD = 0.0;
    652661    if (moscoords == NULL) {
    653662      // this is a Simple image (not a mosaic)
     
    660669      LM_to_RD (&R, &D, P, Q, moscoords);
    661670    }
    662 
    663     measure[0].dR = dR;
    664     measure[0].dD = dD;
    665 
    666     if (measure[0].dR > +180.0*3600.0) {
     671    measure[0].R = R;
     672    measure[0].D = D;
     673
     674    float dRoff = dvoOffsetR(measure, &catalog[c].average[n]);
     675
     676    if (dRoff > +180.0*3600.0) {
    667677      // average on high end of boundary, move star up
    668       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) {
    672       // average on low end of boundary, move star down
    673       R -= 360.0;
    674       measure[0].dR = 3600.0*(catalog[c].average[n].R - R);
     678      measure[0].R += 360.0;
     679      dRoff -= 360.0*3600.0;
     680    }
     681    if (dRoff < -180.0*3600.0) {
     682      measure[0].R -= 360.0;
     683      dRoff += 360.0*3600.0;
    675684    }
    676685  }
     
    734743      raw[i].mask |= MARK_TOO_FEW_MEAS;
    735744    }
    736     if (!finite(measure[0].dR) || !finite(measure[0].dD)) {
     745    if (!finite(measure[0].R) || !finite(measure[0].D)) {
    737746      raw[i].mask |= MARK_NAN_POS_ERROR;
    738747    }
     
    803812    ref[i].dPos = GetAstromErrorTiny (&measure[0], ERROR_MODE_POS);
    804813
    805     if ((DCR_NSEC_POS >= 0) && (DCR_NSEC_NEG >= -1)) {
    806       ref[i].Color = catalog[c].secfilt[n*Nsecfilt + DCR_NSEC_POS].M - catalog[c].secfilt[n*Nsecfilt + DCR_NSEC_NEG].M;
     814    if ((DCR_BLUE_NSEC_POS >= 0) && (DCR_BLUE_NSEC_NEG >= -1)) {
     815      ref[i].ColorBlue = catalog[c].secfilt[n*Nsecfilt + DCR_BLUE_NSEC_POS].M - catalog[c].secfilt[n*Nsecfilt + DCR_BLUE_NSEC_NEG].M;
     816    }
     817    if ((DCR_RED_NSEC_POS >= 0) && (DCR_RED_NSEC_NEG >= -1)) {
     818      ref[i].ColorRed = catalog[c].secfilt[n*Nsecfilt + DCR_RED_NSEC_POS].M - catalog[c].secfilt[n*Nsecfilt + DCR_RED_NSEC_NEG].M;
    807819    }
    808820
     
    880892      // skip measurements based on user selected criteria
    881893      if (!MeasFilterTest(&measure[k], FALSE)) continue;
    882       R[N] = measure[k].dR;
    883       D[N] = measure[k].dD;
     894      R[N] = measure[k].R;
     895      D[N] = measure[k].D;
    884896      dR[N] = GetAstromError (&measure[k], ERROR_MODE_RA);
    885897      dD[N] = GetAstromError (&measure[k], ERROR_MODE_DEC);
     
    906918      if (!MeasFilterTest(&measure[k], FALSE)) continue;
    907919     
    908       x = measure[k].dR - statsR.median;
    909       y = measure[k].dD - statsD.median;
     920      x = measure[k].R - statsR.median;
     921      y = measure[k].D - statsD.median;
    910922      theta = atan2(y,x);
    911923      if ((x*x + y*y) > (SQR(statsR.sigma * Ns * cos(theta)) +
     
    981993      // skip measurements based on user selected criteria
    982994      if (!MeasFilterTest(&measure[k], FALSE)) continue;
    983       R[N] = measure[k].dR;
    984       D[N] = measure[k].dD;
     995      R[N] = measure[k].R;
     996      D[N] = measure[k].D;
    985997      dR[N] = GetAstromError(&measure[k], ERROR_MODE_RA);
    986998      dD[N] = GetAstromError(&measure[k], ERROR_MODE_DEC);
     
    10021014      // skip bad measurements
    10031015      if (!MeasFilterTest(&measure[k], FALSE)) continue; 
    1004       x = measure[k].dR - statsR.median;
    1005       y = measure[k].dD - statsD.median;
     1016      x = measure[k].R - statsR.median;
     1017      y = measure[k].D - statsD.median;
    10061018      theta = atan2(y,x);
    10071019      d2[N] = (x*x + y*y) / (SQR(statsR.sigma * Ns * cos(theta)) +
     
    10181030    for (k = 0;  k < N; k++) {
    10191031      off_t ind = (off_t) index[k];
    1020       R[k] = measure[ind].dR;
    1021       D[k] = measure[ind].dD;
     1032      R[k] = measure[ind].R;
     1033      D[k] = measure[ind].D;
    10221034      dR[k] = GetAstromError(&measure[ind], ERROR_MODE_RA);
    10231035      dD[k] = GetAstromError(&measure[ind], ERROR_MODE_DEC);
     
    10331045      //skip bad measurements
    10341046      if (!MeasFilterTest(&measure[k], FALSE)) continue; 
    1035       x = measure[k].dR - statsR.median;
    1036       y = measure[k].dD - statsD.median;
     1047      x = measure[k].R - statsR.median;
     1048      y = measure[k].D - statsD.median;
    10371049      theta = atan2(y,x);
    10381050      d2[N] = (x*x + y*y) / (SQR(statsR.sigma * Ns * cos(theta)) +
     
    10681080  float mag;
    10691081
    1070   if (!finite(measure[0].dR) || !finite(measure[0].dD)) return FALSE;
     1082  if (!finite(measure[0].R) || !finite(measure[0].D)) return FALSE;
    10711083  if (!finite(measure[0].M)) return FALSE; //XXX is this necessary for all relastro tasks?
    10721084  if (!finite(measure[0].dM)) return FALSE; //XXX is this necessary for all relastro tasks?
     
    11201132  /* select measurements by mag limit */
    11211133  if (ImagSelect) {
    1122     mag = PhotInstTiny (measure);
     1134    mag = PhotInstTiny (measure, MAG_CLASS_PSF);
    11231135    if (mag < ImagMin || mag > ImagMax) return FALSE;
    11241136  }
     
    11351147  float mag;
    11361148
    1137   if (!finite(measure[0].dR) || !finite(measure[0].dD)) return FALSE;
     1149  if (!finite(measure[0].R) || !finite(measure[0].D)) return FALSE;
    11381150  if (!finite(measure[0].M)) return FALSE; //XXX is this necessary for all relastro tasks?
    11391151  if (!finite(measure[0].dM)) return FALSE; //XXX is this necessary for all relastro tasks?
     
    11871199  /* select measurements by mag limit */
    11881200  if (ImagSelect) {
    1189     mag = PhotInst (measure);
     1201    mag = PhotInst (measure, MAG_CLASS_PSF);
    11901202    if (mag < ImagMin || mag > ImagMax) return FALSE;
    11911203  }
  • trunk/Ohana/src/relastro/src/MeanPosIO.c

    r36630 r37038  
    111111  gfits_define_bintable_column (&theader, "D", "RA",        "mean position, ra",  "degrees", 1.0, 0.0);
    112112  gfits_define_bintable_column (&theader, "D", "DEC",       "mean position, dec", "degrees", 1.0, 0.0);
    113   gfits_define_bintable_column (&theader, "J", "OBJ_ID",    "object ID",          NULL,      1.0, 1.0*0x8000);
    114   gfits_define_bintable_column (&theader, "J", "CAT_ID",    "catalog ID",         NULL,      1.0, 1.0*0x8000);
     113  gfits_define_bintable_column (&theader, "J", "OBJ_ID",    "object ID",          NULL,      1.0, FT_BZERO_INT32);
     114  gfits_define_bintable_column (&theader, "J", "CAT_ID",    "catalog ID",         NULL,      1.0, FT_BZERO_INT32);
    115115
    116116  // generate the output array that carries the data
  • trunk/Ohana/src/relastro/src/MosaicOps.c

    r36630 r37038  
    9797
    9898    /* a new mosaic, define ranges */
    99     mosaic[Nmosaic].start = start;
    100     mosaic[Nmosaic].stop  = stop;
    101     mosaic[Nmosaic].Mcal  = 0.0;
    102     mosaic[Nmosaic].dMcal = 0.0;
    103     mosaic[Nmosaic].Xm    = 0.0;
    104     mosaic[Nmosaic].flags  = image[i].flags;
    105     mosaic[Nmosaic].secz  = image[i].secz;
    106     mosaic[Nmosaic].coords = image[i].coords;
     99    mosaic[Nmosaic].start   = start;
     100    mosaic[Nmosaic].stop    = stop;
     101    mosaic[Nmosaic].Mcal    = 0.0;
     102    mosaic[Nmosaic].dMcal   = 0.0;
     103    mosaic[Nmosaic].Xm      = 0.0;
     104    mosaic[Nmosaic].flags   = image[i].flags;
     105    mosaic[Nmosaic].secz    = image[i].secz;
     106    mosaic[Nmosaic].coords  = image[i].coords;
    107107    mosaic[Nmosaic].myImage = i;
    108108
  • trunk/Ohana/src/relastro/src/Shutdown.c

    r12332 r37038  
    2323  SetProtect (TRUE);
    2424  gfits_db_close (db);
    25   fprintf (stderr, "ERROR: addstar halted\n");
     25  fprintf (stderr, "ERROR: relastro halted\n");
    2626  exit (1);
    2727}
  • trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c

    r36833 r37038  
    153153    // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
    154154
    155     if (DCR_COLOR_POS && DCR_COLOR_NEG) {
    156       strextend (command, "-dcr-color %s %s", DCR_COLOR_POS, DCR_COLOR_NEG);
     155    if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) {
     156      strextend (command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG);
     157    }
     158    if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) {
     159      strextend (command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG);
    157160    }
    158161
  • trunk/Ohana/src/relastro/src/UpdateObjects.c

    r36833 r37038  
    1010static double *T;
    1111static double *dT;
    12 static double *C;
     12static double *C_blue;
     13static double *C_red;
    1314
    1415void initObjectData (Catalog *catalog, int Ncatalog) {
     
    3839  ALLOCATE (pY, double, MAX (1, Nmax));
    3940
    40   ALLOCATE (C, double, MAX (1, Nmax));
     41  ALLOCATE (C_blue, double, MAX (1, Nmax));
     42  ALLOCATE (C_red,  double, MAX (1, Nmax));
    4143
    4244
     
    5860  free (pY);
    5961
    60   free (C);
     62  free (C_blue);
     63  free (C_red);
    6164
    6265
     
    6669
    6770  off_t j, k, m;
    68   int i, N, Nc, Nsecfilt, mode, result, status, XVERB;
     71  int i, N, NcBlue, NcRed, Nsecfilt, mode, result, status, XVERB;
    6972  StatType statsR, statsD;
    7073  Coords coords;
     
    130133      }
    131134
    132       Nc = 0;
     135      NcBlue = 0;
     136      NcRed = 0;
    133137      N = 0;
    134138      m = catalog[i].average[j].measureOffset;
     
    149153          char *date = ohana_sec_to_date (measure[k].t);
    150154          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);
     155          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);
    152156          free (date);
    153157        }
     
    225229
    226230        if (setRefColor) {
    227           float color = getColor (m+k, i);
    228           if (!isnan(color)) {
    229             C[Nc] = color;
    230             Nc++;
     231          float colorBlue = getColorBlue (m+k, i);
     232          if (!isnan(colorBlue)) {
     233            C_blue[NcBlue] = colorBlue;
     234            NcBlue++;
     235          }
     236          float colorRed = getColorRed (m+k, i);
     237          if (!isnan(colorRed)) {
     238            C_red[NcRed] = colorRed;
     239            NcRed++;
    231240          }
    232241        }
     
    360369
    361370      if (setRefColor) {
    362         dsort (C, Nc);
    363         float colorMedian = (Nc > 0) ? C[(int)(0.5*Nc)] : NAN;
    364         catalog[i].average[j].refColor = colorMedian;
     371        float colorMedian;
     372        dsort (C_blue, NcBlue);
     373        colorMedian = (NcBlue > 0) ? C_blue[(int)(0.5*NcBlue)] : NAN;
     374        catalog[i].average[j].refColorBlue = colorMedian;
     375        dsort (C_red, NcRed);
     376        colorMedian = (NcRed > 0) ? C_red[(int)(0.5*NcRed)] : NAN;
     377        catalog[i].average[j].refColorRed = colorMedian;
    365378      }
    366379
  • trunk/Ohana/src/relastro/src/args.c

    r36833 r37038  
    294294  }
    295295
    296   DCR_COLOR_POS = NULL;
    297   DCR_COLOR_NEG = NULL;
    298   if ((N = get_argument (argc, argv, "-dcr-color"))) {
    299     remove_argument (N, &argc, argv);
    300     DCR_COLOR_POS = strcreate(argv[N]);
    301     remove_argument (N, &argc, argv);
    302     DCR_COLOR_NEG = strcreate(argv[N]);
     296  // eg g - r or r - i
     297  DCR_BLUE_COLOR_POS = NULL;
     298  DCR_BLUE_COLOR_NEG = NULL;
     299  if ((N = get_argument (argc, argv, "-dcr-blue-color"))) {
     300    remove_argument (N, &argc, argv);
     301    DCR_BLUE_COLOR_POS = strcreate(argv[N]);
     302    remove_argument (N, &argc, argv);
     303    DCR_BLUE_COLOR_NEG = strcreate(argv[N]);
     304    remove_argument (N, &argc, argv);
     305  }
     306
     307  // eg, z - y or i - z
     308  DCR_RED_COLOR_POS = NULL;
     309  DCR_RED_COLOR_NEG = NULL;
     310  if ((N = get_argument (argc, argv, "-dcr-red-color"))) {
     311    remove_argument (N, &argc, argv);
     312    DCR_RED_COLOR_POS = strcreate(argv[N]);
     313    remove_argument (N, &argc, argv);
     314    DCR_RED_COLOR_NEG = strcreate(argv[N]);
    303315    remove_argument (N, &argc, argv);
    304316  }
     
    696708  }
    697709
    698   DCR_COLOR_POS = NULL;
    699   DCR_COLOR_NEG = NULL;
    700   if ((N = get_argument (argc, argv, "-dcr-color"))) {
    701     remove_argument (N, &argc, argv);
    702     DCR_COLOR_POS = strcreate(argv[N]);
    703     remove_argument (N, &argc, argv);
    704     DCR_COLOR_NEG = strcreate(argv[N]);
     710  DCR_BLUE_COLOR_POS = NULL;
     711  DCR_BLUE_COLOR_NEG = NULL;
     712  if ((N = get_argument (argc, argv, "-dcr-blue-color"))) {
     713    remove_argument (N, &argc, argv);
     714    DCR_BLUE_COLOR_POS = strcreate(argv[N]);
     715    remove_argument (N, &argc, argv);
     716    DCR_BLUE_COLOR_NEG = strcreate(argv[N]);
     717    remove_argument (N, &argc, argv);
     718  }
     719  DCR_RED_COLOR_POS = NULL;
     720  DCR_RED_COLOR_NEG = NULL;
     721  if ((N = get_argument (argc, argv, "-dcr-red-color"))) {
     722    remove_argument (N, &argc, argv);
     723    DCR_RED_COLOR_POS = strcreate(argv[N]);
     724    remove_argument (N, &argc, argv);
     725    DCR_RED_COLOR_NEG = strcreate(argv[N]);
    705726    remove_argument (N, &argc, argv);
    706727  }
  • trunk/Ohana/src/relastro/src/dvo_astrom_ops.c

    r36833 r37038  
    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 
  • trunk/Ohana/src/relastro/src/high_speed_objects.c

    r36482 r37038  
    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);
  • trunk/Ohana/src/relastro/src/hpm_objects.c

    r36482 r37038  
    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++;
  • trunk/Ohana/src/relastro/src/initialize.c

    r36833 r37038  
    88  if (RELASTRO_OP == OP_MERGE_SOURCE) return;
    99
    10   if (DCR_COLOR_POS)  fprintf (stderr, "DCR_COLOR_POS:  %s\n", DCR_COLOR_POS);
    11   if (DCR_COLOR_NEG)  fprintf (stderr, "DCR_COLOR_NEG:  %s\n", DCR_COLOR_NEG);
     10  if (DCR_BLUE_COLOR_POS)  fprintf (stderr, "DCR_BLUE_COLOR_POS:  %s - %s\n", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG);
     11  if (DCR_BLUE_COLOR_POS)  fprintf (stderr, "DCR_BLUE_COLOR_POS:  %s - %s\n", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG);
    1212
    1313  if (PHOTCODE_KEEP_LIST)  fprintf (stderr, "PHOTCODE_KEEP_LIST:  %s\n", PHOTCODE_KEEP_LIST);
     
    2323  photcodesGroupB = ParsePhotcodeList (PHOTCODE_B_LIST,     &NphotcodesGroupB, TRUE);
    2424
    25   DCR_NSEC_POS = DCR_NSEC_NEG = -1;
    26   if (DCR_COLOR_POS) {
    27     DCR_PHOTCODE_POS = GetPhotcodebyName (DCR_COLOR_POS);
    28     if (!DCR_PHOTCODE_POS) {
    29       fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", DCR_COLOR_POS);
     25  // blue color elements
     26  DCR_BLUE_NSEC_POS = DCR_BLUE_NSEC_NEG = -1;
     27  if (DCR_BLUE_COLOR_POS) {
     28    DCR_BLUE_PHOTCODE_POS = GetPhotcodebyName (DCR_BLUE_COLOR_POS);
     29    if (!DCR_BLUE_PHOTCODE_POS) {
     30      fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", DCR_BLUE_COLOR_POS);
    3031      exit (1);
    3132    }
    32     DCR_NSEC_POS = GetPhotcodeNsec (DCR_PHOTCODE_POS[0].code);
     33    DCR_BLUE_NSEC_POS = GetPhotcodeNsec (DCR_BLUE_PHOTCODE_POS[0].code);
    3334  }
    34   if (DCR_COLOR_NEG) {
    35     DCR_PHOTCODE_NEG = GetPhotcodebyName (DCR_COLOR_NEG);
    36     if (!DCR_PHOTCODE_NEG) {
    37       fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", DCR_COLOR_NEG);
     35  if (DCR_BLUE_COLOR_NEG) {
     36    DCR_BLUE_PHOTCODE_NEG = GetPhotcodebyName (DCR_BLUE_COLOR_NEG);
     37    if (!DCR_BLUE_PHOTCODE_NEG) {
     38      fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", DCR_BLUE_COLOR_NEG);
    3839      exit (1);
    3940    }
    40     DCR_NSEC_NEG = GetPhotcodeNsec (DCR_PHOTCODE_NEG[0].code);
     41    DCR_BLUE_NSEC_NEG = GetPhotcodeNsec (DCR_BLUE_PHOTCODE_NEG[0].code);
     42  }
     43
     44  // red color elements
     45  DCR_RED_NSEC_POS = DCR_RED_NSEC_NEG = -1;
     46  if (DCR_RED_COLOR_POS) {
     47    DCR_RED_PHOTCODE_POS = GetPhotcodebyName (DCR_RED_COLOR_POS);
     48    if (!DCR_RED_PHOTCODE_POS) {
     49      fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", DCR_RED_COLOR_POS);
     50      exit (1);
     51    }
     52    DCR_RED_NSEC_POS = GetPhotcodeNsec (DCR_RED_PHOTCODE_POS[0].code);
     53  }
     54  if (DCR_RED_COLOR_NEG) {
     55    DCR_RED_PHOTCODE_NEG = GetPhotcodebyName (DCR_RED_COLOR_NEG);
     56    if (!DCR_RED_PHOTCODE_NEG) {
     57      fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", DCR_RED_COLOR_NEG);
     58      exit (1);
     59    }
     60    DCR_RED_NSEC_NEG = GetPhotcodeNsec (DCR_RED_PHOTCODE_NEG[0].code);
    4161  }
    4262
  • trunk/Ohana/src/relastro/src/launch_region_hosts.c

    r36871 r37038  
    8181    if (ExcludeBogus)       strextend (command, "-exclude-bogus %f", ExcludeBogusRadius);
    8282
    83     if (DCR_COLOR_POS && DCR_COLOR_NEG) {
    84       strextend (command, "-dcr-color %s %s", DCR_COLOR_POS, DCR_COLOR_NEG);
     83    if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) {
     84      strextend (command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG);
     85    }
     86    if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) {
     87      strextend (command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG);
    8588    }
    8689
  • trunk/Ohana/src/relastro/src/load_catalogs.c

    r36833 r37038  
    102102  }
    103103
     104  // if we are running with parallel_images but not a parallel database, we need to
     105  // release the lock so the next image host can proceed
     106  if (!hostID && syncfile) {
     107    update_sync_file (syncfile, 1);
     108  }
     109
    104110  // only return the populated catalogs
    105111  REALLOCATE (catalog, Catalog, Ncat);
     
    165171    if (ExcludeBogus)  strextend (command, "-exclude-bogus %f", ExcludeBogusRadius);
    166172   
    167     if (DCR_COLOR_POS && DCR_COLOR_NEG) {
    168       strextend (command, "-dcr-color %s %s", DCR_COLOR_POS, DCR_COLOR_NEG);
     173    if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) {
     174      strextend (command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG);
     175    }
     176    if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) {
     177      strextend (command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG);
    169178    }
    170179
     
    215224  }
    216225
    217   // update syncfile here (save lots of I/O time)
     226  // update syncfile here (save lots of I/O time):
     227
     228  // at this point, the remote relastro_client jobs are done loading their data.  in a
     229  // parallel_images mode, the next image host can be launched while this image host now
     230  // reads that
    218231
    219232  // NOTE: if I let all hosts load blindly, I saturate the data clients with too many
  • trunk/Ohana/src/relastro/src/markObjects.c

    r36630 r37038  
    88  // How strongly do I own this object?
    99  for (i = 0; i < Ncatalog; i++) {
    10     ALLOCATE (catalog[i].nOwn, int, catalog[i].Naverage);
    11     memset (catalog[i].nOwn, 0, catalog[i].Naverage*sizeof(int));
     10    ALLOCATE (catalog[i].nOwn_t, int, catalog[i].Naverage);
     11    memset (catalog[i].nOwn_t, 0, catalog[i].Naverage*sizeof(int));
    1212    for (j = 0; j < catalog[i].Naverage; j++) {
    1313      int nOwn = 0;
     
    1717        nOwn ++;
    1818      }
    19       catalog[i].nOwn[j] = nOwn;
     19      catalog[i].nOwn_t[j] = nOwn;
    2020    }
    2121  }
  • trunk/Ohana/src/relastro/src/relastroVisual.c

    r31635 r37038  
    431431 
    432432  // populate vectors
    433   ALLOCATE(Din, float, Nmeasure);
    434   ALLOCATE(Rin, float, Nmeasure);
     433  ALLOCATE(Din,  float, Nmeasure);
     434  ALLOCATE(Rin,  float, Nmeasure);
    435435  ALLOCATE(Dout, float, Nmeasure);
    436436  ALLOCATE(Rout, float, Nmeasure);
     
    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++;
  • trunk/Ohana/src/relastro/src/relastro_merge_source.c

    r34088 r37038  
    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
  • trunk/Ohana/src/relastro/src/share_mean_pos.c

    r36630 r37038  
    3333      // XXX : sky objects without missing detections
    3434      // XXX watch out for detections which are not associated with an image (REF)
    35       if (catalog[i].nOwn[j] == catalog[i].average[j].Nmeasure) continue;
     35      if (catalog[i].nOwn_t[j] == catalog[i].average[j].Nmeasure) continue;
    3636
    3737      set_mean_pos (&meanpos[Nmeanpos], &catalog[i].average[j]);
Note: See TracChangeset for help on using the changeset viewer.