IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5448 for trunk/Ohana/src/opihi


Ignore:
Timestamp:
Oct 27, 2005, 10:38:30 AM (21 years ago)
Author:
eugene
Message:

implementing SkyRegions in all DVO programs

Location:
trunk/Ohana/src/opihi/dvo
Files:
14 edited

Legend:

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

    r5320 r5448  
    99# define MISSCALE 2
    1010
     11// XXX EAM : should this function be dropped?
    1112int catlog (int argc, char **argv) {
    1213 
  • trunk/Ohana/src/opihi/dvo/dmt.c

    r5320 r5448  
    44int dmt (int argc, char **argv) {
    55 
    6   int i, m, k, N, Nregions, Ngraph, SaveVectors;
     6  int i, m, k, N, Ngraph, SaveVectors;
    77  int Ns, Nsec, NPTS;
    88  char catdir[256], filename[256];
     
    1313  Catalog catalog;
    1414  Graphdata graphmode, graphsky;
    15   RegionFile *regions;
     15  SkyTable *sky;
     16  SkyList *skylist;
    1617  Vector Xvec, Yvec, Zvec, Rvec, Dvec;
    1718  Vector *vec1, *vec2, *vec3, *vec4, *vec5;
     
    5354  Ns = GetPhotcodeNsec (code[0].code);
    5455
     56  /* load sky from correct table */
     57  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
     58  SkyTableSetFilenames (sky, CATDIR, "cpt");
     59
    5560  Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
    56   regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions);
     61  skylist = SkyListByRadius (sky, -1, graphsky.coords.crval1, graphsky.coords.crval2, Radius);
    5762 
    5863  N = 0;
     
    6671  }
    6772
    68   for (k = 0; k < Nregions; k++) {
     73  for (k = 0; k < skylist[0].Nregions; k++) {
    6974
    70     sprintf (filename, "%s/%s", catdir, regions[k].name);
    7175    /* lock, load, unlock catalog */
    72     catalog.filename = filename;
     76    catalog.filename = skylist[0].regions[k][0].filename;
    7377    switch (lock_catalog (&catalog, LCK_SOFT)) {
    7478    case 2:
  • trunk/Ohana/src/opihi/dvo/extract.c

    r5320 r5448  
    11# include "dvo1.h"
     2// XXX EAM : this function is deprecated
    23
    34enum {ZERO, RA, DEC, MAG, dMAG, Xm, Xp, NMEAS, NMISS, REF, TYPE, NPHOT, NCODE, FLAG};
  • trunk/Ohana/src/opihi/dvo/gcat.c

    r3462 r5448  
    33int gcat (int argc, char **argv) {
    44 
    5   int i, Nregions;
    6   RegionFile *regions;
    7   char filename[128];
     5  int i;
    86  struct stat filestat;
    97  double Ra, Dec, Radius;
     8  SkyTable *sky;
     9  SkyList *skylist;
    1010  char catdir[256];
    1111
     
    1717  }
    1818
     19  /* load sky from correct table */
     20  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
     21  SkyTableSetFilenames (sky, CATDIR, "cpt");
     22
    1923  Ra = atof (argv[1]);
    2024  Dec = atof (argv[2]);
     
    2428    Radius = 0.0001;
    2529
    26   regions = find_regions (Ra, Dec, Radius, &Nregions);
     30  skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);
    2731
    28   for (i = 0; i < Nregions; i++) {
    29     sprintf (filename, "%s/%s", catdir, regions[i].name);
    30     if (stat (filename, &filestat) != -1) {
     32  for (i = 0; i < skylist[0].Nregions; i++) {
     33    if (stat (skylist[0].regions[i][0].filename, &filestat) != -1) {
    3134      fprintf (stderr, "%3d %s *\n", i, regions[i].name);
    3235    } else {
     
    3740
    3841  return (TRUE);
    39   free (regions);
    40 
     42  SkyListFree (regions);
    4143}
    42 
  • trunk/Ohana/src/opihi/dvo/gstar.c

    r5320 r5448  
    99  double Mcat, Mrel;
    1010  float *RA, *DEC;
    11   int i, j, k, m, N, *N1, Nregions, Nsec, NPTS;
     11  int i, j, k, m, N, *N1, Nsec, NPTS;
    1212  int Nstars, found, GetMeasures, Nlo, Nhi;
    1313  int SaveVectors;
    1414  Vector *vec1, *vec2, *vec3, *vec4;
    15   RegionFile *regions;
     15  SkyTable *sky;
     16  SkyList *skylist;
    1617  Catalog catalog;
    1718  PhotCode *code;
     
    5253  while (Ra > 360.0) Ra -= 360.0;
    5354 
    54   regions = find_regions (Ra, Dec, Radius, &Nregions);
    55 
    56   if (Nregions > 1) {
     55  /* load sky from correct table */
     56  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
     57  SkyTableSetFilenames (sky, CATDIR, "cpt");
     58  skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);
     59
     60  if (skylist[0].Nregions > 1) {
    5761    fprintf (stderr, "warning, radius overlaps region boundary, not yet implemented\n");
    5862  }
    5963
    60   /* set filename, read in header */
    61   sprintf (filename, "%s/%s", catdir, regions[0].name);
    6264  /* lock, load, unlock catalog */
    63   catalog.filename = filename;
     65  catalog.filename = skylist[0].regions[0][0].filename;
    6466  switch (lock_catalog (&catalog, LCK_SOFT)) {
    6567  case 2:
  • trunk/Ohana/src/opihi/dvo/imdata.c

    r5320 r5448  
    11# include "dvo1.h"
    2 void copy_region (GSCRegion *in, GSCRegion *out);
    32
    43int imdata (int argc, char **argv) {
     
    1312  Image *image;
    1413  Catalog catalog;
    15   GSCRegion *region, *tregion;
     14  SkyTable *sky;
     15  SkyList *skylist, *skyset;
    1616  Vector *vec;
    1717
     
    8080  GetTimeFormat (&TimeReference, &TimeFormat);
    8181
     82  /* load sky from correct table */
     83  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
     84  SkyTableSetFilenames (sky, CATDIR, "cpt");
     85
     86  Nregions = 0;
     87  NREGIONS = 10;
     88  ALLOCATE (skylist, SkyList, 1);
     89  ALLOCATE (skylist[0].regions, SkyRegions *, NREGIONS);
     90
    8291  /* for each image of interest, find the appropriate region files */
    83   Nregion = 0;
    84   ALLOCATE (region, GSCRegion, 1);
    8592  for (i = 0; i < Nsubset; i++) {
    8693    I = subset[i];
     94
    8795    if (!FindMosaicForImage (image, Nimage, I)) continue;
    88     tregion = get_regions (&image[I], &Ntregion);
    89     REALLOCATE (region, GSCRegion, MAX (1, Nregion + Ntregion));
    90     for (j = 0; j < Ntregion; j++) {
    91       skip = FALSE;
    92       for (k = 0; (k < Nregion) && !skip; k++) {
    93         if (!strcmp (region[k].filename, tregion[j].filename)) skip = TRUE;
    94       }
    95       if (!skip) {
    96         copy_region (&tregion[j], &region[Nregion]);
    97         Nregion ++;
    98       }
    99     }
    100     free (tregion);
     96    skyset = SkyListByImage (table, -1, &image[I]);
     97
     98    for (j = 0; j < skyset[0].Nregions; j++) {
     99      found = FALSE;
     100      for (k = 0; (k < skylist[0].Nregion) && !found; k++) {
     101        found = !strcmp (skylist[0].regions[k].name, skyset[0].regions[j].name);
     102      }
     103      if (found) continue;
     104      skylist[0].regions[Nregions] = skyset[0].regions[j];
     105      Nregions ++;
     106      CHECK_REALLOCATE (skylist[0].regions, SkyRegions *, NREGIONS, Nregions, 10);
     107    }
     108    SkyListFree (skyset);
    101109  }     
    102110  free (subset);
    103   for (i = 0; i < Nregion; i++) {
    104     fprintf (stderr, "try %s\n", region[i].filename);
     111  for (i = 0; i < skylist[0].Nregions; i++) {
     112    fprintf (stderr, "try %s\n", skylist[0].regions[i][0].name);
    105113  }
    106114 
     
    111119
    112120  /* for each region file, extract the data of interest in the right time range */
    113   for (j = 0; j < Nregion; j++) {
     121  for (j = 0; j < skylist[0].Nregions; j++) {
    114122
    115123    /* get file name and open */
    116     strcpy (filename, region[j].filename);
    117     catalog.filename = filename;
     124    catalog.filename = skylist[0].regions[j][0].filename;
    118125    switch (lock_catalog (&catalog, LCK_SOFT)) {
    119126    case 2:
     
    210217  return (TRUE);
    211218}
    212 
    213 
    214 void copy_region (GSCRegion *in, GSCRegion *out) {
    215    
    216   out[0].RA[0]  = in[0].RA[0];
    217   out[0].RA[1]  = in[0].RA[1];
    218   out[0].DEC[0] = in[0].DEC[0];
    219   out[0].DEC[1] = in[0].DEC[1];
    220   strcpy (out[0].filename, in[0].filename);
    221 }
    222 
  • trunk/Ohana/src/opihi/dvo/init.c

    r5442 r5448  
    5353  {"addxtra",     addxtra,      "add extra data to object"},
    5454  {"getxtra",     getxtra,      "get extra data from object"},
     55  {"catalog",     catlog,       "plot catalog stars"},
    5556*/
    5657
     
    6061  {"calextract",  calextract,   "extract photometry calibration"},
    6162  {"calmextract", calmextract,  "extract photometry calibration"},
    62   {"catalog",     catlog,       "plot catalog stars"},
    6363  {"ccd",         ccd,          "plot color-color diagram"},
    6464  {"cmatch",      cmatch,       "match two catalogs"},
     
    9191  {"lightcurve",  lightcurve,   "extract lightcurve for a star"},
    9292  {"mextract",    mextract,     "extract measure data values"},
    93   {"pcat",        pcat,         "plot catalog boundaries"},
     93  {"pcat",        skycat,       "plot catalog boundaries"},
    9494  {"photcodes",   photcodes,    "list photometry codes"},
    9595  {"pmeasure",    pmeasure,     "plot individual measurements"},
  • trunk/Ohana/src/opihi/dvo/lcat.c

    r4689 r5448  
    55  double Radius;
    66  int i, N, Nregions, ShowAll;
    7   RegionFile *regions;
    87  char filename[128], exists;
    98  struct stat filestat;
     
    1110  Graphdata graphmode;
    1211  int Ngraph;
     12  SkyTable *sky;
     13  SkyList *skylist;
    1314
    1415  Ngraph = 0;
     
    1617
    1718  VarConfig ("CATDIR", "%s", catdir);
     19
     20  /* load sky from correct table */
     21  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
     22  SkyTableSetFilenames (sky, CATDIR, "cpt");
    1823
    1924  ShowAll = FALSE;
     
    2833
    2934  Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax));
    30   regions = find_regions (graphmode.coords.crval1, graphmode.coords.crval2, Radius, &Nregions);
     35  skylist = SkyListByRadius (sky, -1, graphmode.coords.crval1, graphmode.coords.crval2, Radius);
    3136
    32   for (i = 0; i < Nregions; i++) {
    33     sprintf (filename, "%s/%s", catdir, regions[i].name);
     37  for (i = 0; i < skylist[0].Nregions; i++) {
    3438    exists = 'Y';
    35     if (stat (filename, &filestat) == -1) exists = 'N';
     39    if (stat (skylist[0].regions[i][0].filename, &filestat) == -1) exists = 'N';
    3640    if (ShowAll) {
    37       fprintf (stderr, "%3d %s  %c\n", i, regions[i].name, exists);
     41      fprintf (stderr, "%3d %s  %c\n", i, skylist[0].regions[i][0].name, exists);
    3842    } else {
    3943      if (exists == 'Y') {
    40         fprintf (stderr, "%3d %s\n", i, regions[i].name);
     44        fprintf (stderr, "%3d %s\n", i, skylist[0].regions[i][0].name);
    4145      }
    4246    }
     
    4448
    4549  return (TRUE);
    46 
    47   free (regions);
    48 
     50  SkyListFree (regions);
    4951}
    5052
  • trunk/Ohana/src/opihi/dvo/lcurve.c

    r5320 r5448  
    88  int Ngraph, Xgraph, TimeFormat;
    99  int Nstars, found, AutoLimits, ErrorBars, GalMag, AbsPhot, SaveVectors;
    10   int i, j, m, N, NPTS, *N1, Nregions;
     10  int i, j, m, N, NPTS, *N1;
    1111  time_t TimeReference;
    1212  struct tm *timeptr;
    13   RegionFile *regions;
    1413  Vector *xvec, *yvec;
    1514  Vector Xvec, Yvec, dYvec;
    1615  Catalog catalog;
    1716  Graphdata graphmode;
     17  SkyTable *sky;
     18  SkyList *skylist;
    1819
    1920  VarConfig ("CATDIR", "%s", catdir);
     
    6970  }
    7071 
     72  /* load sky from correct table */
     73  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
     74  SkyTableSetFilenames (sky, CATDIR, "cpt");
     75
    7176  Ra = atof (argv[1]);
    7277  Dec = atof (argv[2]);
    7378  Radius = atof (argv[3]);
    7479
    75   regions = find_regions (Ra, Dec, Radius, &Nregions);
    76 
    77   if (Nregions > 1) {
     80  skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);
     81
     82  if (skylist[0].Nregions > 1) {
    7883    fprintf (stderr, "warning, radius overlaps region boundary, not yet implemented\n");
    7984  }
    8085
    8186  /* set filename, read in header */
    82   sprintf (filename, "%s/%s", catdir, regions[0].name);
    83   catalog.filename = filename;
     87  catalog.filename = skylist[0].regions[0][0].filename;
    8488  switch (lock_catalog (&catalog, LCK_SOFT)) {
    8589  case 2:
     
    198202  if (catalog.measure != 0) free (catalog.measure);
    199203 
     204  SkyListFree (skylist);
    200205  return (TRUE);
    201 
    202206}
  • trunk/Ohana/src/opihi/dvo/lightcurve.c

    r5320 r5448  
    77  float *RA, *DEC;
    88  int Nstars, found, PhotCodeSelect;
    9   int i, j, k, m, N, NPTS, Nsec, RELPHOT, *N1, Nregions, TimeFormat;
     9  int i, j, k, m, N, NPTS, Nsec, RELPHOT, *N1, TimeFormat;
    1010  time_t TimeReference;
    11   RegionFile *regions;
    1211  Vector *tvec, *mvec, *dmvec;
    1312  Catalog catalog;
     
    5049  Radius = atof (argv[3]);
    5150
    52   regions = find_regions (Ra, Dec, Radius, &Nregions);
     51  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
     52  SkyTableSetFilenames (sky, CATDIR, "cpt");
     53  skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);
    5354
    54   if (Nregions > 1) {
     55  if (skylist[0].Nregions > 1) {
    5556    fprintf (stderr, "warning, radius overlaps region boundary, not yet implemented\n");
    5657  }
    5758
    5859  /* set filename, read in header */
    59   sprintf (filename, "%s/%s", catdir, regions[0].name);
    60   catalog.filename = filename;
     60  catalog.filename = skylist[0].regions[0][0].filename;
    6161  switch (lock_catalog (&catalog, LCK_SOFT)) {
    6262  case 2:
     
    148148  if (catalog.secfilt != 0) free (catalog.secfilt);
    149149 
     150  SkyListFree (skylist);
    150151  return (TRUE);
    151 
    152152}
  • trunk/Ohana/src/opihi/dvo/pcat.c

    r5442 r5448  
    22int RD_to_XYpic (double *x, double *y, double r, double d, Coords *coords, double Rmin, double Rmax, double Rmid, int *leftside);
    33
     4// XXX EAM : this function is deprecated (now points at skycat)
    45int pcat (int argc, char **argv) {
    56 
  • trunk/Ohana/src/opihi/dvo/pmeasure.c

    r5320 r5448  
    55  FILE *f;
    66  int i, j, k, m, N;
    7   int InRegion, Nregions, Ngraph;
     7  int Ngraph;
    88  char filename[128], catdir[256];
    99  double Mz, Mr, mag;
     
    1313  int PhotcodeClip;
    1414
     15  SkyTable *sky;
     16  SkyList *skylist;
    1517  Catalog catalog;
    16   RegionFile *regions;
    1718  Graphdata graphmode;
    1819  Vector Xvec, Yvec, Zvec;
     
    2324  if (VarConfig ("CATDIR", "%s", catdir) == NULL) return (FALSE);
    2425
    25   regions = (RegionFile *) NULL;
    2626  f = (FILE *) NULL;
    2727  Mz = 17.0;
     
    6868  }
    6969
    70   InRegion = FALSE;
    71   if ((N = get_argument (argc, argv, "-all"))) {
    72     remove_argument (N, &argc, argv);
    73     InRegion = TRUE;
    74   }
    75 
    76   if ((InRegion || (argc != 2)) && (!InRegion || (argc != 1))) {
    77     fprintf (stderr, "USAGE: catalog (filename / -all) [-m M M] [-n N N] [-g] [-a RA DEC MAG] \n");
     70  if (argc != 2) {
     71    fprintf (stderr, "USAGE: pmeasure (-all) [-m M M] [-p photcode] [-ID ID] [-flag value] [-x]\n");
    7872    return (FALSE);
    7973  }
    8074 
    81   if (InRegion) {
    82     Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax));
    83     regions = find_regions (graphmode.coords.crval1, graphmode.coords.crval2, Radius, &Nregions);
    84   } else {
    85     Nregions = 1;
    86   }
     75  Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax));
     76
     77  /* load sky from correct table */
     78  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
     79  SkyTableSetFilenames (sky, CATDIR, "cpt");
     80  skylist = SkyListByRadius (sky, -1, graphmode.coords.crval1, graphmode.coords.crval2, Radius);
    8781 
    88   for (j = 0; j < Nregions; j++) {
     82  for (j = 0; j < skylist[0].Nregions; j++) {
    8983    catalog.average = 0;
    9084   
    91     if (InRegion) {
    92       sprintf (filename, "%s/%s", catdir, regions[j].name);
    93     } else {
    94       sprintf (filename, "%s/%s", catdir, argv[1]);
    95     }
    96    
    9785    /* lock, load, unlock catalog */
    98     catalog.filename = filename;
     86    catalog.filename = skylist[0].regions[j][0].filename;
    9987    switch (lock_catalog (&catalog, LCK_SOFT)) {
    10088    case 2:
  • trunk/Ohana/src/opihi/dvo/region_list.c

    r4689 r5448  
    11# include "dvo1.h"
     2
     3/* XXX note : for RegionName or RegionList, we need to free the skylist
     4   elements, but not in the case of radius selection - this implies
     5   information carried back up */
    26
    37static int RegionSelect;
     
    4246}
    4347
    44 RegionFile *SelectRegions (char *RegionName, char *RegionList, int *nregions) {
     48SkyList *SelectRegions (char *RegionName, char *RegionList) {
    4549
    4650  double Radius;
    4751  int Ngraph;
    4852  Graphdata graphsky;
    49   RegionFile *regions;
     53  SkyTable *sky;
     54  SkyList *skylist;
    5055
    5156  /* determine region-file names */
    5257  if (RegionName != NULL) {
    53     *nregions = 1;
    54     ALLOCATE (regions, RegionFile, 1);
    55     strcpy (regions[0].name, RegionName);
     58    ALLOCATE (skylist, SkyList, 1);
     59    ALLOCATE (skylist[0].regions[0], SkyRegion *, 1);
     60    ALLOCATE (skylist[0].regions[0][0], SkyRegion, 1);
     61    strcpy (skylist[0].regions[0][0].name, RegionName);
     62    sprintf (filename, "%s/%s.cpt", CATDIR, RegionName);
     63    skylist[0].regions[0][0].filename = strcreate (filename);
    5664    free (RegionName);
    5765    RegionName = NULL;
    58     return (regions);
     66    return (skylist);
    5967  }
    6068  if (RegionList != NULL) {
    61     regions = region_list (RegionList, nregions);
     69    skylist = SkyListLoadFile (RegionList);
    6270    free (RegionList);
    6371    RegionList = NULL;
    64     return (regions);
     72    return (skylist);
    6573  }
    6674
     
    7280
    7381  Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
    74   regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, nregions);
    75   return (regions);
     82
     83  /* load sky from correct table */
     84  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
     85  SkyTableSetFilenames (sky, CATDIR, "cpt");
     86  skylist = SkyListByRadius (sky, -1, graphmode.coords.crval1, graphmode.coords.crval2, Radius);
     87
     88  return (skylist);
    7689}
    7790
     91/* XXX EAM this should perhaps return a skytable? */
    7892/* returns a list of region files names from file */
    79 RegionFile *region_list (char *filename, int *Nregions) {
     93SkyList *SkyListFromFile (char *filename) {
    8094 
     95  FILE *f;
    8196  int NREGIONS, nregion;
    82   RegionFile *regions;
    83   FILE *f;
     97  SkyList *skylist;
     98
     99  ALLOCATE (skylist, SkyList, 1);
    84100
    85101  f = fopen (filename, "r");
    86102  if (f == NULL) {
    87103    fprintf (stderr, "ERROR: can't find region list file %s\n", filename);
    88     *Nregions = 0;
    89     return (NULL);
     104    skylist[0].Nregions = 0;
     105    skylist[0].regions = NULL;
     106    return (skylist);
    90107  }
    91108 
     109  Nregions = 0;
    92110  NREGIONS = 50;
    93   ALLOCATE (regions, RegionFile, NREGIONS);
    94   nregion = 0;
     111  ALLOCATE (skylist[0].regions, SkyRegion *, NREGIONS);
    95112
    96   while (fscanf (f, "%s", regions[nregion].name) != EOF) {
    97     nregion ++;
    98     if (nregion == NREGIONS) {
    99       NREGIONS += 50;
    100       REALLOCATE (regions, RegionFile, NREGIONS);
     113  while (fscanf (f, "%s", filename) != EOF) {
     114    ALLOCATE (skylist[0].regions[Nregions], SkyRegion, 1);
     115    strcpy (skylist[0].regions[Nregions][0].name, filename);
     116    sprintf (filename, "%s/%s.cpt", CATDIR, skylist[0].regions[Nregions][0].name);
     117    skylist[0].regions[Nregions][0].filename = strcreate (filename);
     118    Nregions ++;
     119    CHECK_REALLOCATE (skylist[0].regions, SkyRegion *, NREGIONS, Nregions, 50);
    101120    }
    102121  }
  • trunk/Ohana/src/opihi/dvo/subpix.c

    r5320 r5448  
    55int subpix (int argc, char **argv) {
    66 
    7   int i, j, I, Nlo, Nhi, Nentry, Nstars, Nregions, Nimage, Nmeasure;
     7  int i, j, I, Nlo, Nhi, Nentry, Nstars, Nimage, Nmeasure;
    88  int *index, *entry;
    99  int Nmin, Nsub, NSUB, status;
     
    1717  Measure *measure;
    1818  Image *image;
    19   RegionFile *regions;
    2019  Catalog catalog;
    2120
     
    3534  Radius = atof (argv[3]);
    3635
     36  /* load sky from correct table */
     37  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
     38  SkyTableSetFilenames (sky, CATDIR, "cpt");
     39
    3740  /* load star nearest position */
    38   regions = find_regions (Ra, Dec, Radius, &Nregions);
    39   if (Nregions > 1) {
     41  skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);
     42  if (skylist[0].Nregions > 1) {
    4043    fprintf (stderr, "warning, radius overlaps region boundary, not yet implemented\n");
    4144  }
    4245
    4346  /* lock, load, unlock catalog */
    44   sprintf (filename, "%s/%s", catdir, regions[0].name);
    45   catalog.filename = filename;
     47  catalog.filename = skylist[0].regions[0][0].filename;
    4648  switch (lock_catalog (&catalog, LCK_SOFT)) {
    4749  case 2:
     
    9294    if (catalog.average != 0) free (catalog.average);
    9395    if (catalog.measure != 0) free (catalog.measure);
    94     free (regions);
     96    SkyListFree (skylist);
    9597    return (TRUE);
    9698  }
     
    158160  free (image);
    159161  free (index);
    160   free (regions);
     162  SkyListFree (regions);
    161163
    162164  return (TRUE);
Note: See TracChangeset for help on using the changeset viewer.