IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13015


Ignore:
Timestamp:
Apr 24, 2007, 4:40:57 PM (19 years ago)
Author:
Paul Price
Message:

Adding WCS, so that psastro can be used.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSim/src/ppSimLoop.c

    r12990 r13015  
    283283        M_PI / 3600.0 / 180.0; // Plate scale (radians/pixel)
    284284    float zp = psMetadataLookupF32(NULL, config->arguments, "ZEROPOINT"); // Photometric zero point
     285    float ra0 = psMetadataLookupF32(NULL, config->arguments, "RA"); // Boresight RA (radians)
     286    float dec0 = psMetadataLookupF32(NULL, config->arguments, "DEC"); // Boresight Dec (radians)
     287    float pa = psMetadataLookupF32(NULL, config->arguments, "PA"); // Position angle (radians)
    285288
    286289    // Add catalogue stars
    287290    if (type == PPSIM_TYPE_OBJECT) {
    288         float ra0 = psMetadataLookupF32(NULL, config->arguments, "RA"); // Boresight RA (radians)
    289         float dec0 = psMetadataLookupF32(NULL, config->arguments, "DEC"); // Boresight Dec (radians)
    290         float pa = psMetadataLookupF32(NULL, config->arguments, "PA"); // Position angle (radians)
    291 
    292291        // Read catalogue stars using psastro
    293292        psMetadata *astroRecipe = psMetadataLookupPtr(NULL, config->recipes, PSASTRO_RECIPE);
     
    651650                             "Binning in y", binning);
    652651
     652            // Set up WCS in header
     653            pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell);
     654            if (!hdu->header) {
     655                hdu->header = psMetadataAlloc();
     656            }
     657            pmAstromWCS *wcs = pmAstromWCSAlloc(1, 1); // WCS structure
     658            wcs->toSky = psProjectionAlloc(ra0, dec0, scale * xParityChip, scale * yParityChip, PS_PROJ_TAN);
     659            wcs->cdelt1 = scale * PM_DEG_RAD * xParityChip;
     660            wcs->cdelt2 = scale * PM_DEG_RAD * yParityChip;
     661            wcs->crpix1 = fpa2cell(0.0, x0Cell, xParityCell, binning, x0Chip, xParityChip);
     662            wcs->crpix2 = fpa2cell(0.0, y0Cell, yParityCell, binning, y0Chip, yParityChip);
     663            wcs->trans->x->coeff[1][0] = cos(pa) * wcs->cdelt1;
     664            wcs->trans->x->coeff[0][1] = -sin(pa) * wcs->cdelt1;
     665            wcs->trans->y->coeff[1][0] = sin(pa) * wcs->cdelt2;
     666            wcs->trans->y->coeff[0][1] = cos(pa) * wcs->cdelt2;
     667            // These aren't used by pmAstromWCStoHeader, but set them anyway
     668            wcs->trans->x->coeff[0][0] = ra0;
     669            wcs->trans->y->coeff[0][0] = dec0;
     670            wcs->trans->x->coeff[1][1] = 0.0;
     671            wcs->trans->y->coeff[1][1] = 0.0;
     672
     673            pmAstromWCStoHeader(hdu->header, wcs);
     674            psFree(wcs);
     675
    653676            if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    654677                psError(PS_ERR_IO, false, "Unable to write file.");
Note: See TracChangeset for help on using the changeset viewer.