IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21230


Ignore:
Timestamp:
Jan 29, 2009, 4:26:37 PM (17 years ago)
Author:
Paul Price
Message:

Changing 'weight' to 'variance'. Mainly propagating changes from psModules. Fixed some apparent psphot API changes too.

Location:
branches/pap_branch_20090128/ppSim/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_20090128/ppSim/src/ppSimInsertStars.c

    r20367 r21230  
    3939    float skyRate = psMetadataLookupF32(NULL, recipe, "SKY.RATE"); // Sky rate
    4040    if (isnan(skyRate)) {
    41         float zp      = psMetadataLookupF32(&mdok, recipe, "ZEROPOINT"); assert (mdok);
    42         float scale   = psMetadataLookupF32(&mdok, recipe, "PIXEL.SCALE");     assert (mdok);
    43         float skyMags = psMetadataLookupF32(&mdok, recipe, "SKY.MAGS");  assert (mdok);
     41        float zp      = psMetadataLookupF32(&mdok, recipe, "ZEROPOINT"); assert (mdok);
     42        float scale   = psMetadataLookupF32(&mdok, recipe, "PIXEL.SCALE");     assert (mdok);
     43        float skyMags = psMetadataLookupF32(&mdok, recipe, "SKY.MAGS");  assert (mdok);
    4444        skyRate = scale * scale * ppSimMagToFlux (skyMags, zp);
    4545    }
     
    7575    FILE *outfile = fopen (outname, "w");
    7676
    77     // add sources to the readout image & weight
     77    // add sources to the readout image & variance
    7878    psTrace("ppSim", 1, "Inserting %ld stars...\n", stars->n);
    7979    for (long i = 0; i < stars->n; i++) {
     
    118118        psF64 Area = 2.0 * M_PI * axes.major * axes.minor;
    119119
    120         // this value is the pure (input) flux, and is saved in the output source cmf files
     120        // this value is the pure (input) flux, and is saved in the output source cmf files
    121121        source->psfMag = -2.5*log10(star->flux);
    122122        source->errMag = sqrt(Area*PS_SQR(roughNoise) + flux) / flux;
     
    132132        // Blow away the image parts of the source, which makes the memory explode
    133133        RESET(source->pixels);
    134         RESET(source->weight);
     134        RESET(source->variance);
    135135        RESET(source->maskObj);
    136136        RESET(source->maskView);
  • branches/pap_branch_20090128/ppSim/src/ppSimLoadForceSources.c

    r18011 r21230  
    5656    // Select the spots within range of this readout.  Project the spots to this chip
    5757    for (int i = 0; i < spots->n; i++) {
    58         pmAstromObj *obj = spots->data[i];
     58        pmAstromObj *obj = spots->data[i];
    5959
    60         psProject (obj->TP, obj->sky, fpa->toSky);
    61         psPlaneTransformApply (obj->FP, fpa->fromTPA, obj->TP);
    62         psPlaneTransformApply (obj->chip, chip->fromFPA, obj->FP);
     60        psProject (obj->TP, obj->sky, fpa->toSky);
     61        psPlaneTransformApply (obj->FP, fpa->fromTPA, obj->TP);
     62        psPlaneTransformApply (obj->chip, chip->fromFPA, obj->FP);
    6363
    64         // limit the X,Y range of the objs to the selected chip
    65         if (obj->chip->x < minX) continue;
    66         if (obj->chip->x > maxX) continue;
    67         if (obj->chip->y < minY) continue;
    68         if (obj->chip->y > maxY) continue;
     64        // limit the X,Y range of the objs to the selected chip
     65        if (obj->chip->x < minX) continue;
     66        if (obj->chip->x > maxX) continue;
     67        if (obj->chip->y < minY) continue;
     68        if (obj->chip->y > maxY) continue;
    6969
    70         // convert the pmAstromObj to pmSource
     70        // convert the pmAstromObj to pmSource
    7171
    7272        // instantiate a model for the PSF at this location, Io = 1.0
     
    7474
    7575        // XXX let the flux limit be a user-defined number of sky sigmas (not just 1.0)
    76         // XXX use a fixed radius??
     76        // XXX use a fixed radius??
    7777        // float radius = model->modelRadius (model->params, roughNoise);
    7878        // radius = PS_MAX (radius, 1.0);
    79         float radius = 5.0;
     79        float radius = 5.0;
    8080
    8181        // construct a source, with model flux pixels set, based on the model
     
    8787        // psF64 Area = 2.0 * M_PI * axes.major * axes.minor;
    8888
    89         // these are not really needed since we will be fitting for them
     89        // these are not really needed since we will be fitting for them
    9090        source->psfMag = NAN;
    9191        source->errMag = NAN;
    9292
    9393        // insert the source flux in the image
    94         // XXX not sure the offset is really 0,0
     94        // XXX not sure the offset is really 0,0
    9595        pmSourceAddWithOffset (source, PM_MODEL_OP_FULL, 0xff, 0.0, 0.0);
    9696        pmSourceAddWithOffset (source, PM_MODEL_OP_FULL | PM_MODEL_OP_NOISE, 0xff, 0.0, 0.0);
     
    9898        // Blow away the image parts of the source, which makes the memory explode
    9999        RESET(source->pixels);
    100         RESET(source->weight);
     100        RESET(source->variance);
    101101        RESET(source->maskObj);
    102102        RESET(source->maskView);
     
    105105        RESET(source->blends);
    106106
    107         psArrayAdd (sources, 100, source);
     107        psArrayAdd (sources, 100, source);
    108108        psFree(source);                 // Drop local reference
    109109    }
  • branches/pap_branch_20090128/ppSim/src/ppSimLoop.c

    r18011 r21230  
    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)) {
  • branches/pap_branch_20090128/ppSim/src/ppSimMakeBias.c

    r18011 r21230  
    2020    float readnoise = psMetadataLookupF32(NULL, cell->concepts, "CELL.READNOISE");// CCD read noise, e
    2121    if (isnan(readnoise)) {
    22         psWarning("CELL.READNOISE is not set; reverting to recipe value READNOISE.");
    23         readnoise = psMetadataLookupF32(&mdok, recipe, "READNOISE");
    24         if (!mdok) {
    25             psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find READNOISE in recipe.");
    26             *status = false;
    27             return NULL;
    28         }
     22        psWarning("CELL.READNOISE is not set; reverting to recipe value READNOISE.");
     23        readnoise = psMetadataLookupF32(&mdok, recipe, "READNOISE");
     24        if (!mdok) {
     25            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find READNOISE in recipe.");
     26            *status = false;
     27            return NULL;
     28        }
    2929    }
    3030
    3131    psImage *signal = readout->image;
    32     psImage *variance = readout->weight;
     32    psImage *variance = readout->variance;
    3333
    3434    int numRows = signal->numRows;
     
    3838    psPolynomial1D *biasPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_CHEB, biasOrder);
    3939    for (int j = 0; j < biasOrder + 1; j++) {
    40         biasPoly->coeff[j] = biasRange * psRandomGaussian(rng);
     40        biasPoly->coeff[j] = biasRange * psRandomGaussian(rng);
    4141    }
    4242
     
    4545
    4646    for (int y = 0; y < numRows; y++) {
    47         // Adjust bias level for this row
    48         biasRows->data.F32[y] = psPolynomial1DEval(biasPoly, (float)(y + biasOffset) /
    49                                                   (float)numRows - 0.5) + biasLevel;
     47        // Adjust bias level for this row
     48        biasRows->data.F32[y] = psPolynomial1DEval(biasPoly, (float)(y + biasOffset) /
     49                                                  (float)numRows - 0.5) + biasLevel;
    5050
    51         for (int x = 0; x < numCols; x++) {
     51        for (int x = 0; x < numCols; x++) {
    5252
    53             // Bias level
    54             signal->data.F32[y][x] += biasRows->data.F32[y];
    55             variance->data.F32[y][x] += PS_SQR(readnoise);
     53            // Bias level
     54            signal->data.F32[y][x] += biasRows->data.F32[y];
     55            variance->data.F32[y][x] += PS_SQR(readnoise);
    5656
    57         }
     57        }
    5858    }
    5959    psFree(biasPoly);
  • branches/pap_branch_20090128/ppSim/src/ppSimMakeDark.c

    r18011 r21230  
    77
    88    psImage *signal = readout->image;
    9     psImage *variance = readout->weight;
     9    psImage *variance = readout->variance;
    1010
    1111    psMetadata *recipe = psMetadataLookupMetadata(&mdok, config->recipes, PPSIM_RECIPE); // Recipe
     
    2929
    3030    for (int y = 0; y < signal->numRows; y++) {
    31         for (int x = 0; x < signal->numCols; x++) {
    32                        
    33             // Dark current
    34             float darkCurrent = darkRate * expTime; // Dark current accumulated
    35             signal->data.F32[y][x] += darkCurrent;
    36             variance->data.F32[y][x] += darkCurrent;
    37         }
     31        for (int x = 0; x < signal->numCols; x++) {
     32
     33            // Dark current
     34            float darkCurrent = darkRate * expTime; // Dark current accumulated
     35            signal->data.F32[y][x] += darkCurrent;
     36            variance->data.F32[y][x] += darkCurrent;
     37        }
    3838    }
    3939    return true;
  • branches/pap_branch_20090128/ppSim/src/ppSimMakeSky.c

    r20366 r21230  
    99
    1010    psImage *signal = readout->image;
    11     psImage *variance = readout->weight;
     11    psImage *variance = readout->variance;
    1212
    1313    pmCell *cell = readout->parent;
     
    1919    bool sky  = psMetadataLookupBool(&status, recipe, "SKY"); // Generate a SKY flux?
    2020    bool flat = psMetadataLookupBool(&status, recipe, "FLAT"); // Apply flat-field term?
    21  
     21
    2222    float expTime      = psMetadataLookupF32(&status, recipe, "EXPTIME"); // Exposure time
    2323
     
    2929    float skyMags      = psMetadataLookupF32(&status, recipe, "SKY.MAGS");  assert (status);
    3030    if (!isnan(skyMags)) {
    31         float zp       = psMetadataLookupF32(&status, recipe, "ZEROPOINT"); assert (status);
    32         float scale    = psMetadataLookupF32(&status, recipe, "PIXEL.SCALE"); assert (status);
    33         skyRate = scale * scale * ppSimMagToFlux (skyMags, zp);
     31        float zp       = psMetadataLookupF32(&status, recipe, "ZEROPOINT"); assert (status);
     32        float scale    = psMetadataLookupF32(&status, recipe, "PIXEL.SCALE"); assert (status);
     33        skyRate = scale * scale * ppSimMagToFlux (skyMags, zp);
    3434    }
    3535    if (type == PPSIM_TYPE_FLAT) {
     
    3737    }
    3838
    39     int x0Chip        = psMetadataLookupS32(&status, chip->concepts, "CHIP.X0");
    40     int y0Chip        = psMetadataLookupS32(&status, chip->concepts, "CHIP.Y0");
     39    int x0Chip        = psMetadataLookupS32(&status, chip->concepts, "CHIP.X0");
     40    int y0Chip        = psMetadataLookupS32(&status, chip->concepts, "CHIP.Y0");
    4141    int xParityChip   = psMetadataLookupS32(&status, chip->concepts, "CHIP.XPARITY");
    4242    int yParityChip   = psMetadataLookupS32(&status, chip->concepts, "CHIP.YPARITY");
    4343
    44     int x0Cell        = psMetadataLookupS32(&status, cell->concepts, "CELL.X0");
    45     int y0Cell        = psMetadataLookupS32(&status, cell->concepts, "CELL.Y0");
     44    int x0Cell        = psMetadataLookupS32(&status, cell->concepts, "CELL.X0");
     45    int y0Cell        = psMetadataLookupS32(&status, cell->concepts, "CELL.Y0");
    4646    int xParityCell   = psMetadataLookupS32(&status, cell->concepts, "CELL.XPARITY");
    4747    int yParityCell   = psMetadataLookupS32(&status, cell->concepts, "CELL.YPARITY");
     
    7272            // Gaussian flat-field over the FPA with flatValue = 1.0 at the field center
    7373            float flatValue = 1.0;
    74             if (flat) {
    75                 // we make the flat-field have a response of 1.0 at the field center (like a vignetting)
    76                 flatValue = expf(-0.5 / PS_SQR(flatSigma) * (PS_SQR(yFPA) + PS_SQR(xFPA)));
    77             }
     74            if (flat) {
     75                // we make the flat-field have a response of 1.0 at the field center (like a vignetting)
     76                flatValue = expf(-0.5 / PS_SQR(flatSigma) * (PS_SQR(yFPA) + PS_SQR(xFPA)));
     77            }
    7878
    79             float scatterRate = 0.0;
     79            float scatterRate = 0.0;
    8080
    81             if (sky) {
    82               // add a scattered light term to the flat-field images
    83               if (type == PPSIM_TYPE_FLAT) {
    84                   scatterRate = scatterFrac * PS_SQR(xFPA);
    85               }
     81            if (sky) {
     82              // add a scattered light term to the flat-field images
     83              if (type == PPSIM_TYPE_FLAT) {
     84                  scatterRate = scatterFrac * PS_SQR(xFPA);
     85              }
    8686
    87               // Sky background
    88               float skyFlux = (skyRate * (flatValue + scatterRate)) * realExpTime; // Flux from sky
    89               signal->data.F32[y][x] += skyFlux;
    90               variance->data.F32[y][x] += skyFlux;
    91             }
     87              // Sky background
     88              float skyFlux = (skyRate * (flatValue + scatterRate)) * realExpTime; // Flux from sky
     89              signal->data.F32[y][x] += skyFlux;
     90              variance->data.F32[y][x] += skyFlux;
     91            }
    9292
    93             // used later to modify the star and galaxy photometry
    94             if (expCorr) {
    95                 // exposure correction is (effective exposure time) * (flatValue)
    96               expCorr->data.F32[y][x] = flatValue * realExpTime / expTime;
    97             }
     93            // used later to modify the star and galaxy photometry
     94            if (expCorr) {
     95                // exposure correction is (effective exposure time) * (flatValue)
     96              expCorr->data.F32[y][x] = flatValue * realExpTime / expTime;
     97            }
    9898
    9999            // TO DO: Add fringes
  • branches/pap_branch_20090128/ppSim/src/ppSimMergeReadouts.c

    r18011 r21230  
    1414    if (!inReadout) return true;
    1515
    16     if (!inReadout->weight) {
    17       if (!pmReadoutGenerateWeight(inReadout, true)) {
    18         psError (PS_ERR_UNKNOWN, false, "trouble creating weight");
    19         return false;
     16    if (!inReadout->variance) {
     17      if (!pmReadoutGenerateVariance(inReadout, true)) {
     18        psError (PS_ERR_UNKNOWN, false, "trouble creating variance");
     19        return false;
    2020      }
    2121    }
     
    3030
    3131    psImage *inSignal = inReadout->image;
    32     psImage *inVariance = inReadout->weight;
     32    psImage *inVariance = inReadout->variance;
    3333
    3434    psImage *outSignal = outReadout->image;
    35     psImage *outVariance = outReadout->weight;
     35    psImage *outVariance = outReadout->variance;
    3636
    3737    assert (inSignal->numRows == outSignal->numRows);
     
    3939
    4040    for (int y = 0; y < inSignal->numRows; y++) {
    41         for (int x = 0; x < inSignal->numCols; x++) {
    42             outSignal->data.F32[y][x] += inSignal->data.F32[y][x];
    43             outVariance->data.F32[y][x] += inVariance->data.F32[y][x];
    44         }
     41        for (int x = 0; x < inSignal->numCols; x++) {
     42            outSignal->data.F32[y][x] += inSignal->data.F32[y][x];
     43            outVariance->data.F32[y][x] += inVariance->data.F32[y][x];
     44        }
    4545    }
    4646    return true;
  • branches/pap_branch_20090128/ppSim/src/ppSimPhotomReadoutFake.c

    r20403 r21230  
    1212    }
    1313
    14 # if 0   
     14# if 0
    1515    // set the photcode for this image
    1616    if (!psphotAddPhotcode (recipe, config, view, "PPSIM.FAKE.CHIP")) {
     
    2222    // *** in this section, perform the photometry for real + fake sources on PPSIM.FAKE.CHIP ***
    2323
    24     // find the currently selected readout. 
     24    // find the currently selected readout.
    2525    // we always perform photometry on the mosaiced chip
    2626    pmReadout  *readout = pmFPAfileThisReadout (config->files, view, "PPSIM.FAKE.CHIP");
     
    3535    PS_ASSERT_PTR_NON_NULL (injectedSources, false);
    3636
    37     // Generate the mask and weight images, including the user-defined analysis region of interest
    38     psphotSetMaskAndWeight (config, readout, recipe);
     37    // Generate the mask and variance images, including the user-defined analysis region of interest
     38    psphotSetMaskAndVariance (config, readout, recipe);
    3939
    4040    // XXX need to define the source pixels
     
    5353    psArray *realSources = psArrayAlloc (realMeasuredSources->n);
    5454    for (int i = 0; i < realMeasuredSources->n; i++) {
    55         realSources->data[i] = pmSourceCopy (realMeasuredSources->data[i]);
     55        realSources->data[i] = pmSourceCopy (realMeasuredSources->data[i]);
    5656    }
    5757
    5858    // load the psf model, if suppled.  FWHM_X,FWHM_Y,etc are saved in the recipe
    59     // this function uses PSPHOT.PSF.LOAD as the pmFPAfile 
     59    // this function uses PSPHOT.PSF.LOAD as the pmFPAfile
    6060    pmPSF *psf = psphotLoadPSF (config, view, recipe);
    6161    assert (psf);
    6262
    63     // remove all sources 
     63    // remove all sources
    6464    psphotRemoveAllSources (realSources, recipe);
    6565
     
    7676
    7777    // XXX fake sources should measure peak->x,y, force sources should not
    78     psMaskType maskVal = 0xff; 
     78    psMaskType maskVal = 0xff;
    7979    psImage *significance = psphotSignificanceImage (readout, recipe, 1, maskVal);
    8080    ppSimDetections (significance, recipe, fakeSources);
     
    9090    psphotGuessModels (config, readout, realSources, psf);
    9191    psphotGuessModels (config, readout, fakeSources, psf);
    92    
     92
    9393    // linear fit to real + fake sources
    9494    psArray *sources = ppSimMergeSources (realSources, fakeSources);
     
    9898
    9999    // calculate source magnitudes (for which set??)
    100     psphotMagnitudes(config, view, fakeSources, recipe, psf);
     100    psphotMagnitudes(config, readout, view, fakeSources, psf);
    101101
    102102    // drop the references to the image pixels held by each source
     
    113113    pmReadout *fakeReadout = pmFPAfileThisReadout (config->files, view, "PPSIM.FAKE.SOURCES");
    114114    if (!fakeReadout) {
    115         fakeReadout = pmReadoutAlloc (fakeCell);
    116         psFree (fakeReadout); // there is a copy on 'cell' as well
     115        fakeReadout = pmReadoutAlloc (fakeCell);
     116        psFree (fakeReadout); // there is a copy on 'cell' as well
    117117    }
    118118    psAssert (fakeReadout, "no fakeReadout?");
  • branches/pap_branch_20090128/ppSim/src/ppSimPhotomReadoutForce.c

    r20403 r21230  
    1212    }
    1313
    14 # if 0   
     14# if 0
    1515    // set the photcode for this image
    1616    if (!psphotAddPhotcode (recipe, config, view, "PPSIM.FAKE.CHIP")) {
     
    2222    // *** in this section, perform the photometry for real + force sources on PPSIM.FORCE.CHIP ***
    2323
    24     // find the currently selected readout. 
     24    // find the currently selected readout.
    2525    // we always perform photometry on the mosaiced chip
    2626    pmReadout  *readout = pmFPAfileThisReadout (config->files, view, "PPSIM.FORCE.CHIP");
     
    3535    psAssert (forceSources, "failed to load force photometry sources");
    3636
    37     // Generate the mask and weight images, including the user-defined analysis region of interest
    38     psphotSetMaskAndWeight (config, readout, recipe);
     37    // Generate the mask and variance images, including the user-defined analysis region of interest
     38    psphotSetMaskAndVariance (config, readout, recipe);
    3939
    4040    // XXX need to define the source pixels
     
    4646    psArray *realSources = psArrayAlloc (realMeasuredSources->n);
    4747    for (int i = 0; i < realMeasuredSources->n; i++) {
    48         realSources->data[i] = pmSourceCopy (realMeasuredSources->data[i]);
     48        realSources->data[i] = pmSourceCopy (realMeasuredSources->data[i]);
    4949    }
    5050
    5151    // load the psf model, if suppled.  FWHM_X,FWHM_Y,etc are saved in the recipe
    52     // this function uses PSPHOT.PSF.LOAD as the pmFPAfile 
     52    // this function uses PSPHOT.PSF.LOAD as the pmFPAfile
    5353    pmPSF *psf = psphotLoadPSF (config, view, recipe);
    5454    assert (psf);
    5555
    56     // remove all sources 
     56    // remove all sources
    5757    psphotRemoveAllSources (realSources, recipe);
    5858
     
    6969
    7070    // XXX fake sources should measure peak->x,y, force sources should not
    71     psMaskType maskVal = 0xff; 
     71    psMaskType maskVal = 0xff;
    7272    psImage *significance = psphotSignificanceImage (readout, recipe, 1, maskVal);
    7373    ppSimDetections (significance, recipe, forceSources);
     
    8383    psphotGuessModels (config, readout, realSources, psf);
    8484    psphotGuessModels (config, readout, forceSources, psf);
    85    
     85
    8686    // linear fit to real + force sources
    8787    psArray *sources = ppSimMergeSources (realSources, forceSources);
     
    9191
    9292    // calculate source magnitudes (for which set??)
    93     psphotMagnitudes(config, view, forceSources, recipe, psf);
     93    psphotMagnitudes(config, readout, view, forceSources, psf);
    9494
    9595    // drop the references to the image pixels held by each source
     
    106106    pmReadout *forceReadout = pmFPAfileThisReadout (config->files, view, "PPSIM.FORCE.SOURCES");
    107107    if (!forceReadout) {
    108         forceReadout = pmReadoutAlloc (forceCell);
    109         psFree (forceReadout); // there is a copy on 'cell' as well
     108        forceReadout = pmReadoutAlloc (forceCell);
     109        psFree (forceReadout); // there is a copy on 'cell' as well
    110110    }
    111111    psAssert (forceReadout, "no forceReadout?");
Note: See TracChangeset for help on using the changeset viewer.