Changeset 10954
- Timestamp:
- Jan 7, 2007, 6:48:50 AM (19 years ago)
- Location:
- trunk/pswarp/src
- Files:
-
- 2 added
- 7 edited
-
Makefile.am (modified) (1 diff)
-
pswarp.h (modified) (2 diffs)
-
pswarpArguments.c (modified) (1 diff)
-
pswarpDataLoad.c (modified) (3 diffs)
-
pswarpDefine.c (modified) (1 diff)
-
pswarpMapGrid.c (added)
-
pswarpParseCamera.c (modified) (4 diffs)
-
pswarpTransformReadout.c (modified) (4 diffs)
-
pswarpTransformReadout_Opt.c (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/Makefile.am
r10946 r10954 19 19 pswarpErrorCodes.c \ 20 20 pswarpParseCamera.c \ 21 pswarpTransformReadout.c \ 21 22 pswarpVersion.c 22 23 -
trunk/pswarp/src/pswarp.h
r10952 r10954 13 13 # define PSWARP_RECIPE "PSWARP" // Name of the recipe to use 14 14 15 typedef struct { 16 double Xo, Xx, Xy; 17 double Yo, Yx, Yy; 18 } pswarpMap; 19 20 typedef struct { 21 pswarpMap **grid; 22 int Nx, Ny; 23 int nXpix, nYpix; 24 } pswarpMapGrid; 25 15 26 pmConfig *pswarpArguments (int argc, char **argv); 16 27 bool pswarpParseCamera (pmConfig *config); … … 19 30 bool pswarpDataSave (pmConfig *config); 20 31 void pswarpCleanup (pmConfig *config); 32 bool pswarpTransformReadout (pmReadout *output, pmReadout *input, pmConfig *config); 33 -
trunk/pswarp/src/pswarpArguments.c
r10832 r10954 50 50 pmConfigFileSetsMD (config->arguments, config, "WEIGHT", "-weight", "-weightlist"); 51 51 52 if (argc != 2) {52 if (argc != 3) { 53 53 psError(PSWARP_ERR_ARGUMENTS, true, "Incorrect arguments supplied"); 54 54 return NULL; 55 55 } 56 56 57 psArray *array; 58 57 59 // output position is fixed 58 60 psMetadataAddStr (config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "", argv[1]); 59 61 60 62 // skycell position is fixed 61 psMetadataAddStr (config->arguments, PS_LIST_TAIL, "SKYCELL", 0, "", argv[2]); 63 array = psArrayAlloc(1); 64 array->data[0] = psStringCopy (argv[2]); 65 status = psMetadataAddPtr (config->arguments, PS_LIST_TAIL, "SKYCELL", PS_DATA_ARRAY, "", array); 66 psFree (array); 62 67 63 68 psTrace("pswarp", 1, "Done with pswarpArguments...\n"); -
trunk/pswarp/src/pswarpDataLoad.c
r10952 r10954 32 32 33 33 // de-activate PSWARP.SKYCELL and PSWARP.OUTPUT 34 //34 pmFPAfileActivate (config->files, false, "PSWARP.SKYCELL"); 35 35 pmFPAfileActivate (config->files, false, "PSWARP.OUTPUT"); 36 pmFPAfileActivate (config->files, false, "PSWARP.SKYCELL");37 36 38 37 pmFPAview *view = pmFPAviewAlloc (0); 38 39 // find the FPA phu 40 // XXX wrap the test below into a function 41 // XXX need to read only the headers for the skycell 42 // XXX need to optionally load the astrometry datafile 43 bool bilevelAstrometry = false; 44 pmHDU *phu = pmFPAviewThisPHU (view, input->fpa); 45 if (phu) { 46 char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1"); 47 if (ctype) { 48 bilevelAstrometry = !strcmp (&ctype[4], "-DIS"); 49 } 50 } 51 if (bilevelAstrometry) { 52 pmAstromReadBilevelMosaic (input->fpa, phu->header); 53 } 39 54 40 55 // files associated with the science image … … 45 60 if (!chip->process || !chip->file_exists) { continue; } 46 61 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE); 62 63 // read WCS data from the corresponding header 64 pmHDU *hdu = pmFPAviewThisHDU (view, input->fpa); 65 if (bilevelAstrometry) { 66 pmAstromReadBilevelChip (chip, hdu->header); 67 } else { 68 // XXX get pixelScale from recipes. does it matter? 69 float pixelScale = 13.5; 70 pmAstromReadWCS (input->fpa, chip, hdu->header, pixelScale); 71 } 47 72 48 73 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { … … 56 81 if (! readout->data_exists) { continue; } 57 82 58 pswarp ConvertReadout (output, readout, config);83 pswarpTransformReadout (output, readout, config); 59 84 60 85 pmFPAfileIOChecks (config, view, PM_FPA_AFTER); -
trunk/pswarp/src/pswarpDefine.c
r10952 r10954 23 23 pmFPAfileRead (skycell, view, config); 24 24 25 // XXX this is not a sufficient test 26 view->chip = 0; 27 pmChip *chip = pmFPAviewThisChip (view, skycell->fpa); 28 pmHDU *phu = pmFPAviewThisPHU (view, skycell->fpa); 29 pmHDU *hdu = pmFPAviewThisHDU (view, skycell->fpa); 30 bool bilevelAstrometry = false; 31 if (phu) { 32 char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1"); 33 if (ctype) { 34 bilevelAstrometry = !strcmp (&ctype[4], "-DIS"); 35 } 36 } 37 if (bilevelAstrometry) { 38 pmAstromReadBilevelMosaic (skycell->fpa, phu->header); 39 pmAstromReadBilevelChip (chip, hdu->header); 40 } else { 41 // XXX get pixelScale from recipes. does it matter? 42 float pixelScale = 13.5; 43 pmAstromReadWCS (skycell->fpa, chip, hdu->header, pixelScale); 44 } 45 25 46 // construct the output fpa here 26 47 pmFPAfile *output = psMetadataLookupPtr (NULL, config->files, "PSWARP.OUTPUT"); -
trunk/pswarp/src/pswarpParseCamera.c
r10952 r10954 3 3 bool pswarpParseCamera (pmConfig *config) { 4 4 5 bool status = false;5 bool status; 6 6 7 7 // the input image(s) are required arguments; they define the camera 8 status = false; 8 9 pmFPAfile *input = pmFPAfileDefineFromArgs (&status, config, "PSWARP.INPUT", "INPUT"); 9 if (! status) {10 if (!input) { 10 11 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.INPUT"); 11 12 return false; … … 13 14 14 15 // the input skycell is a required argument: it defines the output image 16 status = false; 15 17 pmFPAfile *skycell = pmFPAfileDefineFromArgs (&status, config, "PSWARP.SKYCELL", "SKYCELL"); 16 if (!s tatus) {17 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP. INPUT");18 if (!skycell) { 19 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.SKYCELL"); 18 20 return false; 19 21 } 20 22 21 23 // the mask is not required; the skycell is a required argument: it defines the output image 24 status = false; 22 25 pmFPAfileDefineFromArgs (&status, config, "PSWARP.MASK", "MASK"); 23 26 if (!status) { … … 26 29 27 30 // the weight is not required; the skycell is a required argument: it defines the output image 31 status = false; 28 32 pmFPAfileDefineFromArgs (&status, config, "PSWARP.WEIGHT", "WEIGHT"); 29 33 if (!status) { … … 32 36 33 37 // these calls bind the I/O handle to the specified fpa 34 pmFPAfileDefineOutput (config, skycell->fpa, "PSWARP.OUTPUT"); 38 if (!pmFPAfileDefineOutput (config, skycell->fpa, "PSWARP.OUTPUT")) { 39 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT"); 40 return false; 41 } 35 42 36 43 // Chip selection: turn on only the chips specified -
trunk/pswarp/src/pswarpTransformReadout.c
r10952 r10954 8 8 9 9 // select the current recipe 10 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);10 // psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSWARP_RECIPE); 11 11 12 12 int outNx = output->image->numCols; … … 27 27 pmChip *chipOutput = cell->parent; 28 28 pmFPA *fpaOutput = chipOutput->parent; 29 30 psF32 **outData = output->image->data.F32; 31 psImage *inImage = input->image; 29 32 30 33 // Iterate over the output image pixels … … 48 51 49 52 // XXX get interpolation method from the recipe 50 outImage->data.F32[y][x] = (psF32)psImagePixelInterpolate(image, inPix->x, inPix->y, mask, 1, NAN, PS_INTERPOLATE_BILINEAR); 53 outData[y][x] = (psF32)psImagePixelInterpolate(inImage, inPix->x, inPix->y, NULL, 1, NAN, PS_INTERPOLATE_BILINEAR); 54 // modify zero and scale? 51 55 56 // outData[y][x] = (psF32)psImagePixelInterpolate(inImage, inPix->x, inPix->y, mask, 1, NAN, PS_INTERPOLATE_BILINEAR); 57 52 58 # if (0) 53 59 if (error) { … … 58 64 mask, 1, NAN); 59 65 } 60 # endif61 62 outImage->data.F32[y][x] = (outImage->data.F32[y][x] - offset) / scale;63 # if (0)64 66 if (error) { 65 67 outError->data.F32[y][x] = outError->data.F32[y][x] / SQUARE(scale);
Note:
See TracChangeset
for help on using the changeset viewer.
