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

Location:
trunk/Ohana/src/addstar
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/doc/notes.txt

    r5445 r5448  
    2121  with .cpm, .cpn, .cps as needed.
    2222
    23  
     23  *** I need to fix the name method: common function to set it once
     24  in the dvo functions.  perhaps a pointer in the SkyRegion structure.
     25  This needs some 32/64 bit care, though.  use a long long (or other
     26  type guaranteed to be 64 bit), and case to the appropriate type (size_t)
     27  when it is used?  also needs to be freed.
    2428
    2529todo:
  • trunk/Ohana/src/addstar/src/SkyRegionUtils.c

    r5445 r5448  
    1515  /* match the basename against the GSCRegion file names */
    1616  for (i = 0; i < input[0].Nregions; i++) {
    17     sprintf (filename, "%s/%s.cpt", path, input[0].regions[i][0].name);
    18     status = stat (filename, &filestats);
     17    status = stat (input[0].regions[i][0].filename, &filestats);
    1918    if ((status == -1) && (errno == ENOENT)) continue;
    2019    /* give an error for other conditions? */
    … …  
    2625  }
    2726  return (subset);
    28 }
    29 
    30 int SkyListSetPath (SkyList *list, char *path) {
    31 
    32   int i;
    33   char line[256];
    34 
    35   for (i = 0; i < list[0].Nregions; i++) {
    36     fprintf (stderr, "region: %s\n", list[0].regions[i][0].name);
    37     sprintf (line, "%s/%s", path, list[0].regions[i][0].name);
    38     fprintf (stderr, "line: %s\n", line);
    39     strcpy (list[0].regions[i][0].name, line);
    40     fprintf (stderr, "catalog: %s\n", list[0].regions[i][0].name);
    41   }
    42 
    43   return (TRUE);
    4427}
    4528
    … …  
    5437}
    5538
    56 SkyTable *SkyTableLoadOptimal () {
    57 
    58   char filename[256];
    59   struct stat filestat;
    60   SkyTable *sky;
    61   int status;
    62 
    63   /* first option: CATDIR/SkyTable.fits */
    64   sprintf (filename, "%s/SkyTable.fits", CATDIR);
    65   check_permissions (filename);
    66 
    67   /* check for file existance */
    68   status = stat (filename, &filestat);
    69   if (status == 0) { /* file exists, are permissions OK? */
    70     sky = SkyTableLoad (filename, VERBOSE);
    71     if (sky == NULL) {
    72       fprintf (stderr, "error loading sky table\n");
    73       exit (1);
    74     }
    75     return (sky);
    76   }
    77 
    78   /* first option: SKY_TABLE */
    79   if (SKY_TABLE[0]) {
    80     status = stat (SKY_TABLE, &filestat);
    81     if (status == 0) { /* file exists, are permissions OK? */
    82       sky = SkyTableLoad (SKY_TABLE, VERBOSE);
    83       if (sky == NULL) {
    84         fprintf (stderr, "error loading sky table\n");
    85         exit (1);
    86       }
    87       SkyTableSetDepth (sky, SKY_DEPTH);
    88 
    89       /* write CATDIR copy */
    90       sprintf (filename, "%s/SkyTable.fits", CATDIR);
    91       check_permissions (filename);
    92       SkyTableSave (sky, filename);
    93       fits_convert_SkyRegion (sky[0].regions, sizeof (SkyTable), sky[0].Nregions);
    94       return (sky);
    95     }
    96   }
    97 
    98   sky = SkyTableFromGSC (GSCFILE, SKY_DEPTH, VERBOSE);
    99   if (sky == NULL) {
    100     fprintf (stderr, "error loading sky table\n");
    101     exit (1);
    102   }
    103 
    104   /* write CATDIR copy */
    105   sprintf (filename, "%s/SkyTable.fits", CATDIR);
    106   check_permissions (filename);
    107   SkyTableSave (sky, filename);
    108   fits_convert_SkyRegion (sky[0].regions, sizeof (SkyRegion), sky[0].Nregions);
    109 
    110   return (sky);
    111 }
  • trunk/Ohana/src/addstar/src/UpdateDatabase_Image.c

    r5445 r5448  
    4444
    4545  /* find correpsonding regions for image */
    46   skylist = SkyListByImage (ServerSky, -1, image, mosaic);
     46  RegisterMosaic (mosaic);
     47  skylist = SkyListByImage (ServerSky, -1, image);
    4748
    4849  /* reduce regions to existing subset, if necessary */
    49   SkyListSetPath (skylist, CATDIR);
    5050  if (options[0].only_match || options[0].existing_regions) {
    5151    SkyList *tmp;
  • trunk/Ohana/src/addstar/src/UpdateDatabase_Refcat.c

    r5445 r5448  
    66  Catalog catalog;
    77  Stars *stars, **subset;
    8   // SkyTable *sky;
    98  SkyList *skylist;
    10 
    11   /* this should be loaded by addstard on start -- keep static? */
    12   /* need to load the correct sky table (GSC default or local verison) */
    13   /* XXX EAM : check on memory usage */
    14   // sky = SkyTableFromGSC (GSCFILE, SKY_DEPTH, VERBOSE);
    159
    1610  if (options[0].update) {
    … …  
    4842
    4943  /* reduce regions to existing subset, if necessary */
    50   SkyListSetPath (skylist, CATDIR);
    5144  if (options[0].only_match || options[0].existing_regions) {
    5245    SkyList *tmp;
  • trunk/Ohana/src/addstar/src/addstar.c

    r5445 r5448  
    2323  options = args (argc, argv, options);
    2424
    25   sky = SkyTableLoadOptimal ();
     25  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);
     26  SkyTableSetFilenames (sky, CATDIR, "cpt");
    2627 
    2728  stars = NULL;
    … …  
    4445    stars = gstars (argv[1], &Nstars, options.photcode, &image);
    4546    if ((DUMP != NULL) && !strcmp (DUMP, "rawstars")) dump_rawstars (stars, Nstars);
    46     skylist = SkyListByImage (sky, -1, &image, MOSAIC);
     47    RegisterMosaic (MOSAIC);
     48    skylist = SkyListByImage (sky, -1, &image);
    4749    overlap = gimages (&db, &image, MOSAIC, &Noverlap);
    4850    break;
  • trunk/Ohana/src/addstar/src/addstard.c

    r5445 r5448  
    1111  args_server (argc, argv);
    1212
    13   /* store the sky table in a global? */
    14   ServerSky = SkyTableLoadOptimal ();
     13  /* store the sky table in a global for internal use */
     14  ServerSky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);
     15  SkyTableSetFilename (ServerSky, CATDIR, "cpt");
    1516
    1617  /* if we separate the incoming data from db update, spawn db thread here */
  • trunk/Ohana/src/addstar/src/get2mass.c

    r5443 r5448  
    5656
    5757  int Nregions, NREGIONS;
    58   char accelfile[1024], line[256], filename[128];
     58  char accelfile[1024], line[256], filename[128], datafile[256];
    5959  FILE *f;
    6060  double Rs, Re, Ds, De;
    … …  
    8383    if (Ds > patch[0].Dmax) continue;
    8484    if (De < patch[0].Dmin) continue;
    85     sprintf (regions[Nregions].name, "%s/%s", path, filename);
     85    sprintf (datafile, "%s/%s", path, filename);
     86    regions[Nregions].filename = strcreate (datafile);
    8687    regions[Nregions].Rmin = Rs;
    8788    regions[Nregions].Rmax = Re;
  • trunk/Ohana/src/addstar/src/get2mass_as.c

    r5443 r5448  
    5151  if (!FilterSkip) Shutdown ("invalid photcode %s", GetPhotcodeNamebyCode(photcode));
    5252
    53   filename = region[0].name;
     53  filename = region[0].filename;
    5454  gf = gzopen (filename, "rb");
    5555  if (gf == NULL) Shutdown ("can't read 2mass data file: %s", filename);
  • trunk/Ohana/src/addstar/src/get2mass_dr2.c

    r5443 r5448  
    2727  fprintf (stderr, "overlap: %f - %f, %f - %f\n", RA0, RA1, DEC0, DEC1);
    2828
    29   filename = region[0].name;
     29  filename = region[0].filename;
    3030  gf = gzopen (filename, "rb");
    3131  if (gf == NULL) Shutdown ("can't read 2mass data file: %s", filename);
  • trunk/Ohana/src/addstar/src/getgsc.c

    r5445 r5448  
    1818  /* load regions from GSC table, restrict to patch */
    1919  sky = SkyTableFromGSC (GSCFILE, 2, VERBOSE);
     20  SkyTableSetPath (sky, GSCDIR, "cpt");
    2021  skylist = SkyListByPatch (sky, -1, patch);
    21   SkyListSetPath (skylist, GSCDIR);
    2222 
    2323  Nstars = 0;
    … …  
    2525 
    2626  for (i = 0; i < skylist[0].Nregions; i++) {
    27     gsc = rd_gsc (skylist[0].regions[i][0].name, &Ngsc);
     27    gsc = rd_gsc (skylist[0].regions[i][0].filename, &Ngsc);
    2828
    2929    REALLOCATE (stars, Stars, MAX (1, Nstars + Ngsc));
    … …  
    3434  }
    3535 
     36  SkyTableFree (sky);
    3637  if (VERBOSE) fprintf (stderr, "%d stars from HST GSC\n", Nstars);
    3738  *NSTARS = Nstars;
  • trunk/Ohana/src/addstar/src/load_pt_catalog.c

    r5445 r5448  
    55  char filename[256];
    66
    7   sprintf (filename, "%s/%s.cpt", path, region[0].name);
     7  catalog[0].filename = region[0].filename;
    88
    9   check_permissions (filename);
    10   if (VERBOSE) fprintf (stderr, "adding to %s\n", filename);
    11 
    12   catalog[0].filename = strcreate (filename);
     9  check_permissions (catalog[0].filename);
     10  if (VERBOSE) fprintf (stderr, "adding to %s\n", catalog[0].filename);
    1311   
    1412  switch (lock_catalog (catalog, LCK_XCLD)) {
Note: See TracChangeset for help on using the changeset viewer.