Changeset 12505
- Timestamp:
- Mar 19, 2007, 3:58:02 PM (19 years ago)
- Location:
- trunk/pswarp/src
- Files:
-
- 10 edited
-
Makefile.am (modified) (1 diff)
-
pswarp.c (modified) (1 diff)
-
pswarp.h (modified) (2 diffs)
-
pswarpArguments.c (modified) (1 diff)
-
pswarpCleanup.c (modified) (1 diff)
-
pswarpDataLoad.c (modified) (5 diffs)
-
pswarpDefine.c (modified) (2 diffs)
-
pswarpMapGrid.c (modified) (2 diffs)
-
pswarpParseCamera.c (modified) (3 diffs)
-
pswarpTransformReadout_Opt.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/Makefile.am
r11554 r12505 17 17 pswarpDataSave.c \ 18 18 pswarpDefine.c \ 19 pswarpDefineSkycell.c \ 19 20 pswarpErrorCodes.c \ 20 21 pswarpMapGrid.c \ -
trunk/pswarp/src/pswarp.c
r10952 r12505 14 14 15 15 psTimerStart ("complete"); 16 17 // model inits are needed in pmSourceIO 18 // models defined in psphot/src/models are not available in psastro 19 pmModelGroupInit (); 16 20 17 21 pmConfig *config = pswarpArguments (argc, argv); -
trunk/pswarp/src/pswarp.h
r10957 r12505 11 11 12 12 # include "pswarpErrorCodes.h" 13 # define PSWARP_RECIPE "PSWARP" // Name of the recipe to use 13 # define PSWARP_RECIPE "PSWARP" // Name of the recipe to use 14 # define PSASTRO_RECIPE "PSASTRO" // Name of the recipe to use 14 15 15 16 // a single pswarpMap converts coordinates from one image to a second image … … 47 48 pswarpMapGrid *pswarpMapGridFromImage (pmReadout *dest, pmReadout *src, int nXpix, int nYpix); 48 49 bool pswarpMapGridSetGrid (pswarpMapGrid *grid, int ix, int iy, int *gridX, int *gridY); 49 bool pswarpMapGridNextGrid (pswarpMapGrid *grid, int gridX, int gridY, int *nextX, int *nextY); 50 bool pswarpMapGridNextGrid_X (pswarpMapGrid *grid, int gridX, int *nextX); 51 bool pswarpMapGridNextGrid_Y (pswarpMapGrid *grid, int gridY, int *nextY); 50 52 double pswarpMapGridMaxError (pswarpMapGrid *grid); 51 53 bool pswarpMapApply (double *outX, double *outY, pswarpMap *map, double inX, double inY); 52 54 bool pswarpMapSetLocalModel (pswarpMap *map, pmReadout *dest, pmReadout *src, int ix, int iy); 55 56 bool pswarpDefineSkycell (pmFPAfile **outFile, pmConfig **outConfig, pmConfig *config, const char *filename, const char *argname); -
trunk/pswarp/src/pswarpArguments.c
r10954 r12505 23 23 psMetadata *options = pmConfigRecipeOptions (config, PSWARP_RECIPE); 24 24 25 // astrom : used to supply astrometric parameters 26 if ((N = psArgumentGet (argc, argv, "-astrom"))) { 27 psArgumentRemove (N, &argc, argv); 28 psMetadataAddStr (options, PS_LIST_TAIL, "ASTROM_SOURCE", PS_META_REPLACE, "", argv[N]); 29 psArgumentRemove (N, &argc, argv); 30 } 25 pmConfigFileSetsMD (config->arguments, config, "ASTROM", "-astrom", "-astromlist"); 31 26 32 27 // chip selection is used to limit chips to be processed 33 28 if ((N = psArgumentGet (argc, argv, "-chip"))) { 34 29 psArgumentRemove (N, &argc, argv); 35 psMetadataAddStr (config->arguments, PS_LIST_TAIL, "CHIP_SELECTIONS", PS_DATA_STRING, "", psStringCopy(argv[N]));30 psMetadataAddStr (config->arguments, PS_LIST_TAIL, "CHIP_SELECTIONS", PS_DATA_STRING, "", argv[N]); 36 31 psArgumentRemove (N, &argc, argv); 37 32 } 33 38 34 39 35 // drop the local view on the options (saved in config->arguments) -
trunk/pswarp/src/pswarpCleanup.c
r11280 r12505 7 7 psTimerStop (); 8 8 psMemCheckCorruption(stderr, true); 9 // XXX not used in pswarppmModelGroupCleanup ();9 pmModelGroupCleanup (); 10 10 psTimeFinalize (); 11 11 pmConceptsDone (); 12 12 pmConfigDone (); 13 //fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "pswarp");14 fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "pswarp");13 fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "pswarp"); 14 // fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "pswarp"); 15 15 16 16 return; -
trunk/pswarp/src/pswarpDataLoad.c
r10958 r12505 9 9 bool pswarpDataLoad (pmConfig *config) { 10 10 11 bool status; 11 12 pmChip *chip; 12 13 pmCell *cell; 13 14 pmReadout *readout; 14 15 pmFPAview *view; 16 17 // select the current recipe 18 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSASTRO_RECIPE); 19 if (!recipe) { 20 psError(PSWARP_ERR_CONFIG, false, "Can't find PSASTRO recipe needed for pixel scale!\n"); 21 return false; 22 } 23 24 // physical pixel scale in microns per pixel 25 double pixelScale = psMetadataLookupF32 (&status, recipe, "PSASTRO.PIXEL.SCALE"); 26 if (!status) { 27 psError(PS_ERR_IO, false, "Failed to lookup pixel scale"); 28 return false; 29 } 15 30 16 31 // select the input data sources … … 21 36 } 22 37 38 // use the external astrometry source if supplied 39 pmFPAfile *astrom = psMetadataLookupPtr (NULL, config->files, "PSWARP.ASTROM"); 40 if (!astrom) { 41 fprintf (stderr, "*** using header astrometry\n"); 42 astrom = input; 43 } 44 23 45 // select the output readout 24 46 view = pmFPAviewAlloc (0); … … 44 66 // XXX need to optionally load the astrometry datafile 45 67 bool bilevelAstrometry = false; 46 pmHDU *phu = pmFPAviewThisPHU (view, input->fpa);68 pmHDU *phu = pmFPAviewThisPHU (view, astrom->fpa); 47 69 if (phu) { 48 70 char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1"); … … 52 74 } 53 75 if (bilevelAstrometry) { 54 pmAstromReadBilevelMosaic (input->fpa, phu->header );76 pmAstromReadBilevelMosaic (input->fpa, phu->header, pixelScale); 55 77 } 56 78 … … 64 86 65 87 // read WCS data from the corresponding header 66 pmHDU *hdu = pmFPAviewThisHDU (view, input->fpa);88 pmHDU *hdu = pmFPAviewThisHDU (view, astrom->fpa); 67 89 if (bilevelAstrometry) { 68 90 pmAstromReadBilevelChip (chip, hdu->header); 69 91 } else { 70 // XXX get pixelScale from recipes. does it matter?71 float pixelScale = 13.5;72 92 pmAstromReadWCS (input->fpa, chip, hdu->header, pixelScale); 73 93 } -
trunk/pswarp/src/pswarpDefine.c
r11281 r12505 4 4 bool pswarpDefine (pmConfig *config) { 5 5 6 // select the current recipe 7 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSWARP_RECIPE); 6 bool status; 7 psMetadata *recipe = NULL; 8 9 // load the pixel scale from the PSASTRO recipe 10 recipe = psMetadataLookupPtr (NULL, config->recipes, PSASTRO_RECIPE); 11 if (!recipe) { 12 psError(PSWARP_ERR_CONFIG, false, "Can't find PSASTRO recipe needed for pixel scale!\n"); 13 return false; 14 } 15 // physical pixel scale in microns per pixel 16 double pixelScale = psMetadataLookupF32 (&status, recipe, "PSASTRO.PIXEL.SCALE"); 17 if (!status) { 18 psError(PS_ERR_IO, false, "Failed to lookup pixel scale"); 19 return false; 20 } 21 22 // load the PSWARP recipe 23 recipe = psMetadataLookupPtr (NULL, config->recipes, PSWARP_RECIPE); 8 24 if (!recipe) { 9 25 psError(PSWARP_ERR_CONFIG, true, "Can't find PSWARP recipe!\n"); … … 36 52 } 37 53 if (bilevelAstrometry) { 38 pmAstromReadBilevelMosaic (skycell->fpa, phu->header );54 pmAstromReadBilevelMosaic (skycell->fpa, phu->header, pixelScale); 39 55 pmAstromReadBilevelChip (chip, hdu->header); 40 56 } else { 41 // XXX get pixelScale from recipes. does it matter?42 float pixelScale = 13.5;43 57 pmAstromReadWCS (skycell->fpa, chip, hdu->header, pixelScale); 44 58 } -
trunk/pswarp/src/pswarpMapGrid.c
r10958 r12505 8 8 int j, nj; 9 9 10 // XXX I was trying to match the grids too closely 10 11 // split the difference of the remainder 11 int xMin = 0.5*(src->image->numCols % nXpix); 12 int yMin = 0.5*(src->image->numRows % nYpix); 13 14 int nXpts = src->image->numCols / nXpix; 15 if (src->image->numCols % nXpix == 0) nXpts ++; 16 int nYpts = src->image->numRows / nYpix; 17 if (src->image->numRows % nYpix == 0) nYpts ++; 12 // int xMin = 0.5*(src->image->numCols % nXpix); 13 // int yMin = 0.5*(src->image->numRows % nYpix); 14 int xMin = 0; 15 int yMin = 0; 16 17 int nXpts = src->image->numCols / nXpix + 1; 18 if (src->image->numCols % nXpix) nXpts ++; 19 int nYpts = src->image->numRows / nYpix + 1; 20 if (src->image->numRows % nYpix) nYpts ++; 18 21 19 22 pswarpMapGrid *grid = pswarpMapGridAlloc (nXpts, nYpts); … … 39 42 } 40 43 41 bool pswarpMapGridNextGrid (pswarpMapGrid *grid, int gridX, int gridY, int *nextX, int *nextY) {44 bool pswarpMapGridNextGrid_X (pswarpMapGrid *grid, int gridX, int *nextX) { 42 45 43 46 *nextX = gridX*grid->nXpix + grid->xMin + 0.5*grid->nXpix; 47 return true; 48 } 49 50 bool pswarpMapGridNextGrid_Y (pswarpMapGrid *grid, int gridY, int *nextY) { 51 44 52 *nextY = gridY*grid->nYpix + grid->yMin + 0.5*grid->nYpix; 45 53 return true; -
trunk/pswarp/src/pswarpParseCamera.c
r10954 r12505 4 4 5 5 bool status; 6 pmFPAfile *skycell = NULL; 7 pmConfig *skyConfig = NULL; 6 8 7 9 // the input image(s) are required arguments; they define the camera … … 13 15 } 14 16 17 // the input image(s) are required arguments; they define the camera 18 status = false; 19 pmFPAfileDefineFromArgs (&status, config, "PSWARP.ASTROM", "ASTROM"); 20 if (status) { 21 fprintf (stderr, "using supplied astrometry\n"); 22 } else { 23 fprintf (stderr, "using header astrometry\n"); 24 } 25 26 // the mask is not required - but must conform to input camera 27 if (!pmFPAfileBindFromArgs (NULL, input, config, "PSWARP.MASK", "MASK")) { 28 fprintf (stderr, "no mask supplied\n"); 29 } 30 31 if (!pmFPAfileBindFromArgs (NULL, input, config, "PSWARP.WEIGHT", "WEIGHT")) { 32 fprintf (stderr, "no weight supplied\n"); 33 } 34 15 35 // the input skycell is a required argument: it defines the output image 16 status = false;17 pmFPAfile *skycell = pmFPAfileDefineFromArgs (&status, config, "PSWARP.SKYCELL", "SKYCELL");18 if (!s kycell) {36 // XXX we may need a different skycell structure here 37 status = pswarpDefineSkycell (&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL"); 38 if (!status) { 19 39 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.SKYCELL"); 20 40 return false; 21 41 } 22 42 23 // the mask is not required; the skycell is a required argument: it defines the output image24 status = false;25 pmFPAfileDefineFromArgs (&status, config, "PSWARP.MASK", "MASK");26 if (!status) {27 // build the basic mask concept here28 }29 30 // the weight is not required; the skycell is a required argument: it defines the output image31 status = false;32 pmFPAfileDefineFromArgs (&status, config, "PSWARP.WEIGHT", "WEIGHT");33 if (!status) {34 // build the basic weight concept here35 }36 37 43 // these calls bind the I/O handle to the specified fpa 38 if (!pmFPAfileDefineOutput ( config, skycell->fpa, "PSWARP.OUTPUT")) {44 if (!pmFPAfileDefineOutput (skyConfig, skycell->fpa, "PSWARP.OUTPUT")) { 39 45 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT"); 40 46 return false; … … 55 61 } 56 62 psFree (chips); 63 psFree (skyConfig); 57 64 58 65 psTrace("pswarp", 1, "Done with pswarpParseCamera...\n"); -
trunk/pswarp/src/pswarpTransformReadout_Opt.c
r10958 r12505 5 5 6 6 int minX, minY, maxX, maxY; 7 int gridX , gridY, nextGridX, nextGridY;7 int gridXo, gridX, gridY, nextGridX, nextGridY; 8 8 pswarpMap *map = NULL; 9 9 … … 19 19 20 20 // we might want to do the rectangular regions outside of the selection independently 21 psImageInit (output->image, NAN);21 // psImageInit (output->image, NAN); 22 22 23 23 // find the output pixel range … … 31 31 32 32 pswarpMapGridSetGrid (grid, minX, minY, &gridX, &gridY); 33 pswarpMapGridNextGrid (grid, gridX, gridY, &nextGridX, &nextGridY);33 pswarpMapGridNextGrid_Y (grid, gridY, &nextGridY); 34 34 map = grid->maps[gridX][gridY]; 35 35 … … 38 38 if (y >= nextGridY) { 39 39 gridY ++; 40 pswarpMapGridNextGrid (grid, gridX, gridY, &nextGridX, &nextGridY);40 pswarpMapGridNextGrid_Y (grid, gridY, &nextGridY); 41 41 map = grid->maps[gridX][gridY]; 42 42 } 43 44 gridXo = gridX; 43 45 for (int x = minX; x < maxX; x++) { 44 46 if (x >= nextGridX) { 45 47 gridX ++; 46 pswarpMapGridNextGrid (grid, gridX, gridY, &nextGridX, &nextGridY);48 pswarpMapGridNextGrid_X (grid, gridX, &nextGridX); 47 49 map = grid->maps[gridX][gridY]; 48 50 } … … 60 62 outData[y][x] = (psF32)psImagePixelInterpolate(inImage, inPix->x, inPix->y, NULL, 1, NAN, PS_INTERPOLATE_BILINEAR); 61 63 } 64 gridX = gridXo; 65 pswarpMapGridNextGrid_X (grid, gridX, &nextGridX); 66 map = grid->maps[gridX][gridY]; 62 67 } 63 68
Note:
See TracChangeset
for help on using the changeset viewer.
