IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 31, 2010, 5:01:05 PM (16 years ago)
Author:
eugene
Message:

updates relative to 20091201, fixes for all psphot variants

Location:
branches/eam_branches/psphot.stack.20100120
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/psphot.stack.20100120

  • branches/eam_branches/psphot.stack.20100120/src/psphotReadoutFindPSF.c

    r26611 r26748  
    77    psTimerStart ("psphotReadout");
    88
    9     // select the current recipe
    10     psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
    11     if (!recipe) {
    12         psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSPHOT_RECIPE);
    13         return false;
    14     }
    15 
    169    // set the photcode for the PSPHOT.INPUT
    1710    if (!psphotAddPhotcode(config, view)) {
     
    2013    }
    2114
    22     // find the currently selected readout
    23     pmReadout  *readout = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT");
    24     PS_ASSERT_PTR_NON_NULL (readout, false);
    25 
    2615    // Generate the mask and variance images, including the user-defined analysis region of interest
    27     psphotSetMaskAndVariance (config, view, recipe);
    28 
    29     // display the image, weight, mask (ch 1,2,3)
    30     psphotVisualShowImage (readout);
     16    psphotSetMaskAndVariance (config, view);
    3117
    3218    // Note that in this implementation, we do NOT model the background and we do not
     
    3420
    3521    // include externally-supplied sources (supplied as PSPHOT.INPUT.CMF)
    36     pmDetections *detections = psphotDetectionsFromSources (config, inSources);
    37     if (!detections || !detections->peaks) {
     22    // XXX we assume a single set of input sources is supplied
     23    if (!psphotDetectionsFromSources (config, view, inSources)) {
    3824        psError(PSPHOT_ERR_ARGUMENTS, true, "Can't find PSF stars");
    39         return psphotReadoutCleanup(config, readout, recipe, detections, NULL, NULL);
     25        return psphotReadoutCleanup(config, view);
    4026    }
    4127
    4228    // construct sources and measure basic stats (moments, local sky)
    43     psArray *sources = psphotSourceStats(config, readout, detections, true);
    44     if (!sources) return false;
     29    if (!psphotSourceStats(config, view, true)) {
     30        psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources");
     31        return false;
     32    }
    4533
    46     // peak flux is wrong : set based on previous image
    47     // use the peak measured in the moments analysis:
    48     for (int i = 0; i < sources->n; i++) {
    49       pmSource *source = sources->data[i];
    50       source->peak->flux = source->moments->Peak;
     34    // peak flux is wrong : use the peak measured in the moments analysis:
     35    if (!psphotRepairLoadedSources(config, view)) {
     36        psError(PSPHOT_ERR_UNKNOWN, false, "failure to repair sources");
     37        return false;
    5138    }
    5239
    5340    // classify sources based on moments, brightness (psf is not known)
    54     if (!psphotRoughClass (readout, sources, recipe, false)) {
    55         psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
    56         return psphotReadoutCleanup (config, readout, recipe, detections, NULL, sources);
     41    if (!psphotRoughClass (config, view)) {
     42        psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough source class");
     43        return psphotReadoutCleanup (config, view);
    5744    }
    5845
    59     if (!psphotImageQuality (recipe, sources)) {
    60         psLogMsg("psphot", 3, "failed to measure image quality");
    61         return psphotReadoutCleanup(config, readout, recipe, detections, NULL, sources);
     46    if (!psphotImageQuality (config, view)) {
     47        psError (PSPHOT_ERR_UNKNOWN, false, "failed to measure image quality");
     48        return psphotReadoutCleanup(config, view);
    6249    }
    6350
    64     pmPSF *psf = psphotChoosePSF(readout, sources, recipe);
    65     if (!psf) {
     51    if (!psphotChoosePSF(config, view)) {
    6652        psError(PSPHOT_ERR_PSF, false, "Failed to construct a psf model");
    67         psFree(sources);
    68         return psphotReadoutCleanup(config, readout, recipe, detections, NULL, NULL);
     53        return psphotReadoutCleanup(config, view);
    6954    }
    70     psphotVisualShowPSFModel(readout, psf);
    7155
    7256# if 0
     
    7559    // fits from that analysis, or run the linear PSF fit for all objects currently in hand
    7660    // construct an initial model for each object, set the radius to fitRadius, set circular fit mask
    77     psphotGuessModels (config, readout, sources, psf);
     61    psphotGuessModels (config, view);
    7862
    7963    // measure aperture photometry corrections
    80     if (!psphotApResid (config, readout, sources, psf)) {
     64    if (!psphotApResid (config, view)) {
    8165        psLogMsg ("psphot", 3, "failed on psphotApResid");
    82         return psphotReadoutCleanup (config, readout, recipe, detections, psf, sources);
     66        return psphotReadoutCleanup (config, view);
    8367    }
    8468# endif
    8569
    8670    // drop the references to the image pixels held by each source
    87     psphotSourceFreePixels(sources);
    88     psFree(sources);
     71    psphotSourceFreePixels(config, view);
    8972
    9073    // create the exported-metadata and free local data
    91     return psphotReadoutCleanup(config, readout, recipe, detections, psf, NULL);
     74    return psphotReadoutCleanup(config, view);
    9275}
Note: See TracChangeset for help on using the changeset viewer.