Changeset 6747 for trunk/ppImage/src/ppImageDetrendPedestal.c
- Timestamp:
- Mar 31, 2006, 3:24:14 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageDetrendPedestal.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageDetrendPedestal.c
r5858 r6747 1 # include "ppImage.h" 1 #include <stdio.h> 2 #include "pslib.h" 3 #include "psmodules.h" 4 #include "ppImage.h" 2 5 3 6 // XXX check on image overlaps, as well as image sizes … … 13 16 14 17 if (options->doDark) { 15 // Dark time for input image16 float inputTime = psMetadataLookupF32(NULL, input->concepts, "CELL.DARKTIME");17 if (inputTime <= 0) {18 psErrorStackPrint(stderr, "DARKTIME for input image (%f) is non-positive.\n",19 inputTime);20 exit(EXIT_FAILURE);21 }18 // Dark time for input image 19 float inputTime = psMetadataLookupF32(NULL, input->concepts, "CELL.DARKTIME"); 20 if (inputTime <= 0) { 21 psErrorStackPrint(stderr, "DARKTIME for input image (%f) is non-positive.\n", 22 inputTime); 23 exit(EXIT_FAILURE); 24 } 22 25 23 if (inputTime != lastExptime) {24 // this will create a new pedestal if the input one is NULL25 // XXX EAM : this function had darkTime * inputTime, which is wrong, yes?26 if (pedestal == NULL) {27 pedestal = pmReadoutAlloc (NULL);28 }29 pedestal->col0 = dark->col0;30 pedestal->row0 = dark->row0;31 pedestal->colBins = dark->colBins;32 pedestal->rowBins = dark->rowBins;26 if (inputTime != lastExptime) { 27 // this will create a new pedestal if the input one is NULL 28 // XXX EAM : this function had darkTime * inputTime, which is wrong, yes? 29 if (pedestal == NULL) { 30 pedestal = pmReadoutAlloc (NULL); 31 } 32 pedestal->col0 = dark->col0; 33 pedestal->row0 = dark->row0; 34 pedestal->colBins = dark->colBins; 35 pedestal->rowBins = dark->rowBins; 33 36 34 pedestal->image = (psImage *) psBinaryOp(pedestal->image, dark->image, "*", psScalarAlloc(inputTime / darkTime, PS_TYPE_F32));35 reusePedestal = false;36 lastExptime = inputTime37 }37 pedestal->image = (psImage *) psBinaryOp(pedestal->image, dark->image, "*", psScalarAlloc(inputTime / darkTime, PS_TYPE_F32)); 38 reusePedestal = false; 39 lastExptime = inputTime 40 } 38 41 } 39 42 40 43 // no bias image, return dark pedestal or NULL 41 44 if (!options->doBias) { 42 return pedestal;45 return pedestal; 43 46 } 44 47 45 48 // no dark image, return bias pedestal, or reuse 46 49 if (!options->doDark) { 47 if (!pedestal) {48 pedestal = psMemIncrRefCounter(bias);49 }50 return pedestal;50 if (!pedestal) { 51 pedestal = psMemIncrRefCounter(bias); 52 } 53 return pedestal; 51 54 } 52 55 53 56 if (reusePedestal) { 54 return pedestal;57 return pedestal; 55 58 } 56 59 57 60 if (bias->image->numRows != dark->image->numRows || 58 bias->image->numCols != dark->image->numCols) {59 psError(PS_ERR_IO, true, "Bias and dark images have different dimensions: %dx%d vs %dx%d\n", 60 bias->image->numCols, bias->image->numRows,61 dark->image->numCols, dark->image->numRows);62 exit(EXIT_FAILURE);61 bias->image->numCols != dark->image->numCols) { 62 psError(PS_ERR_IO, true, "Bias and dark images have different dimensions: %dx%d vs %dx%d\n", 63 bias->image->numCols, bias->image->numRows, 64 dark->image->numCols, dark->image->numRows); 65 exit(EXIT_FAILURE); 63 66 } 64 67 … … 71 74 72 75 // creates a new pedestal image for this readout 73 // if the current exptime is the same as the last exptime, 76 // if the current exptime is the same as the last exptime, 74 77 // reuses the supplied pedestal
Note:
See TracChangeset
for help on using the changeset viewer.
