IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34454


Ignore:
Timestamp:
Sep 20, 2012, 2:46:30 PM (14 years ago)
Author:
watersc1
Message:

Finalized version of ppSkycell. This now constructs the correct WCS
for the output file, and orients the panels correctly. The outputs
should now have some utility.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20120906/ppSkycell/src/ppSkycellLoop.c

    r34450 r34454  
    200200        psImageInit(image1,NAN);
    201201        psImageInit(image2,NAN);
    202         for (int y = 0; y < numRows1; y++) {
    203           for (int x = 0; x < numCols1; x++) {
    204             image1->data.F32[y][x] = NAN;
    205           }
    206         }
    207202       
    208203        psImage *mask1 = NULL, *mask2 = NULL; // Binned masks
     
    220215                continue;
    221216            }
    222             fprintf(stderr,"ISITNAN? %g\n",image1->data.F32[0][0]);
    223217            pmFPAfileActivateSingle(data->config->files, true, "PPSKYCELL.IMAGE", j);
    224218            if (data->masksName) {
     
    240234            psFree(view);
    241235
    242             // Flip images; no idea why this has to be done, but apparently it does
    243 /*             { */
    244 /*                 psImage *rot = psImageRotate(NULL, inRO->image, M_PI, NAN, PS_INTERPOLATE_BILINEAR); */
    245 /*                 psFree(inRO->image); */
    246 /*                 inRO->image = rot; */
    247 /*             } */
    248 /*             if (inRO->mask) { */
    249 /*                 psImage *rot = psImageRotate(NULL, inRO->mask, M_PI, 0, PS_INTERPOLATE_FLAT); */
    250 /*                 psFree(inRO->mask); */
    251 /*                 inRO->mask = rot; */
    252 /*             } */
    253 
    254236            pmReadout *bin1RO = pmReadoutAlloc(NULL), *bin2RO = pmReadoutAlloc(NULL); // Binned readouts
    255237            if (!pmReadoutRebin(bin1RO, inRO, data->maskVal, data->bin1, data->bin1)) {
     
    272254            // XXX Completely neglecting rotations
    273255            // The skycells are divided up neatly with them all having the same orientation
    274             psImageOverlaySection(image1, bin1RO->image, xOffset1, yOffset1, "=");
    275             psImageOverlaySection(image2, bin2RO->image, xOffset2, yOffset2, "=");
     256            psImageOverlaySection(image1, bin1RO->image, xOffset1, yOffset1, "E");
     257            psImageOverlaySection(image2, bin2RO->image, xOffset2, yOffset2, "E");
    276258            if (data->masksName) {
    277259                psImageOverlaySection(mask1, bin1RO->mask, xOffset1, yOffset1, "=");
     
    331313
    332314          // Change wcs here
     315#define WCS_DEBUG 0
    333316          if (modify_wcs1) {
    334317            pmAstromWCS *WCS = pmAstromWCSfromHeader(fits1->fpa->hdu->header);
    335318            double cd1f = 1.0 * data->bin1;
    336319            double cd2f = 1.0 * data->bin1;
     320#if WCS_DEBUG
    337321            fprintf(stderr,">>> %d %d (%g %g) (%g %g) (%g %g)\n",data->bin1,data->bin2,
    338322                    cd1f,cd2f,WCS->cdelt1,WCS->cdelt2,
    339323                    WCS->crpix1,WCS->crpix2
    340324                    );
    341 
     325#endif
    342326            WCS->cdelt1 *= cd1f;
    343327            WCS->cdelt2 *= cd2f;
    344328            WCS->crpix1 = WCS->crpix1 / cd1f;
    345329            WCS->crpix2 = WCS->crpix2 / cd2f;
     330#if WCS_DEBUG
    346331            fprintf(stderr,">>> %d %d (%g %g) (%g %g) (%g %g) %d %d %d %d\n",data->bin1,data->bin2,
    347332                    cd1f,cd2f,WCS->cdelt1,WCS->cdelt2,
     
    350335                    WCS->trans->y->nX,              WCS->trans->y->nY
    351336                    );
    352            
     337#endif
    353338            for (int q = 0; q <= WCS->trans->x->nX; q++) {
    354339              for (int r = 0; r <= WCS->trans->x->nY; r++) {
    355340                WCS->trans->x->coeff[q][r] *= pow(cd1f,q) * pow(cd2f,r);
     341#if WCS_DEBUG
    356342                fprintf(stderr,"PC: %d %d %g %g\n",
    357343                        q,r,pow(cd1f,q) * pow(cd2f,r),
    358344                        WCS->trans->x->coeff[q][r]);
     345#endif
    359346              }
    360347            }
     
    362349              for (int r = 0; r <= WCS->trans->y->nY; r++) {
    363350                WCS->trans->y->coeff[q][r] *= pow(cd1f,q) * pow(cd2f,r);
     351#if WCS_DEBUG
    364352                fprintf(stderr,"PC: %d %d %g %g\n",
    365353                         q,r,pow(cd1f,q) * pow(cd2f,r),
    366354                         WCS->trans->y->coeff[q][r]);
    367 
     355#endif
    368356              }
    369357            }
    370358            pmAstromWCStoHeader (fits1->fpa->hdu->header,WCS);
    371359            WCS = pmAstromWCSfromHeader(fits1->fpa->hdu->header);
     360#if WCS_DEBUG
    372361            fprintf(stderr,">>> %d %d (%g %g) (%g %g) (%g %g)\n",data->bin1,data->bin2,
    373362                    cd1f,cd2f,WCS->cdelt1,WCS->cdelt2,
    374363                    WCS->crpix1,WCS->crpix2
    375364                    );
    376            
     365#endif
    377366            modify_wcs1 = 0;
    378367          }
     
    426415            modify_wcs2 = 0;
    427416          }
    428 
    429 
    430417         
    431418          pmChip *Fchip2 = pmFPAfileThisChip(data->config->files, view, "PPSKYCELL.BIN2");
Note: See TracChangeset for help on using the changeset viewer.