Changeset 21524 for trunk/ppSub/src/ppSubReadoutPhotometry.c
- Timestamp:
- Feb 17, 2009, 2:31:20 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppSub/src/ppSubReadoutPhotometry.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubReadoutPhotometry.c
r21374 r21524 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02- 06 03:20:02$8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-18 00:31:20 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ 12 12 13 #ifdef HAVE_CONFIG_H 14 #include <config.h> 15 #endif 16 17 #include <stdio.h> 18 #include <pslib.h> 19 #include <psmodules.h> 20 #include <psphot.h> 21 13 22 #include "ppSub.h" 14 23 15 /** 16 * Photometry stage 2: find and measure sources on the subtracted image 17 */ 18 bool ppSubReadoutPhotometry (pmConfig *config, psMetadata *stats, const pmFPAview *view) { 19 20 bool mdok = false; 24 bool ppSubReadoutPhotometry (pmConfig *config, psMetadata *stats, const pmFPAview *view) 25 { 26 psAssert(config, "Require configuration"); 27 psAssert(view, "Require view"); 21 28 22 29 // Look up recipe values … … 32 39 // The PSF (measured in ppSubMakePSF) is stored on the chip->analysis of PSPHOT.INPUT 33 40 // In order to use an incoming PSF, it must be stored on the chip->analysis of PSPHOT.PSF.LOAD 34 pmChip *psfInputChip = pmFPAfileThisChip(config->files, view, "PSPHOT.INPUT"); 41 pmChip *psfInputChip = pmFPAfileThisChip(config->files, view, "PSPHOT.INPUT"); // Chip with PSF 35 42 psAssert (psfInputChip, "should have been generated for ppSubMakePSF"); 36 37 pmChip *psfLoadChip = pmFPAfileThisChip(config->files, view, "PSPHOT.PSF.LOAD"); 43 pmChip *psfLoadChip = pmFPAfileThisChip(config->files, view, "PSPHOT.PSF.LOAD"); // Chip to have PSF 38 44 psAssert (psfLoadChip, "PSPHOT.PSF.LOAD should have been defined in ppSubCamera"); 39 40 pmPSF *psf = psMetadataLookupPtr(NULL, psfInputChip->analysis, "PSPHOT.PSF"); 45 pmPSF *psf = psMetadataLookupPtr(NULL, psfInputChip->analysis, "PSPHOT.PSF"); // PSF for photometry 41 46 if (!psf) { 42 47 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find PSF from psphot"); 43 48 return false; 44 49 } 45 psMetadataAddPtr(psfLoadChip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN | PS_META_REPLACE, "PSF from matched addition", psf); 50 psMetadataAddPtr(psfLoadChip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN | PS_META_REPLACE, 51 "PSF from ppSubMakePSF", psf); 52 53 bool mdok = false; 46 54 47 55 // psphotReadoutMinimal performs the photometry analysis on PSPHOT.INPUT; we need to move 48 56 // around the pointers so PSPHOT.INPUT corresponds to the output image; previously, it was 49 57 // equivalent to the minuend image. 50 pmFPAfile *outputFile = psMetadataLookupPtr(&mdok, config->files, "PPSUB.OUTPUT"); 58 pmFPAfile *outputFile = psMetadataLookupPtr(&mdok, config->files, "PPSUB.OUTPUT"); // Output file 51 59 pmReadout *outRO = pmFPAviewThisReadout(view, outputFile->fpa); // Readout with the sources 52 60 53 61 // XXX possibly rename this to PPSUB.RESID? 54 pmFPAfile *photFile = psMetadataLookupPtr(&mdok, config->files, "PSPHOT. RESID");55 pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout with the sources62 pmFPAfile *photFile = psMetadataLookupPtr(&mdok, config->files, "PSPHOT.INPUT"); // Photometry file 63 pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout to photometer 56 64 if (!photRO) { 57 pmCell *cell = pmFPA fileThisCell(config->files, view, "PSPHOT.RESID"); // Output cell65 pmCell *cell = pmFPAviewThisCell(view, photFile->fpa); // Cell to photometer 58 66 photRO = pmReadoutAlloc(cell); // Output readout: subtraction 59 67 } … … 62 70 photRO->variance = psImageCopy(photRO->variance, outRO->variance, PS_TYPE_F32); 63 71 } else { 64 psFree (photRO->variance);72 psFree(photRO->variance); 65 73 photRO->variance = NULL; 66 74 } … … 68 76 photRO->mask = psImageCopy(photRO->mask, outRO->mask, PS_TYPE_IMAGE_MASK); 69 77 } else { 70 psFree (photRO->mask);78 psFree(photRO->mask); 71 79 photRO->mask = NULL; 72 80 } 73 81 74 // pmFPAfile *photFile = outputFile; 75 psMetadataAddPtr (config->files, PS_LIST_TAIL, "PSPHOT.INPUT", PS_DATA_UNKNOWN | PS_META_REPLACE, "psphot input : view on another pmFPAfile", photFile); 76 77 // old-style variance renormalization 78 if (!ppSubReadoutRenormPhot (config, recipe, photRO)) { 79 psError(PS_ERR_UNKNOWN, false, "failure in renormalization"); 80 return false; 81 } 82 #if 0 83 psMetadataAddPtr(config->files, PS_LIST_TAIL, "PSPHOT.INPUT", PS_DATA_UNKNOWN | PS_META_REPLACE, 84 "psphot input: view on another pmFPAfile", photFile); 85 #endif 82 86 83 87 if (!psphotReadoutMinimal(config, view)) { … … 86 90 psErrorClear(); 87 91 } 92 #if 1 93 photRO->data_exists = true; 94 photRO->parent->data_exists = true; 95 photRO->parent->parent->data_exists = true; 96 #endif 88 97 89 98 if (stats) { … … 101 110 } 102 111 103 // XXX not sure that this is still needed (only if psphotReadoutMinimal measures the background)104 // if (!pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL") ||105 // !pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV") ||106 // !pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND")) {107 // psError(PS_ERR_UNKNOWN, false, "Unable to drop PSPHOT internal files.");108 // return false;109 // }110 112 111 // pmFPAfileActivate(config->files, false, "PSPHOT.INPUT"); 112 // pmFPAfileActivate(config->files, false, "PSPHOT.LOAD.PSF"); 113 113 114 114 115
Note:
See TracChangeset
for help on using the changeset viewer.
