IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

implementing SkyRegions in all DVO programs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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:
Note: See TracChangeset for help on using the changeset viewer.