IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40244


Ignore:
Timestamp:
Dec 5, 2017, 6:04:35 AM (9 years ago)
Author:
eugene
Message:

split measure->Mcal into McalPSF and McalAPER

Location:
branches/eam_branches/ohana.20170822/src
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20170822/src/addstar/src/FilterStars.c

    r40212 r40244  
    7373    outcat->measure[N].airmass = airmass (image[0].secz, outcat->average[N].R, outcat->average[N].D, image[0].sidtime, image[0].latitude);
    7474    outcat->measure[N].az      = azimuth (15.0*image[0].sidtime - outcat->average[N].R, outcat->average[N].D, image[0].latitude);
    75     outcat->measure[N].Mcal    = image[0].McalPSF;
     75    outcat->measure[N].McalPSF = image[0].McalPSF;
     76    outcat->measure[N].McalAPER= image[0].McalAPER;
    7677    outcat->measure[N].t       = image[0].tzero + 1e-4*outcat->measure[N].Yccd*image[0].trate;  /* trate is in 0.1 msec / row */
    7778    outcat->measure[N].dt      = MTIME;
  • branches/eam_branches/ohana.20170822/src/addstar/src/ReadStarsUKIRT.c

    r40212 r40244  
    196196    catalog->measure[i].FWy       = ToShortPixels(seeing);
    197197
    198     catalog->measure[i].Mcal      = Mcal;
     198    catalog->measure[i].McalPSF   = Mcal;
     199    catalog->measure[i].McalAPER  = Mcal;
    199200
    200201    catalog->measure[i].detID     = i;
  • branches/eam_branches/ohana.20170822/src/addstar/src/SEDfit.c

    r38467 r40244  
    172172      outcat[0].measure[Nmeas].M         = table[0].row[minFit.row][0].mags[n] + minFit.Md;
    173173      outcat[0].measure[Nmeas].dM        = 0.0;
    174       outcat[0].measure[Nmeas].Mcal      = 0;
     174      outcat[0].measure[Nmeas].McalPSF   = 0;
     175      outcat[0].measure[Nmeas].McalAPER  = 0;
    175176      outcat[0].measure[Nmeas].t         = TIMEREF;
    176177      outcat[0].measure[Nmeas].averef    = Nave;
  • branches/eam_branches/ohana.20170822/src/addstar/src/find_proper.c

    r15036 r40244  
    104104       
    105105        /** add measurements for this star **/
    106         catalog[0].measure[Nmeas].dR  = 360000.0*(catalog[0].average[n].R - usno[N].R);
    107         catalog[0].measure[Nmeas].dD  = 360000.0*(catalog[0].average[n].D - usno[N].D);
    108         catalog[0].measure[Nmeas].M   = 1000.0*fabs(usno[N].r);
    109         catalog[0].measure[Nmeas].Mcal= 0;    /* above measurement is exact */
    110         catalog[0].measure[Nmeas].dM  = 100;  /* error in input files stored in thousandths of mag */
    111         catalog[0].measure[Nmeas].t   = 0;    /* a flag: if 0, image is not in database */
    112         catalog[0].measure[Nmeas].averef  = n;
    113         catalog[0].measure[Nmeas].photcode = USNO_RED;
    114         catalog[0].measure[Nmeas+1].dR  = catalog[0].measure[Nmeas].dR;
    115         catalog[0].measure[Nmeas+1].dD  = catalog[0].measure[Nmeas].dD;
    116         catalog[0].measure[Nmeas+1].M   = 1000.0*fabs(usno[N].b);
    117         catalog[0].measure[Nmeas+1].Mcal= 0;    /* above measurement is exact */
    118         catalog[0].measure[Nmeas+1].dM  = 100;  /* error in input files stored in thousandths of mag */
    119         catalog[0].measure[Nmeas+1].t   = 0;    /* a flag: if 0, image is not in database */
    120         catalog[0].measure[Nmeas+1].averef  = n;
     106        catalog[0].measure[Nmeas].dR         = 360000.0*(catalog[0].average[n].R - usno[N].R);
     107        catalog[0].measure[Nmeas].dD         = 360000.0*(catalog[0].average[n].D - usno[N].D);
     108        catalog[0].measure[Nmeas].M          = 1000.0*fabs(usno[N].r);
     109        catalog[0].measure[Nmeas].McalPSF    = 0;    /* above measurement is exact */
     110        catalog[0].measure[Nmeas].McalAPER   = 0;    /* above measurement is exact */
     111        catalog[0].measure[Nmeas].dM         = 100;  /* error in input files stored in thousandths of mag */
     112        catalog[0].measure[Nmeas].t          = 0;    /* a flag: if 0, image is not in database */
     113        catalog[0].measure[Nmeas].averef     = n;
     114        catalog[0].measure[Nmeas].photcode   = USNO_RED;
     115        catalog[0].measure[Nmeas+1].dR       = catalog[0].measure[Nmeas].dR;
     116        catalog[0].measure[Nmeas+1].dD       = catalog[0].measure[Nmeas].dD;
     117        catalog[0].measure[Nmeas+1].M        = 1000.0*fabs(usno[N].b);
     118        catalog[0].measure[Nmeas+1].McalPSF  = 0;    /* above measurement is exact */
     119        catalog[0].measure[Nmeas+1].McalAPER = 0;    /* above measurement is exact */
     120        catalog[0].measure[Nmeas+1].dM       = 100;  /* error in input files stored in thousandths of mag */
     121        catalog[0].measure[Nmeas+1].t        = 0;    /* a flag: if 0, image is not in database */
     122        catalog[0].measure[Nmeas+1].averef   = n;
    121123        catalog[0].measure[Nmeas+1].photcode = USNO_BLUE;
    122124        /* add flag in average to mark as matched with the USNO catalog */
  • branches/eam_branches/ohana.20170822/src/addstar/src/loadsupercos_rawdata.c

    r39457 r40244  
    8686
    8787        // XXX fix these
    88         newcat->measure[i].Mcal = 0.0;
     88        newcat->measure[i].McalPSF  = 0.0;
     89        newcat->measure[i].McalAPER = 0.0;
    8990        newcat->measure[i].dt = image[Ni].exptime;
    9091
  • branches/eam_branches/ohana.20170822/src/checkastro/src/BrightCatalog.c

    r40212 r40244  
    7171    GET_COLUMN(dD,        "DEC_OFF",    float);
    7272    GET_COLUMN(M,         "MAG_SYS",    float);
    73     GET_COLUMN(Mcal,      "MAG_CAL",    float);
     73    GET_COLUMN(McalPSF,   "MCAL_PSF",   float);
     74    GET_COLUMN(McalAPER,  "MCAL_APER",  float);
    7475    GET_COLUMN(dM,        "MAG_ERR",    float);
    7576    GET_COLUMN(airmass,   "AIRMASS",    float);
     
    9596      measure[i].dD        = dD[i];
    9697      measure[i].M         = M[i];
    97       measure[i].Mcal      = Mcal[i];
     98      measure[i].McalPSF   = McalPSF[i];
     99      measure[i].McalAPER  = McalAPER[i];
    98100      measure[i].dM        = dM[i];
    99101      measure[i].airmass   = airmass[i];
     
    116118    free (dD      );
    117119    free (M       );
    118     free (Mcal    );
     120    free (McalPSF );
     121    free (McalAPER);
    119122    free (dM      );
    120123    free (airmass );
     
    366369    float *dD        ; ALLOCATE (dD       ,  float, catalog->Nmeasure);
    367370    float *M         ; ALLOCATE (M        ,  float, catalog->Nmeasure);
    368     float *Mcal      ; ALLOCATE (Mcal     ,  float, catalog->Nmeasure);
     371    float *McalPSF   ; ALLOCATE (McalPSF  ,  float, catalog->Nmeasure);
     372    float *McalAPER  ; ALLOCATE (McalAPER ,  float, catalog->Nmeasure);
    369373    float *dM        ; ALLOCATE (dM       ,  float, catalog->Nmeasure);
    370374    float *airmass   ; ALLOCATE (airmass  ,  float, catalog->Nmeasure);
     
    388392      dD[i]       = measure[i].dD       ;
    389393      M[i]        = measure[i].M        ;
    390       Mcal[i]     = measure[i].Mcal     ;
     394      McalPSF[i]  = measure[i].McalPSF  ;
     395      McalAPER[i] = measure[i].McalAPER ;
    391396      dM[i]       = measure[i].dM       ;
    392397      airmass[i]  = measure[i].airmass  ;
     
    409414    gfits_set_bintable_column (&theader, &ftable, "DEC_OFF",    dD,        catalog->Nmeasure);
    410415    gfits_set_bintable_column (&theader, &ftable, "MAG_SYS",    M,         catalog->Nmeasure);
    411     gfits_set_bintable_column (&theader, &ftable, "MAG_CAL",    Mcal,      catalog->Nmeasure);
     416    gfits_set_bintable_column (&theader, &ftable, "MCAL_PSF",   McalPSF,   catalog->Nmeasure);
     417    gfits_set_bintable_column (&theader, &ftable, "MCAL_APER",  McalAPER,  catalog->Nmeasure);
    412418    gfits_set_bintable_column (&theader, &ftable, "MAG_ERR",    dM,        catalog->Nmeasure);
    413419    gfits_set_bintable_column (&theader, &ftable, "AIRMASS",    airmass,   catalog->Nmeasure);
     
    428434    free (dD      );
    429435    free (M       );
    430     free (Mcal    );
     436    free (McalPSF );
     437    free (McalAPER);
    431438    free (dM      );
    432439    free (airmass );
  • branches/eam_branches/ohana.20170822/src/dvolens/src/update_objects_catalog.c

    r39611 r40244  
    219219
    220220      // relphot sets measure->Mcal (setMcalOutput.c, called by setMrelFinal.c)
    221       float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure->Mcal;
     221      // XXX : I'm using McalAPER since these lens measurements are aperture-like, right?
     222      float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure->McalAPER;
    222223      float Fcal = 3630.8 * MagToFlux(Mcal);
    223224
  • branches/eam_branches/ohana.20170822/src/dvopsps/include/dvopsps.h

    r40230 r40244  
    1919  float raErr;
    2020  float decErr;
    21   float zp;
    22   float zpFactor;
     21  float zpPSF;
     22  float zpFactorPSF;
     23  float zpAPER;
     24  float zpFactorAPER;
    2325  float telluricExt;
    2426  float airmass;
  • branches/eam_branches/ohana.20170822/src/dvopsps/src/DetectionOps.c

    r39547 r40244  
    5656  GET_COLUMN(raErr       , "raErr",       float);
    5757  GET_COLUMN(decErr      , "decErr",      float);
    58   GET_COLUMN(zp          , "zp",          float);
    59   GET_COLUMN(zpFactor    , "zpFactor",    float);
     58  GET_COLUMN(zpPSF       , "zpPSF",       float);
     59  GET_COLUMN(zpFactorPSF , "zpFactorPSF", float);
     60  GET_COLUMN(zpAPER      , "zpAPER",      float);
     61  GET_COLUMN(zpFactorAPER, "zpFactorAPER",float);
    6062  GET_COLUMN(telluricExt , "telluricExt", float);
    6163  GET_COLUMN(airmass     , "airmass",     float);
     
    8486    detections[i].raErr        = raErr[i];     
    8587    detections[i].decErr       = decErr[i];     
    86     detections[i].zp           = zp[i];         
    87     detections[i].zpFactor     = zpFactor[i];         
     88    detections[i].zpPSF        = zpPSF[i];         
     89    detections[i].zpFactorPSF  = zpFactorPSF[i];         
     90    detections[i].zpAPER       = zpAPER[i];         
     91    detections[i].zpFactorAPER = zpFactorAPER[i];         
    8892    detections[i].telluricExt  = telluricExt[i];     
    8993    detections[i].airmass      = airmass[i];   
     
    110114  free (raErr      );
    111115  free (decErr     );
    112   free (zp         );
    113   free (zpFactor   );
     116  free (zpPSF      );
     117  free (zpFactorPSF);
     118  free (zpAPER      );
     119  free (zpFactorAPER);
    114120  free (telluricExt);
    115121  free (airmass    );
     
    180186  gfits_define_bintable_column (&theader, "E", "raErr",       NULL, NULL, 1.0, 0.0);
    181187  gfits_define_bintable_column (&theader, "E", "decErr",      NULL, NULL, 1.0, 0.0);
    182   gfits_define_bintable_column (&theader, "E", "zp",          NULL, NULL, 1.0, 0.0);
    183   gfits_define_bintable_column (&theader, "E", "zpFactor",    NULL, NULL, 1.0, 0.0);
     188  gfits_define_bintable_column (&theader, "E", "zpPSF",          NULL, NULL, 1.0, 0.0);
     189  gfits_define_bintable_column (&theader, "E", "zpFactorPSF",    NULL, NULL, 1.0, 0.0);
     190  gfits_define_bintable_column (&theader, "E", "zpAPER",         NULL, NULL, 1.0, 0.0);
     191  gfits_define_bintable_column (&theader, "E", "zpFactorAPER",   NULL, NULL, 1.0, 0.0);
    184192  gfits_define_bintable_column (&theader, "E", "telluricExt", NULL, NULL, 1.0, 0.0);
    185193  gfits_define_bintable_column (&theader, "E", "airmass",     NULL, NULL, 1.0, 0.0);
     
    208216  float      *raErr       ; ALLOCATE (raErr       ,  float,    Ndetections);
    209217  float      *decErr      ; ALLOCATE (decErr      ,  float,    Ndetections);
    210   float      *zp          ; ALLOCATE (zp          ,  float,    Ndetections);
    211   float      *zpFactor    ; ALLOCATE (zpFactor    ,  float,    Ndetections);
     218  float      *zpPSF       ; ALLOCATE (zpPSF       ,  float,    Ndetections);
     219  float      *zpFactorPSF ; ALLOCATE (zpFactorPSF ,  float,    Ndetections);
     220  float      *zpAPER      ; ALLOCATE (zpAPER      ,  float,    Ndetections);
     221  float      *zpFactorAPER; ALLOCATE (zpFactorAPER,  float,    Ndetections);
    212222  float      *telluricExt ; ALLOCATE (telluricExt ,  float,    Ndetections);
    213223  float      *airmass     ; ALLOCATE (airmass     ,  float,    Ndetections);
     
    234244    raErr[i]       = detections[i].raErr       ;
    235245    decErr[i]      = detections[i].decErr      ;
    236     zp[i]          = detections[i].zp          ;
    237     zpFactor[i]    = detections[i].zpFactor    ;
     246    zpPSF[i]       = detections[i].zpPSF       ;
     247    zpFactorPSF[i] = detections[i].zpFactorPSF ;
     248    zpAPER[i]      = detections[i].zpAPER      ;
     249    zpFactorAPER[i]= detections[i].zpFactorAPER;
    238250    telluricExt[i] = detections[i].telluricExt ;
    239251    airmass[i]     = detections[i].airmass     ;
     
    260272  gfits_set_bintable_column (&theader, &ftable, "raErr",       raErr       , Ndetections);
    261273  gfits_set_bintable_column (&theader, &ftable, "decErr",      decErr      , Ndetections);
    262   gfits_set_bintable_column (&theader, &ftable, "zp",          zp          , Ndetections);
    263   gfits_set_bintable_column (&theader, &ftable, "zpFactor",    zpFactor    , Ndetections);
     274  gfits_set_bintable_column (&theader, &ftable, "zpPSF",       zpPSF       , Ndetections);
     275  gfits_set_bintable_column (&theader, &ftable, "zpFactorPSF", zpFactorPSF , Ndetections);
     276  gfits_set_bintable_column (&theader, &ftable, "zpAPER",      zpAPER      , Ndetections);
     277  gfits_set_bintable_column (&theader, &ftable, "zpFactorAPER",zpFactorAPER, Ndetections);
    264278  gfits_set_bintable_column (&theader, &ftable, "telluricExt", telluricExt , Ndetections);
    265279  gfits_set_bintable_column (&theader, &ftable, "airmass",     airmass     , Ndetections);
     
    284298  free (raErr       );
    285299  free (decErr      );
    286   free (zp          );
    287   free (zpFactor    );
     300  free (zpPSF       );
     301  free (zpFactorPSF );
     302  free (zpAPER      );
     303  free (zpFactorAPER);
    288304  free (telluricExt );
    289305  free (airmass     );
  • branches/eam_branches/ohana.20170822/src/dvopsps/src/insert_detections_dvopsps_catalog.c

    r39645 r40244  
    183183
    184184  PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (objID, detectID, ippObjID, ippDetectID, imageID, catID, ");
    185   PrintIOBuffer (buffer, "ra, dec_, raErr, decErr, zp, zpFactor, telluricExt, airmass, expTime, ");
     185  PrintIOBuffer (buffer, "ra, dec_, raErr, decErr, zpPSF, zpFactorPSF, zpAPER, zpFactorAPER, telluricExt, airmass, expTime, ");
    186186  PrintIOBuffer (buffer, "Mpsf, dMpsf, Mkron, dMkron, Map, dMap, flags, objflags) VALUES \n");
    187187
     
    254254  PRINT_FLOAT(buffer, detection->raErr,       "%.6f, ");
    255255  PRINT_FLOAT(buffer, detection->decErr,      "%.6f, ");
    256   PRINT_FLOAT(buffer, detection->zp,          "%.6f, ");
    257   PRINT_FLOAT(buffer, detection->zpFactor,    "%.6e, ");
     256  PRINT_FLOAT(buffer, detection->zpPSF,       "%.6f, ");
     257  PRINT_FLOAT(buffer, detection->zpFactorPSF, "%.6e, ");
     258  PRINT_FLOAT(buffer, detection->zpAPER,      "%.6f, ");
     259  PRINT_FLOAT(buffer, detection->zpFactorAPER,"%.6e, ");
    258260  PRINT_FLOAT(buffer, detection->telluricExt, "%.6f, ");
    259261  PRINT_FLOAT(buffer, detection->airmass,     "%.6f, ");
     
    305307int assign_detection_values (Detections *detection, Measure *measure, Average *average) {
    306308
     309  // myAbort ("check on measure->McalPSF vs McalAPER");
     310
    307311  PhotCode *code = GetPhotcodebyCode(measure->photcode);
    308312
     
    311315  float Mflat       = isfinite(measure->Mflat) ? measure->Mflat : 0.0;
    312316  float nominalZP   = code->C * 0.001 + code->K * (measure->airmass - 1);
    313   float zp          = nominalZP - measure->Mcal - Mflat;
    314   float zpFactor    = pow(10.0, -0.4*zp + 3.56);
    315   float telluricExt = - measure->Mcal;
     317  float zpPSF       = nominalZP - measure->McalPSF - Mflat;
     318  float zpFactorPSF = pow(10.0, -0.4*zpPSF + 3.56);
     319  float zpAPER      = nominalZP - measure->McalAPER - Mflat;
     320  float zpFactorAPER= pow(10.0, -0.4*zpAPER + 3.56);
     321  float telluricExt = - measure->McalPSF;
    316322  float expTime     = pow(10.0, 0.4 * measure->dt);
    317323  float airmass     = measure->airmass;
     
    329335  detection->decErr       = measure->dYccd * 0.01 * fabs(measure->pltscale); // estimate of decErr
    330336
    331   detection->zp           = zp;
    332   detection->zpFactor     = zpFactor;
     337  detection->zpPSF        = zpPSF;
     338  detection->zpFactorPSF  = zpFactorPSF;
     339  detection->zpAPER       = zpAPER;
     340  detection->zpFactorAPER = zpFactorAPER;
    333341  detection->telluricExt  = telluricExt;
    334342  detection->airmass      = airmass;
     
    337345  // XXX clean this up with dvo_photcode_ops calls:
    338346  // if (isfinite(measure->FluxPSF) && (measure->FluxPSF < 0.0))
    339   detection->Mpsf  = getMagFromValueOrFlux (measure->FluxPSF,  measure->M,     zp);
    340   detection->Mkron = getMagFromValueOrFlux (measure->FluxKron, measure->Mkron, zp);
    341   detection->Map   = getMagFromValueOrFlux (measure->FluxAp,   measure->Map,   zp);
     347  detection->Mpsf  = getMagFromValueOrFlux (measure->FluxPSF,  measure->M,     zpPSF);
     348  detection->Mkron = getMagFromValueOrFlux (measure->FluxKron, measure->Mkron, zpAPER);
     349  detection->Map   = getMagFromValueOrFlux (measure->FluxAp,   measure->Map,   zpAPER);
    342350
    343351  detection->dMpsf  = getdMagFromValueOrFlux (measure->FluxPSF,  measure->dFluxPSF,  measure->dM);
  • branches/eam_branches/ohana.20170822/src/fakeastro/src/make_2mass_measures.c

    r40212 r40244  
    103103    measure[Nmeasure].airmass = 1.0;
    104104    measure[Nmeasure].az      = 0.0; // irrelevant
    105     measure[Nmeasure].Mcal    = 0.0;
     105    measure[Nmeasure].McalPSF = 0.0;
     106    measure[Nmeasure].McalAPER= 0.0;
    106107    measure[Nmeasure].t       = tzero_2mass;
    107108    measure[Nmeasure].dt      = 0.0;
  • branches/eam_branches/ohana.20170822/src/fakeastro/src/make_fake_stars_catalog.c

    r40212 r40244  
    175175
    176176    stars[Nstars].measure.az      = azimuth (15.0*image->sidtime - stars[Nstars].average.R, stars[Nstars].average.D, image->latitude);
    177     stars[Nstars].measure.Mcal    = image->McalPSF;
     177    stars[Nstars].measure.McalPSF = image->McalPSF;
     178    stars[Nstars].measure.McalAPER= image->McalAPER;
    178179    stars[Nstars].measure.t       = image->tzero + 1e-4*stars[Nstars].measure.Yccd*image->trate;  // trate is in 0.1 msec / row
    179180    stars[Nstars].measure.dt      = Mtime;
  • branches/eam_branches/ohana.20170822/src/fakeastro/src/make_gaia_measures.c

    r40212 r40244  
    104104    measure[Nmeasure].airmass = 1.0;
    105105    measure[Nmeasure].az      = 0.0; // irrelevant
    106     measure[Nmeasure].Mcal    = 0.0;
     106    measure[Nmeasure].McalPSF = 0.0;
     107    measure[Nmeasure].McalAPER= 0.0;
    107108    measure[Nmeasure].t       = tzero_gaia;
    108109    measure[Nmeasure].dt      = 0.0;
  • branches/eam_branches/ohana.20170822/src/markrock/src/find_slow_rocks.c

    r2490 r40244  
    6969        RD_to_XY (&X1[j], &Y1[j], R1[j], D1[j], &catstats[0].coords);
    7070        T1[j] = catalog[0].measure[m+j].t;
    71         M1[j] = catalog[0].measure[m+j].M - catalog[0].measure[m+j].Mcal;
     71        M1[j] = catalog[0].measure[m+j].M - catalog[0].measure[m+j].McalPSF;
    7272      }
    7373      dt = T1[1] - T1[0];
     
    8686          RD_to_XY (&X, &Y, R, D, &catstats[0].coords);
    8787          T = catalog[0].measure[m+j].t;
    88           M = catalog[0].measure[m+j].M - catalog[0].measure[m+j].Mcal;
     88          M = catalog[0].measure[m+j].M - catalog[0].measure[m+j].McalPSF;
    8989          if (T1[0] == T) continue;
    9090          if (T1[1] == T) continue;
  • branches/eam_branches/ohana.20170822/src/opihi/dvo/gstar.c

    r40212 r40244  
    760760
    761761            if (FULL_OUTPUT) {
    762               gprint (GP_LOG, "%6.3f ", catalog.measure[Nv].Mcal);
     762              gprint (GP_LOG, "%6.3f ", catalog.measure[Nv].McalPSF);
     763              gprint (GP_LOG, "%6.3f ", catalog.measure[Nv].McalAPER);
    763764              gprint (GP_LOG, "%6.3f ", catalog.measure[Nv].Mflat);
    764765              gprint (GP_LOG, "%6.3f ", catalog.measure[Nv].Map);
  • branches/eam_branches/ohana.20170822/src/opihi/dvo/imdata.c

    r39457 r40244  
    183183        for (i = 0; i < catalog.Nmeasure; i++) {
    184184          if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue;
    185           vec[0].elements.Flt[N] = catalog.measure[i].Mcal;
     185          vec[0].elements.Flt[N] = catalog.measure[i].McalPSF;
    186186          N++;
    187187          CHECK_REALLOCATE (vec[0].elements.Flt, opihi_flt, NPTS, N, 1000);
  • branches/eam_branches/ohana.20170822/src/relastro/src/BrightCatalog.c

    r40212 r40244  
    6868    GET_COLUMN(D,         "DEC",        double);
    6969    GET_COLUMN(M,         "MAG_SYS",    float);
    70     GET_COLUMN(Mcal,      "MAG_CAL",    float);
     70    GET_COLUMN(McalPSF,   "MCAL_PSF",   float);
     71    GET_COLUMN(McalAPER,  "MCAL_APER",  float);
    7172    GET_COLUMN(dM,        "MAG_ERR",    float);
    7273    GET_COLUMN(airmass,   "AIRMASS",    float);
     
    9495      measure[i].D         = D[i];
    9596      measure[i].M         = M[i];
    96       measure[i].Mcal      = Mcal[i];
     97      measure[i].McalPSF   = McalPSF[i];
     98      measure[i].McalAPER  = McalAPER[i];
    9799      measure[i].dM        = dM[i];
    98100      measure[i].airmass   = airmass[i];
     
    120122    free (D       );
    121123    free (M       );
    122     free (Mcal    );
     124    free (McalPSF );
     125    free (McalAPER);
    123126    free (dM      );
    124127    free (airmass );
     
    385388    double *D         ; ALLOCATE (D        ,  double, catalog->Nmeasure);
    386389    float  *M         ; ALLOCATE (M        ,  float,  catalog->Nmeasure);
    387     float  *Mcal      ; ALLOCATE (Mcal     ,  float,  catalog->Nmeasure);
     390    float  *McalPSF   ; ALLOCATE (McalPSF  ,  float,  catalog->Nmeasure);
     391    float  *McalAPER  ; ALLOCATE (McalAPER ,  float,  catalog->Nmeasure);
    388392    float  *dM        ; ALLOCATE (dM       ,  float,  catalog->Nmeasure);
    389393    float  *airmass   ; ALLOCATE (airmass  ,  float,  catalog->Nmeasure);
     
    408412      D[i]        = measure[i].D        ;
    409413      M[i]        = measure[i].M        ;
    410       Mcal[i]     = measure[i].Mcal     ;
     414      McalPSF[i]  = measure[i].McalPSF  ;
     415      McalAPER[i] = measure[i].McalAPER ;
    411416      dM[i]       = measure[i].dM       ;
    412417      airmass[i]  = measure[i].airmass  ;
     
    434439    gfits_set_bintable_column (&theader, &ftable, "DEC",        D,         catalog->Nmeasure);
    435440    gfits_set_bintable_column (&theader, &ftable, "MAG_SYS",    M,         catalog->Nmeasure);
    436     gfits_set_bintable_column (&theader, &ftable, "MAG_CAL",    Mcal,      catalog->Nmeasure);
     441    gfits_set_bintable_column (&theader, &ftable, "MCAL_PSF",   McalPSF,   catalog->Nmeasure);
     442    gfits_set_bintable_column (&theader, &ftable, "MCAL_APER",  McalAPER,  catalog->Nmeasure);
    437443    gfits_set_bintable_column (&theader, &ftable, "MAG_ERR",    dM,        catalog->Nmeasure);
    438444    gfits_set_bintable_column (&theader, &ftable, "AIRMASS",    airmass,   catalog->Nmeasure);
     
    454460    free (D       );
    455461    free (M       );
    456     free (Mcal    );
     462    free (McalPSF );
     463    free (McalAPER);
    457464    free (dM      );
    458465    free (airmass );
  • branches/eam_branches/ohana.20170822/src/relphot/src/BrightCatalog.c

    r40212 r40244  
    6666    GET_COLUMN(D,         "DEC",        double);
    6767    GET_COLUMN(M,         "MAG_SYS",    float);
    68     GET_COLUMN(Mcal,      "MAG_CAL",    float);
     68    GET_COLUMN(McalPSF,   "MCAL_PSF",   float);
     69    GET_COLUMN(McalAPER,  "MCAL_APER",  float);
    6970    GET_COLUMN(Mflat,     "MAG_FLAT",   float);
    7071    GET_COLUMN(dM,        "MAG_ERR",    float);
     
    8990      measure[i].D         = D[i];
    9091      measure[i].M         = M[i];
    91       measure[i].Mcal      = Mcal[i];
     92      measure[i].McalPSF   = McalPSF[i];
     93      measure[i].McalAPER  = McalAPER[i];
    9294      measure[i].Mflat     = Mflat[i];
    9395      measure[i].dM        = dM[i];
     
    110112    free (D       );
    111113    free (M       );
    112     free (Mcal    );
     114    free (McalPSF );
     115    free (McalAPER);
    113116    free (Mflat   );
    114117    free (dM      );
     
    293296    double *D         ; ALLOCATE (D        ,  double, catalog->Nmeasure);
    294297    float  *M         ; ALLOCATE (M        ,  float,  catalog->Nmeasure);
    295     float  *Mcal      ; ALLOCATE (Mcal     ,  float,  catalog->Nmeasure);
     298    float  *McalPSF   ; ALLOCATE (McalPSF  ,  float,  catalog->Nmeasure);
     299    float  *McalAPER  ; ALLOCATE (McalAPER ,  float,  catalog->Nmeasure);
    296300    float  *Mflat     ; ALLOCATE (Mflat    ,  float,  catalog->Nmeasure);
    297301    float  *dM        ; ALLOCATE (dM       ,  float,  catalog->Nmeasure);
     
    311315    MeasureTiny *measure = catalog->measure;
    312316    for (i = 0; i < catalog->Nmeasure; i++) {
    313       R[i]        = measure[i].R       ;
    314       D[i]        = measure[i].D       ;
     317      R[i]        = measure[i].R        ;
     318      D[i]        = measure[i].D        ;
    315319      M[i]        = measure[i].M        ;
    316       Mcal[i]     = measure[i].Mcal     ;
     320      McalPSF[i]  = measure[i].McalPSF  ;
     321      McalAPER[i] = measure[i].McalAPER ;
    317322      Mflat[i]    = measure[i].Mflat    ;
    318323      dM[i]       = measure[i].dM       ;
     
    334339    gfits_set_bintable_column (&theader, &ftable, "DEC",        D,         catalog->Nmeasure);
    335340    gfits_set_bintable_column (&theader, &ftable, "MAG_SYS",    M,         catalog->Nmeasure);
    336     gfits_set_bintable_column (&theader, &ftable, "MAG_CAL",    Mcal,      catalog->Nmeasure);
     341    gfits_set_bintable_column (&theader, &ftable, "MCAL_PSF",   McalPSF,   catalog->Nmeasure);
     342    gfits_set_bintable_column (&theader, &ftable, "MCAL_APER",  McalAPER,  catalog->Nmeasure);
    337343    gfits_set_bintable_column (&theader, &ftable, "MAG_FLAT",   Mflat,     catalog->Nmeasure);
    338344    gfits_set_bintable_column (&theader, &ftable, "MAG_ERR",    dM,        catalog->Nmeasure);
     
    352358    free (D       );
    353359    free (M       );
    354     free (Mcal    );
     360    free (McalPSF );
     361    free (McalAPER);
    355362    free (Mflat   );
    356363    free (dM      );
  • branches/eam_branches/ohana.20170822/src/relphot/src/StarOps.c

    r40231 r40244  
    473473  int i;
    474474  off_t j, k, m;
    475   float Mcal, Mmos, Mgrid;
    476475
    477476  MEAS_BAD = ID_MEAS_NOCAL;
     
    484483      for (k = 0; k < catalog[i].averageT[j].Nmeasure; k++, m++) {
    485484        if (catalog[i].measureT[m].dbFlags & MEAS_BAD) continue;
    486         Mcal  = getMcal  (m, i, MAG_CLASS_PSF);
    487         if (isnan(Mcal)) continue;
    488         Mmos  = getMmos  (m, i);
     485        float McalPSF  = getMcal  (m, i, MAG_CLASS_PSF);
     486        float McalAPER = getMcal  (m, i, MAG_CLASS_APER);
     487        if (isnan(McalPSF)) continue;
     488        float Mmos  = getMmos  (m, i);
    489489        if (isnan(Mmos)) continue;
    490         Mgrid = getMgrid (m, i);
     490        float Mgrid = getMgrid (m, i);
    491491        if (isnan(Mgrid)) continue;
     492
     493        // XXX note that this operation is setting measure->McalAPER to image->McalAPER
     494        // regardless of how the average value was calculate.
     495        // IF average.Mkron (e.g.) is calculated using image.McalPSF, we should store McalPSF for both
     496        // of these items below
    492497
    493498        // note that measurements for which the image is not selected will not be modified
     
    495500
    496501        // set the output calibration
    497         catalog[i].measure[m].Mcal = Mcal + Mmos + Mgrid;
     502        catalog[i].measure[m].McalPSF  = McalPSF  + Mmos + Mgrid;
     503        catalog[i].measure[m].McalAPER = McalAPER + Mmos + Mgrid;
    498504
    499505        if (catalog[i].measureT[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
    500           myAssert (isfinite(catalog[i].measure[m].Mcal), "oops, broke an ubercal mag");
     506          myAssert (isfinite(catalog[i].measure[m].McalPSF), "oops, broke an ubercal mag");
    501507        }
    502508      }
     
    560566      int m = catalog[i].averageT[j].measureOffset;
    561567      for (n = 0; n < catalog[i].averageT[j].Nmeasure; n++) {
    562         fprintf (fout, "meas %5d %5d | %6.3f %6.3f | %6.3f\n", m+n, catalog[i].measureT[m+n].photcode, catalog[i].measureT[m+n].M, catalog[i].measureT[m+n].Mkron, catalog[i].measureT[m+n].Mcal);
     568        fprintf (fout, "meas %5d %5d | %6.3f %6.3f | %6.3f %6.3f\n", m+n, catalog[i].measureT[m+n].photcode, catalog[i].measureT[m+n].M, catalog[i].measureT[m+n].Mkron, catalog[i].measureT[m+n].McalPSF, catalog[i].measureT[m+n].McalAPER);
    563569      }
    564570    }
     
    643649// sigma of the INNER 50% mean.  it then flags any measurements which are more than
    644650// NSIGMA_REJECT (5) sigma of the mean
     651
     652// this function only operations on the PSF magnitudes
    645653
    646654# define NSIGMA_CLIP 3.0
  • branches/eam_branches/ohana.20170822/src/relphot/src/bcatalog.c

    r39641 r40244  
    153153        if (subcatalog[0].measureT[Nmeasure].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
    154154          if (!KEEP_UBERCAL) {
    155             subcatalog[0].measureT[Nmeasure].Mcal = 0.0;
     155            subcatalog[0].measureT[Nmeasure].McalPSF  = 0.0;
     156            subcatalog[0].measureT[Nmeasure].McalAPER = 0.0;
    156157            subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_PHOTOM_UBERCAL;
    157158          }
    158159        } else {
    159160          if (getImageEntry (Nmeasure, Ncat) >= 0) {
    160             subcatalog[0].measureT[Nmeasure].Mcal = 0.0;
     161            subcatalog[0].measureT[Nmeasure].McalPSF  = 0.0;
     162            subcatalog[0].measureT[Nmeasure].McalAPER = 0.0;
    161163          }
    162164        }
  • branches/eam_branches/ohana.20170822/src/relphot/src/setMrelCatalog.c

    r40231 r40244  
    102102// 3) UBERCAL measurements can have their weight increased by a big factor to help tie down the averages
    103103// 4) some reference photcode of some kind can be specified as fixed and have a high weight
     104
     105// Although I calculate McalAPER for exposures, I am only using McalPSF for exposures
     106// XXX this means that a query of the database for mag:rel:kron will be inconsistent if there
     107// is any significant difference
    104108
    105109// set mean of chip measurements (selected by photcode range for now):
     
    224228      // overlaps).  Msys + measure.Mcal is our best guess of the true magnitude
    225229      Mmos = Mgrid = 0;
    226       Mcal = measureT[k].Mcal; // check that this is zero for loaded REF value
     230      Mcal = measureT[k].McalPSF; // check that this is zero for loaded REF value
    227231    } else {
    228232      // getMcal returns image[].Mcal; note the flat-field correction is stored in measure.Mflat
     
    521525// 2) select the BEST detections per filter (regardless of PRIMARY)
    522526// 3) apply the zero point and AB->Jy transformations
     527
     528// I calculate McalAPER and McalPSF independently for stacks.  I use McalAPER for Mkron
     529// and Map, and McalPSF for Mpsf.  A query of the database for mag:rel:kron will be
     530// inconsistent if there is any significant difference
     531
    523532int setMrelAverageStack (Catalog *catalog, int cat, off_t ave, int Nsecfilt, FlatCorrectionTable *flatcorr) {
    524533
     
    633642        // overlaps).  Msys + measure.Mcal is our best guess of the true magnitude
    634643        Mmos = Mgrid = 0;
    635         McalPSF = measure[k].Mcal; // check that this is zero for loaded REF value
     644        McalPSF = measure[k].McalPSF; // check that this is zero for loaded REF value
    636645        McalAPER = McalPSF; // check that this is zero for loaded REF value
    637646      } else {
     
    791800// * no grid, no mosaic, no 2MASS, no SYNTH, no Ubercal, no flatcorr
    792801// analysis is done on flux, not mags (as the faintest objects will be nearly insignificant)
     802
     803// Although I calculate McalAPER for exposures, I am only using McalPSF for exposures
     804// XXX this means that a query of the database for mag:rel:kron will be inconsistent if there
     805// is any significant difference
     806
    793807int setMrelAverageForcedWarp (Catalog *catalog, int cat, off_t ave, int Nsecfilt, FlatCorrectionTable *flatcorr, SetMrelInfo *results) {
    794808  OHANA_UNUSED_PARAM(flatcorr);
     
    868882      // data for which the associated image has not been loaded (probably because of
    869883      // overlaps).  Msys + measure.Mcal is our best guess of the true magnitude
    870       Mcal = measure[k].Mcal; // check that this is zero for loaded REF value
     884      Mcal = measure[k].McalPSF; // check that this is zero for loaded REF value
    871885    } else {
    872886      Mcal  = getMcal (meas, cat, MAG_CLASS_PSF);
  • branches/eam_branches/ohana.20170822/src/relphot/src/setMrelFinal.c

    r40213 r40244  
    6565          if (catalog[0].measure[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
    6666            if (!KEEP_UBERCAL) {
    67               catalog[0].measure[m].Mcal = 0.0;
     67              catalog[0].measure[m].McalPSF  = 0.0;
     68              catalog[0].measure[m].McalAPER = 0.0;
    6869              catalog[0].measure[m].dbFlags &= ~ID_MEAS_PHOTOM_UBERCAL;
    6970            }
    7071          } else {
    7172            if (RESET_ZEROPTS && (getImageEntry (m, 0) >= 0)) {
    72               catalog[0].measure[m].Mcal = 0.0;
     73              catalog[0].measure[m].McalPSF  = 0.0;
     74              catalog[0].measure[m].McalAPER = 0.0;
    7375            }
    7476          }
  • branches/eam_branches/ohana.20170822/src/uniphot/src/update_catalog_setphot.c

    r40212 r40244  
    6161# endif
    6262
    63     measure[0].Mcal = Mcal;
     63    myAssert(isfinite(Mcal), "oops: ubercal made a nan");
     64
     65    measure[0].McalPSF  = Mcal;
     66    measure[0].McalAPER = Mcal;
    6467    measure[0].Mflat = Mflat; // in the previous version, Mcal_offset (which is added to Mflat) had a negative sign here
    6568    measure[0].dMcal = dMcal;
    66     myAssert(isfinite(measure[0].Mcal), "oops: ubercal made a nan");
    6769
    6870    if (RESET) {
  • branches/eam_branches/ohana.20170822/src/uniphot/src/update_catalog_uniphot.c

    r40212 r40244  
    2424      if (code[0].type != PHOT_DEP) continue;
    2525      if (code[0].equiv != photcode[0].code) continue;
    26       catalog[0].measure[m].Mcal -= sgroup[0].M;
     26      catalog[0].measure[m].McalPSF  -= sgroup[0].M;
     27      catalog[0].measure[m].McalAPER -= sgroup[0].M;
    2728      found ++;
    2829    }
Note: See TracChangeset for help on using the changeset viewer.