Changeset 30936
- Timestamp:
- Mar 16, 2011, 3:42:31 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/psphot/src
- Files:
-
- 8 edited
-
Makefile.am (modified) (3 diffs)
-
psphot.c (modified) (2 diffs)
-
psphot.h (modified) (3 diffs)
-
psphotForced.c (modified) (2 diffs)
-
psphotForcedImageLoop.c (modified) (5 diffs)
-
psphotImageLoop.c (modified) (3 diffs)
-
psphotMakePSF.c (modified) (1 diff)
-
psphotStandAlone.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psphot/src/Makefile.am
r30749 r30936 69 69 psphotForced.c \ 70 70 psphotForcedArguments.c \ 71 psphotForcedImageLoop.c \72 psphotForcedReadout.c \73 71 psphotParseCamera.c \ 72 psphotImageLoop.c \ 74 73 psphotMosaicChip.c \ 75 74 psphotCleanup.c … … 79 78 psphotMakePSF.c \ 80 79 psphotMakePSFArguments.c \ 81 psphotMakePSFImageLoop.c \82 psphotMakePSFReadout.c \83 80 psphotParseCamera.c \ 81 psphotImageLoop.c \ 84 82 psphotMosaicChip.c \ 85 83 psphotCleanup.c … … 128 126 psphotReadoutForcedKnownSources.c \ 129 127 psphotReadoutMinimal.c \ 128 psphotForcedReadout.c \ 129 psphotMakePSFReadout.c \ 130 130 psphotModelBackground.c \ 131 131 psphotMaskBackground.c \ -
branches/eam_branches/ipp-20110213/psphot/src/psphot.c
r24144 r30936 1 1 # include "psphotStandAlone.h" 2 # define FORCED_PHOTOMETRY 0 2 3 3 4 int main (int argc, char **argv) { … … 20 21 21 22 // call psphot for each readout 22 if (!psphotImageLoop (config )) {23 if (!psphotImageLoop (config, PSPHOT_SINGLE)) { 23 24 psErrorStackPrint(stderr, "Error in the psphot image loop\n"); 24 25 exit (psphotGetExitStatus()); -
branches/eam_branches/ipp-20110213/psphot/src/psphot.h
r30903 r30936 14 14 15 15 # define READOUT_OR_INTERNAL(VIEW,FILE)((FILE)->mode == PM_FPA_MODE_INTERNAL) ? (FILE)->readout : pmFPAviewThisReadout((VIEW), (FILE)->fpa) 16 17 typedef enum { 18 PSPHOT_SINGLE, 19 PSPHOT_FORCED, 20 PSPHOT_MAKE_PSF, 21 } psphotImageLoopMode; 16 22 17 23 // top-level psphot functions … … 23 29 bool psphotVersionHeaderFull(psMetadata *header); 24 30 void psphotVersionPrint(void); 31 32 bool psphotImageLoop (pmConfig *config, psphotImageLoopMode mode); 25 33 26 34 bool psphotModelTest (pmConfig *config, const pmFPAview *view, psMetadata *recipe); … … 311 319 312 320 pmConfig *psphotForcedArguments(int argc, char **argv); 313 bool psphotForcedImageLoop (pmConfig *config);314 321 bool psphotForcedReadout(pmConfig *config, const pmFPAview *view, const char *filerule); 315 322 316 323 pmConfig *psphotMakePSFArguments(int argc, char **argv); 317 bool psphotMakePSFImageLoop (pmConfig *config);318 324 bool psphotMakePSFReadout(pmConfig *config, const pmFPAview *view, const char *filerule); 319 325 -
branches/eam_branches/ipp-20110213/psphot/src/psphotForced.c
r25981 r30936 1 1 # include "psphotStandAlone.h" 2 # define FORCED_PHOTOMETRY 1 2 3 3 4 int main (int argc, char **argv) { … … 20 21 21 22 // call psphot for each readout 22 if (!psphot ForcedImageLoop (config)) {23 if (!psphotImageLoop (config, PSPHOT_FORCED)) { 23 24 psErrorStackPrint(stderr, "Error in the psphot image loop\n"); 24 25 exit (psphotGetExitStatus()); -
branches/eam_branches/ipp-20110213/psphot/src/psphotForcedImageLoop.c
r29936 r30936 1 1 # include "psphotStandAlone.h" 2 2 3 # define ESCAPE(MESSAGE) { \4 psError(PSPHOT_ERR_DATA, false, MESSAGE);\5 psFree (view);\6 return false;\7 }3 # define ESCAPE(MESSAGE) { \ 4 psError(PSPHOT_ERR_DATA, false, MESSAGE); \ 5 psFree (view); \ 6 return false; \ 7 } 8 8 9 9 bool psphotForcedImageLoop (pmConfig *config) { … … 31 31 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for fpa in psphot."); 32 32 33 // select the appropriate recipe information 34 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE); 35 psAssert (recipe, "missing recipe?"); 36 37 psImageMaskType maskTest = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); 38 33 39 // for psphot, we force data to be read at the chip level 34 40 while ((chip = pmFPAviewNextChip (view, load->fpa, 1)) != NULL) { … … 45 51 // mosaic the cells of a chip into a single contiguous (trimmed) chip 46 52 if (!psphotMosaicChip(config, view, "PSPHOT.INPUT", "PSPHOT.LOAD")) ESCAPE ("Unable to mosaic chip."); 53 54 // Read WCS if easy. 55 // XXX Since we're mosaicking cells, we ignore the case where the WCS is defined for a cell. 56 { 57 pmChip *inChip = pmFPAviewThisChip(view, input->fpa); // Mosaicked chip 58 pmHDU *hduLow = pmHDUGetLowest(input->fpa, inChip, NULL); 59 if (hduLow && !pmAstromReadWCS(input->fpa, inChip, hduLow->header, 1.0)) { 60 psWarning("Unable to read WCS astrometry from header."); 61 psErrorClear(); 62 pmHDU *hduHigh = pmHDUGetHighest(input->fpa, inChip, NULL); 63 if (hduHigh && hduHigh != hduLow && 64 !pmAstromReadWCS(input->fpa, chip, hduHigh->header, 1.0)) { 65 psWarning("Unable to read WCS astrometry from primary header."); 66 psErrorClear(); 67 } 68 } 69 } 47 70 48 71 // try to load other supporting data (PSF, SRC, etc). … … 76 99 if (readout->mask) { 77 100 psImageMaskType maskSat = pmConfigMaskGet("SAT", config); // Mask value for saturated pixels 78 if (!pmReadoutMaskNonfinite(readout, maskSat)) {101 if (!pmReadoutMaskInvalid(readout, maskTest, maskSat)) { 79 102 psError(psErrorCodeLast(), false, "Unable to mask non-finite pixels."); 80 103 psFree(view); … … 91 114 } 92 115 116 // drop all versions of the internal files 93 117 status = true; 94 118 status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL"); -
branches/eam_branches/ipp-20110213/psphot/src/psphotImageLoop.c
r29936 r30936 1 1 # include "psphotStandAlone.h" 2 2 3 # define ESCAPE(MESSAGE) { \4 psError(PSPHOT_ERR_DATA, false, MESSAGE);\5 psFree (view);\6 return false;\7 }3 # define ESCAPE(MESSAGE) { \ 4 psError(PSPHOT_ERR_DATA, false, MESSAGE); \ 5 psFree (view); \ 6 return false; \ 7 } 8 8 9 bool psphotImageLoop (pmConfig *config ) {9 bool psphotImageLoop (pmConfig *config, psphotImageLoopMode mode) { 10 10 11 11 bool status; … … 90 90 91 91 // Update the header 92 { 93 pmHDU *hdu = pmHDUGetHighest(input->fpa, chip, cell); 94 if (hdu && hdu != lastHDU) { 95 psphotVersionHeaderFull(hdu->header); 96 lastHDU = hdu; 97 } 92 pmHDU *hdu = pmHDUGetHighest(input->fpa, chip, cell); 93 if (hdu && hdu != lastHDU) { 94 psphotVersionHeaderFull(hdu->header); 95 lastHDU = hdu; 98 96 } 99 97 … … 109 107 110 108 // run the actual photometry analysis on this chip/cell/readout 111 if (!psphotReadout (config, view, "PSPHOT.INPUT")) { 112 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout); 113 psFree (view); 114 return false; 115 } 109 switch (mode) { 110 case PSPHOT_SINGLE: 111 if (!psphotReadout (config, view, "PSPHOT.INPUT")) { 112 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout); 113 psFree (view); 114 return false; 115 } 116 break; 117 case PSPHOT_FORCED: 118 if (!psphotForcedReadout (config, view, "PSPHOT.INPUT")) { 119 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout); 120 psFree (view); 121 return false; 122 } 123 break; 124 case PSPHOT_MAKE_PSF: 125 if (!psphotMakePSFReadout (config, view, "PSPHOT.INPUT")) { 126 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout); 127 psFree (view); 128 return false; 129 } 130 break; 131 } 116 132 } 117 133 -
branches/eam_branches/ipp-20110213/psphot/src/psphotMakePSF.c
r25982 r30936 20 20 21 21 // call psphot for each readout 22 if (!psphot MakePSFImageLoop (config)) {22 if (!psphotImageLoop (config, PSPHOT_MAKE_PSF)) { 23 23 psErrorStackPrint(stderr, "Error in the psphot image loop\n"); 24 24 exit (psphotGetExitStatus()); -
branches/eam_branches/ipp-20110213/psphot/src/psphotStandAlone.h
r23487 r30936 14 14 pmConfig *psphotArguments (int argc, char **argv); 15 15 bool psphotParseCamera (pmConfig *config); 16 bool psphotImageLoop (pmConfig *config);17 16 bool psphotMosaicChip(pmConfig *config, const pmFPAview *view, char *outFile, char *inFile); 18 17 void psphotCleanup (pmConfig *config);
Note:
See TracChangeset
for help on using the changeset viewer.
