IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 31, 2021, 11:45:18 AM (5 years ago)
Author:
eugene
Message:

major revision of the flagging and resets. cleanup of old cruft and deprecated flag values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/relphot.20210521/src/ResetOps.c

    r41624 r41625  
    7575    }
    7676  }
     77  if (RESET_FLATCORR) {
     78    measure->Mflat = 0.0;
     79  }
    7780  measure->dbFlags &= ~photomBitsMeasure;
    7881}
     
    8891  for (off_t i = 0; i < Nsubset; i++) {
    8992    // reset these bits regardless (we will re-determine)
    90     subset[i].flags &= ~(ID_IMAGE_PHOTOM_NOCAL | ID_IMAGE_PHOTOM_POOR | ID_IMAGE_PHOTOM_SKIP | ID_IMAGE_PHOTOM_FEW);
     93    subset[i].flags &= ~(ID_IMAGE_PHOTOM_POOR | ID_IMAGE_PHOTOM_FEW);
    9194    if (RESET) {
    9295      if (RESET_ZEROPTS) {
     
    117120
    118121  for (off_t i = 0; i < catalog->Naverage; i++) {
    119     catalog[0].average[i].psfQF     = NAN;      // force recalculation in setMrelCatalog
    120     catalog[0].average[i].psfQFperf = NAN;      // force recalculation in setMrelCatalog
    121     catalog[0].average[i].stargal   = NAN;      // force recalculation in setMrelCatalog
    122     catalog[0].average[i].photFlagsUpper = 0;   // reset (will be re-calculated)
    123     catalog[0].average[i].photFlagsLower = 0;   // reset (will be re-calculated)
    124     catalog[0].average[i].NwarpOK        = 0;   // reset (will be re-calculated)
     122    catalog->average[i].psfQF     = NAN;        // force recalculation in setMrelCatalog
     123    catalog->average[i].psfQFperf = NAN;        // force recalculation in setMrelCatalog
     124    catalog->average[i].stargal   = NAN;        // force recalculation in setMrelCatalog
     125    catalog->average[i].photFlagsUpper = 0;     // reset (will be re-calculated)
     126    catalog->average[i].photFlagsLower = 0;     // reset (will be re-calculated)
     127    catalog->average[i].NwarpOK        = 0;     // reset (will be re-calculated)
     128
     129    // RESET_FLATCORR independent of RESET?
    125130
    126131    if (!RESET) continue;
     
    128133    catalog->average[i].flags    &= ~photomBitsAverage; // reset all photometry bits (but not astrom)
    129134
    130     for (int Ns = 0; Ns < Nsecfilt; Ns++) {
     135    // Reset secfilt values only for the active photcodes
     136    for (int Ns = 0; Ns < Nphotcodes; Ns++) {
     137     
     138      int thisCode = photcodes[Ns][0].code;
     139      int Nsec = GetPhotcodeNsec(thisCode);
     140      off_t N = Nsecfilt*i+Nsec;
     141     
     142      dvo_secfilt_init (&catalog->secfilt[N], SECFILT_RESET_ALL);
     143    }
     144
     145    // Reset measure values only for the active photcodes
     146   
     147    off_t m = catalog->average[i].measureOffset;
     148   
     149    for (off_t j = 0; j < catalog->average[i].Nmeasure; j++, m++) {
     150     
     151      /* select measurements for active photcodes */
     152      PhotCode *code = GetPhotcodebyCode (catalog->measure[m].photcode);
     153      if (!code) continue;
     154      // photcode exists, but is it one of the active ones?
     155      int found = FALSE;
     156      for (int Ns = 0; !found && (Ns < Nphotcodes); Ns++) {
     157        if (code->equiv != photcodes[Ns][0].code) continue;
     158        found = TRUE;
     159      }
     160      if (!found) continue;
     161
     162      // reset the Mflat value if requested
     163      if (RESET_FLATCORR) {
     164        catalog->measure[m].Mflat = 0.0;
     165      }
     166     
     167      /* select measurements by time */
     168      if (TimeSelect) {
     169        if (catalog->measure[m].t < TSTART) continue;
     170        if (catalog->measure[m].t > TSTOP) continue;
     171      }
    131172       
    132       off_t N = Nsecfilt*i+Ns;
    133       dvo_secfilt_init (&catalog->secfilt[N], SECFILT_RESET_ALL);
     173      // only reset Mcal for measures with a matching image
     174      // do not reset Mcal for ubercal images unless explicitly requested
    134175
    135       off_t m = catalog->average[i].measureOffset;
    136 
    137       for (off_t j = 0; j < catalog->average[i].Nmeasure; j++, m++) {
    138        
    139         /* select measurements by time */
    140         if (TimeSelect) {
    141           if (catalog->measure[m].t < TSTART) continue;
    142           if (catalog->measure[m].t > TSTOP) continue;
     176      if (catalog->measure[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
     177        if (!KEEP_UBERCAL) {
     178          catalog->measure[m].McalPSF  = 0.0;
     179          catalog->measure[m].McalAPER = 0.0;
     180          catalog->measure[m].dbFlags &= ~ID_MEAS_PHOTOM_UBERCAL;
     181        }
     182      } else {
     183        if (RESET_ZEROPTS && (getImageEntry (m, 0) >= 0)) {
     184          catalog->measure[m].McalPSF  = 0.0;
     185          catalog->measure[m].McalAPER = 0.0;
    143186        }
    144        
    145         // only reset Mcal for measures with a matching image
    146         // do not reset Mcal for ubercal images unless explicitly requested
    147 
    148         if (catalog->measure[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
    149           if (!KEEP_UBERCAL) {
    150             catalog->measure[m].McalPSF  = 0.0;
    151             catalog->measure[m].McalAPER = 0.0;
    152             catalog->measure[m].dbFlags &= ~ID_MEAS_PHOTOM_UBERCAL;
    153           }
    154         } else {
    155           if (RESET_ZEROPTS && (getImageEntry (m, 0) >= 0)) {
    156             catalog->measure[m].McalPSF  = 0.0;
    157             catalog->measure[m].McalAPER = 0.0;
    158           }
    159         }
    160         catalog->measure[m].dbFlags &= ~photomBitsMeasure;
    161187      }
     188      catalog->measure[m].dbFlags &= ~photomBitsMeasure;
    162189    }
    163190  }
    164191}
    165192
     193
Note: See TracChangeset for help on using the changeset viewer.