IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 22, 2007, 3:05:47 PM (19 years ago)
Author:
eugene
Message:

load / apply psf model from external source

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20070817/ppSim/src/ppSimInsertSources.c

    r14547 r14614  
    33bool ppSimInsertSources (pmReadout *readout, psImage *expCorr, psArray *stars, pmConfig *config) {
    44
     5    bool mdok;
    56
    67    assert (stars);
     8    assert (readout);
    79   
    810    pmCell *cell = readout->parent;
    911    pmChip *chip = cell->parent;
    1012
    11     // XXX we probably need this to get the size right
    12 # if (0)
    13     bool mdok;
     13    // XXX this is an estimate of the sky noise based on the inputs to the image simulation.
     14    // XXX update this to allow the estimate based on the measured sky background
     15    // XXX this is missing the gain.
    1416    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSIM_RECIPE); // Recipe
    1517
     
    2931    // Rough noise estimate, appropriate for entire cell (use for source radius?)
    3032    float roughNoise = sqrtf(PS_SQR(readnoise) + (darkRate + skyRate) * expTime);
    31 # endif
    3233
    3334    int x0Chip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.X0");
     
    4344    int binning = psMetadataLookupS32(NULL, config->arguments, "BINNING"); // Binning in x and y
    4445
    45     pmPSF *psf = psMetadataLookupPtr (NULL, chip->analysis, "PSF");
     46    pmPSF *psf = psMetadataLookupPtr (&mdok, chip->analysis, "PSPHOT.PSF");
     47    assert (psf);
    4648
    4749    int dX = PM_CELL_TO_CHIP (0.0, x0Cell, xParityCell, binning);
     
    7476        pmModelSetFlux (model, star->flux);
    7577
     78        // XXX let the flux limit be a user-defined number of sky sigmas (not just 1.0)
     79        float radius = model->modelRadius (model->params, roughNoise);
     80        radius = PS_MAX (radius, 1.0);
     81
    7682        // construct a source, with model flux pixels set, based on the model
    77         pmSource *source = pmSourceFromModel (model, readout, PM_SOURCE_TYPE_STAR);
     83        pmSource *source = pmSourceFromModel (model, readout, radius, PM_SOURCE_TYPE_STAR);
    7884
    7985        // XXX add the sources to a source array
    8086
     87        // insert the source flux in the image
    8188        pmSourceAddWithOffset (source, PM_MODEL_OP_FULL, 0xff, dX, dY);
    8289    }
Note: See TracChangeset for help on using the changeset viewer.