IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 30, 2005, 9:13:10 AM (21 years ago)
Author:
eugene
Message:

more photselection modifications

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/photometry.c

    r4606 r4679  
    244244  if (!strcasecmp (parname, "Nphot")) param = AVE_NPHOT;
    245245  if (!strcasecmp (parname, "Ncode")) param = AVE_NCODE;
     246  if (!strcasecmp (parname, "Ncrit")) param = AVE_NCRIT;
    246247  return (param);
    247248}
     
    250251int TestPhotSelections (PhotCode **code, int *mode, int param) {
    251252
    252   int NeedPhotcode;
     253  int NeedPhotcode, Needcode;
    253254
    254255  /* if i've supplied a photcode (code != NULL), i'm not allowed to restrict it */
     
    262263  }
    263264
    264   /* if I have an average or ensemble restriction, I must have a photcode */
     265  /* for measure tests, supply MEAS_ZERO */
     266
     267  /* if I have an average or ensemble restriction, I must have a PRI/SEC photcode */
    265268  NeedPhotcode = FALSE;
    266269  NeedPhotcode |= ChiSelect;
    267270  NeedPhotcode |= NphotSelect;
    268   NeedPhotcode |= NcodeSelect;
    269271  NeedPhotcode |= ErrSelect;
    270272  NeedPhotcode |= TypeSelect;
    271273  NeedPhotcode |= TypefracSelect;
    272274 
    273   /* for measure tests, supply MEAS_ZERO */
    274275  NeedPhotcode |= (param == AVE_Xm);
    275276  NeedPhotcode |= (param == AVE_MAG);
     
    277278  NeedPhotcode |= (param == AVE_TYPE);
    278279  NeedPhotcode |= (param == AVE_NPHOT);
    279   NeedPhotcode |= (param == AVE_NCODE);
    280 
    281   if (NeedPhotcode || PhotcodeSelect) {
    282     if (!PhotcodeSelect) return (FALSE);
     280  Needcode = (param == AVE_NCODE);
     281
     282  if (NeedPhotcode || Needcode || NcodeSelect || PhotcodeSelect) {
     283    if (!PhotcodeSelect) {
     284      fprintf (stderr, "photcode selection problem: value requires photcode\n");
     285      return (FALSE);
     286    }
    283287    code[0] = PhotcodeValue;
    284288    mode[0] = PhotcodeMode;
    285     if (code[0][0].type == PHOT_DEP) return (FALSE);
    286     if (code[0][0].type == PHOT_REF) return (FALSE);
     289  }
     290  if (NeedPhotcode) {
     291    if (code[0][0].type == PHOT_PRI) return (TRUE);
     292    if (code[0][0].type == PHOT_SEC) return (TRUE);
     293    fprintf (stderr, "photcode selection problem: average value requires PRI/SEC photcode\n");
     294    return (FALSE);
    287295  }
    288296  return (TRUE);
     
    615623      value = 0;
    616624      for (i = 0; i < average[0].Nm; i++) {
    617         if (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].source)) continue;
     625        if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].source))) continue;
    618626        if (ErrSelect && (measure[i].dM > ErrValue)) continue;
    619627        if (FlagSelect && (measure[i].flags != FlagValue)) continue;
     
    738746  if (code == NULL) return (FALSE);
    739747
    740   /* only PRI/SEC photcodes apply the filter */
    741   if (code[0].type == PHOT_DEP) return (TRUE);
    742   if (code[0].type == PHOT_REF) return (TRUE);
    743 
    744   /* exclusions based on average.params  */
    745   if (ChiSelect) {
    746     Xm = PhotXm (code, average, secfilt);
    747     if (Xm == -1) return (FALSE);
    748     if (Xm > ChiLimit) return (FALSE);
    749   }
    750  
    751   /* for ErrSelect, check average errors */
    752   if (ErrSelect) {
    753     dM = iPhotdM (code, average, secfilt);
    754     if (dM > ErrValue) return (NO_MAG);
    755   }
    756  
    757748  /* for NcodeSelect, count Nmeas for appropriate photcode */
    758749  if (NcodeSelect) {
     
    777768  }
    778769
     770  /* only PRI/SEC photcodes apply the filter */
     771  if (code[0].type == PHOT_DEP) return (TRUE);
     772  if (code[0].type == PHOT_REF) return (TRUE);
     773
     774  /* exclusions based on average.params  */
     775  if (ChiSelect) {
     776    Xm = PhotXm (code, average, secfilt);
     777    if (Xm == -1) return (FALSE);
     778    if (Xm > ChiLimit) return (FALSE);
     779  }
     780 
     781  /* for ErrSelect, check average errors */
     782  if (ErrSelect) {
     783    dM = iPhotdM (code, average, secfilt);
     784    if (dM > ErrValue) return (NO_MAG);
     785  }
     786 
    779787  /* for NphotSelect, count Nmeas for appropriate photcode */
    780788  if (NphotSelect) {
Note: See TracChangeset for help on using the changeset viewer.