Changeset 4679
- Timestamp:
- Jul 30, 2005, 9:13:10 AM (21 years ago)
- Location:
- trunk/Ohana/src/opihi/dvo
- Files:
-
- 7 edited
-
ccd.c (modified) (3 diffs)
-
cmd.c (modified) (3 diffs)
-
ddmags.c (modified) (3 diffs)
-
dmagaves.c (modified) (1 diff)
-
dmagmeas.c (modified) (3 diffs)
-
dmags.c (modified) (4 diffs)
-
photometry.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/ccd.c
r4606 r4679 8 8 int i, m, k, Npts, NPTS, N; 9 9 int N1, N2, i1, i2, mode[4]; 10 int Ngraph, Nsec, Nregions ;10 int Ngraph, Nsec, Nregions, KeepNulls; 11 11 12 12 Catalog catalog; … … 33 33 if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape; 34 34 if (!SetPhotSelections (&argc, argv, 4)) goto usage; 35 36 KeepNulls = FALSE; 37 if (N = get_argument (argc, argv, "-nulls")) { 38 KeepNulls = TRUE; 39 remove_argument (N, &argc, argv); 40 } 35 41 36 42 /* interpret command-line options */ … … 82 88 SetSelectionParam (2); 83 89 M2 = ExtractDMag (&code[2], &mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N2); 84 if (N2 == 0) goto skip; 90 if (N2 == 0) { 91 if (KeepNulls) { 92 ALLOCATE (M2, double, 1); 93 N2 = 1; 94 M2[0] = NO_MAG; 95 } else { 96 goto skip; 97 } 98 } 85 99 86 100 for (i1 = 0; i1 < N1; i1++) { -
trunk/Ohana/src/opihi/dvo/cmd.c
r4606 r4679 7 7 int i, j, m, i1, i3, N1, N3, N; 8 8 int Npts, NPTS, mode[3]; 9 int Ngraph, Nsec, Nregions ;9 int Ngraph, Nsec, Nregions, KeepNulls; 10 10 11 11 Catalog catalog; … … 33 33 if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape; 34 34 if (!SetPhotSelections (&argc, argv, 3)) goto usage; 35 36 KeepNulls = FALSE; 37 if (N = get_argument (argc, argv, "-nulls")) { 38 KeepNulls = TRUE; 39 remove_argument (N, &argc, argv); 40 } 35 41 36 42 /* interpret command-line options */ … … 80 86 SetSelectionParam (2); 81 87 M3 = ExtractMagnitudes (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N3); 82 if (N3 == 0) goto skip; 88 if (N3 == 0) { 89 if (KeepNulls) { 90 ALLOCATE (M3, double, 1); 91 N3 = 1; 92 M3[0] = NO_MAG; 93 } else { 94 goto skip; 95 } 96 } 83 97 84 98 for (i1 = 0; i1 < N1; i1++) { -
trunk/Ohana/src/opihi/dvo/ddmags.c
r4606 r4679 6 6 double Radius; 7 7 double *M1, *M2; 8 int i, m, k, N pts, NPTS;8 int i, m, k, N, Npts, NPTS; 9 9 int N1, N2, i1, i2, mode[4]; 10 int Ngraph, Nsec, Nregions ;10 int Ngraph, Nsec, Nregions, KeepNulls; 11 11 12 12 Catalog catalog; … … 33 33 if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape; 34 34 if (!SetPhotSelections (&argc, argv, 4)) goto usage; 35 36 KeepNulls = FALSE; 37 if (N = get_argument (argc, argv, "-nulls")) { 38 KeepNulls = TRUE; 39 remove_argument (N, &argc, argv); 40 } 35 41 36 42 /* interpret command-line options */ … … 82 88 SetSelectionParam (2); 83 89 M2 = ExtractDMag (&code[2], &mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N2); 84 if (N2 == 0) goto skip; 90 if (N2 == 0) { 91 if (KeepNulls) { 92 ALLOCATE (M2, double, 1); 93 N2 = 1; 94 M2[0] = NO_MAG; 95 } else { 96 goto skip; 97 } 98 } 85 99 86 100 for (i1 = 0; i1 < N1; i1++) { -
trunk/Ohana/src/opihi/dvo/dmagaves.c
r4606 r4679 21 21 RegionName = NULL; 22 22 RegionList = NULL; 23 code[2] = NULL; 23 24 24 25 /* load photcode information */ -
trunk/Ohana/src/opihi/dvo/dmagmeas.c
r4606 r4679 7 7 int i, j, k, m, i1, i3, N1, N3, N; 8 8 int Npts, NPTS, param, mode[3]; 9 int Ngraph, Nsec, Nregions ;9 int Ngraph, Nsec, Nregions, KeepNulls; 10 10 11 11 Catalog catalog; … … 33 33 if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape; 34 34 if (!SetPhotSelections (&argc, argv, 3)) goto usage; 35 36 KeepNulls = FALSE; 37 if (N = get_argument (argc, argv, "-nulls")) { 38 KeepNulls = TRUE; 39 remove_argument (N, &argc, argv); 40 } 35 41 36 42 /* interpret command-line arguments: dmagmeas F1 - F2 : (value) */ … … 81 87 SetSelectionParam (2); 82 88 M3 = ExtractMeasures (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N3, param); 83 if (N3 == 0) goto skip; 89 if (N3 == 0) { 90 if (KeepNulls) { 91 ALLOCATE (M3, double, 1); 92 N3 = 1; 93 M3[0] = NO_MAG; 94 } else { 95 goto skip; 96 } 97 } 84 98 85 99 for (i1 = 0; i1 < N1; i1++) { -
trunk/Ohana/src/opihi/dvo/dmags.c
r4585 r4679 7 7 int i, j, m, i1, i3, N1, N3, N; 8 8 int Npts, NPTS, mode[3]; 9 int Nsec, Nregions ;9 int Nsec, Nregions, KeepNulls; 10 10 11 11 PhotCode *code[3]; … … 33 33 if (!SetPhotSelections (&argc, argv, 3)) goto usage; 34 34 35 KeepNulls = FALSE; 36 if (N = get_argument (argc, argv, "-nulls")) { 37 KeepNulls = TRUE; 38 remove_argument (N, &argc, argv); 39 } 40 35 41 /* interpret required command-line arguments: dmags F1 - F2 : F3 */ 36 42 if (argc != 6) { goto usage; } … … 40 46 if (!GetPhotcodeInfo (argv[3], &code[1], &mode[1])) goto usage; 41 47 if (!GetPhotcodeInfo (argv[5], &code[2], &mode[2])) goto usage; 42 if (!TestPhotSelections (&code[0], MEAS_ZERO)) goto escape;48 if (!TestPhotSelections (&code[0], &mode[0], MEAS_ZERO)) goto escape; 43 49 44 50 /* load region corresponding to selection above */ … … 79 85 SetSelectionParam (2); 80 86 M3 = ExtractMagnitudes (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N3); 81 if (N3 == 0) goto skip; 87 if (N3 == 0) { 88 if (KeepNulls) { 89 ALLOCATE (M3, double, 1); 90 N3 = 1; 91 M3[0] = NO_MAG; 92 } else { 93 goto skip; 94 } 95 } 82 96 83 97 for (i1 = 0; i1 < N1; i1++) { -
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.
