IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39262 for trunk


Ignore:
Timestamp:
Dec 12, 2015, 8:38:47 PM (11 years ago)
Author:
eugene
Message:

updates for Mflat

Location:
trunk/Ohana/src
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/src/loadgalphot_readstars.c

    r39125 r39262  
    204204  fit->ClipNsigma = 5.0;
    205205
     206  // use the list of index values from above to join entries with the same index
     207
    206208  int Nbad = 0;
    207209  for (i = 0; i < Nrow; i++) {
  • trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c

    r39142 r39262  
    8585    N1[Nstars] = i;
    8686    Nstars ++;
    87     input[0].found_t[i] = -1;
     87    input[0].found_t[i] = FALSE;
    8888  }
    8989  if (Nstars < 1) {
     
    180180    off_t N = N1[i];
    181181
     182    input[0].found_t[N] = TRUE;
     183
    182184    /* make sure there is space for next Nmeasure entries */
    183185    if (Nmeas + input[0].average[N].Nmeasure >= NMEAS) {
     
    209211      Nreplace = replace_tycho (&output[0].average[n], output[0].measure, next_meas, &input[0].average[N], &input[0].measure[Minp]);
    210212      if (Nreplace == 6) {
    211         input[0].found_t[N] = Nmeas;
    212213        output[0].found_t[n] = Nmeas;
    213214        i++;
     
    224225        // XXX this does not support lensing, starpar, or galphot measurements
    225226        if (replace_match (&output[0].average[n], output[0].measure, next_meas, &input[0].average[N], &input[0].measure[offset])) {
    226           input[0].found_t[N] = output[0].average[n].measureOffset; 
    227227          continue;
    228228        }
     
    274274        }
    275275      }
    276       input[0].found_t[N] = Nmeas;
    277276      output[0].average[n].Nmeasure ++;
    278277      Nmeas ++;
     
    394393    }
    395394
    396     if (input[0].found_t[N] >= 0) continue;
     395    if (input[0].found_t[N]) continue;
    397396
    398397    // if we are using MATCHED_TABLES, we are going to leave the edge cases in their
    399398    // source catalog, even if they have leaked beyond the edge
    400399    if (!MATCHED_TABLES && !IN_REGION (input[0].average[N].R, input[0].average[N].D)) continue;
     400
     401    input[0].found_t[N] = TRUE;
    401402
    402403    // XXX should we accept the input measurements for these fields?
     
    450451
    451452      /* we set next[Nmeas] to -1 here, and update correctly below */
    452       input[0].found_t[N] = Nmeas;
    453453      next_meas[Nmeas] = -1;
    454454      Nmeas ++;
     
    559559  }
    560560
    561   /* note stars which have been found in this catalog */
    562   for (i = 0; i < input[0].Naverage; i++) {
    563     if (input[0].found_t[i] > -1) {
    564       input[0].found_t[i] = -2;
    565     } else {
    566       input[0].found_t[i] = -3;
    567     }
    568   }
    569 
    570561  /* check if the catalog has changed?  if no change, no need to write */
    571562  output[0].objID    = objID; // new max value, save on catalog close
  • trunk/Ohana/src/libautocode/def/measure-ps1-sim.d

    r37807 r39262  
    2727FIELD XoffDCR,        X_OFF_DCR,     float,          X offset from correction,     pixels
    2828FIELD YoffDCR,        Y_OFF_DCR,     float,          Y offset from correction,     pixels
    29 FIELD RoffGAL,        R_OFF_GAL,     float,          RA offset from correction,    arcsec
    30 FIELD DoffGAL,        D_OFF_GAL,     float,          DEC offset from correction,   arcsec
     29
     30FIELD Mflat,          M_FLAT,        float,          Static Flat-field offset,     mag
     31FIELD dummy2,         PADDING,       int,            unused 4 bytes
    3132
    3233FIELD t,              TIME,         int,            time in seconds (UNIX)
     
    4849FIELD dRsys,          POS_SYS_ERR,  short,          systematic error from astrom,   1/100 of pixels
    4950
    50 FIELD dummy,          PADDING,      short,          padding
     51FIELD dummy,          PADDING2,     short,          padding
    5152FIELD posangle,       POSANGLE,     short,          position angle sky to chip,     (0xffff/360) deg
    5253FIELD pltscale,       PLTSCALE,     float,          plate scale,                    arcsec/pixel
  • trunk/Ohana/src/libautocode/def/measure-ps1-v5.d

    r38986 r39262  
    4242FIELD XoffCAM,        X_OFF_CAM,     float,          X offset from correction,     pixels
    4343FIELD YoffCAM,        Y_OFF_CAM,     float,          Y offset from correction,     pixels
    44 FIELD RoffGAL,        R_OFF_GAL,     float,          RA offset from correction,    arcsec
    45 FIELD DoffGAL,        D_OFF_GAL,     float,          DEC offset from correction,   arcsec
     44
     45FIELD Mflat,          M_FLAT,        float,          Static Flat-field offset,     mag
     46FIELD dummy2,         PADDING,       int,            unused 4 bytes
    4647
    4748# could these be packed into fewer bits?
  • trunk/Ohana/src/libautocode/def/measure.d

    r39225 r39262  
    4343FIELD YoffCAM,        Y_OFF_CAM,     float,          Y offset from correction,     pixels
    4444
    45 # XXX I can deprecate these as I am going to apply the correct uR,uD offset
    46 # XXX not sure how to use this yet...
    47 # XXX replace RoffGall with Moff -> static component of the zpt correction
    48 FIELD RoffGAL,        R_OFF_GAL,     float,          RA offset from correction,    arcsec
    49 FIELD DoffGAL,        D_OFF_GAL,     float,          DEC offset from correction,   arcsec
     45FIELD Mflat,          M_FLAT,        float,          Static Flat-field offset,     mag
     46FIELD dummy2,         PADDING,       int,            unused 4 bytes
    5047
    5148# could these be packed into fewer bits?
  • trunk/Ohana/src/libdvo/include/dvo.h

    r39125 r39262  
    476476  double         R;
    477477  double         D;
    478   float          RoffGAL;
    479   float          DoffGAL;
    480478  float          M;
    481479  float          Mcal;
     480  float          Mflat;
    482481  float          dM;
    483482  float          airmass;
     
    620619  float            XoffDCR;              // X offset from correction (pixels)
    621620  float            YoffDCR;              // Y offset from correction (pixels)
    622   float            RoffGAL;              // RA offset from correction (arcsec)
    623   float            DoffGAL;              // DEC offset from correction (arcsec)
     621  float            Mflat;                // flat offset from correction (arcsec)
     622  int              padding2;             // dummy
    624623  float            Sky;                  // local estimate of sky flux (counts/sec)
    625624  float            dSky;                 // local estimate of sky flux (counts/sec)
  • trunk/Ohana/src/libdvo/src/dbExtractMeasures.c

    r38986 r39262  
    597597    case MEAS_XOFF_CAM: { value.Flt = measure[0].XoffCAM; break; }
    598598    case MEAS_YOFF_CAM: { value.Flt = measure[0].YoffCAM; break; }
    599     case MEAS_ROFF_GAL: { value.Flt = measure[0].RoffGAL; break; }
    600     case MEAS_DOFF_GAL: { value.Flt = measure[0].DoffGAL; break; }
    601599
    602600    case MEAS_XFIELD: /* offset relative to exposure center in ra,dec space */
     
    723721
    724722    case MEAS_MCAL_OFFSET: { value.Flt = measure[0].Mcal; break; }
    725 
    726     case MEAS_FLAT: /* OK */
    727       // flat = measure.Mcal - image.Mcal
    728       if (REMOTE_CLIENT) {
    729         ImageMetadata *image = MatchImageMetadataDVO (measure[0].imageID);
    730         if (image == NULL) break;
    731         value.Flt = measure[0].Mcal - image[0].Mcal;
    732       } else {
    733         Image *image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
    734         if (image == NULL) break;
    735         value.Flt = measure[0].Mcal - image[0].Mcal;
    736       }
    737       break;
     723    case MEAS_FLAT: { value.Flt = measure[0].Mflat; break; }
    738724
    739725      // we have measure[0].Xccd,Yccd and image[0].NX,NY.  Find the distance to the center
  • trunk/Ohana/src/libdvo/src/dvo_catalog.c

    r39125 r39262  
    332332 measure->XoffCAM   = NAN;
    333333 measure->YoffCAM   = NAN;
    334  measure->RoffGAL   = NAN;
    335  measure->DoffGAL   = NAN;
     334
     335 measure->Mflat     = 0.0;
     336 measure->dummy2    = 0;
    336337
    337338 measure->Sky       = NAN;
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_SIM.c

    r38462 r39262  
    2929    out[i].XoffDCR    = in[i].XoffDCR;
    3030    out[i].YoffDCR    = in[i].YoffDCR;
    31     out[i].RoffGAL    = in[i].RoffGAL;
    32     out[i].DoffGAL    = in[i].DoffGAL;
     31    out[i].Mflat      = in[i].Mflat;
    3332    out[i].t          = in[i].t;
    3433    out[i].averef     = in[i].averef;
     
    7574    out[i].XoffDCR    = in[i].XoffDCR;
    7675    out[i].YoffDCR    = in[i].YoffDCR;
    77     out[i].RoffGAL    = in[i].RoffGAL;
    78     out[i].DoffGAL    = in[i].DoffGAL;
     76    out[i].Mflat      = in[i].Mflat;
    7977    out[i].t          = in[i].t;
    8078    out[i].averef     = in[i].averef;
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c

    r39125 r39262  
    4242    out[i].XoffCAM    = in[i].XoffCAM;
    4343    out[i].YoffCAM    = in[i].YoffCAM;
    44     out[i].RoffGAL    = in[i].RoffGAL;
    45     out[i].DoffGAL    = in[i].DoffGAL;
     44    out[i].Mflat      = in[i].Mflat;
    4645    out[i].Sky        = in[i].Sky;
    4746    out[i].dSky       = in[i].dSky;
     
    116115    out[i].XoffCAM    = in[i].XoffCAM;
    117116    out[i].YoffCAM    = in[i].YoffCAM;
    118     out[i].RoffGAL    = in[i].RoffGAL;
    119     out[i].DoffGAL    = in[i].DoffGAL;
     117    out[i].Mflat      = in[i].Mflat;
    120118    out[i].Sky        = in[i].Sky;
    121119    out[i].dSky       = in[i].dSky;
     
    16781676    out[i].XoffDCR    = in[i].XoffDCR;
    16791677    out[i].YoffDCR    = in[i].YoffDCR;
    1680     out[i].RoffGAL    = in[i].RoffGAL;
    1681     out[i].DoffGAL    = in[i].DoffGAL;
     1678    out[i].Mflat      = in[i].Mflat;
    16821679    out[i].Sky        = in[i].Sky;
    16831680    out[i].dSky       = in[i].dSky;
  • trunk/Ohana/src/libdvo/src/dvo_tiny_values.c

    r38062 r39262  
    2222  measureT[0].dM         = measure[0].dM;
    2323  measureT[0].airmass    = measure[0].airmass;
    24   measureT[0].RoffGAL    = measure[0].RoffGAL;
    25   measureT[0].DoffGAL    = measure[0].DoffGAL;
     24  measureT[0].Mflat      = measure[0].Mflat;
    2625  measureT[0].Xccd       = measure[0].Xccd;
    2726  measureT[0].Yccd       = measure[0].Yccd;
  • trunk/Ohana/src/relastro/src/BrightCatalog.c

    r39225 r39262  
    6767    GET_COLUMN(R,         "RA",         double);
    6868    GET_COLUMN(D,         "DEC",        double);
    69     GET_COLUMN(RoffGAL,   "ROFF_GAL",   float);
    70     GET_COLUMN(DoffGAL,   "DOFF_GAL",   float);
    7169    GET_COLUMN(M,         "MAG_SYS",    float);
    7270    GET_COLUMN(Mcal,      "MAG_CAL",    float);
     
    9492      measure[i].R         = R[i];
    9593      measure[i].D         = D[i];
    96       measure[i].RoffGAL   = RoffGAL[i];
    97       measure[i].DoffGAL   = DoffGAL[i];
    9894      measure[i].M         = M[i];
    9995      measure[i].Mcal      = Mcal[i];
     
    121117    free (R       );
    122118    free (D       );
    123     free (RoffGAL );
    124     free (DoffGAL );
    125119    free (M       );
    126120    free (Mcal    );
     
    362356    gfits_define_bintable_column (&theader, "D", "RA",       "ra",                         "degrees", 1.0, 0.0);
    363357    gfits_define_bintable_column (&theader, "D", "DEC",      "dec",                        "degrees", 1.0, 0.0);
    364     gfits_define_bintable_column (&theader, "E", "ROFF_GAL", "ra offset",                  "arcsec", 1.0, 0.0);
    365     gfits_define_bintable_column (&theader, "E", "DOFF_GAL", "dec offset",                 "arcsec", 1.0, 0.0);
    366358    gfits_define_bintable_column (&theader, "E", "MAG_SYS",  "magnitude (sys)",             NULL,    1.0, 0.0);
    367359    gfits_define_bintable_column (&theader, "E", "MAG_CAL",  "magnitude (cal)",             NULL,    1.0, 0.0);
     
    382374
    383375    // generate the output array that carries the data
    384     ohana_memcheck (1);
    385376    gfits_create_table (&theader, &ftable);
    386     ohana_memcheck (1);
    387377
    388378    // create intermediate storage arrays
    389379    double *R         ; ALLOCATE (R        ,  double, catalog->Nmeasure);
    390380    double *D         ; ALLOCATE (D        ,  double, catalog->Nmeasure);
    391     float  *RoffGAL   ; ALLOCATE (RoffGAL  ,  float,  catalog->Nmeasure);
    392     float  *DoffGAL   ; ALLOCATE (DoffGAL  ,  float,  catalog->Nmeasure);
    393381    float  *M         ; ALLOCATE (M        ,  float,  catalog->Nmeasure);
    394382    float  *Mcal      ; ALLOCATE (Mcal     ,  float,  catalog->Nmeasure);
     
    407395    int    *catID     ; ALLOCATE (catID    ,  int  ,  catalog->Nmeasure);
    408396    short  *photcode  ; ALLOCATE (photcode ,  short,  catalog->Nmeasure);
    409     ohana_memcheck (1);
    410397
    411398    // assign the storage arrays
     
    414401      R[i]        = measure[i].R        ;
    415402      D[i]        = measure[i].D        ;
    416       RoffGAL[i]  = measure[i].RoffGAL  ;
    417       DoffGAL[i]  = measure[i].DoffGAL  ;
    418403      M[i]        = measure[i].M        ;
    419404      Mcal[i]     = measure[i].Mcal     ;
     
    433418      photcode[i] = measure[i].photcode ;
    434419    }
    435     ohana_memcheck (1);
    436420
    437421    // add the columns to the output array
    438422    gfits_set_bintable_column (&theader, &ftable, "RA",         R,         catalog->Nmeasure);
    439     ohana_memcheck (1);
    440423    gfits_set_bintable_column (&theader, &ftable, "DEC",        D,         catalog->Nmeasure);
    441     ohana_memcheck (1);
    442     gfits_set_bintable_column (&theader, &ftable, "ROFF_GAL",   RoffGAL,   catalog->Nmeasure);
    443     gfits_set_bintable_column (&theader, &ftable, "DOFF_GAL",   DoffGAL,   catalog->Nmeasure);
    444424    gfits_set_bintable_column (&theader, &ftable, "MAG_SYS",    M,         catalog->Nmeasure);
    445425    gfits_set_bintable_column (&theader, &ftable, "MAG_CAL",    Mcal,      catalog->Nmeasure);
     
    461441    free (R       );
    462442    free (D       );
    463     free (RoffGAL );
    464     free (DoffGAL );
    465443    free (M       );
    466444    free (Mcal    );
  • trunk/Ohana/src/relastro/src/ImageOps.c

    r38986 r39262  
    769769      ref[i].R += dTime * catalog[c].average[n].uR / 3600.0 / cos(ref[i].D*RAD_DEG);
    770770      ref[i].D += dTime * catalog[c].average[n].uD / 3600.0;
    771     }
    772 
    773     // if we are correcting for the Galaxy Motion Model, we assume the mean R,D is at the J2000 epoch position
    774     if (0) {
    775       myAssert (!isnan(measure[0].RoffGAL), "oops");
    776       myAssert (!isnan(measure[0].DoffGAL), "oops");
    777       ref[i].R += measure[0].RoffGAL / 3600.0;
    778       ref[i].D += measure[0].DoffGAL / 3600.0;
    779771    }
    780772
  • trunk/Ohana/src/relphot/src/BrightCatalog.c

    r37037 r39262  
    6767    GET_COLUMN(M,         "MAG_SYS",    float);
    6868    GET_COLUMN(Mcal,      "MAG_CAL",    float);
     69    GET_COLUMN(Mflat,     "MAG_FLAT",   float);
    6970    GET_COLUMN(dM,        "MAG_ERR",    float);
    7071    GET_COLUMN(airmass,   "AIRMASS",    float);
     
    8990      measure[i].M         = M[i];
    9091      measure[i].Mcal      = Mcal[i];
     92      measure[i].Mflat     = Mflat[i];
    9193      measure[i].dM        = dM[i];
    9294      measure[i].airmass   = airmass[i];
     
    109111    free (M       );
    110112    free (Mcal    );
     113    free (Mflat   );
    111114    free (dM      );
    112115    free (airmass );
     
    269272    gfits_define_bintable_column (&theader, "E", "MAG_SYS",  "magnitude (sys)",             NULL,    1.0, 0.0);
    270273    gfits_define_bintable_column (&theader, "E", "MAG_CAL",  "magnitude (cal)",             NULL,    1.0, 0.0);
     274    gfits_define_bintable_column (&theader, "E", "MAG_FLAT", "magnitude (flat)",            NULL,    1.0, 0.0);
    271275    gfits_define_bintable_column (&theader, "E", "MAG_ERR",  "magnitude (err)",             NULL,    1.0, 0.0);
    272276    gfits_define_bintable_column (&theader, "E", "AIRMASS",  "airmass",                     NULL,    1.0, 0.0);
     
    290294    float  *M         ; ALLOCATE (M        ,  float,  catalog->Nmeasure);
    291295    float  *Mcal      ; ALLOCATE (Mcal     ,  float,  catalog->Nmeasure);
     296    float  *Mflat     ; ALLOCATE (Mflat    ,  float,  catalog->Nmeasure);
    292297    float  *dM        ; ALLOCATE (dM       ,  float,  catalog->Nmeasure);
    293298    float  *airmass   ; ALLOCATE (airmass  ,  float,  catalog->Nmeasure);
     
    310315      M[i]        = measure[i].M        ;
    311316      Mcal[i]     = measure[i].Mcal     ;
     317      Mflat[i]    = measure[i].Mflat    ;
    312318      dM[i]       = measure[i].dM       ;
    313319      airmass[i]  = measure[i].airmass  ;
     
    329335    gfits_set_bintable_column (&theader, &ftable, "MAG_SYS",    M,         catalog->Nmeasure);
    330336    gfits_set_bintable_column (&theader, &ftable, "MAG_CAL",    Mcal,      catalog->Nmeasure);
     337    gfits_set_bintable_column (&theader, &ftable, "MAG_FLAT",   Mflat,     catalog->Nmeasure);
    331338    gfits_set_bintable_column (&theader, &ftable, "MAG_ERR",    dM,        catalog->Nmeasure);
    332339    gfits_set_bintable_column (&theader, &ftable, "AIRMASS",    airmass,   catalog->Nmeasure);
     
    346353    free (M       );
    347354    free (Mcal    );
     355    free (Mflat   );
    348356    free (dM      );
    349357    free (airmass );
  • trunk/Ohana/src/relphot/src/setMrelCatalog.c

    r39107 r39262  
    11# include "relphot.h"
     2
     3/*
     4# define TEST_OBJ_ID 0x3ae2
     5# define TEST_CAT_ID 0x16c5f
     6*/
     7# define TEST_OBJ_ID 0
     8# define TEST_CAT_ID 0
     9
    210int markMeasureByRanking (StatDataSet *dataset, Measure *measure, int minrank, DVOMeasureFlags flags);
    311
     
    113121
    114122  // option for a test print
    115   if (FALSE && (averageT[0].objID == 0x7146) && (averageT[0].catID == 0x49d8)) {
     123  if ((averageT[0].objID == TEST_OBJ_ID) && (averageT[0].catID == TEST_CAT_ID)) {
    116124    fprintf (stderr, "test obj\n");
    117125    print_measure_set_alt (average, secfilt, measure);
     
    353361
    354362    if (isSetMrelFinal) {
    355       if (FALSE && (average->objID == 0x1) && (average->catID)) {
     363      if ((average[0].objID == TEST_OBJ_ID) && (average[0].catID == TEST_CAT_ID)) {
    356364        fprintf (stderr, "test obj\n");
    357365      }
     
    723731
    724732  // option for a test print
    725   if (FALSE && (average[0].objID == 0x0000049c) && (average[0].catID == 0x00016c5e)) {
     733  if ((average[0].objID == TEST_OBJ_ID) && (average[0].catID == TEST_CAT_ID)) {
    726734    fprintf (stderr, "test obj\n");
    727735    print_measure_set_alt (average, secfilt, measure);
  • trunk/Ohana/src/uniphot/Makefile

    r38986 r39262  
    1 default: uniphot setphot setphot_client setfwhm setposangle setposangle_client setastrom setastrom_client setgalmodel setgalmodel_client fiximids fiximids_client fixstkids fixstkids_client ckids ckids_client
     1# default: uniphot setphot setphot_client setfwhm setposangle setposangle_client setastrom setastrom_client setgalmodel setgalmodel_client fiximids fiximids_client fixstkids fixstkids_client ckids ckids_client
     2default: uniphot setfwhm setposangle setposangle_client setastrom setastrom_client setgalmodel setgalmodel_client fiximids fiximids_client fixstkids fixstkids_client ckids ckids_client
     3
    24help:
    35@echo "make options: uniphot setphot setfwhm default help install default (uniphot setphot setfwhm)"
     
    3436ckids_client: $(BIN)/ckids_client.$(ARCH)
    3537
    36 install: $(DESTBIN)/uniphot $(DESTBIN)/setfwhm $(DESTBIN)/setphot $(DESTBIN)/setphot_client $(DESTBIN)/setposangle $(DESTBIN)/setposangle_client $(DESTBIN)/setastrom $(DESTBIN)/setastrom_client $(DESTBIN)/setgalmodel $(DESTBIN)/setgalmodel_client $(DESTBIN)/fiximids $(DESTBIN)/fiximids_client $(DESTBIN)/fixstkids $(DESTBIN)/fixstkids_client $(DESTBIN)/ckids $(DESTBIN)/ckids_client
     38# install: $(DESTBIN)/uniphot $(DESTBIN)/setfwhm $(DESTBIN)/setphot $(DESTBIN)/setphot_client $(DESTBIN)/setposangle $(DESTBIN)/setposangle_client $(DESTBIN)/setastrom $(DESTBIN)/setastrom_client $(DESTBIN)/setgalmodel $(DESTBIN)/setgalmodel_client $(DESTBIN)/fiximids $(DESTBIN)/fiximids_client $(DESTBIN)/fixstkids $(DESTBIN)/fixstkids_client $(DESTBIN)/ckids $(DESTBIN)/ckids_client
     39install: $(DESTBIN)/uniphot $(DESTBIN)/setfwhm $(DESTBIN)/setposangle $(DESTBIN)/setposangle_client $(DESTBIN)/setastrom $(DESTBIN)/setastrom_client $(DESTBIN)/setgalmodel $(DESTBIN)/setgalmodel_client $(DESTBIN)/fiximids $(DESTBIN)/fiximids_client $(DESTBIN)/fixstkids $(DESTBIN)/fixstkids_client $(DESTBIN)/ckids $(DESTBIN)/ckids_client
    3740
    3841UNIPHOT = \
  • trunk/Ohana/src/uniphot/include/setphot.h

    r39138 r39262  
    1717  unsigned int flags;
    1818} ImageSubset;
     19
     20// we have one correction (an image) for each filter and chip
     21typedef struct {
     22  int Nx;       // number of chips in x
     23  int Ny;       // number of chips in y
     24  int Nfilter;  // number of filters
     25  int Nseason;  // number of correction peridos
     26
     27  int Nchips;   // chip offset (Nx*Ny)
     28  int Nflats;   // season offset (Nx*Ny*Nfilters)
     29  int Nvalues;  // Nx*Ny*Nfilters*Nseason
     30
     31  int dX;       // superpixel size
     32  int dY;       // superpixel size
     33
     34  int NxCCD;    // number of pixels
     35  int NyCCD;    // number of pixels
     36
     37  Matrix **matrix; // allocate an array of pointers
     38  // index = ix + iy*Nx + filter*Nchips + dir*Ngroup
     39} CamCorrection;
    1940
    2041/* global variables set in parameter file */
  • trunk/Ohana/src/uniphot/src/cam_correction.c

    r38062 r39262  
    2929
    3030  int Ndir, Nfilter, Nx, Ny, dX, dY, NxCCD, NyCCD;
    31   if (!gfits_scan (&header, "NDIR",    "%d", 1, &Ndir))    return FALSE;
    32   if (!gfits_scan (&header, "NFILTER", "%d", 1, &Nfilter)) return FALSE;
     31  if (!gfits_scan (&header, "NDIR",     "%d", 1, &Ndir))    return FALSE;
     32  if (!gfits_scan (&header, "NFILTER",  "%d", 1, &Nfilter)) return FALSE;
    3333  if (!gfits_scan (&header, "NX",       "%d", 1, &Nx))      return FALSE;
    3434  if (!gfits_scan (&header, "NY",       "%d", 1, &Ny))      return FALSE;
     
    6161  }
    6262
    63   int found = FALSE;
    6463  while (TRUE) {
    6564    Header theader;
     
    9089    // assert that cam->matrix[index] is NULL?
    9190    cam->matrix[index] = matrix;
    92 
    93     if (!found) {
    94      
    95     }
    9691  }
    9792  return TRUE;
  • trunk/Ohana/src/uniphot/src/initialize_setphot.c

    r39138 r39262  
    3333
    3434  int N;
     35
     36  CAM_FILE = NULL;
     37  if ((N = get_argument (argc, argv, "-CAM"))) {
     38    remove_argument (N, &argc, argv);
     39    char *tmpfile = strcreate (argv[N]);
     40    CAM_FILE = abspath (tmpfile, DVO_MAX_PATH);
     41    remove_argument (N, &argc, argv);
     42  }
     43  CAM_RESET = FALSE;
     44  if ((N = get_argument (argc, argv, "-CAM-reset"))) {
     45    remove_argument (N, &argc, argv);
     46    CAM_RESET = TRUE;
     47  }
    3548
    3649  VERBOSE = FALSE;
  • trunk/Ohana/src/uniphot/src/initialize_setphot_client.c

    r38986 r39262  
    2626
    2727  int N;
     28
     29  CAM_FILE = NULL;
     30  if ((N = get_argument (argc, argv, "-CAM"))) {
     31    remove_argument (N, &argc, argv);
     32    char *tmpfile = strcreate (argv[N]);
     33    CAM_FILE = abspath (tmpfile, DVO_MAX_PATH);
     34    remove_argument (N, &argc, argv);
     35  }
     36  CAM_RESET = FALSE;
     37  if ((N = get_argument (argc, argv, "-CAM-reset"))) {
     38    remove_argument (N, &argc, argv);
     39    CAM_RESET = TRUE;
     40  }
    2841
    2942  VERBOSE = FALSE;
  • trunk/Ohana/src/uniphot/src/setphot.c

    r38986 r39262  
    88  ZptTable *zpts;
    99  Image *image;
    10   FlatCorrectionTable flatcorrTable;
     10
     11  // FlatCorrectionTable flatcorrTable;
    1112
    1213  /* get configuration info, args, lockfile */
     
    3334  }
    3435
     36  // if supplied, read in the camera-static flat-field correction
     37  if (CAM_FILE) {
     38    if (!load_cam_correction (CAM_FILE)) {
     39      fprintf (stderr, "failed to load camera-static flat-field correction\n");
     40      exit (2);
     41    }
     42    merge_flatcorr_with_cam (flatcorrTable);
     43  } else {
     44    convert_flatcorr_to_cam (flatcorrTable);
     45  }
     46
     47  {
     48    char newflatfile[DVO_MAX_PATH];
     49    int size = snprintf (newflatfile, DVO_MAX_PATH, "%s/flatfield.fits", CATDIR);
     50    assert (size < DVO_MAX_PATH);
     51    save_cam_correction (newflatfile);
     52  }
     53
    3554  if (!zpts) Shutdown ("failed to load zero points, or empty table");
    3655
     
    4261
    4362  if (UBERCAL) {
    44     match_flatcorr_to_images (image, Nimage, &flatcorrTable);
     63    // we are going to deprecate the flatcorr imaage lookup
     64    // match_flatcorr_to_images (image, Nimage, &flatcorrTable);
     65    match_camcorr_to_images (image, Nimage);
    4566  }
    4667
    4768  if (!IMAGES_ONLY) {
    48     status = update_dvo_setphot (image, Nimage, &flatcorrTable);
     69    status = update_dvo_setphot (image, Nimage);
    4970  }
    5071
  • trunk/Ohana/src/uniphot/src/update_catalog_setphot.c

    r35425 r39262  
    11# include "setphot.h"
    22
    3 void update_catalog_setphot (Catalog *catalog, Image *image, off_t *index, off_t Nimage, FlatCorrectionTable *flatcorr) {
     3void update_catalog_setphot (Catalog *catalog, Image *image, off_t *index, off_t Nimage) {
    44
    55  off_t i, j, found;
     
    77  // if we are resetting, reset all flags
    88  DVOMeasureFlags photomFlags = ID_MEAS_POOR_PHOTOM | ID_MEAS_SKIP_PHOTOM | ID_MEAS_PHOTOM_UBERCAL;
     9
     10  CamCorrection *camcorr = get_cam_correction_ptr (); 
    911
    1012  found = 0;   
     
    2123      float Mcal = image[id].Mcal;
    2224      float dMcal = image[id].dMcal;
    23       float Mcal_offset = 0.0;
     25      float Mflat = 0.0;
    2426
    2527      // if we know about a flat-field correction, then we need to apply the sub-chip correction
    2628      int flat_id = image[id].photom_map_id;
    2729      if (flat_id > 0) {
    28           Mcal_offset = FlatCorrectionOffset (flatcorr, flat_id, catalog[0].measure[m].Xccd, catalog[0].measure[m].Yccd);
     30        Mflat = CamCorrectionOffset (camcorr, flat_id, catalog[0].measure[m].Xccd, catalog[0].measure[m].Yccd);
    2931      }
    3032
    31       catalog[0].measure[m].Mcal = Mcal - Mcal_offset;
     33      catalog[0].measure[m].Mcal = Mcal;
     34      catalog[0].measure[m].Mflat = Mflat;
    3235      catalog[0].measure[m].dMcal = dMcal;
    3336      myAssert(isfinite(catalog[0].measure[m].Mcal), "oops: ubercal made a nan");
Note: See TracChangeset for help on using the changeset viewer.