IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 17, 2009, 12:08:50 PM (17 years ago)
Author:
beaumont
Message:

merged with head

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/psphot

  • branches/cnb_branches/cnb_branch_20090301/psphot/src/psphotModelBackground.c

    r21183 r23352  
    3131static bool backgroundModel(psImage *model,  // Model image
    3232                            psImage *modelStdev, // Model stdev image
    33                             psImage *image, // Image for which to generate a background model
    34                             psImage *mask, // Mask for image
     33                            psMetadata *analysis, // Analysis metadata for outputs
     34                            pmReadout *readout, // Readout for which to generate a background model
    3535                            psImageBinning *binning, // Binning parameters
    3636                            const pmConfig *config // Configuration
     
    4141    bool status = true;
    4242
     43    psImage *image = readout->image, *mask = readout->mask; // Image and mask for readout
     44
    4345    // select the appropriate recipe information
    4446    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     
    4951    assert (maskVal);
    5052
    51     // user supplied seed, if available
    52     unsigned long seed = psMetadataLookupS32 (&status, recipe, "IMSTATS_SEED");
    53     if (!status) {
    54         seed = 0;
    55     }
    56     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, seed);
     53    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS);
    5754
    5855    // subtract this amount extra from the sky
     
    140137
    141138    // we save the binning structure for use in psphotMagnitudes
    142     status = psMetadataAddPtr(recipe, PS_LIST_TAIL, "PSPHOT.BACKGROUND.BINNING", PS_DATA_UNKNOWN | PS_META_REPLACE, "Background binning", binning);
    143     PS_ASSERT (status, false);
    144 
     139    psMetadataAddPtr(analysis, PS_LIST_TAIL, "PSPHOT.BACKGROUND.BINNING",
     140                     PS_DATA_UNKNOWN | PS_META_REPLACE, "Background binning", binning);
    145141
    146142    psF32 **modelData = model->data.F32;
     
    343339    psImage *modelStdev = psImageAlloc(binning->nXruff, binning->nYruff, PS_TYPE_F32); // Standard deviation
    344340
    345     if (!backgroundModel(model, modelStdev, ro->image, ro->mask, binning, config)) {
     341    if (!backgroundModel(model, modelStdev, ro->analysis, ro, binning, config)) {
    346342        psFree(model);
    347343        psFree(modelStdev);
     
    365361    pmFPAfile *file = psMetadataLookupPtr (&status, config->files, filename);
    366362    pmFPA *inFPA = file->fpa;
    367     pmReadout *readout = pmFPAviewThisReadout (view, inFPA);
    368     psImage *image = readout->image;
    369     psImage *mask  = readout->mask;
    370 
    371     psImageBinning *binning = backgroundBinning(image, config); // Image binning parameters
     363    pmReadout *readout = pmFPAviewThisReadout(view, inFPA);
     364
     365    psImageBinning *binning = backgroundBinning(readout->image, config); // Image binning parameters
    372366    pmReadout *model = pmFPAGenerateReadout(config, view, "PSPHOT.BACKMDL", inFPA, binning);
    373367    pmReadout *modelStdev = pmFPAGenerateReadout(config, view, "PSPHOT.BACKMDL.STDEV", inFPA, binning);
    374368
    375     if (!backgroundModel(model->image, modelStdev->image, image, mask, binning, config)) {
     369    if (!backgroundModel(model->image, modelStdev->image, model->analysis, readout, binning, config)) {
    376370        psError(PS_ERR_UNKNOWN, false, "Unable to generate background model");
    377371        return false;
Note: See TracChangeset for help on using the changeset viewer.