IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 27, 2005, 7:10:17 PM (21 years ago)
Author:
eugene
Message:

working on SkyRegion conversion

File:
1 edited

Legend:

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

    r5320 r5451  
    33int dmags (int argc, char **argv) {
    44 
    5   char filename[256], catdir[256], *RegionName, *RegionList;
     5  char *RegionName, *RegionList;
    66  double *M1, *M3;
    77  int i, j, m, i1, i3, N1, N3, N;
    88  int Npts, NPTS, mode[3];
    9   int Nsec, Nregions, KeepNulls;
     9  int Nsec, KeepNulls;
    1010
    1111  PhotCode *code[3];
    1212  Catalog catalog;
    13   RegionFile *regions;
     13  SkyList *skylist;
    1414  Vector *xvec, *yvec;
    1515
    1616  /* defaults */
    17   regions = NULL;
    1817  catalog.average = NULL;
    1918  catalog.secfilt = NULL;
     
    2524  if (!InitPhotcodes ()) goto escape;
    2625  Nsec = GetPhotcodeNsecfilt ();
    27 
    28   /* find CATDIR in config system */
    29   if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;
    3026
    3127  /* interpret command-line options */
     
    4945
    5046  /* load region corresponding to selection above */
    51   if ((regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;
     47  if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape;
    5248
    5349  /* init vectors to save data */
     
    5854
    5955  /* loop over regions, extract data for each region */
    60   for (j = 0; j < Nregions; j++) {
     56  for (j = 0; j < skylist[0].Nregions; j++) {
    6157    /* lock, load, unlock catalog */
    62     sprintf (filename, "%s/%s", catdir, regions[j].name);
    63     catalog.filename = filename;
     58    catalog.filename = (char *) skylist[0].regions[j][0].filename;
    6459    switch (lock_catalog (&catalog, LCK_SOFT)) {
    6560      case 2:
     
    119114    catalog.measure = (Measure *) NULL;
    120115  }
    121   if (regions != NULL) free (regions);
     116
     117  /* need to free SkyList / or free all regions as well */
     118  SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL)));
    122119  xvec[0].Nelements = yvec[0].Nelements = Npts;
    123120  return (TRUE);
     
    132129
    133130escape:
    134   if (regions != NULL) free (regions);
     131  SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL)));
    135132  if (catalog.average != NULL) free (catalog.average);
    136133  if (catalog.secfilt != NULL) free (catalog.secfilt);
Note: See TracChangeset for help on using the changeset viewer.