Changeset 7621 for trunk/ppImage/src/ppImagePhotom.c
- Timestamp:
- Jun 21, 2006, 12:51:48 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImagePhotom.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImagePhotom.c
r7592 r7621 24 24 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT"); 25 25 if (!status) { 26 27 26 // psphotReadout requires a pmFPAfile supplied with the name PSPHOT.INPUT 28 // create a pmFPAfile which points at PPIMAGE.OUTPUT27 // create a pmFPAfile which points to PPIMAGE.OUTPUT.CHIP (guaranteed to be mosaiced by chip) 29 28 // mode is 'REFERENCE' to prevent double frees of the fpa 30 pmFPAfile *output = psMetadataLookupPtr (&status, config->files, "PPIMAGE.OUTPUT ");29 pmFPAfile *output = psMetadataLookupPtr (&status, config->files, "PPIMAGE.OUTPUT.CHIP"); 31 30 input = pmFPAfileDefineInput (config, output->fpa, "PSPHOT.INPUT"); 32 31 input->mode = PM_FPA_MODE_REFERENCE; 33 32 34 33 pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.OUTPUT"); 35 36 // supply the output name (from cmd-line) to all output (WRITE) files37 // XXX does this cause trouble with existing files?38 char *outname = psMetadataLookupPtr(&status, config->arguments, "OUTPUT");39 pmFPAfileAddFileNames (config->files, "OUTPUT", outname, PM_FPA_MODE_WRITE);40 34 } 41 35 42 // XXX add the option output files here 36 // optionally save the residual image 37 if (psMetadataLookupBool(NULL, recipe, "SAVE.RESID")) { 38 pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.RESID"); 39 } 43 40 44 //int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN");45 //int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN");41 int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN"); 42 int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN"); 46 43 47 // we only was to operate on PSPHOT pmFPAfiles here: 48 pmFPAfileActivate (config->files, false, NULL); 49 pmFPAfileActivate (config->files, true, "PSPHOT.INPUT"); 50 pmFPAfileActivate (config->files, true, "PSPHOT.RESID"); 51 pmFPAfileActivate (config->files, true, "PSPHOT.OUTPUT"); 44 // these calls construct a new fpa for the I/O handle 52 45 53 pmFPAfileActivate (config->files, true, "PSPHOT.BACKSUB"); 54 pmFPAfileActivate (config->files, true, "PSPHOT.BACKGND"); 55 pmFPAfileActivate (config->files, true, "PSPHOT.BACKMDL"); 46 // optionally save the background model (small FITS image) 47 if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKMDL")) { 48 pmFPAfileDefineFromFPA (config, input->fpa, DX, DY, "PSPHOT.BACKMDL"); 49 } 50 // optionally save the full background image 51 if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKGND")) { 52 pmFPAfileDefineFromFPA (config, input->fpa, 1, 1, "PSPHOT.BACKGND"); 53 } 54 // optionally save the background-subtracted image 55 if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKSUB")) { 56 pmFPAfileDefineFromFPA (config, input->fpa, 1, 1, "PSPHOT.BACKSUB"); 57 } 58 // optionally save the PSF Model 59 if (psMetadataLookupBool(NULL, recipe, "SAVE.PSF")) { 60 pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.PSF.SAVE"); 61 } 62 // optionally load the PSF Model 63 if (psMetadataLookupBool(NULL, recipe, "LOAD.PSF")) { 64 pmFPAfileDefineInput (config, input->fpa, "PSPHOT.PSF.LOAD"); 65 } 56 66 67 // XXX not tested (or defined?) 68 // pmFPAfileConstruct (config->files, format, config->camera, "PSPHOT.PSF_SAMPLE"); 57 69 70 // view->cell = -1; 58 71 // iterate over the cells in the current chip 59 // view->cell = -1;60 61 72 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { 62 73 psLogMsg ("ppImagePhot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 63 74 if (! cell->process || ! cell->file_exists) { continue; } 64 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);65 75 66 76 // process each of the readouts 67 77 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 68 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);69 78 if (! readout->data_exists) { continue; } 70 79 71 80 // run the actual photometry analysis 72 81 psphotReadout (config, view); 82 } 83 } 84 return true; 85 } 73 86 74 pmFPAfileIOChecks (config, view, PM_FPA_AFTER); 75 } 76 pmFPAfileIOChecks (config, view, PM_FPA_AFTER); 77 } 87 // we only want to operate on PSPHOT pmFPAfiles here: 88 // XXX is this necessary? why invoke I/O during this function? 89 // the psphot constructed files, if chosen, will be saved at the chip level 90 // in the next call outside of this function. 91 // XXX there could be an issue if those files are set for 'cell' or 'readout' 92 // pmFPAfileActivate (config->files, false, NULL); 93 // pmFPAfileActivate (config->files, true, "PSPHOT.INPUT"); 94 // pmFPAfileActivate (config->files, true, "PSPHOT.RESID"); 95 // pmFPAfileActivate (config->files, true, "PSPHOT.OUTPUT"); 96 // pmFPAfileActivate (config->files, true, "PSPHOT.BACKSUB"); 97 // pmFPAfileActivate (config->files, true, "PSPHOT.BACKGND"); 98 // pmFPAfileActivate (config->files, true, "PSPHOT.BACKMDL"); 99 100 78 101 79 102 // de-activate the PSPHOT image files, activate the PPIMAGE ones 103 # if 0 80 104 pmFPAfileActivate (config->files, false, NULL); 81 105 pmFPAfileActivate (config->files, true, "PPIMAGE.INPUT"); … … 85 109 pmFPAfileActivate (config->files, true, "PPIMAGE.FLAT"); 86 110 pmFPAfileActivate (config->files, true, "PPIMAGE.OUTPUT"); 87 88 111 pmFPAfileActivate (config->files, true, "PPIMAGE.BIN1"); 89 112 pmFPAfileActivate (config->files, true, "PPIMAGE.JPEG1"); 90 113 pmFPAfileActivate (config->files, true, "PPIMAGE.BIN2"); 91 114 pmFPAfileActivate (config->files, true, "PPIMAGE.JPEG2"); 115 # endif 92 116 93 return true;94 }
Note:
See TracChangeset
for help on using the changeset viewer.
