- Timestamp:
- Dec 15, 2009, 6:41:32 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/ppSub/src/ppSubReadoutPhotometry.c
r26264 r26432 24 24 bool ppSubReadoutPhotometry(const char *name, ppSubData *data) 25 25 { 26 bool mdok = false; 27 26 28 psAssert(data, "Require processing data"); 27 29 pmConfig *config = data->config; // Configuration … … 42 44 } 43 45 44 // The PSF (measured in ppSubMakePSF) is stored on the chip->analysis of PSPHOT.INPUT 45 // In order to use an incoming PSF, it must be stored on the chip->analysis of PSPHOT.PSF.LOAD 46 // select the view of interest 46 47 pmFPAview *view = ppSubViewReadout(); // View to readout 47 pmChip *psfInputChip = pmFPAfileThisChip(config->files, view, "PSPHOT.INPUT"); // Chip with PSF48 psAssert (psfInputChip, "should have been generated for ppSubMakePSF");49 pmChip *psfLoadChip = pmFPAfileThisChip(config->files, view, "PSPHOT.PSF.LOAD"); // Chip to have PSF50 psAssert (psfLoadChip, "PSPHOT.PSF.LOAD should have been defined in ppSubCamera");51 pmPSF *psf = psMetadataLookupPtr(NULL, psfInputChip->analysis, "PSPHOT.PSF"); // PSF for photometry52 if (!psf) {53 psErrorStackPrint(stderr, "No PSF available");54 psWarning("No PSF available --- suspect bad data quality.");55 ppSubDataQuality(data, psErrorCodeLast(), PPSUB_FILES_PHOT_SUB | PPSUB_FILES_PHOT_INV);56 return true;57 }58 psMetadataAddPtr(psfLoadChip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN | PS_META_REPLACE,59 "PSF from ppSubMakePSF", psf);60 61 bool mdok = false;62 48 63 49 // psphotReadoutMinimal performs the photometry analysis on PSPHOT.INPUT; we need to move 64 // around the pointers so PSPHOT.INPUT corresponds to the output image; previously, it was 65 // equivalent to the minuend image. 66 pmReadout *inRO = pmFPAfileThisReadout(config->files, view, name); // Readout with image and sources 67 if (psMetadataLookup(inRO->analysis, "PSPHOT.SOURCES")) { 68 psMetadataRemoveKey(inRO->analysis, "PSPHOT.SOURCES"); 69 } 70 50 // around the pointers so PSPHOT.INPUT corresponds to the output image of interest (on one 51 // pass this is the subtraction image, in another it is negative of the subtraction 71 52 pmFPAfile *photFile = psMetadataLookupPtr(&mdok, config->files, "PSPHOT.INPUT"); // Photometry file 72 53 pmFPAfile *inFile = psMetadataLookupPtr(&mdok, config->files, name); // Input file … … 76 57 return false; 77 58 } 59 60 // drop references to PSPHOT.SOURCES on both of these (why is this needed for both??) 78 61 pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout to photometer 79 62 if (psMetadataLookup(photRO->analysis, "PSPHOT.SOURCES")) { 80 63 psMetadataRemoveKey(photRO->analysis, "PSPHOT.SOURCES"); 81 64 } 65 pmReadout *inRO = pmFPAfileThisReadout(config->files, view, name); // Readout with image and sources 66 if (psMetadataLookup(inRO->analysis, "PSPHOT.SOURCES")) { 67 psMetadataRemoveKey(inRO->analysis, "PSPHOT.SOURCES"); 68 } 82 69 83 psMetadataAddPtr(photRO->parent->parent->analysis, PS_LIST_TAIL, "PSPHOT.PSF", 84 PS_META_REPLACE | PS_DATA_UNKNOWN, "Point-spread function", data->psf); 85 86 psFree(photRO->analysis); 87 photRO->analysis = psMetadataAlloc(); 70 // grab the PSF information from the pmFPAfile PSPHOT.PSF.LOAD 71 pmFPAfile *psfFile = psMetadataLookupPtr(&mdok, config->files, "PSPHOT.PSF.LOAD"); // PSF file 72 ppSubCopyPSF (photFile, psfFile, view); 88 73 89 74 // psphotSaveImage (photFile->fpa->hdu->header, photRO->image, "findsrc.im.fits"); 90 75 // psphotSaveImage (photFile->fpa->hdu->header, photRO->variance, "findsrc.wt.fits"); 91 76 // psphotSaveImage (photFile->fpa->hdu->header, photRO->mask, "findsrc.mk.fits"); 77 78 // erase the overlays from a previous psphot-related step 79 if (pmVisualIsVisual()) { 80 psphotVisualEraseOverlays (1, "all"); 81 } 92 82 93 83 if (!psphotReadoutMinimal(config, view)) { … … 126 116 return false; 127 117 } 118 if (!psMetadataCopySingle(inRO->analysis, photRO->analysis, PM_DETEFF_ANALYSIS)) { 119 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to copy Detection Efficiency"); 120 return false; 121 } 128 122 } 129 123 … … 133 127 return true; 134 128 } 135 136 137 138 139 129 140 130 #ifdef TESTING
Note:
See TracChangeset
for help on using the changeset viewer.
