IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 5, 2009, 4:47:00 PM (17 years ago)
Author:
Paul Price
Message:

Merging pap_branch_20090128. Resolved a small number of conflicts. Compiles, but not tested in detail.

File:
1 edited

Legend:

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

    r18011 r21365  
    3434    psArray *galaxies = psArrayAllocEmpty (1);
    3535    if (type == PPSIM_TYPE_OBJECT) {
    36         // Load forced-photometry positions (these are placed on fpa->analysis for use in ppSimPhotomReadout)
    37         if (!ppSimLoadSpots (fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load forced-photometry spots");
    38 
    39         // Load catalogue stars
     36        // Load forced-photometry positions (these are placed on fpa->analysis for use in ppSimPhotomReadout)
     37        if (!ppSimLoadSpots (fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load forced-photometry spots");
     38
     39        // Load catalogue stars
    4040        if (!ppSimLoadStars (stars, fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load catalog stars");
    4141
    42         // Add random stars
     42        // Add random stars
    4343        if (!ppSimMakeStars (stars, fpa, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "failed to make random stars");
    4444
    45         // Add random galaxies
     45        // Add random galaxies
    4646        if (!ppSimMakeGalaxies (galaxies, fpa, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "failed to make random galaxies");
    4747    }
     
    105105                // TO DO: Decide if cell is to be windowed, reduce numCols, numRows appropriately
    106106                readout->image = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Signal in pixels
    107                 readout->weight = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Noise in pixels
     107                readout->variance = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Noise in pixels
    108108
    109109                psImageInit (readout->image, 0.0);
    110                 psImageInit (readout->weight, 0.0);
     110                psImageInit (readout->variance, 0.0);
    111111
    112112                psFree(readout);        // Drop reference
     
    115115            psVector *biasCols = ppSimMakeBiassec (cell, config);
    116116
    117             pmReadout *readout;
    118             while ((readout = pmFPAviewNextReadout (view, fpa, 1))) {
    119 
    120                 // if we have not read in a weight or generated a fake image above, we need to
     117            pmReadout *readout;
     118            while ((readout = pmFPAviewNextReadout (view, fpa, 1))) {
     119
     120                // if we have not read in a variance or generated a fake image above, we need to
    121121                // build one here
    122                 if (!readout->weight) {
    123                     if (!pmReadoutGenerateWeight(readout, true)) {
    124                         psError (PS_ERR_UNKNOWN, false, "trouble creating weight");
     122                if (!readout->variance) {
     123                    if (!pmReadoutGenerateVariance(readout, true)) {
     124                        psError (PS_ERR_UNKNOWN, false, "trouble creating variance");
    125125                        return false;
    126126                    }
     
    133133
    134134                psVector *biasRows = ppSimMakeBias (&status, readout, config, rng);
    135                 if (!status) ESCAPE (PS_ERR_UNKNOWN, "problem generating dark structure");
     135                if (!status) ESCAPE (PS_ERR_UNKNOWN, "problem generating dark structure");
    136136                if (type == PPSIM_TYPE_BIAS) goto done;
    137137
    138                 if (!ppSimMakeDark (readout, config)) ESCAPE (PS_ERR_UNKNOWN, "problem generating dark structure");
     138                if (!ppSimMakeDark (readout, config)) ESCAPE (PS_ERR_UNKNOWN, "problem generating dark structure");
    139139                if (type == PPSIM_TYPE_DARK) goto done;
    140140
     
    153153
    154154            done:
    155                 if (!ppSimAddNoise(readout->image, readout->weight, cell, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "problem adding noise");
     155                if (!ppSimAddNoise(readout->image, readout->variance, cell, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "problem adding noise");
    156156                if (!ppSimSaturate(readout, config)) ESCAPE (PS_ERR_UNKNOWN, "problem setting saturation levels");
    157157
     
    165165                readout->parent->parent->data_exists = true;
    166166
    167                 // if there is an input image, merge it with the simulated image
    168                 if (!ppSimMergeReadouts (config, view)) ESCAPE (PS_ERR_UNKNOWN, "problem merging input image with simulated image");
     167                // if there is an input image, merge it with the simulated image
     168                if (!ppSimMergeReadouts (config, view)) ESCAPE (PS_ERR_UNKNOWN, "problem merging input image with simulated image");
    169169            }
    170170            psFree(biasCols);
     
    173173
    174174            if (cell->hdu) {
    175                 // XXX only do this if there is no INPUT image?
     175                // XXX only do this if there is no INPUT image?
    176176                if (!ppSimInitHeader(config, NULL, NULL, cell)) ESCAPE (PS_ERR_UNKNOWN, "problem setting output header");
    177177            }
     
    186186        }
    187187
    188         // XXX why no UpdateConceptsChip??
     188        // XXX why no UpdateConceptsChip??
    189189
    190190        if (chip->hdu) {
    191             // XXX only do this if there is no INPUT image
     191            // XXX only do this if there is no INPUT image
    192192            if (!ppSimInitHeader(config, NULL, chip, NULL)) ESCAPE (PS_ERR_UNKNOWN, "problem setting output header");
    193193        }
    194194
    195195        // we perform photometry on the readouts of this chip in the output
    196         if (!ppSimPhotom (config, view)) ESCAPE (PS_ERR_UNKNOWN, "problem performing photometry");
     196        if (!ppSimPhotom (config, view)) ESCAPE (PS_ERR_UNKNOWN, "problem performing photometry");
    197197
    198198        if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
Note: See TracChangeset for help on using the changeset viewer.