Changeset 4585 for trunk/Ohana/src/opihi/dvo/calmextract.c
- Timestamp:
- Jul 20, 2005, 4:27:25 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/calmextract.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/calmextract.c
r3462 r4585 6 6 int calmextract (int argc, char **argv) { 7 7 8 int i, j, k, m, N, N1, Nr, mode[2]; 9 int NSTAR, Nstar, Nsec, Nregions; 10 char filename[256], catdir[256], *RegionName, *RegionList; 11 double *M1, M2, dM2, color, Radius; 12 8 13 Catalog catalog; 9 Graphdata graphsky;10 14 RegionFile *regions; 11 15 PhotCode *code[2]; 12 16 Vector **vec; 13 14 int i, j, k, m, N, N1, Nr, mode[2];15 int Ngraph, NSTAR, Nstar, Nsec, Nregions, RegionList;16 char filename[256], catdir[256], RegionListFile[256];17 double *M1, M2, dM2, color, Radius;18 17 19 18 /* these need to be freed in the end */ … … 22 21 catalog.secfilt = NULL; 23 22 catalog.measure = NULL; 23 RegionName = NULL; 24 RegionList = NULL; 24 25 25 26 /* load photcode information */ 26 if (!InitPhotcodes ()) return (FALSE);27 if (!InitPhotcodes ()) goto escape; 27 28 Nsec = GetPhotcodeNsecfilt (); 28 29 29 /* load data about plot windows */30 Ngraph = 0;31 if (!GetGraphData (&graphsky, NULL, &Ngraph)) goto escape;32 33 30 /* find CATDIR in config system */ 34 VarConfig ("CATDIR", "%s", catdir); 35 36 /* specify catalog files */ 37 RegionList = FALSE; 38 if (N = get_argument (argc, argv, "-list")) { 39 RegionList = TRUE; 40 remove_argument (N, &argc, argv); 41 strcpy (RegionListFile, argv[N]); 42 remove_argument (N, &argc, argv); 43 } 31 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape; 44 32 45 33 /* command line arguments */ 46 if (!SetPhotSelections (&argc, argv)) goto usage; 34 if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape; 35 if (!SetPhotSelections (&argc, argv, 2)) goto usage; 36 37 /* interpret required command-line arguments: calmextract F1 - F2 */ 47 38 if (argc != 4) goto usage; 48 39 if (strcmp (argv[2], "-")) goto usage; 49 40 if (!GetPhotcodeInfo (argv[1], &code[0], &mode[0])) goto usage; 50 41 if (!GetPhotcodeInfo (argv[3], &code[1], &mode[1])) goto usage; 51 /* code.type must be PHOT_REF */ 52 53 /* test PhotSelections: is photcode specified if needed? */ 54 if (!TestPhotSelections (&code)) { 55 fprintf (stderr, "photcode selection rules violated\n"); 56 fprintf (stderr, "average and ensemble restrictions require a corresponding photcode\n"); 57 goto escape; 58 } 59 42 if (!TestPhotSelections (&code[0], MEAS_ZERO)) goto escape; 60 43 61 44 /* returned vectors are dmag, mag, color, time, airmass, ra, dec, x, y, exptime */ … … 86 69 } 87 70 88 /* select region files */ 89 if (RegionList) { 90 regions = region_list (RegionListFile, &Nregions); 91 if (!SetImageSelection (MEAS_XMOSAIC, NULL, FALSE)) goto escape; 92 } else { 93 Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax)); 94 regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions); 95 if (!SetImageSelection (MEAS_XMOSAIC, &graphsky, TRUE)) goto escape; 96 } 71 /* load region corresponding to selection above */ 72 if ((regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape; 73 if (!SetImageSelection (MEAS_XMOSAIC)) goto escape; 97 74 98 75 for (Nr = 0; Nr < Nregions; Nr++) { … … 177 154 vec[i][0].Nelements = N; 178 155 } 156 FreeImageSelection (); 179 157 return (TRUE); 180 158 … … 185 163 escape: 186 164 165 FreeImageSelection (); 187 166 if (regions != NULL) free (regions); 188 167 for (i = 0; i < NVEC; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.
