IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10958


Ignore:
Timestamp:
Jan 7, 2007, 4:14:29 PM (19 years ago)
Author:
eugene
Message:

working version with locally-linear map

Location:
trunk/pswarp
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpDataLoad.c

    r10954 r10958  
    1212    pmCell *cell;
    1313    pmReadout *readout;
     14    pmFPAview *view;
    1415
    1516    // select the input data sources
     
    2122
    2223    // 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");
    2829    if (!output) {
    2930        psError(PSWARP_ERR_CONFIG, true, "Can't find output data!\n");
    3031        return false;
    3132    }
     33    psFree (view);
    3234
    3335    // de-activate PSWARP.SKYCELL and PSWARP.OUTPUT
     
    3537    pmFPAfileActivate (config->files, false, "PSWARP.OUTPUT");
    3638
    37     pmFPAview *view = pmFPAviewAlloc (0);
     39    view = pmFPAviewAlloc (0);
    3840
    3941    // find the FPA phu
     
    8183                if (! readout->data_exists) { continue; }
    8284
    83                 pswarpTransformReadout (output, readout, config);
     85                // XXX _Opt version uses locally-linear map
     86                // pswarpTransformReadout (output, readout, config);
     87                pswarpTransformReadout_Opt (output, readout, config);
    8488
    8589                pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
  • trunk/pswarp/src/pswarpMapGrid.c

    r10957 r10958  
    55pswarpMapGrid *pswarpMapGridFromImage (pmReadout *dest, pmReadout *src, int nXpix, int nYpix) {
    66
     7    int i, ni;
     8    int j, nj;
     9
    710    // split the difference of the remainder
    811    int xMin = 0.5*(src->image->numCols % nXpix);
    912    int yMin = 0.5*(src->image->numRows % nYpix);
    1013
    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++) {
    1723            pswarpMapSetLocalModel (grid->maps[ni][nj], dest, src, i, j);
    1824        }
     
    128134    map->Xx = V10->x - V00->x;
    129135    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;
    131137
    132138    map->Yx = V10->y - V00->y;
    133139    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;
    135141 
    136142    map->xo = ix;
  • trunk/pswarp/src/pswarpMatchRange.c

    r10957 r10958  
    88    psPlaneTransformApply (FP, fpaSrc->fromTPA, TP); \
    99    psPlaneTransformApply (srcPix, chipSrc->fromFPA, FP); \
    10     *minX = PS_MAX (*minX, srcPix->x); \
    11     *minY = PS_MAX (*minY, srcPix->y); \
    12     *maxX = PS_MIN (*maxX, srcPix->x); \
    13     *maxY = PS_MIN (*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);
    1414
    1515// we are warping from src to dest.  find the max overlapping pixels in the INPUT (src)
     
    3030    pmFPA *fpaDest = chipDest->parent;
    3131
    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;
    3636
    3737    // XXX save these as static for speed?
     
    7575    TEST_MINMAX;
    7676
     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
    7788    return true;
    7889}
  • trunk/pswarp/src/pswarpTransformReadout.c

    r10957 r10958  
    5555        }
    5656    }
     57
     58    psFree (inPix);
     59    psFree (outPix);
     60    psFree (FP);
     61    psFree (TP);
     62    psFree (sky);
     63
    5764    return true;
    5865}
  • trunk/pswarp/src/pswarpTransformReadout_Opt.c

    r10957 r10958  
    6161        }
    6262    }
     63
     64    psFree (inPix);
     65    psFree (grid);
    6366    return true;
    6467}
  • trunk/pswarp/test/simple.image.op

    r10955 r10958  
     1
     2$NX = 2048
     3$NY = 2048
    14
    25macro go
    36  mkref
    47  mksrc
    5 #  exec pswarp -file src.fits out.fits ref.fits
     8  exec pswarp -file src.fits out ref.fits
    69end
    710
    811macro mkref
    9   mcreate ref 512 512
     12  mcreate ref $NX $NY
    1013  keyword ref CTYPE1 -w "RA---TAN"
    1114  keyword ref CTYPE2 -w "DEC--TAN"
    1215  keyword ref CRVAL1 -wf 0.0
    1316  keyword ref CRVAL2 -wf 0.0
    14   keyword ref CRPIX1 -wf 256
    15   keyword ref CRPIX2 -wf 256
     17  keyword ref CRPIX1 -wf {$NX/2}
     18  keyword ref CRPIX2 -wf {$NY/2}
    1619
    1720  keyword ref CDELT1 -wf {1/3600}
     
    2730
    2831macro mksrc
    29   mcreate src 512 512
    30   for i 0 512 64
    31     for j 0 512 64
     32  mcreate src $NX $NY
     33  for i 0 $NX 64
     34    for j 0 $NY 64
    3235      zap src $i $j 1 1 -v 1
    3336    end
     
    3841  keyword src CRVAL1 -wf 0.0
    3942  keyword src CRVAL2 -wf 0.0
    40   keyword src CRPIX1 -wf 256
    41   keyword src CRPIX2 -wf 256
     43  keyword src CRPIX1 -wf {$NX/2}
     44  keyword src CRPIX2 -wf {$NY/2}
    4245
    4346  keyword src CDELT1 -wf {1/3600}
Note: See TracChangeset for help on using the changeset viewer.