Changeset 10958
- Timestamp:
- Jan 7, 2007, 4:14:29 PM (19 years ago)
- Location:
- trunk/pswarp
- Files:
-
- 6 edited
-
src/pswarpDataLoad.c (modified) (4 diffs)
-
src/pswarpMapGrid.c (modified) (2 diffs)
-
src/pswarpMatchRange.c (modified) (3 diffs)
-
src/pswarpTransformReadout.c (modified) (1 diff)
-
src/pswarpTransformReadout_Opt.c (modified) (1 diff)
-
test/simple.image.op (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarpDataLoad.c
r10954 r10958 12 12 pmCell *cell; 13 13 pmReadout *readout; 14 pmFPAview *view; 14 15 15 16 // select the input data sources … … 21 22 22 23 // select the output readout 23 pmFPAview *outView = pmFPAviewAlloc (0);24 outView->chip = 0;25 outView->cell = 0;26 outView->readout = 0;27 pmReadout *output = pmFPAfileThisReadout (config->files, outView, "PSWARP.OUTPUT");24 view = pmFPAviewAlloc (0); 25 view->chip = 0; 26 view->cell = 0; 27 view->readout = 0; 28 pmReadout *output = pmFPAfileThisReadout (config->files, view, "PSWARP.OUTPUT"); 28 29 if (!output) { 29 30 psError(PSWARP_ERR_CONFIG, true, "Can't find output data!\n"); 30 31 return false; 31 32 } 33 psFree (view); 32 34 33 35 // de-activate PSWARP.SKYCELL and PSWARP.OUTPUT … … 35 37 pmFPAfileActivate (config->files, false, "PSWARP.OUTPUT"); 36 38 37 pmFPAview *view = pmFPAviewAlloc (0);39 view = pmFPAviewAlloc (0); 38 40 39 41 // find the FPA phu … … 81 83 if (! readout->data_exists) { continue; } 82 84 83 pswarpTransformReadout (output, readout, config); 85 // XXX _Opt version uses locally-linear map 86 // pswarpTransformReadout (output, readout, config); 87 pswarpTransformReadout_Opt (output, readout, config); 84 88 85 89 pmFPAfileIOChecks (config, view, PM_FPA_AFTER); -
trunk/pswarp/src/pswarpMapGrid.c
r10957 r10958 5 5 pswarpMapGrid *pswarpMapGridFromImage (pmReadout *dest, pmReadout *src, int nXpix, int nYpix) { 6 6 7 int i, ni; 8 int j, nj; 9 7 10 // split the difference of the remainder 8 11 int xMin = 0.5*(src->image->numCols % nXpix); 9 12 int yMin = 0.5*(src->image->numRows % nYpix); 10 13 11 pswarpMapGrid *grid = pswarpMapGridAlloc (src->image->numCols / nXpix, src->image->numRows / nYpix); 12 13 int ni = 0; 14 int nj = 0; 15 for (int i = xMin; i < src->image->numCols; i += nXpix, ni++) { 16 for (int j = yMin; j < src->image->numRows; j += nYpix, nj++) { 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 ++; 18 19 pswarpMapGrid *grid = pswarpMapGridAlloc (nXpts, nYpts); 20 21 for (ni = 0, i = xMin; ni < nXpts; i += nXpix, ni++) { 22 for (nj = 0, j = yMin; nj < nYpts; j += nYpix, nj++) { 17 23 pswarpMapSetLocalModel (grid->maps[ni][nj], dest, src, i, j); 18 24 } … … 128 134 map->Xx = V10->x - V00->x; 129 135 map->Xy = V01->x - V00->x; 130 map->Xo = V00->x + map->Xx*ix +map->Xy*iy;136 map->Xo = V00->x - map->Xx*ix - map->Xy*iy; 131 137 132 138 map->Yx = V10->y - V00->y; 133 139 map->Yy = V01->y - V00->y; 134 map->Yo = V00->y + map->Yx*ix +map->Yy*iy;140 map->Yo = V00->y - map->Yx*ix - map->Yy*iy; 135 141 136 142 map->xo = ix; -
trunk/pswarp/src/pswarpMatchRange.c
r10957 r10958 8 8 psPlaneTransformApply (FP, fpaSrc->fromTPA, TP); \ 9 9 psPlaneTransformApply (srcPix, chipSrc->fromFPA, FP); \ 10 *minX = PS_M AX(*minX, srcPix->x); \11 *minY = PS_M AX(*minY, srcPix->y); \12 *maxX = PS_M IN(*maxX, srcPix->x); \13 *maxY = PS_M IN(*maxY, srcPix->y);10 *minX = PS_MIN (*minX, srcPix->x); \ 11 *minY = PS_MIN (*minY, srcPix->y); \ 12 *maxX = PS_MAX (*maxX, srcPix->x); \ 13 *maxY = PS_MAX (*maxY, srcPix->y); 14 14 15 15 // we are warping from src to dest. find the max overlapping pixels in the INPUT (src) … … 30 30 pmFPA *fpaDest = chipDest->parent; 31 31 32 *minX = 0;33 *minY = 0;34 *maxX = src->image->numCols;35 *maxY = src->image->numRows;32 *minX = src->image->numCols; 33 *minY = src->image->numRows; 34 *maxX = 0; 35 *maxY = 0; 36 36 37 37 // XXX save these as static for speed? … … 75 75 TEST_MINMAX; 76 76 77 *minX = PS_MAX (*minX, 0); 78 *minY = PS_MAX (*minY, 0); 79 *maxX = PS_MIN (*maxX, src->image->numCols); 80 *maxY = PS_MIN (*maxY, src->image->numRows); 81 82 psFree (srcPix); 83 psFree (destPix); 84 psFree (FP); 85 psFree (TP); 86 psFree (sky); 87 77 88 return true; 78 89 } -
trunk/pswarp/src/pswarpTransformReadout.c
r10957 r10958 55 55 } 56 56 } 57 58 psFree (inPix); 59 psFree (outPix); 60 psFree (FP); 61 psFree (TP); 62 psFree (sky); 63 57 64 return true; 58 65 } -
trunk/pswarp/src/pswarpTransformReadout_Opt.c
r10957 r10958 61 61 } 62 62 } 63 64 psFree (inPix); 65 psFree (grid); 63 66 return true; 64 67 } -
trunk/pswarp/test/simple.image.op
r10955 r10958 1 2 $NX = 2048 3 $NY = 2048 1 4 2 5 macro go 3 6 mkref 4 7 mksrc 5 # exec pswarp -file src.fits out.fitsref.fits8 exec pswarp -file src.fits out ref.fits 6 9 end 7 10 8 11 macro mkref 9 mcreate ref 512 51212 mcreate ref $NX $NY 10 13 keyword ref CTYPE1 -w "RA---TAN" 11 14 keyword ref CTYPE2 -w "DEC--TAN" 12 15 keyword ref CRVAL1 -wf 0.0 13 16 keyword ref CRVAL2 -wf 0.0 14 keyword ref CRPIX1 -wf 25615 keyword ref CRPIX2 -wf 25617 keyword ref CRPIX1 -wf {$NX/2} 18 keyword ref CRPIX2 -wf {$NY/2} 16 19 17 20 keyword ref CDELT1 -wf {1/3600} … … 27 30 28 31 macro mksrc 29 mcreate src 512 51230 for i 0 5126431 for j 0 5126432 mcreate src $NX $NY 33 for i 0 $NX 64 34 for j 0 $NY 64 32 35 zap src $i $j 1 1 -v 1 33 36 end … … 38 41 keyword src CRVAL1 -wf 0.0 39 42 keyword src CRVAL2 -wf 0.0 40 keyword src CRPIX1 -wf 25641 keyword src CRPIX2 -wf 25643 keyword src CRPIX1 -wf {$NX/2} 44 keyword src CRPIX2 -wf {$NY/2} 42 45 43 46 keyword src CDELT1 -wf {1/3600}
Note:
See TracChangeset
for help on using the changeset viewer.
