Changeset 4585 for trunk/Ohana/src/opihi/dvo/cmd.c
- Timestamp:
- Jul 20, 2005, 4:27:25 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/cmd.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/cmd.c
r4470 r4585 3 3 int cmd (int argc, char **argv) { /* really need to think about upper limits & how to represent them */ 4 4 5 char filename[256], catdir[256], *RegionName, *RegionList; 6 double Radius, *M1, *M3; 7 int i, j, m, i1, i3, N1, N3, N; 8 int Npts, NPTS, mode[3]; 9 int Ngraph, Nsec, Nregions; 10 5 11 Catalog catalog; 6 12 Graphdata graphsky; … … 9 15 Vector *xvec, *yvec; 10 16 11 char filename[256], catdir[256], *CPTfile;12 double Radius, *M1, *M3;13 int i, j, m, i1, i3, N1, N3, N;14 int Npts, NPTS, mode[3];15 int Ngraph, Nsec, Nregions;16 17 17 /* defaults */ 18 18 regions = NULL; … … 20 20 catalog.secfilt = NULL; 21 21 catalog.measure = NULL; 22 RegionName = NULL; 23 RegionList = NULL; 22 24 23 25 /* load photcode information */ … … 25 27 Nsec = GetPhotcodeNsecfilt (); 26 28 27 /* load data about plot windows */28 Ngraph = 0;29 if (!GetGraphData (&graphsky, NULL, &Ngraph)) return (FALSE);30 31 29 /* find CATDIR in config system */ 32 VarConfig ("CATDIR", "%s", catdir); 33 34 /* check for CPT selection */ 35 CPTfile = NULL; 36 if (N = get_argument (argc, argv, "-cpt")) { 37 remove_argument (N, &argc, argv); 38 CPTfile = strcreate (argv[N]); 39 remove_argument (N, &argc, argv); 40 } 30 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape; 41 31 42 32 /* interpret command-line options */ 43 if (!SetPhotSelections (&argc, argv)) goto usage; 33 if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape; 34 if (!SetPhotSelections (&argc, argv, 3)) goto usage; 35 36 /* interpret command-line options */ 44 37 if (argc != 6) { goto usage; } 45 38 if (strcmp (argv[2], "-")) goto usage; 46 39 if (strcmp (argv[4], ":")) goto usage; 47 48 /* interpret command-line options */49 40 if (!GetPhotcodeInfo (argv[1], &code[0], &mode[0])) return (FALSE); 50 41 if (!GetPhotcodeInfo (argv[3], &code[1], &mode[1])) return (FALSE); 51 42 if (!GetPhotcodeInfo (argv[5], &code[2], &mode[2])) return (FALSE); 43 if (!TestPhotSelections (&code[0], MEAS_ZERO)) goto escape; 52 44 53 /* determine region-file names */ 54 if (CPTfile == NULL) { 55 float Radius; 56 Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax)); 57 regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions); 58 } else { 59 Nregions = 1; 60 ALLOCATE (regions, RegionFile, 1); 61 strcpy (regions[0].name, CPTfile); 62 } 45 /* load region corresponding to selection above */ 46 if ((regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape; 63 47 64 48 /* init vectors to save data */ … … 90 74 m = catalog.average[i].offset; 91 75 76 SetSelectionParam (0); 92 77 M1 = ExtractDMag (code, mode, &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N1); 93 78 if (N1 == 0) goto skip; 94 79 80 SetSelectionParam (2); 95 81 M3 = ExtractMagnitudes (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N3); 96 82 if (N3 == 0) goto skip; … … 101 87 yvec[0].elements[Npts] = M3[i3]; 102 88 Npts++; 103 if (Npts == NPTS) {89 if (Npts >= NPTS) { 104 90 NPTS += 2000; 105 91 REALLOCATE (xvec[0].elements, float, NPTS); … … 132 118 if (catalog.secfilt != NULL) free (catalog.secfilt); 133 119 if (catalog.measure != NULL) free (catalog.measure); 120 if (RegionName != NULL) free (RegionName); 121 if (RegionList != NULL) free (RegionList); 134 122 return (FALSE); 135 123 }
Note:
See TracChangeset
for help on using the changeset viewer.
