IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 6, 2009, 6:52:51 PM (17 years ago)
Author:
Paul Price
Message:

Making ppSub inverse mode work. Seems to work now --- produces the correct output files for inverse mode on and off, photometry on and off.

Location:
branches/pap/ppSub/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap/ppSub/src

    • Property svn:ignore
      •  

        old new  
        1010stamp-h1
        1111ppSubKernel
         12ppSubErrorCodes.h
         13ppSubErrorCodes.c
  • branches/pap/ppSub/src/ppSubMakePSF.c

    r23688 r23719  
    2222#include "ppSub.h"
    2323
    24 bool ppSubMakePSF(pmConfig *config, ppSubData *data, const pmFPAview *view)
     24bool ppSubMakePSF(pmConfig *config, ppSubData *data)
    2525{
    2626    psAssert(config, "Require configuration");
    27     psAssert(view, "Require view");
     27
     28    if (!data->photometry) {
     29        return true;
     30    }
    2831
    2932    psTimerStart("PPSUB_PHOT");
     
    4447    pmReadout *minuend = NULL;          // Image that will be positive following subtraction
    4548    pmFPAfile *minuendFile = NULL;      // File for minuend image
     49    pmFPAview *view = ppSubViewReadout(); // View to readout
    4650    if (reverse) {
    4751        minuend = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.CONV");
     
    5357
    5458#if 1
     59    pmFPAfile *photFile = psMetadataLookupPtr(&mdok, config->files, "PSPHOT.INPUT"); // Photometry file
     60#if 0
     61    pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout to photometer
    5562    pmReadout *template = minuend;
    56     pmFPAfile *photFile = psMetadataLookupPtr(&mdok, config->files, "PSPHOT.INPUT"); // Photometry file
    57     pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout to photometer
    5863    if (!photRO) {
    5964        pmCell *cell = pmFPAviewThisCell(view, photFile->fpa); // Cell to photometer
     
    7479    }
    7580#else
     81    if (!pmFPACopy(photFile->fpa, minuendFile->fpa)) {
     82        psError(PS_ERR_UNKNOWN, false, "Unable to copy FPA for photometry");
     83        psFree(view);
     84        return false;
     85    }
     86    pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout to photometer
     87    if (psMetadataLookup(photRO->analysis, "PSPHOT.SOURCES")) {
     88        psMetadataRemoveKey(photRO->analysis, "PSPHOT.SOURCES");
     89    }
     90#endif
     91
     92
     93#else
    7694    // Supply the minuend pmFPAfile to psphot as PSPHOT.INPUT:
    7795    psMetadataAddPtr(config->files, PS_LIST_TAIL, "PSPHOT.INPUT", PS_DATA_UNKNOWN | PS_META_REPLACE,
     
    87105        psErrorStackPrint(stderr, "Unable to determine PSF");
    88106        psWarning("Unable to determine PSF --- suspect bad data quality.");
    89         ppSubDataQuality(config, data, PSPHOT_ERR_PSF, PPSUB_FILES_PHOT);
     107        ppSubDataQuality(config, data, PSPHOT_ERR_PSF, PPSUB_FILES_PHOT_SUB | PPSUB_FILES_PHOT_INV);
     108        psFree(view);
    90109        return true;
    91110    }
     
    93112    // Record the FWHM in the output header
    94113    pmReadout *outRO = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT"); // Output readout
     114    psFree(view);
    95115    pmHDU *hdu = pmHDUFromCell(outRO->parent); // HDU with header
    96116    psMetadataItemSupplement(hdu->header, psphotRecipe, "FWHM_MAJ");
     
    100120    psMetadataRemoveKey(photRO->analysis, "PSPHOT.HEADER");
    101121
     122    data->psf = psMemIncrRefCounter(psMetadataLookupPtr(NULL, photRO->parent->parent->analysis,
     123                                                        "PSPHOT.PSF"));
     124
    102125    return true;
    103126}
Note: See TracChangeset for help on using the changeset viewer.