Changeset 7621
- Timestamp:
- Jun 21, 2006, 12:51:48 PM (20 years ago)
- Location:
- trunk/ppImage/src
- Files:
-
- 9 edited
-
ppImage.h (modified) (1 diff)
-
ppImageAstrom.c (modified) (3 diffs)
-
ppImageLoop.c (modified) (4 diffs)
-
ppImageMosaic.c (modified) (2 diffs)
-
ppImageOptions.c (modified) (2 diffs)
-
ppImageOptions.h (modified) (2 diffs)
-
ppImageParseCamera.c (modified) (4 diffs)
-
ppImagePhotom.c (modified) (2 diffs)
-
ppImageRebinReadout.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImage.h
r7592 r7621 34 34 bool ppImageDetrendNonLinearPolynomial(pmReadout *input, psMetadataItem *dataItem); 35 35 36 bool ppImageRebinReadout (pmConfig *config, pmFPAview *view, char *filename); 36 bool ppImageRebinChip (pmConfig *config, pmFPAview *view, char *outName, char *inName); 37 bool ppImageRebinReadout (pmReadout *output, pmReadout *input, pmFPAfile *outFile); 37 38 38 39 bool ppImagePhotom (pmConfig *config, pmFPAview *view); 39 40 bool ppImageAstrom (pmConfig *config); 40 41 41 bool ppImageMosaicChip (pmChip *chip, pmConfig *config, const pmFPAview *view); 42 bool ppImageMosaicChip (pmConfig *config, const pmFPAview *view, char *outFile, char *inFile); 43 bool ppImageMosaicFPA (pmConfig *config, char *outFile, char *inFile); 42 44 43 45 #endif -
trunk/ppImage/src/ppImageAstrom.c
r7592 r7621 5 5 bool status; 6 6 7 // select recipe options supplied on command line 8 // XXX move these options to the "PSASTRO" recipe? 9 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, RECIPE_NAME); 10 7 11 // find or define a pmFPAfile PSPHOT.INPUT 8 12 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSASTRO.INPUT"); 9 13 if (!status) { 10 14 11 // psphotReadout requires a pmFPAfile supplied with the name PS PHOT.INPUT12 // create a pmFPAfile which points at P PIMAGE.OUTPUT15 // psphotReadout requires a pmFPAfile supplied with the name PSASTRO.INPUT 16 // create a pmFPAfile which points at PSPHOT.OUTPUT 13 17 // mode is 'REFERENCE' to prevent double frees of the fpa 14 18 pmFPAfile *output = psMetadataLookupPtr (&status, config->files, "PSPHOT.OUTPUT"); … … 17 21 18 22 pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.OUTPUT"); 19 20 // supply the output name (from cmd-line) to all output (WRITE) files21 // XXX does this cause trouble with existing files?22 char *outname = psMetadataLookupPtr(&status, config->arguments, "OUTPUT");23 pmFPAfileAddFileNames (config->files, "OUTPUT", outname, PM_FPA_MODE_WRITE);24 23 } 25 26 // we only was to operate on PSPHOT pmFPAfiles here:27 pmFPAfileActivate (config->files, false, NULL);28 pmFPAfileActivate (config->files, true, "PSASTRO.INPUT");29 pmFPAfileActivate (config->files, true, "PSASTRO.OUTPUT");30 24 31 25 // interpret the available initial astrometric information … … 38 32 psastroMosaicGetRefstars (config, refs); 39 33 40 char *mosastro = psMetadataLookupStr (NULL, config->arguments, "MOSASTRO"); 41 if (mosastro == NULL) { 34 if (psMetadataLookupBool (NULL, recipe, "ASTROM.CHIP")) { 42 35 psastroChipAstrom (config, refs); 43 } else { 36 } 37 if (psMetadataLookupBool (NULL, recipe, "ASTROM.MOSAIC")) { 44 38 psastroMosaicAstrom (config, refs); 45 39 } 46 40 47 psastroDataSave (config);48 49 // de-activate the PSPHOT image files, activate the PPIMAGE ones50 pmFPAfileActivate (config->files, false, NULL);51 pmFPAfileActivate (config->files, true, "PPIMAGE.INPUT");52 pmFPAfileActivate (config->files, true, "PPIMAGE.BIAS");53 pmFPAfileActivate (config->files, true, "PPIMAGE.DARK");54 pmFPAfileActivate (config->files, true, "PPIMAGE.MASK");55 pmFPAfileActivate (config->files, true, "PPIMAGE.FLAT");56 pmFPAfileActivate (config->files, true, "PPIMAGE.OUTPUT");57 58 pmFPAfileActivate (config->files, true, "PPIMAGE.BIN1");59 pmFPAfileActivate (config->files, true, "PPIMAGE.JPEG1");60 pmFPAfileActivate (config->files, true, "PPIMAGE.BIN2");61 pmFPAfileActivate (config->files, true, "PPIMAGE.JPEG2");62 63 41 return true; 64 42 } -
trunk/ppImage/src/ppImageLoop.c
r7592 r7621 37 37 if (!ppImageDetrendReadout (config, options, view)) return false; 38 38 39 if (options->doBin1) ppImageRebinReadout (config, view, "PPIMAGE.BIN1");40 if (options->doBin2) ppImageRebinReadout (config, view, "PPIMAGE.BIN2");41 42 39 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) return false; 43 40 } … … 45 42 } 46 43 47 ppImageMosaicChip (chip, config, view); 44 ppImageMosaicChip (config, view, "PPIMAGE.OUTPUT.CHIP", "PPIMAGE.OUTPUT"); 45 ppImageRebinChip (config, view, "PPIMAGE.BIN1", "PPIMAGE.OUTPUT.CHIP"); 46 ppImageRebinChip (config, view, "PPIMAGE.BIN2", "PPIMAGE.OUTPUT.CHIP"); 48 47 49 48 // we perform photometry on the readouts of this chip in the output … … 53 52 } 54 53 54 ppImageMosaicFPA (config, "PPIMAGE.OUTPUT.FPA1", "PPIMAGE.BIN1"); 55 ppImageMosaicFPA (config, "PPIMAGE.OUTPUT.FPA2", "PPIMAGE.BIN2"); 56 55 57 // we perform astrometry on all chips after sources have been detected 56 if (options->doAstrom ) ppImageAstrom (config);58 if (options->doAstromChip || options->doAstromMosaic) ppImageAstrom (config); 57 59 58 // ppImageFPAMosaic (config, view);59 // ppImageJpegFPA (config, view);60 61 60 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) return false; 62 61 … … 67 66 // input image is: PPIMAGE.INPUT 68 67 // output image is: PPIMAGE.OUTPUT 68 69 // XXX need to be careful in ppImage in general about which pmFPAfiles are active and when. 70 // major phases: 71 // - detrend loop 72 // - -
trunk/ppImage/src/ppImageMosaic.c
r7592 r7621 1 1 # include "ppImage.h" 2 2 3 bool ppImageMosaicChip (pmC hip *chip, pmConfig *config, const pmFPAview *view) {3 bool ppImageMosaicChip (pmConfig *config, const pmFPAview *view, char *outFile, char *inFile) { 4 4 5 5 bool status; 6 6 7 pmFPAfile * outByChip = psMetadataLookupPtr (&status, config->files, "PPIMAGE.OUTPUT.CHIP");7 pmFPAfile *in = psMetadataLookupPtr (&status, config->files, inFile); 8 8 if (!status) { 9 9 psErrorStackPrint(stderr, "Can't find required I/O file!\n"); … … 11 11 } 12 12 13 pmFPAAddSourceFromView (outByChip->fpa, view, outByChip->format); 14 pmChip *outChip = pmFPAviewThisChip (view, outByChip->fpa); 15 pmChipMosaic (outChip, chip); 13 pmFPAfile *out = psMetadataLookupPtr (&status, config->files, outFile); 14 if (!status) { 15 psErrorStackPrint(stderr, "Can't find required I/O file!\n"); 16 exit(EXIT_FAILURE); 17 } 18 19 pmFPAAddSourceFromView (out->fpa, view, out->format); 20 pmChip *outChip = pmFPAviewThisChip (view, out->fpa); 21 pmChip *inChip = pmFPAviewThisChip (view, in->fpa); 22 23 pmChipMosaic (outChip, inChip); 16 24 17 25 return true; 18 26 } 27 28 bool ppImageMosaicFPA (pmConfig *config, char *outFile, char *inFile) { 29 30 bool status; 31 32 pmFPAfile *in = psMetadataLookupPtr (&status, config->files, inFile); 33 if (!status) { 34 psErrorStackPrint(stderr, "Can't find required I/O file!\n"); 35 exit(EXIT_FAILURE); 36 } 37 38 pmFPAfile *out = psMetadataLookupPtr (&status, config->files, outFile); 39 if (!status) { 40 psErrorStackPrint(stderr, "Can't find required I/O file!\n"); 41 exit(EXIT_FAILURE); 42 } 43 44 pmFPAview *view = pmFPAviewAlloc (0); 45 pmFPAAddSourceFromView (out->fpa, view, out->format); 46 pmFPAMosaic (out->fpa, in->fpa); 47 48 psFree (view); 49 return true; 50 } -
trunk/ppImage/src/ppImageOptions.c
r7531 r7621 29 29 options->doFringe = false; // Fringe subtraction 30 30 options->doPhotom = false; // Source identification and photometry 31 options->doAstrom = false; // Astrometry 31 options->doAstromChip = false; // Astrometry 32 options->doAstromMosaic = false; // Astrometry 32 33 33 options->doBin1 = false; // create binned image (scale 1) 34 options->doBin2 = false; // create binned image (scale 2) 35 options->doBin1JPG = false; // create jpg of binned image (scale 1) 36 options->doBin2JPG = false; // create jpg of binned image (scale 2) 34 options->BaseFITS = false; // create binned image (scale 1) 35 options->ChipFITS = false; // create binned image (scale 1) 36 options->FPA1FITS = false; // create binned image (scale 1) 37 options->FPA2FITS = false; // create binned image (scale 1) 38 39 options->Bin1FITS = false; // create binned image (scale 1) 40 options->Bin2FITS = false; // create binned image (scale 2) 41 options->Bin1JPEG = false; // create jpeg of binned image (scale 1) 42 options->Bin2JPEG = false; // create jpeg of binned image (scale 2) 37 43 38 44 // Overscan defaults … … 164 170 if (!status) options->yBin1 = 16; 165 171 166 options->doBin1 = psMetadataLookupBool(NULL, recipe, "BIN1.FITS"); 167 options->doBin1JPG = psMetadataLookupBool(NULL, recipe, "BIN1.JPEG"); 168 if (options->doBin1JPG && !options->doBin1) { 169 psLogMsg(__func__, PS_LOG_ERROR, "Invalid Phase2 Options: cannot make JPG of Bin1 image without Bin1 image"); 170 exit(EXIT_FAILURE); 171 } 172 options->BaseFITS = psMetadataLookupBool(NULL, recipe, "BASE.FITS"); 173 options->ChipFITS = psMetadataLookupBool(NULL, recipe, "CHIP.FITS"); 174 options->FPA1FITS = psMetadataLookupBool(NULL, recipe, "FPA1.FITS"); 175 options->FPA2FITS = psMetadataLookupBool(NULL, recipe, "FPA2.FITS"); 172 176 173 options->doBin2 = psMetadataLookupBool(NULL, recipe, "BIN2.FITS"); 174 options->doBin2JPG = psMetadataLookupBool(NULL, recipe, "BIN2.JPEG"); 175 if (options->doBin2JPG && !options->doBin2) { 176 psLogMsg(__func__, PS_LOG_ERROR, "Invalid Phase2 Options: cannot make JPG of Bin2 image without Bin2 image"); 177 exit(EXIT_FAILURE); 178 } 177 options->Bin1FITS = psMetadataLookupBool(NULL, recipe, "BIN1.FITS"); 178 options->Bin1JPEG = psMetadataLookupBool(NULL, recipe, "BIN1.JPEG"); 179 options->Bin2FITS = psMetadataLookupBool(NULL, recipe, "BIN2.FITS"); 180 options->Bin2JPEG = psMetadataLookupBool(NULL, recipe, "BIN2.JPEG"); 179 181 180 182 options->doPhotom = psMetadataLookupBool(NULL, recipe, "PHOTOM"); 181 options->doAstrom = psMetadataLookupBool(NULL, recipe, "ASTROM"); 182 if (options->doAstrom && !options->doPhotom) { 183 options->doAstromChip = psMetadataLookupBool(NULL, recipe, "ASTROM.CHIP"); 184 options->doAstromMosaic = psMetadataLookupBool(NULL, recipe, "ASTROM.MOSAIC"); 185 if ((options->doAstromChip || options->doAstromMosaic) && !options->doPhotom) { 183 186 psLogMsg(__func__, PS_LOG_ERROR, "Invalid Phase2 Options: cannot do ASTROMetry without PHOTOMetry"); 184 187 exit(EXIT_FAILURE); -
trunk/ppImage/src/ppImageOptions.h
r7531 r7621 12 12 bool doFringe; // Fringe subtraction 13 13 bool doPhotom; // Source identification and photometry 14 bool doAstrom; // Astrometry 14 bool doAstromChip; // per-chip Astrometry 15 bool doAstromMosaic; // full-mosaic Astrometry 15 16 16 17 bool doOverscan; // Overscan subtraction … … 22 23 void *nonLinearSource; 23 24 24 bool doBin1; 25 bool doBin1JPG; 25 bool BaseFITS; 26 bool ChipFITS; 27 bool FPA1FITS; 28 bool FPA2FITS; 29 30 bool Bin1FITS; 31 bool Bin1JPEG; 26 32 int xBin1, yBin1; 27 33 28 bool doBin2;29 bool doBin2JPG;34 bool Bin2FITS; 35 bool Bin2JPEG; 30 36 int xBin2, yBin2; 31 37 -
trunk/ppImage/src/ppImageParseCamera.c
r7592 r7621 6 6 bool status = false; 7 7 8 // the input image defines the camera 8 // the input image defines the camera, and all recipes and options the follow 9 9 pmFPAfile *input = pmFPAfileDefineFromArgs (&status, config, "PPIMAGE.INPUT", "INPUT"); 10 10 if (!status) { … … 14 14 15 15 // add recipe options supplied on command line 16 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, "PHASE2");16 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, "PHASE2"); 17 17 psMetadata *arglist = psMetadataLookupPtr (&status, config->arguments, "PPIMAGE.OPTIONS"); 18 18 psMetadataCopy (recipe, arglist); … … 20 20 // parse the options from the metadata format to the ppImageOptions structure 21 21 ppImageOptions *options = ppImageOptionsParse (config); 22 23 // the following files are output targets24 pmFPAfileDefineOutput (config, input->fpa, "PPIMAGE.OUTPUT");25 pmFPAfileDefineNewCamera (config, "PPIMAGE.OUTPUT.CHIP");26 22 27 23 // the following are defined from the argument list, if given, … … 56 52 if (!status) psAbort ("ppImageParseDetrend", "can't find a flat image source"); 57 53 } 58 if (options->doBin1) { 59 pmFPAfile *file = pmFPAfileDefineFromFPA (config, input->fpa, options->xBin1, options->yBin1, "PPIMAGE.BIN1"); 60 if (options->doBin1JPG) { 61 pmFPAfileDefineOutput (config, file->fpa, "PPIMAGE.JPEG1"); 54 55 // the following files are output targets 56 pmFPAfile *output = pmFPAfileDefineOutput (config, input->fpa, "PPIMAGE.OUTPUT"); 57 pmFPAfile *byChip = pmFPAfileDefineNewCamera (config, "PPIMAGE.OUTPUT.CHIP"); 58 pmFPAfile *byFPA1 = pmFPAfileDefineNewCamera (config, "PPIMAGE.OUTPUT.FPA1"); 59 pmFPAfile *byFPA2 = pmFPAfileDefineNewCamera (config, "PPIMAGE.OUTPUT.FPA2"); 60 61 // save any of these files? 62 output->save = options->BaseFITS; 63 byChip->save = options->ChipFITS; 64 byFPA1->save = options->FPA1FITS; 65 byFPA2->save = options->FPA2FITS; 66 67 // output is used as a carrier: input to byChip 68 output->freeLevel = PM_FPA_LEVEL_CHIP; 69 70 // define the binned target files (which may just be carriers for some camera configurations) 71 pmFPAfile *bin1 = pmFPAfileDefineFromFPA (config, byChip->fpa, options->xBin1, options->yBin1, "PPIMAGE.BIN1"); 72 pmFPAfile *bin2 = pmFPAfileDefineFromFPA (config, byChip->fpa, options->xBin2, options->yBin2, "PPIMAGE.BIN2"); 73 74 // set the CELL.XBIN and CELL.YBIN for the output mosaiced FPAs 75 for (int i = 0; i < byFPA1->fpa->chips->n; i++) { 76 pmChip *chip = byFPA1->fpa->chips->data[i]; 77 for (int j = 0; j < chip->cells->n; j++) { 78 pmCell *cell = chip->cells->data[j]; 79 psMetadataAddF32 (cell->concepts, PS_LIST_TAIL, "CELL.XBIN", PS_META_REPLACE, "", options->xBin1); 80 psMetadataAddF32 (cell->concepts, PS_LIST_TAIL, "CELL.YBIN", PS_META_REPLACE, "", options->yBin1); 62 81 } 63 82 } 64 if (options->doBin2) { 65 pmFPAfile *file = pmFPAfileDefineFromFPA (config, input->fpa, options->xBin2, options->yBin2, "PPIMAGE.BIN2"); 66 if (options->doBin2JPG) { 67 pmFPAfileDefineOutput (config, file->fpa, "PPIMAGE.JPEG2"); 83 for (int i = 0; i < byFPA2->fpa->chips->n; i++) { 84 pmChip *chip = byFPA2->fpa->chips->data[i]; 85 for (int j = 0; j < chip->cells->n; j++) { 86 pmCell *cell = chip->cells->data[j]; 87 psMetadataAddF32 (cell->concepts, PS_LIST_TAIL, "CELL.XBIN", PS_META_REPLACE, "", options->xBin2); 88 psMetadataAddF32 (cell->concepts, PS_LIST_TAIL, "CELL.YBIN", PS_META_REPLACE, "", options->yBin2); 68 89 } 69 90 } 70 91 71 // ppImage is supplied with an output name, which may be used by multiple 72 // output files to construct the output names. supply this value to the 73 // files which are write types. 74 char *output = psMetadataLookupPtr(&status, config->arguments, "OUTPUT"); 75 pmFPAfileAddFileNames (config->files, "OUTPUT", output, PM_FPA_MODE_WRITE); 92 // bin1 and bin2 are used as carriers: input for byFPA1, byFPA2 93 bin1->freeLevel = PM_FPA_LEVEL_FPA; 94 bin2->freeLevel = PM_FPA_LEVEL_FPA; 95 96 pmFPAfile *jpg1 = pmFPAfileDefineOutput (config, byFPA1->fpa, "PPIMAGE.JPEG1"); 97 pmFPAfile *jpg2 = pmFPAfileDefineOutput (config, byFPA2->fpa, "PPIMAGE.JPEG2"); 98 99 // XXX we could potentially not define these pmFPAfiles if no output is requested... 100 bin1->save = options->Bin1FITS; 101 bin2->save = options->Bin2FITS; 102 jpg1->save = options->Bin1JPEG; 103 jpg2->save = options->Bin2JPEG; 76 104 77 105 // Chip selection: turn on only the chips specified (pass status to suppress missing-key log msg) -
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 } -
trunk/ppImage/src/ppImageRebinReadout.c
r6849 r7621 1 1 #include "ppImage.h" 2 2 3 bool ppImageRebinReadout (pmConfig *config, pmFPAview *view, char *filename) 3 bool ppImageRebinChip (pmConfig *config, pmFPAview *view, char *outName, char *inName) { 4 5 pmCell *cell; 6 pmReadout *inReadout, *outReadout; 7 8 pmFPAfile *inFile = psMetadataLookupPtr (NULL, config->files, inName); 9 if (inFile == NULL) return NULL; 10 11 pmFPAfile *outFile = psMetadataLookupPtr (NULL, config->files, outName); 12 if (outFile == NULL) return NULL; 13 14 // XXX double check that chip != -1? 15 16 pmChip *inChip = pmFPAviewThisChip (view, inFile->fpa); 17 pmChip *outChip = pmFPAviewThisChip (view, outFile->fpa); 18 pmChipCopyStructure (outChip, inChip, outFile->xBin, outFile->yBin); 19 20 while ((cell = pmFPAviewNextCell (view, inFile->fpa, 1)) != NULL) { 21 psLogMsg ("ppImageRebinChip", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 22 if (! cell->process || ! cell->file_exists) { continue; } 23 24 // process each of the readouts 25 while ((inReadout = pmFPAviewNextReadout (view, inFile->fpa, 1)) != NULL) { 26 if (! inReadout->data_exists) { continue; } 27 28 outReadout = pmFPAviewThisReadout (view, outFile->fpa); 29 30 // run the rebin code 31 ppImageRebinReadout (outReadout, inReadout, outFile); 32 } 33 } 34 return true; 35 } 36 37 bool ppImageRebinReadout (pmReadout *output, pmReadout *input, pmFPAfile *outFile) 4 38 { 5 bool status;6 39 psF32 value; 7 40 psS32 nPix; 8 9 // find the currently selected readout10 pmReadout *input = pmFPAfileThisReadout (config->files, view, "PPIMAGE.INPUT");11 12 // set up the readouts for dark and bias13 pmReadout *output = pmFPAfileThisReadout (config->files, view, filename);14 15 // we need the file for the binning factors as well16 pmFPAfile *file = psMetadataLookupPtr (&status, config->files, filename);17 if (file == NULL) return NULL;18 41 19 42 // the binning process must not change the size of the output image... … … 22 45 // psFree (stats); 23 46 24 int dX = file->xBin;25 int dY = file->yBin;47 int dX = outFile->xBin; 48 int dY = outFile->yBin; 26 49 27 50 int nX = input->image->numCols;
Note:
See TracChangeset
for help on using the changeset viewer.
