IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42696


Ignore:
Timestamp:
Jun 24, 2024, 9:08:34 AM (2 years ago)
Author:
eugene
Message:

user options to set the MIN_MAG, PSF-KRON cut, and PSF_QF cut for stars used in the calibration; identify the GPC1 and GPC2 stack and forced-warp photcodes correctly; option to tie calibration to a different average photcode than the photcode equiv entry (ie, tie to the equiv of the equiv)

Location:
branches/eam_branches/ipp-20230313/Ohana/src/relphot
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20230313/Ohana/src/relphot/include/relphot.h

    r42389 r42696  
    414414int IS_DIFF_DB;
    415415
     416double MAG_MIN;
    416417double MAG_LIM;
    417418double SIGMA_LIM;
     419
     420double STAR_MAX_PSF_KRON;
     421double PSF_QF_MIN;
     422
    418423double IMAGE_SCATTER;
    419424double IMAGE_OFFSET;
     
    468473int    RESET_FLATCORR;
    469474int    REPAIR_WARPS;
     475int    USE_REF_EQUIV;
    470476int    PRESERVE_PS1;
    471477int    REQUIRE_PSFFIT;
  • branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/ConfigInit.c

    r41647 r42696  
    2323  if (VERBOSE) fprintf (stderr, "loaded config file: %s\n", file);
    2424
    25   GetConfig (config, "MAG_LIM",                "%lf", 0, &MAG_LIM);
    26   GetConfig (config, "SIGMA_LIM",              "%lf", 0, &SIGMA_LIM);
     25  // the following cuts are limit the objects used to calculate the image zero points.
     26  // These are used in bcatalog.c and apply to Mcat (nominal measurement magnitude)
     27  GetConfig (config, "SIGMA_LIM",              "%lf",    0, &SIGMA_LIM);
     28  GetConfig (config, "MAG_LIM",                "%lf",    0, &MAG_LIM);
     29
     30  DefConfig ("MAG_MIN",                        "%lf", 15.0, MAG_MIN);
     31  DefConfig ("STAR_MAX_PSF_KRON",              "%lf",  0.2, STAR_MAX_PSF_KRON);
     32  DefConfig ("PSF_QF_MIN",                     "%lf", 0.95, PSF_QF_MIN);
    2733
    2834  DefConfig ("STAR_SCATTER",                    "%lf",  0.1, STAR_SCATTER);
  • branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/StarOps.c

    r41647 r42696  
    3434
    3535
    36 //
     36// Nsecfilt is a property of the photcode table.  we only need to retrieve it once.
     37static int Nsecfilt = -1;
     38
     39// return the average photometry for this measurement
    3740float getMrel (Catalog *catalog, off_t meas, int cat, dvoMagClassType class, dvoMagSourceType source) {
    3841
     
    4144
    4245  int ecode = GetPhotcodeEquivCodebyCode (photcode);
     46  if (USE_REF_EQUIV) {
     47    // tie this photometry to an alternative refernce
     48    // (e.g., tie UDR4.i to PV3.i)
     49    int refcode = GetPhotcodeEquivCodebyCode (ecode);
     50    if (refcode < 0) return NAN;
     51    ecode = refcode;
     52  }
     53
    4354  int Nsec = GetPhotcodeNsec(ecode);
    44   int Nsecfilt = GetPhotcodeNsecfilt ();
     55  if (Nsec < 0) return NAN;
     56
     57  if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); }
    4558
    4659  int entry = Nsecfilt*ave+Nsec;
     
    312325  }
    313326
    314   int Nsecfilt = GetPhotcodeNsecfilt ();
     327  if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); }
    315328
    316329  SetMrelInfo summary, results;
     
    334347  int i;
    335348
    336   int Nsecfilt = GetPhotcodeNsecfilt ();
     349  if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); }
    337350
    338351  SetMrelInfo summary, results;
     
    424437  ThreadInfo *threadinfo = data;
    425438
    426   int Nsecfilt = GetPhotcodeNsecfilt ();
     439  if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); }
    427440
    428441  SetMrelInfo results;
     
    451464  off_t k;
    452465
    453   int Nsecfilt = GetPhotcodeNsecfilt ();
     466  if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); }
    454467
    455468  off_t m = average[0].measureOffset;
     
    559572  off_t j;
    560573
    561   int Nsecfilt = GetPhotcodeNsecfilt ();
     574  if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); }
    562575
    563576  for (i = 0; i < Ncatalog; i++) {
     
    601614  ALLOCATE (slist, double, Ntot);
    602615
    603   int Nsecfilt = GetPhotcodeNsecfilt ();
     616  if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); }
    604617
    605618  // eliminate bad stars using the stats for a single secfilt at a time
     
    666679  // N1 = N2 = N3 = N4 = N0 = 0;
    667680
    668   int Nsecfilt = GetPhotcodeNsecfilt ();
     681  if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); }
    669682
    670683  Ntot = 0;
     
    719732  StatType stats;
    720733
    721   int Nsecfilt = GetPhotcodeNsecfilt ();
     734  if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); }
    722735
    723736  Ntot = 0;
     
    760773  StatType stats;
    761774
    762   int Nsecfilt = GetPhotcodeNsecfilt ();
     775  if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); }
    763776
    764777  Ntot = 0;
     
    805818  ALLOCATE (Mlist, double, NBIN);
    806819
    807   int Nsecfilt = GetPhotcodeNsecfilt ();
     820  if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); }
    808821
    809822  int Ns;
     
    840853  Graphdata graphdata;
    841854
    842   int Nsecfilt = GetPhotcodeNsecfilt ();
     855  if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); }
    843856
    844857  Ntotal = 0;
     
    911924  return;
    912925
    913   int Nsecfilt = GetPhotcodeNsecfilt ();
     926  if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); }
    914927
    915928  FILE *fout = NULL;
  • branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/args.c

    r42389 r42696  
    237237  }
    238238
     239  USE_REF_EQUIV = FALSE;
     240  if ((N = get_argument (argc, argv, "-use-ref-equiv"))) {
     241    remove_argument (N, &argc, argv);
     242    USE_REF_EQUIV = TRUE;
     243  }
    239244  PRESERVE_PS1 = FALSE;
    240245  if ((N = get_argument (argc, argv, "-preserve-ps1"))) {
     
    836841  }
    837842
     843  USE_REF_EQUIV = FALSE;
     844  if ((N = get_argument (argc, argv, "-use-ref-equiv"))) {
     845    remove_argument (N, &argc, argv);
     846    USE_REF_EQUIV = TRUE;
     847  }
    838848  PRESERVE_PS1 = FALSE;
    839849  if ((N = get_argument (argc, argv, "-preserve-ps1"))) {
  • branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/bcatalog.c

    r42389 r42696  
    8585
    8686      // skip garbage measurements
    87       if (isnan(catalog[0].measure[offset].psfQF)     || (catalog[0].measure[offset].psfQF < 0.95))    { Npsfqf ++; continue; }
    88       if (isnan(catalog[0].measure[offset].psfQFperf) || (catalog[0].measure[offset].psfQFperf < 0.95)) { Npsfqf ++; continue; }
     87      if (isnan(catalog[0].measure[offset].psfQF)     || (catalog[0].measure[offset].psfQF     < PSF_QF_MIN)) { Npsfqf ++; continue; }
     88      if (isnan(catalog[0].measure[offset].psfQFperf) || (catalog[0].measure[offset].psfQFperf < PSF_QF_MIN)) { Npsfqf ++; continue; }
    8989      if (isnan(catalog[0].measure[offset].M)) { Nnan ++; continue; }
    9090      if (isnan(Maper)) { Nnan ++; continue; }
     
    104104
    105105      // weak test for galaxies
    106       if (Mkp > 0.5) {
     106      if (Mkp > STAR_MAX_PSF_KRON) {
    107107        nEXT ++;
    108108      } else {
     
    113113      mag = PhotCat (&catalog[0].measure[offset], MAG_CLASS_PSF);
    114114      if (mag > MAG_LIM) { Nmag ++; continue; }
     115      if (mag < MAG_MIN) { Nmag ++; continue; }
     116      // note that these two cuts are applied to all photcodes. these are also applied to
     117      // the nominal apparent mags : if the expected sensitivity is very different between
     118      // different filters, or if exposure times have a large range, these cuts may not be
     119      // effective (or may exclude too much).
    115120
    116121      /* select measurements by measurement error */
     
    123128        if (mag > ImagMax) { Nimag ++; continue; }
    124129      }
     130      // note that instrumental mag cuts are reasonable for individual exposures using the same
     131      // detector, but are probably not appropriate for stacks with a large range of the number
     132      // of inputs. 
    125133
    126134      // count this measurement as valid for this secfilt entry
  • branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/extra.c

    r41647 r42696  
    7070}
    7171
    72 // for now (20140710) I need to identify gpc1 stacks explicitly.  generalize in the future
     72// for now (20140710) I need to identify gpc1 & gpc2 stacks explicitly.  generalize in the future
    7373int isGPC1stack (int photcode) {
    7474
    75   if ((photcode == 11000) || (photcode == 14100)) return TRUE; // g-band
    76   if ((photcode == 11100) || (photcode == 14200)) return TRUE; // r-band
    77   if ((photcode == 11200) || (photcode == 14300)) return TRUE; // i-band
    78   if ((photcode == 11300) || (photcode == 14400)) return TRUE; // z-band
    79   if ((photcode == 11400) || (photcode == 14500)) return TRUE; // y-band
    80   if ((photcode == 11500) || (photcode == 14600)) return TRUE; // w-band
     75  // 11000 : GPC1.g.SkyChip
     76  // 11001 : VARIOUS.g.SkyChip (output of xcamera stacks)
     77  // 14100 : SIMTEST.g.SkyChip
     78  // 31000 : GPC2.g.SkyChip
     79 
     80  if ((photcode == 11000) || (photcode == 11001) || (photcode == 14100) || (photcode == 31000)) return TRUE; // g-band
     81  if ((photcode == 11100) || (photcode == 11101) || (photcode == 14200) || (photcode == 31100)) return TRUE; // r-band
     82  if ((photcode == 11200) || (photcode == 11201) || (photcode == 14300) || (photcode == 31200)) return TRUE; // i-band
     83  if ((photcode == 11300) || (photcode == 11301) || (photcode == 14400) || (photcode == 31300)) return TRUE; // z-band
     84  if ((photcode == 11400) || (photcode == 11401) || (photcode == 14500) || (photcode == 31400)) return TRUE; // y-band
     85  if ((photcode == 11500) || (photcode == 11501) || (photcode == 14600) || (photcode == 31500)) return TRUE; // w-band
    8186
    8287  return FALSE;
     
    8590// for now (20140710) I need to identify gpc1 stacks explicitly.  generalize in the future
    8691int isGPC1warp (int photcode) {
     92
     93  // 11000 : GPC1.g.SkyChip
     94  // 14100 : SIMTEST.g.SkyChip
     95
     96  // 12000 : GPC1.g.ForcedWarp
     97  // 15100 : SIMTEST.g.ForcedWarp
     98  // 32000 : GPC2.g.ForcedWarp
    8799
    88100  // diff warps get stack-like photcodes (kind of lame)
     
    97109  }
    98110
    99   if ((photcode == 12000) || (photcode == 15100)) return TRUE; // g-band
    100   if ((photcode == 12100) || (photcode == 15200)) return TRUE; // r-band
    101   if ((photcode == 12200) || (photcode == 15300)) return TRUE; // i-band
    102   if ((photcode == 12300) || (photcode == 15400)) return TRUE; // z-band
    103   if ((photcode == 12400) || (photcode == 15500)) return TRUE; // y-band
    104   if ((photcode == 12500) || (photcode == 15600)) return TRUE; // w-band
     111  if ((photcode == 12000) || (photcode == 15100) || (photcode == 32000)) return TRUE; // g-band
     112  if ((photcode == 12100) || (photcode == 15200) || (photcode == 32100)) return TRUE; // r-band
     113  if ((photcode == 12200) || (photcode == 15300) || (photcode == 32200)) return TRUE; // i-band
     114  if ((photcode == 12300) || (photcode == 15400) || (photcode == 32300)) return TRUE; // z-band
     115  if ((photcode == 12400) || (photcode == 15500) || (photcode == 32400)) return TRUE; // y-band
     116  if ((photcode == 12500) || (photcode == 15600) || (photcode == 32500)) return TRUE; // w-band
    105117
    106118  return FALSE;
  • branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/initialize.c

    r42134 r42696  
    5050      fprintf (stderr, "DophotSelect: FALSE\n");
    5151    }
    52     fprintf (stderr, "PSF_QF limit: 0.85 (hardwired)\n");
     52    fprintf (stderr, "PSF_QF limit: %f\n", PSF_QF_MIN);
    5353
    5454    // fprintf (stderr, "Photom Bad Mask: 0x%08x, Photom Poor Mask: 0x%08x\n");
    5555
    56     fprintf (stderr, "MAG_LIM: %f, SIGMA_LIM: %f\n", MAG_LIM, SIGMA_LIM);
     56    fprintf (stderr, "MAG_MIN: %f, MAG_LIM: %f, SIGMA_LIM: %f\n", MAG_MIN, MAG_LIM, SIGMA_LIM);
    5757    fprintf (stderr, "INST_MAG_MIN: %f, INST_MAG_MAX: %f\n", ImagMin, ImagMax);
    5858
     59    fprintf (stderr, "STAR_MAX_PSF_KRON: %f\n", STAR_MAX_PSF_KRON);
    5960    fprintf (stderr, "STAR_TOOFEW: %d\n", STAR_TOOFEW);
    6061
  • branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/load_catalogs.c

    r41647 r42696  
    151151    // TimeSelect -time
    152152    // DophotSelect
    153     // (note that psfQF is applied rigidly at 0.85, as is the galaxy test)
     153    // PSF_QF_MIN
     154    // STAR_MAX_PSF_KRON
     155    // MAG_MIN
    154156    // MAG_LIM
    155157    // SIGMA_LIM
     
    158160
    159161    char *command = NULL;
    160     strextend (&command, "relphot_client %s -load %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -D CAMERA %s -D MAG_LIM %f -D SIGMA_LIM %f",
    161               PhotcodeList, table->hosts[i].results, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, CAMERA, MAG_LIM, SIGMA_LIM);
     162    strextend (&command, "relphot_client %s -load %s -hostID %d -D CATDIR %s -hostdir %s", PhotcodeList, table->hosts[i].results, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname);
     163    strextend (&command, "-region %f %f %f %f -D CAMERA %s", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, CAMERA);
     164    strextend (&command, "-D MAG_MIN %f -D MAG_LIM %f -D SIGMA_LIM %f", MAG_MIN, MAG_LIM, SIGMA_LIM);
     165    strextend (&command, "-D STAR_MAX_PSF_KRON %f -D PSF_QF_MIN %f", STAR_MAX_PSF_KRON, PSF_QF_MIN);
    162166
    163167    if (VERBOSE)             { strextend (&command, "-v"); }
  • branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/relphot.c

    r42520 r42696  
    3333 
    3434  switch (mode) {
    35     case UPDATE_IMAGES:
     35    case UPDATE_IMAGES: // -images
    3636      // calculate zero points for images (may group by exposure [mosaic], night [tgroups]; may measure flat-correction)
    37       // IF CALLED WITH NLOOP == 0, DOES NOT LOAD bcatalog, just loads image table and generates ImageSubset.dat
     37      // IF CALLED WITH NLOOP == 0 (and NOT -only-stacks-and-warps), this step DOES NOT LOAD bcatalog.  Instead it just loads
     38      // the image table and applies the Mcal values to the measurements.  In parallel context, it generates ImageSubset.dat.
    3839      // If called with -update, calls reload_catalogs() just like apply_offsets, UNLESS -only-stacks-and-warps is selected
    3940      relphot_images (skylist);
Note: See TracChangeset for help on using the changeset viewer.