IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 18, 2010, 4:11:53 PM (16 years ago)
Author:
eugene
Message:

merge changes from branches/eam_branches/psphot,psModules.20100506 (finish basic psphotStack)

Location:
trunk/psphot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot

  • trunk/psphot/src/psphot.h

    r27819 r28013  
    3737bool            psphotReadoutMinimal(pmConfig *config, const pmFPAview *view);
    3838
    39 bool            psphotReadoutCleanup (pmConfig *config, const pmFPAview *view);
    40 bool            psphotReadoutCleanupReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
     39bool            psphotReadoutCleanup (pmConfig *config, const pmFPAview *view, const char *filerule);
     40bool            psphotReadoutCleanupReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
    4141
    4242bool            psphotDefineFiles (pmConfig *config, pmFPAfile *input);
     
    5151
    5252// psphotReadout functions
    53 bool            psphotAddPhotcode (pmConfig *config, const pmFPAview *view);
     53bool            psphotAddPhotcode (pmConfig *config, const pmFPAview *view, const char *filerule);
    5454bool            psphotAddPhotcodeReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
    5555
    56 bool            psphotSetMaskAndVariance (pmConfig *config, const pmFPAview *view);
    57 bool            psphotSetMaskAndVarianceReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    58 
    59 bool            psphotModelBackground (pmConfig *config, const pmFPAview *view);
    60 bool            psphotModelBackgroundReadoutFileIndex (pmConfig *config, const pmFPAview *view, const char *filename, int index);
    61 
    62 bool            psphotSubtractBackground (pmConfig *config, const pmFPAview *view);
    63 bool            psphotSubtractBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    64 
    65 bool            psphotFindDetections (pmConfig *config, const pmFPAview *view, bool firstPass);
    66 bool            psphotFindDetectionsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe, bool firstPass);
    67 
    68 bool            psphotSourceStats (pmConfig *config, const pmFPAview *view, bool setWindow);
    69 bool            psphotSourceStatsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe, bool setWindow);
    70 
    71 bool            psphotDeblendSatstars (pmConfig *config, const pmFPAview *view);
    72 bool            psphotDeblendSatstarsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index);
    73 
    74 bool            psphotBasicDeblend (pmConfig *config, const pmFPAview *view);
    75 bool            psphotBasicDeblendReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index);
    76 
    77 bool            psphotRoughClass (pmConfig *config, const pmFPAview *view);
    78 bool            psphotRoughClassReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
     56bool            psphotSetMaskAndVariance (pmConfig *config, const pmFPAview *view, const char *filerule);
     57bool            psphotSetMaskAndVarianceReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     58
     59bool            psphotModelBackground (pmConfig *config, const pmFPAview *view, const char *filerule);
     60bool            psphotModelBackgroundReadoutFileIndex (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
     61
     62bool            psphotSubtractBackground (pmConfig *config, const pmFPAview *view, const char *filerule);
     63bool            psphotSubtractBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     64
     65bool            psphotFindDetections (pmConfig *config, const pmFPAview *view, const char *filerule, bool firstPass);
     66bool            psphotFindDetectionsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool firstPass);
     67
     68bool            psphotSourceStats (pmConfig *config, const pmFPAview *view, const char *filerule, bool setWindow);
     69bool            psphotSourceStatsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool setWindow);
     70
     71bool            psphotDeblendSatstars (pmConfig *config, const pmFPAview *view, const char *filerule);
     72bool            psphotDeblendSatstarsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
     73
     74bool            psphotBasicDeblend (pmConfig *config, const pmFPAview *view, const char *filerule);
     75bool            psphotBasicDeblendReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
     76
     77bool            psphotRoughClass (pmConfig *config, const pmFPAview *view, const char *filerule);
     78bool            psphotRoughClassReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
    7979bool            psphotRoughClassRegion (int nRegion, psRegion *region, psArray *sources, psMetadata *analysis, psMetadata *recipe, const bool havePSF);
    8080
    81 bool            psphotImageQuality (pmConfig *config, const pmFPAview *view);
    82 bool            psphotImageQualityReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    83 
    84 bool            psphotChoosePSF (pmConfig *config, const pmFPAview *view);
    85 bool            psphotChoosePSFReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    86 
    87 bool            psphotGuessModels (pmConfig *config, const pmFPAview *view);
    88 bool            psphotGuessModelsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index);
    89 
    90 bool            psphotMergeSources (pmConfig *config, const pmFPAview *view);
    91 bool            psphotMergeSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index);
    92 
    93 bool            psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, bool final);
     81bool            psphotImageQuality (pmConfig *config, const pmFPAview *view, const char *filerule);
     82bool            psphotImageQualityReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     83
     84bool            psphotChoosePSF (pmConfig *config, const pmFPAview *view, const char *filerule);
     85bool            psphotChoosePSFReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     86
     87bool            psphotGuessModels (pmConfig *config, const pmFPAview *view, const char *filerule);
     88bool            psphotGuessModelsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
     89
     90bool            psphotMergeSources (pmConfig *config, const pmFPAview *view, const char *filerule);
     91bool            psphotMergeSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
     92
     93bool            psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final);
    9494bool            psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final);
    9595
    96 bool            psphotSourceSize (pmConfig *config, const pmFPAview *view, bool getPSFsize);
    97 bool            psphotSourceSizeReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe, bool getPSFsize);
    98 
    99 bool            psphotBlendFit (pmConfig *config, const pmFPAview *view);
    100 bool            psphotBlendFitReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
     96bool            psphotSourceSize (pmConfig *config, const pmFPAview *view, const char *filerule, bool getPSFsize);
     97bool            psphotSourceSizeReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool getPSFsize);
     98
     99bool            psphotBlendFit (pmConfig *config, const pmFPAview *view, const char *filerule);
     100bool            psphotBlendFitReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
    101101bool            psphotBlendFit_Threaded (psThreadJob *job);
    102102
    103 bool            psphotReplaceAllSources (pmConfig *config, const pmFPAview *view);
    104 bool            psphotReplaceAllSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    105 
    106 bool            psphotAddNoise (pmConfig *config, const pmFPAview *view);
    107 bool            psphotSubNoise (pmConfig *config, const pmFPAview *view);
    108 bool            psphotAddOrSubNoise (pmConfig *config, const pmFPAview *view, bool add);
    109 bool            psphotAddOrSubNoiseReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe, bool add);
    110 
    111 bool            psphotExtendedSourceAnalysis (pmConfig *config, const pmFPAview *view);
    112 bool            psphotExtendedSourceAnalysisReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    113 
    114 bool            psphotExtendedSourceFits (pmConfig *config, const pmFPAview *view);
    115 bool            psphotExtendedSourceFitsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    116 
    117 bool            psphotApResid (pmConfig *config, const pmFPAview *view);
    118 bool            psphotApResidReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    119 
    120 bool            psphotMagnitudes (pmConfig *config, const pmFPAview *view);
     103bool            psphotReplaceAllSources (pmConfig *config, const pmFPAview *view, const char *filerule);
     104bool            psphotReplaceAllSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     105
     106bool            psphotAddNoise (pmConfig *config, const pmFPAview *view, const char *filerule);
     107bool            psphotSubNoise (pmConfig *config, const pmFPAview *view, const char *filerule);
     108bool            psphotAddOrSubNoise (pmConfig *config, const pmFPAview *view, const char *filerule, bool add);
     109bool            psphotAddOrSubNoiseReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool add);
     110
     111bool            psphotExtendedSourceAnalysis (pmConfig *config, const pmFPAview *view, const char *filerule);
     112bool            psphotExtendedSourceAnalysisReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     113
     114bool            psphotExtendedSourceFits (pmConfig *config, const pmFPAview *view, const char *filerule);
     115bool            psphotExtendedSourceFitsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     116
     117bool            psphotApResid (pmConfig *config, const pmFPAview *view, const char *filerule);
     118bool            psphotApResidReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     119
     120bool            psphotMagnitudes (pmConfig *config, const pmFPAview *view, const char *filerule);
    121121bool            psphotMagnitudesReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, pmReadout *readout, psArray *sources, pmPSF *psf);
    122122bool            psphotMagnitudes_Threaded (psThreadJob *job);
    123123
    124 bool            psphotEfficiency (pmConfig *config, const pmFPAview *view);
    125 bool            psphotEfficiencyReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
     124bool            psphotEfficiency (pmConfig *config, const pmFPAview *view, const char *filerule);
     125bool            psphotEfficiencyReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
    126126
    127127bool            psphotPSFWeights(pmConfig *config, pmReadout *readout, const pmFPAview *view, psArray *sources);
    128128bool            psphotPSFWeights_Threaded (psThreadJob *job);
    129129
    130 bool            psphotSkyReplace (pmConfig *config, const pmFPAview *view);
    131 bool            psphotSkyReplaceReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index);
    132 
    133 bool            psphotSourceFreePixels (pmConfig *config, const pmFPAview *view);
    134 bool            psphotSourceFreePixelsReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index);
     130bool            psphotSkyReplace (pmConfig *config, const pmFPAview *view, const char *filerule);
     131bool            psphotSkyReplaceReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
     132
     133bool            psphotSourceFreePixels (pmConfig *config, const pmFPAview *view, const char *filerule);
     134bool            psphotSourceFreePixelsReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index);
    135135
    136136// in psphotSourceStats.c:
     
    147147
    148148// in psphotMergeSources.c:
    149 bool            psphotLoadExtSources (pmConfig *config, const pmFPAview *view);
     149bool            psphotLoadExtSources (pmConfig *config, const pmFPAview *view, const char *filerule);
    150150psArray        *psphotLoadPSFSources (pmConfig *config, const pmFPAview *view);
    151 bool            psphotRepairLoadedSources (pmConfig *config, const pmFPAview *view);
    152 bool            psphotCheckExtSources (pmConfig *config, const pmFPAview *view);
     151bool            psphotRepairLoadedSources (pmConfig *config, const pmFPAview *view, const char *filerule);
     152bool            psphotCheckExtSources (pmConfig *config, const pmFPAview *view, const char *filerule);
    153153
    154154// generate the detection structure for the supplied array of sources
    155 bool            psphotDetectionsFromSources (pmConfig *config, const pmFPAview *view, psArray *sources);
     155bool            psphotDetectionsFromSources (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *sources);
    156156
    157157// generate the detection structure for the supplied array of sources
     
    349349bool psphotStackImageLoop (pmConfig *config);
    350350bool psphotStackReadout (pmConfig *config, const pmFPAview *view);
    351 bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view);
     351bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view, const char *ruleDet, const char *ruleCnv);
    352352bool psphotStackChisqImageAddReadout(const pmConfig *config, // Configuration
    353353                                     const pmFPAview *view,
     354                                     const char *filename,
    354355                                     pmReadout **chiReadout,
    355                                      char *filename,
    356356                                     int index);
    357357
    358 bool psphotStackRemoveChisqFromInputs (pmConfig *config);
     358bool psphotStackRemoveChisqFromInputs (pmConfig *config, const char *filerule);
    359359bool pmFPAfileRemoveSingle(psMetadata *files, const char *name, int num);
    360360
    361 psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view);
    362 bool psphotMatchSourcesReadout (psArray *objects, pmConfig *config, const pmFPAview *view, char *filename, int index);
     361psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view, const char *filerule);
     362bool psphotMatchSourcesReadout (psArray *objects, pmConfig *config, const pmFPAview *view, const char *filerule, int index);
    363363bool psphotMatchSourcesToObjects (psArray *objects, psArray *sources, float RADIUS);
    364364
     
    367367int pmPhotObjSortByX (const void **a, const void **b);
    368368
     369typedef enum {
     370    PSPHOT_CNV_SRC_NONE,
     371    PSPHOT_CNV_SRC_AUTO,
     372    PSPHOT_CNV_SRC_CNV,
     373    PSPHOT_CNV_SRC_RAW,
     374} psphotStackConvolveSource;
     375
     376/// Options for stacking process
     377typedef struct {
     378    // Setup
     379   
     380    int numCols;                            // size of image (X)
     381    int numRows;                            // size of image (Y)
     382
     383    int num;                            // Number of inputs
     384    bool convolve;                      // Convolve images?
     385    psphotStackConvolveSource convolveSource;
     386    // psArray *convImages, *convMasks, *convVariances; // Filenames for the temporary convolved images
     387
     388    // bool matchZPs;                      // Adjust relative fluxes based on transparency analysis?
     389    // bool photometry;                    // Perform photometry?
     390    // psMetadata *stats;                  // Statistics for output
     391    // FILE *statsFile;                    // File to which to write statistics
     392    // psArray *origImages, *origMasks, *origVariances; // Filenames of the original images
     393    // psArray *origCovars;                // Original covariances matrices
     394    // int quality;                        // Bad data quality flag
     395
     396    // Prepare
     397    pmPSF *psf;                         // Target PSF
     398    psVector *inputSeeing;              // Input seeing FWHMs
     399    psVector *inputMask;                // Mask for inputs
     400
     401    float targetSeeing;                 // Target seeing FWHM
     402    psArray *sourceLists;               // Individual lists of sources for matching
     403    psVector *norm;                     // Normalisation for each image
     404    psArray *psfs;
     405
     406    // psVector *exposures;                // Exposure times
     407    // float sumExposure;                  // Sum of exposure times
     408    // float zp;                           // Zero point for output
     409    // psVector *inputMask;                // Mask for inputs
     410    // psArray *sources;                   // Matched sources
     411
     412    // Convolve
     413    psArray *kernels;                   // PSF-matching kernels --- required in the stacking
     414    psArray *regions;                   // PSF-matching regions --- required in the stacking
     415    psVector *matchChi2;                // chi^2 for stamps from matching
     416    psVector *weightings;               // Combination weightings for images (1/noise^2)
     417    // psArray *cells;                     // Cells for convolved images --- a handle for reading again
     418    // int numCols, numRows;               // Size of image
     419    // psArray *convCovars;                // Convolved covariance matrices
     420
     421    // Combine initial
     422    // pmReadout *outRO;                   // Output readout
     423    // pmReadout *expRO;                   // Exposure readout
     424    // psArray *inspect;                   // Array of arrays of pixels to inspect
     425
     426    // Rejection
     427    // psArray *rejected;                  // Rejected pixels
     428} psphotStackOptions;
     429
     430/*** psphotStackMatchPSF prototypes ***/
     431bool psphotStackMatchPSFs (pmConfig *config, const pmFPAview *view);
     432bool psphotStackMatchPSFsReadout (pmConfig *config, const pmFPAview *view, psphotStackOptions *options, int index);
     433bool psphotStackMatchPSFsPrepare (pmConfig *config, const pmFPAview *view, psphotStackOptions *options, int index);
     434
     435// psphotStackMatchPSFsUtils
     436psVector *SetOptWidths (bool *optimum, psMetadata *recipe);
     437pmReadout *makeFakeReadout(pmConfig *config, pmReadout *raw, psArray *sources, pmPSF *psf, psImageMaskType maskVal, int fullSize);
     438bool rescaleData(pmReadout *readout, pmConfig *config, psphotStackOptions *options, int index);
     439bool renormKernel(pmReadout *readout, psphotStackOptions *options, int index);
     440bool saveMatchData (pmReadout *readout, psphotStackOptions *options, int index);
     441bool matchKernel(pmConfig *config, pmReadout *cnv, pmReadout *raw, psphotStackOptions *options, int index);
     442bool dumpImageDiff(pmReadout *readoutConv, pmReadout *readoutFake, pmReadout *readoutRef, int index, char *rootname);
     443bool dumpImage(pmReadout *readoutOut, pmReadout *readoutRef, int index, char *rootname);
     444bool loadKernel (pmConfig *config, pmReadout *readoutCnv, psphotStackOptions *options, int index);
     445
     446pmPSF *psphotStackPSF(const pmConfig *config, int numCols, int numRows, const psArray *psfs, const psVector *inputMask);
     447
     448psphotStackOptions *psphotStackOptionsAlloc (int num);
     449psphotStackConvolveSource psphotStackConvolveSourceFromString (const char *string);
     450pmFPAfile *psphotStackGetConvolveSource (pmConfig *config, psphotStackOptions *options, int index);
     451
     452bool psphotCopySources (pmConfig *config, const pmFPAview *view, const char *ruleOut, const char *ruleSrc);
     453bool psphotCopySourcesReadout (pmConfig *config, const pmFPAview *view, const char *ruleOut, const char *ruleSrc, int index);
     454
     455bool psphotRadialApertures (pmConfig *config, const pmFPAview *view, const char *filerule);
     456bool psphotRadialAperturesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     457bool psphotRadialApertureSource (pmSource *source, psMetadata *recipe, float skynoise, psImageMaskType maskVal, const psVector *radMax);
     458
     459bool psphotExtendedSourceAnalysisByObject (pmConfig *config, psArray *objects, const pmFPAview *view, const char *filerule);
     460bool psphotRadialAperturesByObject (pmConfig *config, psArray *objects, const pmFPAview *view, const char *filerule);
     461
     462bool psphotStackObjectsUnifyPosition (psArray *objects);
     463
    369464#endif
Note: See TracChangeset for help on using the changeset viewer.