IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33255


Ignore:
Timestamp:
Feb 14, 2012, 6:43:19 AM (14 years ago)
Author:
eugene
Message:

updated setphot_client code to use more setphot functions (update_dvo_setphot, update_catalog_setphot)

Location:
branches/eam_branches/ipp-20111122/Ohana/src/uniphot
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/uniphot/Makefile

    r33241 r33255  
    6363SETPHOT_CLIENT = \
    6464$(SRC)/setphot_client.$(ARCH).o     \
     65$(SRC)/update_dvo_setphot.$(ARCH).o \
     66$(SRC)/update_catalog_setphot.$(ARCH).o \
    6567$(SRC)/initialize_setphot_client.$(ARCH).o \
    66 $(SRC)/ImageSubset.$(ARCH).o        \
    67 $(SRC)/update_dvo_setphot_client.$(ARCH).o \
    68 $(SRC)/update_catalog_setphot_client.$(ARCH).o
     68$(SRC)/ImageSubset.$(ARCH).o
    6969
    7070$(SETPHOT_CLIENT): $(INC)/setphot.h
  • branches/eam_branches/ipp-20111122/Ohana/src/uniphot/include/setphot.h

    r33241 r33255  
    4343ImageSubset  *ImageSubsetLoad     PROTO((char *filename, off_t *nimage));
    4444int           ImageSubsetSave     PROTO((char *filename, Image *image, off_t Nimage));
     45Image        *ImagesFromSubset    PROTO((ImageSubset *subset, off_t N));
    4546
    4647void          lock_image_db       PROTO((FITS_DB *db, char *filename));
  • branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/ImageSubset.c

    r33242 r33255  
    11# include "setphot.h"
     2
     3# define GET_COLUMN(OUT,NAME,TYPE) \
     4  TYPE *OUT = gfits_get_bintable_column_data (&theader, &ftable, NAME, type, &Nrow, &Ncol); \
     5  myAssert (!strcmp(type, #TYPE), "wrong column type");
    26
    37ImageSubset *ImageSubsetLoad(char *filename, off_t *nimage) {
    48
    5   int i, Ncol, Ncol2;
     9  int i, Ncol;
    610  off_t Nrow;
    711  Header header;
     
    4751  char type[16];
    4852
    49   // need to create and assign to flat-field correction
    50   float *Mcal = gfits_get_bintable_column_data (&theader, &ftable, "MCAL", type, &Nrow, &Ncol);
    51   myAssert (!strcmp(type, "float"), "wrong column type");
    52 
    53   float *dMcal = gfits_get_bintable_column_data (&theader, &ftable, "MCAL_ERR", type, &Nrow, &Ncol2);
    54   myAssert (!strcmp(type, "float"), "wrong column type");
    55   myAssert (Ncol == Ncol2, "table length mismatch");
    56 
    57   unsigned int *imageID = gfits_get_bintable_column_data (&theader, &ftable, "IMAGE_ID", type, &Nrow, &Ncol2);
    58   myAssert (!strcmp(type, "int"), "wrong column type");
    59   myAssert (Ncol == Ncol2, "table length mismatch");
    60 
    61   unsigned int *map = gfits_get_bintable_column_data (&theader, &ftable, "PHOTOM_MAP", type, &Nrow, &Ncol2);
    62   myAssert (!strcmp(type, "int"), "wrong column type");
    63   myAssert (Ncol == Ncol2, "table length mismatch");
    64 
    65   unsigned int *flags = gfits_get_bintable_column_data (&theader, &ftable, "FLAGS", type, &Nrow, &Ncol2);
    66   myAssert (!strcmp(type, "int"), "wrong column type");
    67   myAssert (Ncol == Ncol2, "table length mismatch");
     53  GET_COLUMN (Mcal,    "MCAL",       float);
     54  GET_COLUMN (dMcal,   "MCAL_ERR",   float);
     55  GET_COLUMN (imageID, "IMAGE_ID",   int);
     56  GET_COLUMN (map,     "PHOTOM_MAP", int);
     57  GET_COLUMN (flags,   "FLAGS",      int);
    6858
    6959  // XXX free the fits table data here
     
    165155  return TRUE;
    166156}
     157
     158Image *ImagesFromSubset (ImageSubset *subset, off_t N) {
     159
     160  off_t i;
     161
     162  // we have been given an ImageSubset array, containing a reduced set of image fields
     163  // create full a Image array and save the needed values
     164  Image *image = NULL;
     165  ALLOCATE (image, Image, N);
     166  for (i = 0; i < N; i++) {
     167    image[i].imageID       = subset[i].imageID      ;
     168    image[i].photom_map_id = subset[i].photom_map_id;
     169    image[i].flags         = subset[i].flags        ;
     170    image[i].Mcal          = subset[i].Mcal         ;
     171    image[i].dMcal         = subset[i].dMcal        ;
     172  }
     173  return image;
     174}
     175
  • branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/setphot_client.c

    r33244 r33255  
    1212int main (int argc, char **argv) {
    1313
    14   /* get configuration info, args, lockfile (set CATDIR, HOSTDIR, HOSTNAME, IMAGES) */
    15   /* XXX pass in both HOSTDIR and HOSTID or just HOSTNAME (and read the host table)? */
     14  // get configuration info, args, lockfile (set CATDIR, HOST_ID, HOSTDIR, IMAGES)
    1615  initialize_setphot_client (argc, argv);
    1716
    1817  // load the image subset table from the specified location
    1918  off_t Nimage;
    20   ImageSubset *image = ImageSubsetLoad (IMAGES, &Nimage);
     19  ImageSubset *subset = ImageSubsetLoad (IMAGES, &Nimage);
     20  Image *image = ImagesFromSubset (subset, Nimage);
    2121
    2222  // load the flat-field correction table from CATDIR
     
    2525  FlatCorrectionTable *flatcorrTable = FlatCorrectionLoad (flatcorrFile, VERBOSE);
    2626
    27   update_dvo_setphot_client (image, Nimage, flatcorrTable);
     27  update_dvo_setphot (image, Nimage, flatcorrTable);
    2828
    2929  exit (0);
  • branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_catalog_setphot_client.c

    r33241 r33255  
    11# include "setphot.h"
    22
     3// XXX IF we pass in an array of Image not ImageSubset, this would be identical to update_catalog_setphot
    34void update_catalog_setphot_client (Catalog *catalog, ImageSubset *image, off_t *index, off_t Nimage, FlatCorrectionTable *flatcorr) {
    45
  • branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_dvo_setphot.c

    r33241 r33255  
    1515 
    1616# define PARALLEL 1
    17   if (PARALLEL) {
     17  if (PARALLEL && !HOST_ID) {
    1818    update_dvo_setphot_parallel (sky, image, Nimage);
    1919    exit (0);
     
    2626  }
    2727  ALLOCATE (index, off_t, maxID + 1);
     28  for (i = 0; i < maxID + 1; i++) {
     29    index[i] = -1;
     30  }
    2831  for (i = 0; i < Nimage; i++) {
    2932    if (!image[i].imageID) continue; // images with ID == 0 are virtual
     
    4144  for (i = 0; i < skylist[0].Nregions; i++) {
    4245
     46    if (HOST_ID && (HOST_ID != skylist->regions[i]->hostID)) continue;
     47    if (HOST_ID && !(skylist->regions[i]->hostFlags & DATA_ON_TGT)) continue;
     48
     49    char localFilename[1024];
     50    snprintf (localFilename, 1024, "%s/%s.cpt", HOSTDIR, skylist->regions[i]->name);
     51
    4352    // set up the basic catalog info
    44     catalog.filename  = skylist[0].filename[i];
     53    catalog.filename  = HOST_ID ? localFilename : skylist[0].filename[i];
    4554    catalog.catformat = DVO_FORMAT_UNDEF; // not needed since we skip empty catalogs
    4655    catalog.catmode   = DVO_MODE_UNDEF;   // not needed since we skip empty catalogs
  • branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_dvo_setphot_client.c

    r33242 r33255  
    1010  Catalog catalog;
    1111  off_t i, maxID, *index;
     12
     13  // load the current sky table (layout of all SkyRegions)
     14  sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, -1, VERBOSE);
     15  SkyTableSetFilenames (sky, CATDIR, "cpt");
     16
     17# if (0)
     18  if (PARALLEL) {
     19    update_dvo_setphot_parallel (sky, image, Nimage);
     20    exit (0);
     21  }
     22# endif
    1223
    1324  // create an index for the image IDs
     
    2435    index[image[i].imageID] = i;
    2536  }
    26 
    27   // load the current sky table (layout of all SkyRegions)
    28   sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, -1, VERBOSE);
    29   SkyTableSetFilenames (sky, CATDIR, "cpt");
    3037
    3138  // determine the populated SkyRegions overlapping the requested area (default depth)
Note: See TracChangeset for help on using the changeset viewer.