IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 20, 2005, 4:27:25 AM (21 years ago)
Author:
eugene
Message:

substantial cleanup of photometry extraction functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/calextract.c

    r3689 r4585  
    55int calextract (int argc, char **argv) {
    66 
     7  int i, j, m, N, Nr, Nregions, mode[2];
     8  int Nsec, NSTAR;
     9  char filename[256], catdir[256], *RegionName, *RegionList;
     10  double Radius, M1, M2, dM2, color;
     11
    712  Catalog catalog;
    8   Graphdata graphsky;
    913  RegionFile *regions;
    1014  PhotCode *code[2];
    1115  Vector **vec;
    12 
    13   int i, j, m, N, Nr, Nregions, mode[2];
    14   int RegionList, Ngraph, Nsec, NSTAR;
    15   char filename[256], catdir[256], RegionListFile[256];
    16   double Radius, M1, M2, dM2, color;
    1716
    1817  /* these need to be freed in the end */
     
    2120  catalog.secfilt = NULL;
    2221  catalog.measure = NULL;
     22  RegionName = NULL;
     23  RegionList = NULL;
    2324
    2425  /* load photcode information */
     
    2627  Nsec = GetPhotcodeNsecfilt ();
    2728
    28   /* load data about plot windows */
    29   Ngraph = 0;
    30   if (!GetGraphData (&graphsky, NULL, &Ngraph)) goto escape;
    31 
    3229  /* find CATDIR in config system */
    33   VarConfig ("CATDIR", "%s", catdir);
    34 
    35   /* specify catalog files */
    36   RegionList = FALSE;
    37   if (N = get_argument (argc, argv, "-list")) {
    38     RegionList = TRUE;
    39     remove_argument (N, &argc, argv);
    40     strcpy (RegionListFile, argv[N]);
    41     remove_argument (N, &argc, argv);
    42   }
     30  if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;
    4331
    4432  /* command line arguments */
    45   if (!SetPhotSelections (&argc, argv)) goto usage;
     33  SetSelectionParam (0);
     34  if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape;
     35  if (!SetPhotSelections (&argc, argv, 2)) goto usage;
     36
    4637  if (argc != 4) goto usage;
    4738  if (strcmp (argv[2], "-")) goto usage;
     
    6657  if ((vec[Nd2] = SelectVector ("cal:dm2",      ANYVECTOR, TRUE)) == NULL) goto escape;
    6758
    68   /* select region files */
    69   if (RegionList) {
    70     regions = region_list (RegionListFile, &Nregions);
    71   } else {
    72     Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
    73     regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions);
    74   }
     59  /* load region corresponding to selection above */
     60  if ((regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;
    7561
    7662  for (Nr = 0; Nr < Nregions; Nr++) {
     
    150136 escape:
    151137 
     138  if (RegionName != NULL) free (RegionName);
     139  if (RegionList != NULL) free (RegionList);
    152140  if (regions != NULL) free (regions); 
    153141  for (i = 0; i < NVEC; i++) {
Note: See TracChangeset for help on using the changeset viewer.