IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 25, 2007, 3:35:50 PM (19 years ago)
Author:
eugene
Message:

incorporating changes from eam_02_branch (pmSourceAdd/Sub, modified API for pmModelAdd, cached models)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotOutput.c

    r13008 r13035  
    5959        for (int j = 0; j < source->pixels->numCols; j++) {
    6060            // skip masked points
    61             if (source->mask->data.U8[i][j]) {
     61            if (source->maskObj->data.U8[i][j]) {
    6262                continue;
    6363            }
     
    7272                     source->pixels->data.F32[i][j],
    7373                     1.0 / source->weight->data.F32[i][j],
    74                      source->mask->data.U8[i][j]);
     74                     source->maskObj->data.U8[i][j]);
    7575        }
    7676    }
     
    104104    for (int i = 0; (sources != NULL) && (i < sources->n); i++) {
    105105        pmSource *source = (pmSource *) sources->data[i];
    106         pmModel *model = pmSourceSelectModel (source);
     106        pmModel *model = pmSourceGetModel (NULL, source);
    107107        if (model == NULL)
    108108            continue;
     
    154154    return header;
    155155}
    156 
    157 # if (0)
    158 // output functions: we have several fixed modes (sx, obj, cmp)
    159 void psphotOutput (pmReadout *readout, psMetadata *arguments) {
    160 
    161     bool status;
    162     char *outputFile = NULL;
    163 
    164     psMetadata *header = pmReadoutGetHeader (readout);
    165 
    166     pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF");
    167     // sample PSF images??
    168     if (psfSample != NULL) psphotSamplePSFs (psf, readout->image, psfSample);
    169     if (psfSample != NULL) psphotSamplePSFs (psf, readout->image, psfSample);
    170 
    171     if (psfFile != NULL) {
    172         psMetadata *psfData = pmPSFtoMD (NULL, psf);
    173         psMetadataConfigWrite (psfData, psfFile);
    174         psFree (psfData);
    175     }
    176 }
    177 
    178 psImage *pmModelPSFatXY (psImage *image, pmModel *modelEXT, pmPSF *psf, int x, int y, int dx, int dy) {
    179 
    180     psRegion region = {x - dx, x + dx, y - dy, y + dy};
    181     psImage *view = psImageSubset (image, region);
    182     psImage *sample = psImageCopy (NULL, view, PS_TYPE_F32);
    183     psImageInit (sample, 0);
    184     modelEXT->params->data.F32[2] = x;
    185     modelEXT->params->data.F32[3] = y;
    186     pmModel *modelPSF = pmModelFromPSF (modelEXT, psf);
    187     pmModelAdd (sample, NULL, modelPSF, false, false);
    188     psFree (modelPSF);
    189     return (sample);
    190 }
    191 
    192 bool psphotSamplePSFs (pmPSF *psf, psImage *image, char *output) {
    193 
    194     // make sample PSFs for 4 corners and the center
    195     psImage *sample;
    196 
    197     // optional dump of all rough source data
    198     if (output[0] == 0) return false;
    199 
    200     pmModel *modelEXT = pmModelAlloc (psf->type);
    201     modelEXT->params->data.F32[0] = 0;
    202     modelEXT->params->data.F32[1] = 1;
    203 
    204     psFits *fits = psFitsOpen (output, "w");
    205 
    206     // the centers are in parent coordinates; they do not need to correspond to valid pixels...
    207     sample = pmModelPSFatXY (image, modelEXT, psf, 25, 25, 25, 25);
    208     psFitsWriteImage (fits, NULL, sample, 0);
    209     sample = pmModelPSFatXY (image, modelEXT, psf, image->numCols - 25, image->numRows - 25, 25, 25);
    210     psFitsWriteImage (fits, NULL, sample, 0);
    211     sample = pmModelPSFatXY (image, modelEXT, psf, image->numCols - 25, 25, 25, 25);
    212     psFitsWriteImage (fits, NULL, sample, 0);
    213     sample = pmModelPSFatXY (image, modelEXT, psf, 25, image->numRows - 25, 25, 25);
    214     psFitsWriteImage (fits, NULL, sample, 0);
    215     sample = pmModelPSFatXY (image, modelEXT, psf, image->numCols / 2, image->numRows / 2, 25, 25);
    216     psFitsWriteImage (fits, NULL, sample, 0);
    217 
    218     psFitsClose (fits);
    219     return (TRUE);
    220 }
    221 # endif
Note: See TracChangeset for help on using the changeset viewer.