Changeset 4679 for trunk/Ohana/src/opihi/dvo/photometry.c
- Timestamp:
- Jul 30, 2005, 9:13:10 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/photometry.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/photometry.c
r4606 r4679 244 244 if (!strcasecmp (parname, "Nphot")) param = AVE_NPHOT; 245 245 if (!strcasecmp (parname, "Ncode")) param = AVE_NCODE; 246 if (!strcasecmp (parname, "Ncrit")) param = AVE_NCRIT; 246 247 return (param); 247 248 } … … 250 251 int TestPhotSelections (PhotCode **code, int *mode, int param) { 251 252 252 int NeedPhotcode ;253 int NeedPhotcode, Needcode; 253 254 254 255 /* if i've supplied a photcode (code != NULL), i'm not allowed to restrict it */ … … 262 263 } 263 264 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 */ 265 268 NeedPhotcode = FALSE; 266 269 NeedPhotcode |= ChiSelect; 267 270 NeedPhotcode |= NphotSelect; 268 NeedPhotcode |= NcodeSelect;269 271 NeedPhotcode |= ErrSelect; 270 272 NeedPhotcode |= TypeSelect; 271 273 NeedPhotcode |= TypefracSelect; 272 274 273 /* for measure tests, supply MEAS_ZERO */274 275 NeedPhotcode |= (param == AVE_Xm); 275 276 NeedPhotcode |= (param == AVE_MAG); … … 277 278 NeedPhotcode |= (param == AVE_TYPE); 278 279 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 } 283 287 code[0] = PhotcodeValue; 284 288 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); 287 295 } 288 296 return (TRUE); … … 615 623 value = 0; 616 624 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; 618 626 if (ErrSelect && (measure[i].dM > ErrValue)) continue; 619 627 if (FlagSelect && (measure[i].flags != FlagValue)) continue; … … 738 746 if (code == NULL) return (FALSE); 739 747 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 757 748 /* for NcodeSelect, count Nmeas for appropriate photcode */ 758 749 if (NcodeSelect) { … … 777 768 } 778 769 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 779 787 /* for NphotSelect, count Nmeas for appropriate photcode */ 780 788 if (NphotSelect) {
Note:
See TracChangeset
for help on using the changeset viewer.
