Changeset 33255
- Timestamp:
- Feb 14, 2012, 6:43:19 AM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src/uniphot
- Files:
-
- 7 edited
-
Makefile (modified) (1 diff)
-
include/setphot.h (modified) (1 diff)
-
src/ImageSubset.c (modified) (3 diffs)
-
src/setphot_client.c (modified) (2 diffs)
-
src/update_catalog_setphot_client.c (modified) (1 diff)
-
src/update_dvo_setphot.c (modified) (3 diffs)
-
src/update_dvo_setphot_client.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/Makefile
r33241 r33255 63 63 SETPHOT_CLIENT = \ 64 64 $(SRC)/setphot_client.$(ARCH).o \ 65 $(SRC)/update_dvo_setphot.$(ARCH).o \ 66 $(SRC)/update_catalog_setphot.$(ARCH).o \ 65 67 $(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 69 69 70 70 $(SETPHOT_CLIENT): $(INC)/setphot.h -
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/include/setphot.h
r33241 r33255 43 43 ImageSubset *ImageSubsetLoad PROTO((char *filename, off_t *nimage)); 44 44 int ImageSubsetSave PROTO((char *filename, Image *image, off_t Nimage)); 45 Image *ImagesFromSubset PROTO((ImageSubset *subset, off_t N)); 45 46 46 47 void lock_image_db PROTO((FITS_DB *db, char *filename)); -
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/ImageSubset.c
r33242 r33255 1 1 # 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"); 2 6 3 7 ImageSubset *ImageSubsetLoad(char *filename, off_t *nimage) { 4 8 5 int i, Ncol , Ncol2;9 int i, Ncol; 6 10 off_t Nrow; 7 11 Header header; … … 47 51 char type[16]; 48 52 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); 68 58 69 59 // XXX free the fits table data here … … 165 155 return TRUE; 166 156 } 157 158 Image *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 12 12 int main (int argc, char **argv) { 13 13 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) 16 15 initialize_setphot_client (argc, argv); 17 16 18 17 // load the image subset table from the specified location 19 18 off_t Nimage; 20 ImageSubset *image = ImageSubsetLoad (IMAGES, &Nimage); 19 ImageSubset *subset = ImageSubsetLoad (IMAGES, &Nimage); 20 Image *image = ImagesFromSubset (subset, Nimage); 21 21 22 22 // load the flat-field correction table from CATDIR … … 25 25 FlatCorrectionTable *flatcorrTable = FlatCorrectionLoad (flatcorrFile, VERBOSE); 26 26 27 update_dvo_setphot _client(image, Nimage, flatcorrTable);27 update_dvo_setphot (image, Nimage, flatcorrTable); 28 28 29 29 exit (0); -
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_catalog_setphot_client.c
r33241 r33255 1 1 # include "setphot.h" 2 2 3 // XXX IF we pass in an array of Image not ImageSubset, this would be identical to update_catalog_setphot 3 4 void update_catalog_setphot_client (Catalog *catalog, ImageSubset *image, off_t *index, off_t Nimage, FlatCorrectionTable *flatcorr) { 4 5 -
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_dvo_setphot.c
r33241 r33255 15 15 16 16 # define PARALLEL 1 17 if (PARALLEL ) {17 if (PARALLEL && !HOST_ID) { 18 18 update_dvo_setphot_parallel (sky, image, Nimage); 19 19 exit (0); … … 26 26 } 27 27 ALLOCATE (index, off_t, maxID + 1); 28 for (i = 0; i < maxID + 1; i++) { 29 index[i] = -1; 30 } 28 31 for (i = 0; i < Nimage; i++) { 29 32 if (!image[i].imageID) continue; // images with ID == 0 are virtual … … 41 44 for (i = 0; i < skylist[0].Nregions; i++) { 42 45 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 43 52 // set up the basic catalog info 44 catalog.filename = skylist[0].filename[i];53 catalog.filename = HOST_ID ? localFilename : skylist[0].filename[i]; 45 54 catalog.catformat = DVO_FORMAT_UNDEF; // not needed since we skip empty catalogs 46 55 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 10 10 Catalog catalog; 11 11 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 12 23 13 24 // create an index for the image IDs … … 24 35 index[image[i].imageID] = i; 25 36 } 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");30 37 31 38 // determine the populated SkyRegions overlapping the requested area (default depth)
Note:
See TracChangeset
for help on using the changeset viewer.
