IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 5, 2010, 1:38:43 PM (16 years ago)
Author:
eugene
Message:

updates to psphot APIs to enable stack photometry

Location:
branches/eam_branches/20091201/psphot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/psphot

  • branches/eam_branches/20091201/psphot/src/psphotOutput.c

    r26542 r26788  
    126126}
    127127
    128 bool psphotAddPhotcodeReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index) {
    129 
    130     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    131     PS_ASSERT (file, false);
    132 
    133     pmReadout  *readout = pmFPAviewThisReadout (view, file->fpa);
    134 
    135     // determine PHOTCODE from fpa & view, overwrite in readout->analysis
    136     char *photcode = pmConceptsPhotcodeForView (file, view);
    137     PS_ASSERT (photcode, false);
    138 
    139     psMetadataAddStr (readout->analysis, PS_LIST_TAIL, "PHOTCODE", PS_META_REPLACE, "photcode from FPA concepts", photcode);
    140     psLogMsg ("psphot", 3, "PHOTCODE is %s", photcode);
    141 
    142     psFree (photcode);
    143     return true;
    144 }
    145 
    146128bool psphotAddPhotcode (pmConfig *config, const pmFPAview *view) {
    147129
     
    161143}
    162144
    163 bool psphotSetHeaderNstars (psMetadata *recipe, psArray *sources) {
     145bool psphotAddPhotcodeReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index) {
     146
     147    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
     148    PS_ASSERT (file, false);
     149
     150    pmReadout  *readout = pmFPAviewThisReadout (view, file->fpa);
     151
     152    // determine PHOTCODE from fpa & view, overwrite in readout->analysis
     153    char *photcode = pmConceptsPhotcodeForView (file, view);
     154    PS_ASSERT (photcode, false);
     155
     156    psMetadataAddStr (readout->analysis, PS_LIST_TAIL, "PHOTCODE", PS_META_REPLACE, "photcode from FPA concepts", photcode);
     157    psLogMsg ("psphot", 3, "PHOTCODE is %s", photcode);
     158
     159    psFree (photcode);
     160    return true;
     161}
     162
     163bool psphotSetHeaderNstars (psMetadata *header, psArray *sources) {
    164164
    165165    int nSrc = 0;
     
    190190    }
    191191
    192     psMetadataAddS32 (recipe, PS_LIST_TAIL, "NSTARS",   PS_META_REPLACE, "Number of sources", nSrc);
    193     psMetadataAddS32 (recipe, PS_LIST_TAIL, "NDET_EXT", PS_META_REPLACE, "Number of extended sources", nEXT);
    194     psMetadataAddS32 (recipe, PS_LIST_TAIL, "NDET_CR",  PS_META_REPLACE, "Number of cosmic rays", nCR);
    195     return true;
    196 }
    197 
    198 // these values are saved in an output header stub - they are added to either the
    199 // PHU header (CMP) or the MEF table header (CMF)
    200 // XXX these are currently carried by the recipe -- this will not work in a Stack context
    201 // XXX they should be place in the readout->analysis of the given image
    202 psMetadata *psphotDefineHeader (psMetadata *recipe) {
     192    psMetadataAddS32 (header, PS_LIST_TAIL, "NSTARS",   PS_META_REPLACE, "Number of sources", nSrc);
     193    psMetadataAddS32 (header, PS_LIST_TAIL, "NDET_EXT", PS_META_REPLACE, "Number of extended sources", nEXT);
     194    psMetadataAddS32 (header, PS_LIST_TAIL, "NDET_CR",  PS_META_REPLACE, "Number of cosmic rays", nCR);
     195    return true;
     196}
     197
     198// these values are saved in an output header stub - they are added to either the PHU header
     199// (CMP) or the MEF table header (CMF).  before the header is created, each readout has these
     200// values stored on readout->analysis
     201psMetadata *psphotDefineHeader (psMetadata *analysis) {
    203202
    204203    bool status = true;
     
    207206
    208207    // write necessary information to output header
    209     psMetadataItemSupplement (&status, header, recipe, "ZERO_PT");
    210     psMetadataItemSupplement (&status, header, recipe, "PHOTCODE");
    211 
    212     psMetadataItemSupplement (&status, header, recipe, "APMIFIT");
    213     psMetadataItemSupplement (&status, header, recipe, "DAPMIFIT");
    214     psMetadataItemSupplement (&status, header, recipe, "NAPMIFIT");
     208    psMetadataItemSupplement (&status, header, analysis, "ZERO_PT");
     209    psMetadataItemSupplement (&status, header, analysis, "PHOTCODE");
     210
     211    psMetadataItemSupplement (&status, header, analysis, "APMIFIT");
     212    psMetadataItemSupplement (&status, header, analysis, "DAPMIFIT");
     213    psMetadataItemSupplement (&status, header, analysis, "NAPMIFIT");
    215214
    216215    // PSF model parameters (shape values for image center)
    217     psMetadataItemSupplement (&status, header, recipe, "NPSFSTAR");
    218     psMetadataItemSupplement (&status, header, recipe, "APLOSS");
    219 
    220     psMetadataItemSupplement (&status, header, recipe, "FWHM_MAJ");
    221     psMetadataItemSupplement (&status, header, recipe, "FW_MJ_SG");
    222     psMetadataItemSupplement (&status, header, recipe, "FW_MJ_LQ");
    223     psMetadataItemSupplement (&status, header, recipe, "FW_MJ_UQ");
    224 
    225     psMetadataItemSupplement (&status, header, recipe, "FWHM_MIN");
    226     psMetadataItemSupplement (&status, header, recipe, "FW_MN_SG");
    227     psMetadataItemSupplement (&status, header, recipe, "FW_MN_LQ");
    228     psMetadataItemSupplement (&status, header, recipe, "FW_MN_UQ");
    229 
    230     psMetadataItemSupplement (&status, header, recipe, "ANGLE");
     216    psMetadataItemSupplement (&status, header, analysis, "NPSFSTAR");
     217    psMetadataItemSupplement (&status, header, analysis, "APLOSS");
     218
     219    psMetadataItemSupplement (&status, header, analysis, "FWHM_MAJ");
     220    psMetadataItemSupplement (&status, header, analysis, "FW_MJ_SG");
     221    psMetadataItemSupplement (&status, header, analysis, "FW_MJ_LQ");
     222    psMetadataItemSupplement (&status, header, analysis, "FW_MJ_UQ");
     223
     224    psMetadataItemSupplement (&status, header, analysis, "FWHM_MIN");
     225    psMetadataItemSupplement (&status, header, analysis, "FW_MN_SG");
     226    psMetadataItemSupplement (&status, header, analysis, "FW_MN_LQ");
     227    psMetadataItemSupplement (&status, header, analysis, "FW_MN_UQ");
     228
     229    psMetadataItemSupplement (&status, header, analysis, "ANGLE");
    231230
    232231    // Image Quality measurements
    233     psMetadataItemSupplement (&status, header, recipe, "IQ_NSTAR");
    234 
    235     psMetadataItemSupplement (&status, header, recipe, "IQ_FW1");
    236     psMetadataItemSupplement (&status, header, recipe, "IQ_FW1_E");
    237     psMetadataItemSupplement (&status, header, recipe, "IQ_FW2");
    238     psMetadataItemSupplement (&status, header, recipe, "IQ_FW2_E");
    239 
    240     psMetadataItemSupplement (&status, header, recipe, "IQ_M2");
    241     psMetadataItemSupplement (&status, header, recipe, "IQ_M2_ER");
    242     psMetadataItemSupplement (&status, header, recipe, "IQ_M2_LQ");
    243     psMetadataItemSupplement (&status, header, recipe, "IQ_M2_UQ");
    244 
    245     psMetadataItemSupplement (&status, header, recipe, "IQ_M2C");
    246     psMetadataItemSupplement (&status, header, recipe, "IQ_M2C_E");
    247     psMetadataItemSupplement (&status, header, recipe, "IQ_M2C_L");
    248     psMetadataItemSupplement (&status, header, recipe, "IQ_M2C_U");
    249 
    250     psMetadataItemSupplement (&status, header, recipe, "IQ_M2S");
    251     psMetadataItemSupplement (&status, header, recipe, "IQ_M2S_E");
    252     psMetadataItemSupplement (&status, header, recipe, "IQ_M2S_L");
    253     psMetadataItemSupplement (&status, header, recipe, "IQ_M2S_U");
    254 
    255     psMetadataItemSupplement (&status, header, recipe, "IQ_M3");
    256     psMetadataItemSupplement (&status, header, recipe, "IQ_M3_ER");
    257     psMetadataItemSupplement (&status, header, recipe, "IQ_M3_LQ");
    258     psMetadataItemSupplement (&status, header, recipe, "IQ_M3_UQ");
    259 
    260     psMetadataItemSupplement (&status, header, recipe, "IQ_M4");
    261     psMetadataItemSupplement (&status, header, recipe, "IQ_M4_ER");
    262     psMetadataItemSupplement (&status, header, recipe, "IQ_M4_LQ");
    263     psMetadataItemSupplement (&status, header, recipe, "IQ_M4_UQ");
     232    psMetadataItemSupplement (&status, header, analysis, "IQ_NSTAR");
     233
     234    psMetadataItemSupplement (&status, header, analysis, "IQ_FW1");
     235    psMetadataItemSupplement (&status, header, analysis, "IQ_FW1_E");
     236    psMetadataItemSupplement (&status, header, analysis, "IQ_FW2");
     237    psMetadataItemSupplement (&status, header, analysis, "IQ_FW2_E");
     238
     239    psMetadataItemSupplement (&status, header, analysis, "IQ_M2");
     240    psMetadataItemSupplement (&status, header, analysis, "IQ_M2_ER");
     241    psMetadataItemSupplement (&status, header, analysis, "IQ_M2_LQ");
     242    psMetadataItemSupplement (&status, header, analysis, "IQ_M2_UQ");
     243
     244    psMetadataItemSupplement (&status, header, analysis, "IQ_M2C");
     245    psMetadataItemSupplement (&status, header, analysis, "IQ_M2C_E");
     246    psMetadataItemSupplement (&status, header, analysis, "IQ_M2C_L");
     247    psMetadataItemSupplement (&status, header, analysis, "IQ_M2C_U");
     248
     249    psMetadataItemSupplement (&status, header, analysis, "IQ_M2S");
     250    psMetadataItemSupplement (&status, header, analysis, "IQ_M2S_E");
     251    psMetadataItemSupplement (&status, header, analysis, "IQ_M2S_L");
     252    psMetadataItemSupplement (&status, header, analysis, "IQ_M2S_U");
     253
     254    psMetadataItemSupplement (&status, header, analysis, "IQ_M3");
     255    psMetadataItemSupplement (&status, header, analysis, "IQ_M3_ER");
     256    psMetadataItemSupplement (&status, header, analysis, "IQ_M3_LQ");
     257    psMetadataItemSupplement (&status, header, analysis, "IQ_M3_UQ");
     258
     259    psMetadataItemSupplement (&status, header, analysis, "IQ_M4");
     260    psMetadataItemSupplement (&status, header, analysis, "IQ_M4_ER");
     261    psMetadataItemSupplement (&status, header, analysis, "IQ_M4_LQ");
     262    psMetadataItemSupplement (&status, header, analysis, "IQ_M4_UQ");
    264263
    265264    // XXX these need to be defined from elsewhere
    266265    psMetadataAdd (header, PS_LIST_TAIL, "FSATUR",   PS_DATA_F32 | PS_META_REPLACE, "SATURATION MAG",      0.0);
    267266    psMetadataAdd (header, PS_LIST_TAIL, "FLIMIT",   PS_DATA_F32 | PS_META_REPLACE, "COMPLETENESS MAG",    0.0);
    268     psMetadataItemSupplement (&status, header, recipe, "NSTARS");
    269 
    270     psMetadataItemSupplement (&status, header, recipe, "NDET_EXT");
    271     psMetadataItemSupplement (&status, header, recipe, "NDET_CR");
     267    psMetadataItemSupplement (&status, header, analysis, "NSTARS");
     268
     269    psMetadataItemSupplement (&status, header, analysis, "NDET_EXT");
     270    psMetadataItemSupplement (&status, header, analysis, "NDET_CR");
    272271
    273272    // sky background model statistics
    274     psMetadataItemSupplement (&status, header, recipe, "MSKY_MN");
    275     psMetadataItemSupplement (&status, header, recipe, "MSKY_SIG");
    276     psMetadataItemSupplement (&status, header, recipe, "MSKY_MIN");
    277     psMetadataItemSupplement (&status, header, recipe, "MSKY_MAX");
    278     psMetadataItemSupplement (&status, header, recipe, "MSKY_NX");
    279     psMetadataItemSupplement (&status, header, recipe, "MSKY_NY");
     273    psMetadataItemSupplement (&status, header, analysis, "MSKY_MN");
     274    psMetadataItemSupplement (&status, header, analysis, "MSKY_SIG");
     275    psMetadataItemSupplement (&status, header, analysis, "MSKY_MIN");
     276    psMetadataItemSupplement (&status, header, analysis, "MSKY_MAX");
     277    psMetadataItemSupplement (&status, header, analysis, "MSKY_NX");
     278    psMetadataItemSupplement (&status, header, analysis, "MSKY_NY");
    280279
    281280    psMetadataAddF32 (header, PS_LIST_TAIL, "DT_PHOT", PS_META_REPLACE, "elapsed psphot time", psTimerMark ("psphotReadout"));
Note: See TracChangeset for help on using the changeset viewer.