Changeset 4585 for trunk/Ohana/src/opihi/dvo/ccd.c
- Timestamp:
- Jul 20, 2005, 4:27:25 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/ccd.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/ccd.c
r4470 r4585 3 3 int ccd (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], *CPTfile; 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, N; 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; 22 RegionName = NULL; 23 RegionList = NULL; 23 24 24 25 /* load photcode information */ … … 26 27 Nsec = GetPhotcodeNsecfilt (); 27 28 28 /* load data about plot windows */29 Ngraph = 0;30 if (!GetGraphData (&graphsky, NULL, &Ngraph)) return (FALSE);31 32 29 /* find CATDIR in config system */ 33 VarConfig ("CATDIR", "%s", catdir); 34 35 /* check for CPT selection */ 36 CPTfile = NULL; 37 if (N = get_argument (argc, argv, "-cpt")) { 38 remove_argument (N, &argc, argv); 39 CPTfile = strcreate (argv[N]); 40 remove_argument (N, &argc, argv); 41 } 30 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape; 42 31 43 32 /* interpret command-line options */ 44 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 */ 45 37 if (argc != 8) goto usage; 46 38 if (strcmp (argv[2], "-")) goto usage; 47 39 if (strcmp (argv[4], ":")) goto usage; 48 40 if (strcmp (argv[6], "-")) goto usage; 49 50 /* interpret command-line options */51 41 if (!GetPhotcodeInfo (argv[1], &code[0], &mode[0])) return (FALSE); 52 42 if (!GetPhotcodeInfo (argv[3], &code[1], &mode[1])) return (FALSE); 53 43 if (!GetPhotcodeInfo (argv[5], &code[2], &mode[2])) return (FALSE); 54 44 if (!GetPhotcodeInfo (argv[7], &code[3], &mode[3])) return (FALSE); 55 if ( (mode[2] == MAG_AVE) || (mode[2] == MAG_REF)) UseAverages = TRUE;45 if (!TestPhotSelections (&code[0], MEAS_ZERO)) goto escape; 56 46 57 /* determine region-file names */ 58 if (CPTfile == NULL) { 59 float Radius; 60 Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax)); 61 regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions); 62 } else { 63 Nregions = 1; 64 ALLOCATE (regions, RegionFile, 1); 65 strcpy (regions[0].name, CPTfile); 66 } 47 /* load region corresponding to selection above */ 48 if ((regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape; 67 49 68 50 /* init vectors to save data */ … … 94 76 m = catalog.average[i].offset; 95 77 78 SetSelectionParam (0); 96 79 M1 = ExtractDMag (&code[0], &mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N1); 97 80 if (N1 == 0) goto skip; 98 81 82 SetSelectionParam (2); 99 83 M2 = ExtractDMag (&code[2], &mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N2); 100 84 if (N2 == 0) goto skip; … … 105 89 yvec[0].elements[Npts] = M2[i2]; 106 90 Npts++; 107 if (Npts == NPTS) {91 if (Npts >= NPTS) { 108 92 NPTS += 2000; 109 93 REALLOCATE (xvec[0].elements, float, NPTS); … … 128 112 129 113 usage: 130 fprintf (stderr, "USAGE: ccd F - F : measure.param\n");114 fprintf (stderr, "USAGE: ccd F - F : F - F\n"); 131 115 return (FALSE); 132 116 … … 136 120 if (catalog.secfilt != NULL) free (catalog.secfilt); 137 121 if (catalog.measure != NULL) free (catalog.measure); 122 if (RegionName != NULL) free (RegionName); 123 if (RegionList != NULL) free (RegionList); 138 124 return (FALSE); 139 125 }
Note:
See TracChangeset
for help on using the changeset viewer.
