IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 3, 2021, 2:31:34 PM (5 years ago)
Author:
eugene
Message:

minor whitespace change; attempt to plug leaks in pswarpLoopSkycell, but it is not actually used, add some test code for transformation (inactive)

File:
1 edited

Legend:

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

    r31878 r41538  
    1313# include "pswarp.h"
    1414
     15FILE *fout = NULL;
     16
    1517/**
    1618 * pswarpMapGridFromImage builds a set (a grid) of locally-linear maps which convert the source
     
    4648    }
    4749
     50    if (0) {
     51        // test the transformation sky<->chip for chip in smf:
     52        if (fout == NULL) { fout = fopen ("map.grid.txt", "w"); }
     53
     54        pmCell *cell = dest->parent;
     55        pmChip *chip = cell->parent;
     56        pmFPA *fpa = chip->parent;
     57
     58        int NxChip = dest->image->numCols;
     59        int NyChip = dest->image->numRows;
     60
     61        // XXX save these as static for speed?
     62        psPlane *CH0 = psPlaneAlloc();
     63        psPlane *CH1 = psPlaneAlloc();
     64       
     65        psPlane *FP0 = psPlaneAlloc();
     66        psPlane *TP0 = psPlaneAlloc();
     67
     68        psPlane *FP1 = psPlaneAlloc();
     69        psPlane *TP1 = psPlaneAlloc();
     70
     71        psSphere *sky = psSphereAlloc();
     72
     73        // measure the map for the center of each superpixel
     74        for (i = 0; i < NxChip; i += 100) {
     75            for (j = 0; j < NyChip; j += 100) {
     76               
     77                CH0->x = i;
     78                CH0->y = j;
     79                psPlaneTransformApply(FP0, chip->toFPA, CH0);
     80                psPlaneTransformApply (TP0, fpa->toTPA, FP0);
     81                psDeproject (sky, TP0, fpa->toSky);
     82                psProject (TP1, sky, fpa->toSky);
     83                psPlaneTransformApply (FP1, fpa->fromTPA, TP1);
     84                psPlaneTransformApply (CH1, chip->fromFPA, FP1);
     85
     86                fprintf (fout, "%f %f > %f %f > %f %f > %f %f | ", CH0->x, CH0->y, FP0->x, FP0->y, TP0->x, TP0->y, sky->r*180/M_PI, sky->d*180/M_PI);
     87                fprintf (fout, "%f %f < %f %f < %f %f \n", TP1->x, TP1->y, FP1->x, FP1->y, CH1->x, CH1->y);
     88
     89            }
     90        }
     91        fclose (fout);
     92
     93        psFree (CH0);
     94        psFree (FP0);
     95        psFree (TP0);
     96
     97        psFree (CH1);
     98        psFree (FP1);
     99        psFree (TP1);
     100
     101        psFree (sky);
     102    }
     103
    48104    grid->nXpix = nXpix;
    49105    grid->nYpix = nYpix;
     
    164220
    165221    // XXX need to include readout->cell->chip offsets
     222    // XXX note that 'dest' is the SMF and 'src' is the skycell CMF
     223    // this is the lower accuracy direction...
    166224
    167225    /** V(0,0) position */
     
    205263    map->xo = ix;
    206264    map->yo = iy;
    207 
     265   
    208266    psFree (offset);
    209267    psFree (FP);
Note: See TracChangeset for help on using the changeset viewer.