Changeset 4585 for trunk/Ohana/src/opihi/dvo/ddmags.c
- Timestamp:
- Jul 20, 2005, 4:27:25 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/ddmags.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/ddmags.c
r3689 r4585 3 3 int ddmags (int argc, char **argv) { 4 4 5 Catalog catalog; 6 Graphdata graphsky; 7 RegionFile *regions; 8 PhotCode *code[4]; 9 Vector *xvec, *yvec; 10 11 char filename[256], catdir[256]; 5 char filename[256], catdir[256], *RegionName, *RegionList; 12 6 double Radius; 13 7 double *M1, *M2; 14 8 int i, m, k, Npts, NPTS; 15 9 int N1, N2, i1, i2, mode[4]; 16 int Ngraph, Nsec, Nregions, UseAverages; 10 int Ngraph, Nsec, Nregions; 11 12 Catalog catalog; 13 RegionFile *regions; 14 PhotCode *code[4]; 15 Vector *xvec, *yvec; 17 16 18 17 /* defaults */ … … 21 20 catalog.secfilt = NULL; 22 21 catalog.measure = NULL; 23 24 /* find CATDIR in config system */ 25 VarConfig ("CATDIR", "%s", catdir); 22 RegionName = NULL; 23 RegionList = NULL; 26 24 27 25 /* load photcode information */ … … 29 27 Nsec = GetPhotcodeNsecfilt (); 30 28 31 /* load data about plot windows */ 32 Ngraph = 0; 33 if (!GetGraphData (&graphsky, NULL, &Ngraph)) return (FALSE); 34 35 /* find catalog files which overlap this region */ 36 Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax)); 37 regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions); 29 /* find CATDIR in config system */ 30 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape; 38 31 39 32 /* interpret command-line options */ 40 if (!SetPhotSelections (&argc, argv)) goto usage; 33 if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape; 34 if (!SetPhotSelections (&argc, argv, 4)) goto usage; 35 36 /* interpret command-line options */ 41 37 if (argc != 8) goto usage; 42 38 if (strcmp (argv[2], "-")) goto usage; 43 39 if (strcmp (argv[4], ":")) goto usage; 44 40 if (strcmp (argv[6], "-")) goto usage; 45 46 /* interpret command-line options */47 41 if (!GetPhotcodeInfo (argv[1], &code[0], &mode[0])) return (FALSE); 48 42 if (!GetPhotcodeInfo (argv[3], &code[1], &mode[1])) return (FALSE); 49 43 if (!GetPhotcodeInfo (argv[5], &code[2], &mode[2])) return (FALSE); 50 44 if (!GetPhotcodeInfo (argv[7], &code[3], &mode[3])) return (FALSE); 51 if ((mode[2] == MAG_AVE) || (mode[2] == MAG_REF)) UseAverages = TRUE; 45 if (!TestPhotSelections (&code[0], MEAS_ZERO)) goto escape; 46 47 /* load region corresponding to selection above */ 48 if ((regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape; 52 49 53 50 /* init vectors to save data */ … … 79 76 m = catalog.average[i].offset; 80 77 78 SetSelectionParam (0); 81 79 M1 = ExtractDMag (&code[0], &mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N1); 82 80 if (N1 == 0) goto skip; 83 81 82 SetSelectionParam (2); 84 83 M2 = ExtractDMag (&code[2], &mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N2); 85 84 if (N2 == 0) goto skip; … … 90 89 yvec[0].elements[Npts] = M2[i2]; 91 90 Npts++; 92 if (Npts == NPTS) {91 if (Npts >= NPTS) { 93 92 NPTS += 2000; 94 93 REALLOCATE (xvec[0].elements, float, NPTS); … … 120 119 if (catalog.secfilt != NULL) free (catalog.secfilt); 121 120 if (catalog.measure != NULL) free (catalog.measure); 121 if (RegionName != NULL) free (RegionName); 122 if (RegionList != NULL) free (RegionList); 122 123 return (FALSE); 123 124 }
Note:
See TracChangeset
for help on using the changeset viewer.
