Changeset 7508 for trunk/ppImage/src/ppImagePhot.c
- Timestamp:
- Jun 9, 2006, 6:25:41 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImagePhot.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImagePhot.c
r6747 r7508 1 #include <stdio.h> 2 #include "pslib.h" 3 #include "psmodules.h" 4 #include "ppImage.h" 1 # include "ppImage.h" 5 2 6 bool ppImagePhot(ppData *data, ppOptions *options, pmConfig *config) 7 { 8 ppFile *input = data->input; // The input file information 9 pmFPA *fpa = input->fpa; // The input FPA 3 bool ppImagePhotom (pmConfig *config, pmFPAview *view) { 10 4 11 int numMosaicked = pmFPAMosaicCells(fpa, 1, 1); // Number of chips mosaicked together 12 psLogMsg(__func__, PS_LOG_INFO, "%d chips mosaicked.\n", numMosaicked); 5 bool status; 6 pmCell *cell; 7 pmReadout *readout; 13 8 14 #if 1 15 // Write out the mosaicked chip, just to see; this wouldn't normally happen 16 psFits *mosaicFile = psFitsOpen("mosaic.fits", "w"); 17 psArray *chips = fpa->chips; 18 for (int i = 0; i < chips->n; i++) { 19 pmChip *chip = chips->data[i]; 20 if (! chip || ! chip->exists || ! chip->process) { 21 continue; 22 } 23 psArray *cells = chip->cells; 24 pmCell *cell = cells->data[0]; 25 psArray *readouts = cell->readouts; 26 pmReadout *readout = readouts->data[0]; 27 psImage *image = readout->image; 28 psFitsWriteImage(mosaicFile, NULL, image, 0); 9 psphotModelGroupInit (); 10 11 // select recipe options supplied on command line 12 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, "PSPHOT"); 13 14 // set default recipe values here 15 // XXX place this in a psphot library function? 16 psMetadataAddStr (recipe, PS_LIST_TAIL, "FITMODE", PS_META_NO_REPLACE, "default fitting mode", "NONE"); 17 psMetadataAddStr (recipe, PS_LIST_TAIL, "PHOTCODE", PS_META_NO_REPLACE, "default photcode", "NONE"); 18 psMetadataAddStr (recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_NO_REPLACE, "default break point", "NONE"); 19 psMetadataAddF32 (recipe, PS_LIST_TAIL, "ZERO_PT", PS_META_NO_REPLACE, "default zero point", 25.00); 20 psMetadataAddS32 (recipe, PS_LIST_TAIL, "BACKGROUND.XBIN", PS_META_NO_REPLACE, "default binning", 64); 21 psMetadataAddS32 (recipe, PS_LIST_TAIL, "BACKGROUND.YBIN", PS_META_NO_REPLACE, "default binning", 64); 22 23 // find or define a pmFPAfile PSPHOT.INPUT 24 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT"); 25 if (!status) { 26 27 // psphotReadout requires a pmFPAfile supplied with the name PSPHOT.INPUT 28 // create a pmFPAfile which points at PPIMAGE.OUTPUT 29 // mode is 'REFERENCE' to prevent double frees of the fpa 30 pmFPAfile *output = psMetadataLookupPtr (&status, config->files, "PPIMAGE.OUTPUT"); 31 input = pmFPAfileDefine (config->files, config->camera, output->fpa, "PSPHOT.INPUT"); 32 input->mode = PM_FPA_MODE_REFERENCE; 33 34 pmFPAfileDefine (config->files, config->camera, input->fpa, "PSPHOT.OUTPUT"); 35 36 // supply the output name (from cmd-line) to all output (WRITE) files 37 // 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); 29 40 } 30 #endif31 41 32 // XXX EAM: Insert psphot stuff here 42 // XXX add the option output files here 43 44 // int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN"); 45 // int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN"); 46 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"); 52 53 pmFPAfileActivate (config->files, true, "PSPHOT.BACKSUB"); 54 pmFPAfileActivate (config->files, true, "PSPHOT.BACKGND"); 55 pmFPAfileActivate (config->files, true, "PSPHOT.BACKMDL"); 56 57 58 // iterate over the cells in the current chip 59 // view->cell = -1; 60 61 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { 62 psLogMsg ("ppImagePhot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 63 if (! cell->process || ! cell->file_exists) { continue; } 64 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 65 66 // process each of the readouts 67 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 68 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 69 if (! readout->data_exists) { continue; } 70 71 // run the actual photometry analysis 72 psphotReadout (config, view); 73 74 pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER); 75 } 76 pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER); 77 } 78 79 // de-activate the PSPHOT image files, activate the PPIMAGE ones 80 pmFPAfileActivate (config->files, false, NULL); 81 pmFPAfileActivate (config->files, true, "PPIMAGE.INPUT"); 82 pmFPAfileActivate (config->files, true, "PPIMAGE.BIAS"); 83 pmFPAfileActivate (config->files, true, "PPIMAGE.DARK"); 84 pmFPAfileActivate (config->files, true, "PPIMAGE.MASK"); 85 pmFPAfileActivate (config->files, true, "PPIMAGE.FLAT"); 86 pmFPAfileActivate (config->files, true, "PPIMAGE.OUTPUT"); 87 88 pmFPAfileActivate (config->files, true, "PPIMAGE.BIN1"); 89 pmFPAfileActivate (config->files, true, "PPIMAGE.JPEG1"); 90 pmFPAfileActivate (config->files, true, "PPIMAGE.BIN2"); 91 pmFPAfileActivate (config->files, true, "PPIMAGE.JPEG2"); 33 92 34 93 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
