IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 30, 2022, 4:30:17 PM (4 years ago)
Author:
eugene
Message:

added -psf option; fpcamera seems to work quite well now if supplied the psf file measured for the chip

Location:
branches/eam_branches/ipp-20220316/fpcamera/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20220316/fpcamera/src/fpcameraAnalysis.c

    r42183 r42186  
    2020
    2121    // loop over the input images
    22     pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "FPCAMERA.INPUT");
     22    pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "FPCAMERA.INPUT");
    2323    if (!input) ESCAPE(FPCAMERA_ERR_CONFIG, "Can't find or interpret output file rule FPCAMERA.INPUT!");
    2424
    2525    // astrometry reference (smf)
    26     pmFPAfile *astrom = psMetadataLookupPtr (NULL, config->files, "FPCAMERA.INPUT.ASTROM");
     26    pmFPAfile *astrom = psMetadataLookupPtr (&status, config->files, "FPCAMERA.INPUT.ASTROM");
    2727    if (!astrom) ESCAPE(FPCAMERA_ERR_CONFIG, "Can't find or interpret output file rule FPCAMERA.INPUT.ASTROM!");
    2828
     
    3333    pmFPAfileActivate (config->files, true, "FPCAMERA.INPUT.VARIANCE");
    3434    pmFPAfileActivate (config->files, true, "FPCAMERA.RESID");
    35     // Note FPCAMERA.RESID is tied to FPCAMERA.INPUT so they must be active in the same block.
     35    pmFPAfileActivate (config->files, true, "PSPHOT.PSF.LOAD"); // if this file is defined, we need to activate it now
     36    // Note: the output file FPCAMERA.RESID is tied to FPCAMERA.INPUT so they must be active in the same block.
    3637
    3738    view = pmFPAviewAlloc (0);
     
    5758
    5859                fpcameraChooseRefstars (input, astrom, view);
     60
     61                // Provide a simple (wrong) PSF as a default if psf model is not supplied with -psf or -psflist.
     62                // The user-supplied psf model will replace this one on a chip-by-chip basis
     63                // pmPSF *psf = pmPSFBuildSimple ("PS_MODEL_PS1_V1", 5.0, 5.0, 0.0, 0.5);
     64                pmPSF *psf = pmPSFBuildSimple ("PS_MODEL_GAUSS", 5.0, 5.0, 0.0);
     65                psf->fieldNx = readout->image->numCols;
     66                psf->fieldNy = readout->image->numRows;
     67                psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_META_REPLACE | PS_DATA_UNKNOWN, "psphot PSF model", psf);
     68                psFree (psf);
     69
     70                if (!psphotForcedReadout (config, view, "FPCAMERA.INPUT")) ESCAPE(FPCAMERA_ERR_DATA, "failure in psphotForcedReadout");
    5971            }
     72            // drop all versions of the internal files
     73            status = true;
     74            status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL");
     75            status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV");
     76            status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND");
     77            if (!status) ESCAPE(FPCAMERA_ERR_PROG, "trouble dropping internal files");
    6078        }
    6179        if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE(FPCAMERA_ERR_IO, "failure in IOChecks(AFTER) at Chip");
     
    7290// chip->process is set (unset) based on command-line -chip selections (in fpcameraArguments)
    7391// chip->file_exists is set (in pmFPAFlags.c:pmChipSetFileStatus) by pmFPAfileDefineFromArgs (in pmFPAAddSource...)
     92
     93/*
     94        // XXX set sxx, etc from FWHM in recipe
     95        pmPSF *psf = pmPSFBuildSimple (modelNames->data[0], 1.0, 1.0, 0.0, 1.0);
     96        psf->fieldNx = readout->image->numCols;
     97        psf->fieldNy = readout->image->numRows;
     98        psFree (modelNames);
     99
     100*/
  • branches/eam_branches/ipp-20220316/fpcamera/src/fpcameraArguments.c

    r42183 r42186  
    1111    fpcameraErrorRegister();            // register our error codes/messages
    1212    pmModelClassInit();                 // model inits are needed in pmSourceIO
     13    psphotInit();
    1314
    1415    if (argc == 1) ESCAPE(FPCAMERA_ERR_ARGUMENTS, "No arguments supplied");
     
    7273    if (!status) ESCAPE(FPCAMERA_ERR_ARGUMENTS, "Missing -astrom-file (input) : provide an smf or similar");
    7374
     75    // specify the input images to process
     76    status = pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT.PSF", "-psf",     "-psflist");
     77    // user-supplied psf model is optional
     78   
    7479    if (argc != 2) ESCAPE(FPCAMERA_ERR_ARGUMENTS, "Incorrect number of arguments supplied");
    7580
  • branches/eam_branches/ipp-20220316/fpcamera/src/fpcameraChooseRefstars.c

    r42183 r42186  
    105105    pmDetections *detections = pmDetectionsAlloc();
    106106    detections->allSources   = psArrayAllocEmpty (100);
     107    detections->newSources   = psArrayAllocEmpty (100);
    107108
    108109    bool status = psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "psphot detections", detections);
  • branches/eam_branches/ipp-20220316/fpcamera/src/fpcameraCleanup.c

    r42178 r42186  
    33/* \brief this loop saves the photometry/astrometry data files */
    44void fpcameraCleanup (pmConfig *config, psMetadata *stats) {
     5
     6    psMemCheckCorruption (stderr, true);
    57
    68    psFree (stats);
     
    1012
    1113    psTimerStop ();
    12     psMemCheckCorruption (stderr, true);
     14    psphotVisualClose();
     15
    1316    pmModelClassCleanup ();
    1417    psTimeFinalize ();
    1518    pmConceptsDone ();
    1619    pmConfigDone ();
     20
     21    pmSourceFitSetDone ();
     22    psLibFinalize();
     23
    1724    fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "fpcamera");
    1825    return;
  • branches/eam_branches/ipp-20220316/fpcamera/src/fpcameraParseCamera.c

    r42183 r42186  
    1919    if (!status) ESCAPE (PS_ERR_UNKNOWN, "failed to load find definition");
    2020
     21    pmFPAfile *psphotInput = pmFPAfileDefineFromFile (config, input, 1, 1, "PSPHOT.INPUT");
     22    if (!psphotInput) ESCAPE(FPCAMERA_ERR_CONFIG, "Failed to define FPA for PSPHOT.INPUT");
     23
    2124    if (!psphotSetMaskBits (config)) ESCAPE (PS_ERR_UNKNOWN, "failed to set mask bit values");
    2225
     
    2427    pmFPAfileDefineFromArgs (&status, config, "FPCAMERA.INPUT.ASTROM", "INPUT.ASTROM");
    2528    if (!status) ESCAPE(FPCAMERA_ERR_CONFIG, "Failed to build FPA from FPCAMERA.INPUT.ASTROM");
     29
     30    // if optional PSF model is supplied, associate with input file
     31    if (psMetadataLookupPtr(NULL, config->arguments, "INPUT.PSF")) {
     32        pmFPAfileBindFromArgs(&status, input, config, "PSPHOT.PSF.LOAD", "INPUT.PSF");
     33        if (!status) ESCAPE(FPCAMERA_ERR_CONFIG, "Failed to find/build PSPHOT.PSF.LOAD");
     34    }
    2635
    2736    // select the current recipe
     
    5665    return true;
    5766}
     67
Note: See TracChangeset for help on using the changeset viewer.