IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33117


Ignore:
Timestamp:
Jan 18, 2012, 1:47:30 PM (15 years ago)
Author:
eugene
Message:

add flat-correction to getMcal (requires lots of APIs to take flatcorr as a parameter)

Location:
branches/eam_branches/ipp-20111122/Ohana/src/relphot
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/doc/flatcorr.txt

    r33100 r33117  
     1
     22012.01.18
     3
     4I have updated libdvo to define a flatcorr table, and have the APIs to
     5read and write the table.  I have also updated setphot to load the
     6ubercal measurements and to define the flatcorr table and links (from
     7image -> flatcorr).  Now I need to understand where to include this in
     8relphot.
     9
     10One option would be to include it as part of the function 'getMcal'.
     11This function goes from (cat,meas) -> (image) to find the image zero
     12point (Mcal).  It could also check for a photom_map_id value for that
     13image, and include that in the calculation (if it exists).
     14
     15
     16Another option would be to add a new function (getMmap or something)
     17and to include this essentially everywhere getMcal is called. 
    118
    2192012.01.13
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h

    r31668 r33117  
    133133int           bcatalog            PROTO((Catalog *subcatalog, Catalog *catalog));
    134134void          clean_images        PROTO((void));
    135 void          clean_measures      PROTO((Catalog *catalog, int Ncatalog, int final));
     135void          clean_measures      PROTO((Catalog *catalog, int Ncatalog, int final, FlatCorrectionTable *flatcorr));
    136136void          clean_mosaics       PROTO((void));
    137137void          clean_stars         PROTO((Catalog *catalog, int Ncatalog));
     
    156156Coords       *getCoords           PROTO((off_t meas, int cat));
    157157off_t         getImageEntry       PROTO((off_t meas, int cat));
    158 float         getMcal             PROTO((off_t meas, int cat));
     158float         getMcal             PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog));
    159159float         getMgrid            PROTO((off_t meas, int cat));
    160160float         getMmos             PROTO((off_t meas, int cat));
     
    162162Image        *getimage            PROTO((off_t N));
    163163Image        *getimages           PROTO((off_t *N, off_t **LineNumber));
    164 void          global_stats        PROTO((Catalog *catalog, int Ncatalog));
     164void          global_stats        PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr));
    165165void          initGrid            PROTO((int dX, int dY));
    166166void          initGridBins        PROTO((Catalog *catalog, int Ncatalog));
     
    185185void          plot_chisq          PROTO((Catalog *catalog, int Ncatalog));
    186186void          plot_defaults       PROTO((Graphdata *graphdata));
    187 void          plot_grid           PROTO((Catalog *catalog));
     187void          plot_grid           PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr));
    188188void          plot_images         PROTO((void));
    189189void          plot_list           PROTO((Graphdata *graphdata, double *xlist, double *ylist, int N, char *label, char *format, ...) OHANA_FORMAT(printf, 6, 7) );
    190190void          plot_mosaic_fields  PROTO((Catalog *catalog));
    191191void          plot_mosaics        PROTO((void));
    192 void          plot_scatter        PROTO((Catalog *catalog, int Ncatalog));
     192void          plot_scatter        PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr));
    193193void          plot_star_coords    PROTO((Catalog *catalog, int Ncatalog));
    194194void          plot_stars          PROTO((Catalog *catalog, int Ncatalog));
    195 void          reload_catalogs     PROTO((SkyList *skylist));
     195void          reload_catalogs     PROTO((SkyList *skylist, FlatCorrectionTable *flatcorr));
    196196int           reload_images       PROTO((FITS_DB *db));
    197197int           setExclusions       PROTO((Catalog *catalog, int Ncatalog));
    198198void          setMcal             PROTO((Catalog *catalog, int Poor));
    199199void          setMcalFinal        PROTO((void));
    200 int           setMcalOutput       PROTO((Catalog *catalog, int Ncatalog));
    201 void          setMgrid            PROTO((Catalog *catalog));
    202 int           setMmos             PROTO((Catalog *catalog, int Poor));
    203 int           setMrel             PROTO((Catalog *catalog, int Ncatalog));
    204 void          setMrelFinal        PROTO((Catalog *catalog));
    205 int           setMrelOutput       PROTO((Catalog *catalog, int Ncatalog, int mark));
     200int           setMcalOutput       PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr));
     201void          setMgrid            PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr));
     202int           setMmos             PROTO((Catalog *catalog, int Poor, FlatCorrectionTable *flatcorr));
     203int           setMrel             PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr));
     204void          setMrelFinal        PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr));
     205int           setMrelOutput       PROTO((Catalog *catalog, int Ncatalog, int mark, FlatCorrectionTable *flatcorr));
    206206int           setMave             PROTO((Catalog *catalog, int Ncatalog));
    207207void          set_ZP              PROTO((double ZERO));
    208208int           setrefcode          PROTO((Image *image, off_t Nimage));
    209 void          skip_measurements   PROTO((Catalog *catalog, int pass));
     209void          skip_measurements   PROTO((Catalog *catalog, int pass, FlatCorrectionTable *flatcorr));
    210210void          sortA               PROTO((double *X, int N));
    211211void          sortB               PROTO((double *X, double *Y, int N));
     
    213213void          sortD               PROTO((double *X, double *Y, double *Z, int N));
    214214StatType      statsImageM         PROTO((Catalog *catalog));
    215 StatType      statsImageN         PROTO((Catalog *catalog));
     215StatType      statsImageN         PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr));
    216216StatType      statsImageX         PROTO((Catalog *catalog));
    217217StatType      statsImagedM        PROTO((Catalog *catalog));
    218218StatType      statsMosaicM        PROTO((Catalog *catalog));
    219 StatType      statsMosaicN        PROTO((Catalog *catalog));
     219StatType      statsMosaicN        PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr));
    220220StatType      statsMosaicX        PROTO((Catalog *catalog));
    221221StatType      statsMosaicdM       PROTO((Catalog *catalog));
    222 StatType      statsStarN          PROTO((Catalog *catalog, int Ncatalog, int Nsec, int seccode));
     222StatType      statsStarN          PROTO((Catalog *catalog, int Ncatalog, int Nsec, int seccode, FlatCorrectionTable *flatcorr));
    223223StatType      statsStarS          PROTO((Catalog *catalog, int Ncatalog, int Nsec));
    224224StatType      statsStarX          PROTO((Catalog *catalog, int Ncatalog, int Nsec));
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/GridOps.c

    r31450 r33117  
    284284
    285285/* direct (non-iterative) solution for Mgrid values for all grid bins */
    286 void setMgridDirect (Catalog *catalog, int Ncatalog) {
     286void setMgridDirect (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr) {
    287287
    288288  int **gotstar, **gridmeas;
     
    399399
    400400        // skip images marked as BAD
    401         Mcal = getMcal  (m, c);
     401        Mcal = getMcal  (m, c, flatcorr, catalog);
    402402        if (isnan(Mcal)) {
    403403          Ncal ++;
     
    522522
    523523/* determine Mgrid values for all grid bins */
    524 void setMgrid (Catalog *catalog) {
     524void setMgrid (Catalog *catalog, FlatCorrectionTable *flatcorr) {
    525525
    526526  int i, j, m, c, n, N, Nmax, Nbad, Nmos, Ncal, Nrel, Nsys, Nfit;
     
    554554        continue;
    555555      }
    556       Mcal = getMcal  (m, c);
     556      Mcal = getMcal  (m, c, flatcorr, catalog);
    557557      if (isnan(Mcal)) {
    558558        Ncal ++;
     
    609609}
    610610
    611 void plot_grid (Catalog *catalog) {
     611void plot_grid (Catalog *catalog, FlatCorrectionTable *flatcorr) {
    612612
    613613  int i, j, m, c, n, N, Narea;
     
    641641        continue;
    642642      }
    643       Mcal  = getMcal  (m, c);
     643      Mcal  = getMcal  (m, c, flatcorr, catalog);
    644644      if (isnan(Mcal)) continue;
    645645      Mmos  = getMmos  (m, c);
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ImageOps.c

    r33101 r33117  
    253253}
    254254
    255 float getMcal (off_t meas, int cat) {
     255float getMcal (off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog) {
    256256
    257257  off_t i;
    258   float value;
     258  float value, offset;
    259259
    260260  i = MeasureToImage[cat][meas];
     
    263263  if (image[i].flags & IMAGE_BAD) return (NAN); 
    264264  value = image[i].Mcal;
     265  offset = 0.0;
     266
     267  // to do this, I need to pass in the catalog and flatcorr pointers
     268  int flat_id = image[i].photom_map_id;
     269  if (flat_id) {
     270    offset = FlatCorrectionOffset (flatcorr, flat_id, catalog[cat].measure[meas].Xccd, catalog[cat].measure[meas].Yccd);
     271  }
     272  value += offset;
     273
    265274  return (value);
    266275}
     
    493502}
    494503
    495 StatType statsImageN (Catalog *catalog) {
     504StatType statsImageN (Catalog *catalog, FlatCorrectionTable *flatcorr) {
    496505
    497506  off_t i, j, m, c, n, N;
     
    516525      c = ImageToCatalog[i][j];
    517526
    518       Mcal  = getMcal  (m, c);
     527      Mcal  = getMcal  (m, c, flatcorr, catalog);
    519528      if (isnan(Mcal)) continue;
    520529      Mmos  = getMmos  (m, c);
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/MosaicOps.c

    r33101 r33117  
    376376}
    377377
    378 int setMmos (Catalog *catalog, int PoorImages) {
     378int setMmos (Catalog *catalog, int PoorImages, FlatCorrectionTable *flatcorr) {
    379379
    380380  off_t i, j, m, c, N, Nmax;
     
    425425          continue;
    426426      }
    427       Mcal  = getMcal  (m, c);
     427      Mcal  = getMcal  (m, c, flatcorr, catalog);
    428428      if (isnan(Mcal)) {
    429429          Ncal++;
     
    745745}
    746746
    747 StatType statsMosaicN (Catalog *catalog) {
     747StatType statsMosaicN (Catalog *catalog, FlatCorrectionTable *flatcorr) {
    748748
    749749  off_t i, j, m, c, n, N;
     
    769769      c = MosaicToCatalog[i][j];
    770770
    771       Mcal = getMcal  (m, c);
     771      Mcal = getMcal  (m, c, flatcorr, catalog);
    772772      if (isnan(Mcal)) continue;
    773773      Mgrid = getMgrid (m, c);
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/StarOps.c

    r31668 r33117  
    4747}
    4848
    49 int setMrel (Catalog *catalog, int Ncatalog) {
     49int setMrel (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr) {
    5050
    5151  off_t j, k, m;
     
    8888            Mcal = Mmos = Mgrid = 0;
    8989          } else {
    90             Mcal  = getMcal  (m, i);
     90            Mcal  = getMcal  (m, i, flatcorr, catalog);
    9191            if (isnan(Mcal)) {
    9292              Ncal ++;
     
    144144}
    145145
    146 int setMrelOutput (Catalog *catalog, int Ncatalog, int mark) {
     146int setMrelOutput (Catalog *catalog, int Ncatalog, int mark, FlatCorrectionTable *flatcorr) {
    147147
    148148  int i, N;
     
    190190            Mcal = Mmos = Mgrid = 0;
    191191          } else {
    192             Mcal  = getMcal  (m, i);
     192            Mcal  = getMcal  (m, i, flatcorr, catalog);
    193193            if (isnan(Mcal)) continue;
    194194            Mmos  = getMmos  (m, i);
     
    253253
    254254      // update average photometry for each of the average filters
     255
     256      // XXX Note that this would be faster if we had an array of results and accumulated
     257      // them in a single pass
     258
    255259      for (Ns = 0; Ns < Nsecfilt; Ns++) {
    256260
     
    353357
    354358/* set measure.Mcal for all measures except ID_MEAS_NOCAL and ID_IMAGE_PHOTOM_NOCAL */
    355 int setMcalOutput (Catalog *catalog, int Ncatalog) {
     359int setMcalOutput (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr) {
    356360
    357361  int i;
     
    368372      for (k = 0; k < catalog[i].averageT[j].Nmeasure; k++, m++) {
    369373        if (catalog[i].measureT[m].dbFlags & MEAS_BAD) continue;
    370         Mcal  = getMcal  (m, i);
     374        Mcal  = getMcal  (m, i, flatcorr, catalog);
    371375        if (isnan(Mcal)) continue;
    372376        Mmos  = getMmos  (m, i);
     
    456460# define NSIGMA_CLIP 3.0
    457461# define NSIGMA_REJECT 5.0
    458 void clean_measures (Catalog *catalog, int Ncatalog, int final) {
     462void clean_measures (Catalog *catalog, int Ncatalog, int final, FlatCorrectionTable *flatcorr) {
    459463
    460464  off_t j, k, m, Nmax, Ndel, Nave;
     
    510514
    511515          /* if (catalog[i].measureT[m].dbFlags & MEAS_BAD) continue; */
    512           Mcal  = getMcal  (m, i);
     516          Mcal  = getMcal  (m, i, flatcorr, catalog);
    513517          if (isnan(Mcal)) { Ncal ++; continue; }
    514518          Mmos  = getMmos  (m, i);
     
    554558
    555559          /* if (catalog[i].measureT[m].dbFlags & MEAS_BAD) continue; */
    556           Mcal  = getMcal  (m, i);
     560          Mcal  = getMcal  (m, i, flatcorr, catalog);
    557561          if (isnan(Mcal)) continue;
    558562          Mmos  = getMmos  (m, i);
     
    593597}
    594598
    595 StatType statsStarN (Catalog *catalog, int Ncatalog, int Nsec, int seccode) {
     599StatType statsStarN (Catalog *catalog, int Ncatalog, int Nsec, int seccode, FlatCorrectionTable *flatcorr) {
    596600
    597601  off_t j, k, m, Ntot;
     
    625629        int ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[m].photcode);
    626630        if (ecode != seccode) { continue;}
    627         Mcal = getMcal  (m, i);
     631        Mcal = getMcal  (m, i, flatcorr, catalog);
    628632        if (isnan(Mcal)) { continue;}
    629633        Mmos = getMmos  (m, i);
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/global_stats.c

    r31450 r33117  
    11# include "relphot.h"
    22
    3 void global_stats (Catalog *catalog, int Ncatalog) {
     3void global_stats (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr) {
    44
    55  StatType stN, stX, stS, imN, imX, imM, imD, msM, msX, msN, msD;
     
    1717    int seccode = photcodes[Ns][0].code;
    1818
    19     stN = statsStarN (catalog, Ncatalog, Nsec, seccode);
     19    stN = statsStarN (catalog, Ncatalog, Nsec, seccode, flatcorr);
    2020    stX = statsStarX (catalog, Ncatalog, Nsec);
    2121    stS = statsStarS (catalog, Ncatalog, Nsec);
     
    2727  }
    2828 
    29   imN = statsImageN (catalog);
     29  imN = statsImageN (catalog, flatcorr);
    3030  imX = statsImageX (catalog);
    3131  imM = statsImageM (catalog);
    3232  imD = statsImagedM (catalog);
    3333 
    34   msN = statsMosaicN (catalog);
     34  msN = statsMosaicN (catalog, flatcorr);
    3535  msM = statsMosaicM (catalog);
    3636  msD = statsMosaicdM (catalog);
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/plot_scatter.c

    r31450 r33117  
    11# include "relphot.h"
    22   
    3 void plot_scatter (Catalog *catalog, int Ncatalog) {
     3void plot_scatter (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr) {
    44
    55  off_t i, j, k, m, N, Ntot;
     
    4040
    4141                if (catalog[i].measureT[m].dbFlags & MEAS_BAD) continue;
    42                 Mcal = getMcal  (m, i);
     42                Mcal = getMcal  (m, i, flatcorr, catalog);
    4343                if (isnan(Mcal)) continue;
    4444                Mmos = getMmos  (m, i);
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/reload_catalogs.c

    r31668 r33117  
    77    gettimeofday (&start, (void *) NULL);
    88
    9 void reload_catalogs (SkyList *skylist) {
     9void reload_catalogs (SkyList *skylist, FlatCorrectionTable *flatcorr) {
    1010
    1111  int i;
     
    6969    TIMESTAMP(time4);
    7070
    71     setMrelFinal (&catalog);
     71    setMrelFinal (&catalog, flatcorr);
    7272    TIMESTAMP(time5);
    7373
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot.c

    r31668 r33117  
    11# include "relphot.h"
    2 # define USE_DIRECT 0
    3 
    4 # define TIMESTAMP(TIME) \
    5     gettimeofday (&stop, (void *) NULL);        \
    6     dtime = DTIME (stop, start);                \
    7     TIME += dtime;                              \
    8     gettimeofday (&start, (void *) NULL);
    92
    103# define MARKTIME(MSG,...) { \
     
    2417  gettimeofday (&start, (void *) NULL);
    2518
    26   // XXX quick and stupid test:
    27   if (0) {
    28     int i, j;
    29     off_t *Nlist, *NLIST, **mlist;
    30     off_t *NlistI, *NLISTI, **mlistI;
    31     int **clist;
    32     int **clistI;
    33     float dtime;
    34     float time1 = 0.0;
    35     float time2 = 0.0;
    36 
    37     int Nmosaic = 10000;
    38     int Nimage = 600000;
    39 
    40     for (j = 0; j < 19000; j++) {
    41 
    42       // mosaic indexes
    43       ALLOCATE (Nlist, off_t,   Nmosaic);
    44       ALLOCATE (NLIST, off_t,   Nmosaic);
    45       ALLOCATE (clist, int *,   Nmosaic);
    46       ALLOCATE (mlist, off_t *, Nmosaic);
    47    
    48       for (i = 0; i < Nmosaic; i++) {
    49         Nlist[i] = 0;
    50         NLIST[i] = 100;
    51         ALLOCATE (clist[i], int,   NLIST[i]);
    52         ALLOCATE (mlist[i], off_t, NLIST[i]);
    53       }
    54 
    55       // image indexes
    56       ALLOCATE (NlistI, off_t,   Nimage);
    57       ALLOCATE (NLISTI, off_t,   Nimage);
    58       ALLOCATE (clistI, int *,   Nimage);
    59       ALLOCATE (mlistI, off_t *, Nimage);
    60    
    61       for (i = 0; i < Nimage; i++) {
    62         NlistI[i] = 0;
    63         NLISTI[i] = 100;
    64         ALLOCATE (clistI[i], int,   NLISTI[i]);
    65         ALLOCATE (mlistI[i], off_t, NLISTI[i]);
    66       }
    67 
    68       TIMESTAMP(time1);
    69 
    70       // free mosaic indexes
    71       for (i = 0; i < Nmosaic; i++) {
    72         free (clist[i]);
    73         free (mlist[i]);
    74       }
    75       free (Nlist);
    76       free (NLIST);
    77       free (clist);
    78       free (mlist);
    79 
    80       // free image indexes
    81       for (i = 0; i < Nimage; i++) {
    82         free (clistI[i]);
    83         free (mlistI[i]);
    84       }
    85       free (NlistI);
    86       free (NLISTI);
    87       free (clistI);
    88       free (mlistI);
    89 
    90       TIMESTAMP(time2);
    91 
    92       if (j % 100 == 0) {
    93         fprintf (stderr, "done with %d\n", j);
    94         fprintf (stderr, "time1  %f : init mosaic\n", time1);
    95         fprintf (stderr, "time2  %f : free mosaic\n", time2);
    96       }
    97     }
    98    
    99     fprintf (stderr, "time1  %f : init mosaic\n", time1);
    100     fprintf (stderr, "time2  %f : free mosaic\n", time2);
    101     exit (1);
    102   }
    103 
    10419  /* get configuration info, args */
    10520  initialize (argc, argv);
     
    12540  // LCK_EMPTY (if UPDATE) or LCK_MISSING (if !UPDATE)
    12641  if ((db.dbstate == LCK_EMPTY) || (db.dbstate == LCK_MISSING)) {
    127     // XXX get ZERO_POINT from config
    128     dvo_image_create (&db, 25.0);
    129     // Shutdown ("ERROR: No images in catalog %s (1)", db.filename);
     42
     43    // 25.0 is the nominal zero point for measurements in the database
     44    // for all measurements except PHOT_REF:
     45    // measure.M contains: -2.5*log(DN) + 2.5*log(exptime) + 25.0
     46    // for measurements using PHOT_REF:
     47    // measure.M contains: -2.5*log(DN) + 2.5*log(exptime) + True Zero Point (but exptime and ZP are known)
     48    dvo_image_create (&db, 25.0);
     49
     50    // XXX why are we running relphot on an empty database?
    13051  } else {
    13152    if (!dvo_image_load (&db, VERBOSE, FALSE)) Shutdown ("can't read image catalog %s", db.filename);
     
    14364  if (!UPDATE) dvo_image_unlock (&db);
    14465
     66  // load the flat correction table (if defined)
     67  char flatcorrfile[256];
     68  sprintf (flatcorrfile, "%s/flatcorr.fits", CATDIR);
     69  FlatCorrectionTable *flatcorr = FlatCorrectionLoad (flatcorrfile, VERBOSE);
     70
    14571  /* load catalog data from region files */
    14672  catalog = load_catalogs (skylist, &Ncatalog);
     
    16793  setExclusions (catalog, Ncatalog);
    16894
    169   global_stats (catalog, Ncatalog);
     95  global_stats (catalog, Ncatalog, flatcorr);
    17096
    17197  if (PLOTSTUFF) {
     
    184110      for (i = 0; i < NGRID; i++) {
    185111          STAR_BAD = ID_STAR_POOR;
    186           setMrel  (catalog, Ncatalog);
     112          setMrel  (catalog, Ncatalog, flatcorr);
    187113          STAR_BAD  = ID_STAR_POOR | ID_STAR_FEW;
    188           setMgrid (catalog);
     114          setMgrid (catalog, flatcorr);
    189115      }
    190116      STAR_BAD  = ID_STAR_POOR | ID_STAR_FEW;
     
    194120  /* determine fit values */
    195121  for (i = 0; i < NLOOP; i++) {
    196     setMrel  (catalog, Ncatalog);
     122    setMrel  (catalog, Ncatalog, flatcorr);
    197123    setMcal  (catalog, FALSE);
    198     setMmos  (catalog, FALSE);
    199     setMgrid (catalog);
     124    setMmos  (catalog, FALSE, flatcorr);
     125    setMgrid (catalog, flatcorr);
    200126   
    201127    if (PLOTSTUFF) {
    202       plot_scatter (catalog, Ncatalog);
    203       plot_grid (catalog);
     128      plot_scatter (catalog, Ncatalog, flatcorr);
     129      plot_grid (catalog, flatcorr);
    204130      plot_mosaics ();
    205131      plot_images ();
     
    209135    // if (i < NLOOP - 1) rationalize_mosaics (catalog, Ncatalog);
    210136    // if (i % 6 == 1) rationalize_images ();
    211     if (i % 6 == 2) clean_measures (catalog, Ncatalog, FALSE);
     137    if (i % 6 == 2) clean_measures (catalog, Ncatalog, FALSE, flatcorr);
    212138    if (i % 6 == 3) clean_stars (catalog, Ncatalog);
    213139    if (i % 6 == 5) clean_mosaics ();
     
    218144    // if ((i == 4) || (i == 8) || (i == 12) || (i == 16)) clean_mosaics ();
    219145    // if ((i == 4) || (i == 8) || (i == 12) || (i == 16)) clean_images ();
    220     global_stats (catalog, Ncatalog);
     146    global_stats (catalog, Ncatalog, flatcorr);
    221147    MARKTIME("-- finished loop %d: %f sec\n", i, dtime);
    222148  }
    223149
    224150  if (PLOTSTUFF) {
    225     plot_scatter (catalog, Ncatalog);
    226     plot_grid (catalog);
     151    plot_scatter (catalog, Ncatalog, flatcorr);
     152    plot_grid (catalog, flatcorr);
    227153    plot_mosaics ();
    228154    plot_images ();
     
    235161  /* set Mcal & Mmos for bad images */
    236162  setMcal  (catalog, TRUE);
    237   setMmos  (catalog, TRUE);
     163  setMmos  (catalog, TRUE, flatcorr);
    238164  MARKTIME("-- finalize Mcal values: %f sec\n", dtime);
    239165
     
    309235
    310236  /* load catalog data from region files, update Mrel include all data */
    311   reload_catalogs (skylist);
     237  reload_catalogs (skylist, flatcorr);
    312238  MARKTIME("-- updated all catalogs: %f sec\n", dtime);
    313239
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot_objects.c

    r31450 r33117  
    11# include "relphot.h"
     2
     3// apply the current calibration values to the measurements to determine the average
     4// magnitudes, applying the desired clipping analysis.  Note that this does not depend on
     5// the form of the image zero point measurement.  If there is a grid or map term, and this
     6// has been correctly propagated to the measurement, the average will respect that value.
    27
    38int relphot_objects () {
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/setMrelFinal.c

    r31450 r33117  
    55// output dbFlags values
    66
    7 void setMrelFinal (Catalog *catalog) {
     7void setMrelFinal (Catalog *catalog, FlatCorrectionTable *flatcorr) {
    88
    99  off_t i, j, m;
     
    6060
    6161  for (i = 0; i < 5; i++) {
    62     skip_measurements (catalog, i);       /* set ID_MEAS_SKIP for measures to be skipped */
    63     setMrelOutput  (catalog, 1, FALSE);   /* set Mrel using all measures not skipped */
    64     clean_measures (catalog, 1, TRUE);    /* mark outliers ID_MEAS_POOR_PHOTOM */
    65     setMrelOutput  (catalog, 1, TRUE);    /* set Mrel using remaining measures */
     62    skip_measurements (catalog, i, flatcorr);       /* set ID_MEAS_SKIP for measures to be skipped */
     63    setMrelOutput  (catalog, 1, FALSE, flatcorr);   /* set Mrel using all measures not skipped */
     64    clean_measures (catalog, 1, TRUE, flatcorr);    /* mark outliers ID_MEAS_POOR_PHOTOM */
     65    setMrelOutput  (catalog, 1, TRUE, flatcorr);    /* set Mrel using remaining measures */
    6666  }
    67   setMcalOutput (catalog, 1);
     67  setMcalOutput (catalog, 1, flatcorr);
    6868
    6969  int Nsecfilt = GetPhotcodeNsecfilt ();
     
    8686
    8787/* ID_MEAS_SKIP marks measurements which were not used to calculate Mrel */
    88 void skip_measurements (Catalog *catalog, int pass) {
     88void skip_measurements (Catalog *catalog, int pass, FlatCorrectionTable *flatcorr) {
    8989
    9090  off_t i, k, m;
     
    134134      /* skip measurements from BAD images and mosaics */
    135135      /* do NOT skip measurements without a matching image */
    136       if (isnan(getMcal (m, 0))) goto skip;
     136      if (isnan(getMcal (m, 0, flatcorr, catalog))) goto skip;
    137137      if (isnan(getMmos (m, 0))) goto skip;
    138138
Note: See TracChangeset for help on using the changeset viewer.