Changeset 7060
- Timestamp:
- May 3, 2006, 5:57:32 PM (20 years ago)
- Location:
- trunk/psModules/src
- Files:
-
- 6 edited
-
camera/pmFPA.c (modified) (2 diffs)
-
camera/pmFPA.h (modified) (2 diffs)
-
detrend/pmFlatNormalize.c (modified) (6 diffs)
-
detrend/pmFlatNormalize.h (modified) (1 diff)
-
detrend/pmMaskBadPixels.h (modified) (2 diffs)
-
psmodules.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPA.c
r7017 r7060 12 12 * XXX: Should we implement non-linear cell->chip transforms? 13 13 * 14 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-05-0 1 01:55:43$14 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-05-04 03:57:32 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 173 173 } 174 174 175 void pmCellFreeData(pmCell *cell) 176 { 177 pmCellFreeReadouts(cell); 178 if (cell->hdu) { 179 psFree(cell->hdu->images); 180 } 181 } 182 183 void pmChipFreeData(pmChip *chip) 184 { 185 for (int i = 0; i < chip->cells->n; i++) { 186 pmCellFreeData(chip->cells->data[i]); 187 } 188 if (chip->hdu) { 189 psFree(chip->hdu->images); 190 } 191 } 192 193 void pmFPAFreeData(pmFPA *fpa) 194 { 195 for (int i = 0; i < fpa->chips->n; i++) { 196 pmChipFreeData(fpa->chips->data[i]); 197 } 198 if (fpa->hdu) { 199 psFree(fpa->hdu->images); 200 } 201 } 175 202 176 203 pmReadout *pmReadoutAlloc(pmCell *cell) -
trunk/psModules/src/camera/pmFPA.h
r7017 r7060 7 7 * @author GLG, MHPCC 8 8 * 9 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-05-0 1 01:55:43$9 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-05-04 03:57:32 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 151 151 void pmCellFreeReadouts(pmCell *cell); 152 152 void pmChipFreeCells(pmChip *chip); 153 void pmCellFreeData(pmCell *cell); 154 void pmChipFreeData(pmChip *chip); 155 void pmFPAFreeData(pmFPA *fpa); 153 156 154 157 /** Allocates a pmReadout -
trunk/psModules/src/detrend/pmFlatNormalize.c
r6999 r7060 7 7 8 8 9 // Estimate the flat-field normalisation 10 bool pmFlatNormalize(psVector *sourceFlux, // The source flux in each image; modified for return 11 psVector *chipGains, // Initial guess of the chip gains; modified for return12 psImage *fluxLevels, // Fluxes for each integration (row) and chip (col); modified13 unsigned int maxIter, // Maximum number of iterations14 double tolerance // Tolerance level before dying15 )9 // Estimate the flat-field normalisation; return the source flux in each integration 10 psVector *pmFlatNormalize(bool *converge, // Did we converge? 11 psVector *chipGains, // Initial guess of the chip gains; modified for return 12 const psImage *fluxLevels, // Fluxes for each integration (row) and chip (col) 13 unsigned int maxIter, // Maximum number of iterations 14 double tolerance // Tolerance level before dying 15 ) 16 16 { 17 int numSources = sourceFlux->n; // Number of measurements made18 int numChips = chipGains->n; // Number of chips with which each measurementis made17 int numSources = fluxLevels->numRows; // Number of integrations 18 int numChips = fluxLevels->numCols; // Number of chips with which each integration is made 19 19 20 20 // Sanity checks 21 assert(fluxLevels->numCols == numSources); 22 assert(fluxLevels->numRows == numChips); 23 assert(sourceFlux->type.type == PS_TYPE_F64); 21 assert(chipGains->n == numChips); 24 22 assert(chipGains->type.type == PS_TYPE_F64); 25 assert(fluxLevels->type.type == PS_TYPE_F64);26 23 assert(maxIter >= 1); 27 24 assert(tolerance > 0); 28 25 29 26 // Take the logarithms 27 psImage *flux = psImageCopy(NULL, fluxLevels, PS_TYPE_F64); // Copy of the input flux levels matrix 30 28 psImage *fluxMask = psImageAlloc(numSources, numChips, PS_TYPE_U8); // Mask for bad measurements 31 29 psImageInit(fluxMask, 0); … … 44 42 45 43 for (int j = 0; j < numSources; j++) { 46 if (isfinite(flux Levels->data.F64[j][i]) && fluxLevels->data.F64[j][i] > 0) {47 flux Levels->data.F64[j][i] = log(fluxLevels->data.F64[j][i]);44 if (isfinite(flux->data.F64[j][i]) && flux->data.F64[j][i] > 0) { 45 flux->data.F64[j][i] = log(flux->data.F64[j][i]); 48 46 } else { 49 47 // Blank out this measurement 50 48 fluxMask->data.U8[j][i] = 1; 51 flux Levels->data.F64[j][i] = NAN;49 flux->data.F64[j][i] = NAN; 52 50 } 53 51 } 54 52 } 55 // Don't need to initialise sourceFlux, since that is changed immediately56 53 57 54 58 55 double diff = INFINITY; // Difference from previous iteration 56 psVector *sourceFlux = psVectorAlloc(numSources, PS_TYPE_F64); // The flux in each integration 57 // Don't need to initialise sourceFlux, since that is changed immediately 59 58 for (int iter = 0; iter < maxIter && diff > tolerance; iter++) { 60 59 diff = 0.0; … … 70 69 for (int j = 0; j < numChips; j++) { 71 70 if (!gainMask->data.U8[j] && !fluxMask->data.U8[i][j]) { 72 sum += flux Levels->data.F64[i][j] - chipGains->data.F64[j];71 sum += flux->data.F64[i][j] - chipGains->data.F64[j]; 73 72 number++; 74 73 } … … 93 92 for (int j = 0; j < numSources; j++) { 94 93 if (!fluxMask->data.U8[j][i]) { 95 sum += flux Levels->data.F64[j][i] - sourceFlux->data.F64[j];94 sum += flux->data.F64[j][i] - sourceFlux->data.F64[j]; 96 95 number++; 97 96 } … … 106 105 } 107 106 } 107 psFree(flux); 108 108 psFree(fluxMask); 109 109 110 // Un-log everything110 // Un-log the vectors 111 111 for (int i = 0; i < numChips; i++) { 112 112 if (!gainMask->data.U8[i]) { … … 122 122 psFree(sourceMask); 123 123 124 return (diff <= tolerance); // Did we converge? 124 if (converge) { 125 *converge = (diff < tolerance); // Did we converge? 126 } 127 128 return sourceFlux; 125 129 } -
trunk/psModules/src/detrend/pmFlatNormalize.h
r6999 r7060 5 5 // Normalise the flat-field measurements (f_ij = g_i s_j where f_ij is the flux recorded for chip i and 6 6 // integration j, g_i is the gain for the i-th chip, s_j is the flux of the source in the j-th integration). 7 bool pmFlatNormalize(psVector *sourceFlux, // The source flux in each image; modified for return 8 psVector *chipGains, // Initial guess of the chip gains; modified for return 9 psImage *fluxLevels, // Fluxes for each integration (row) and chip (col); modified10 unsigned int maxIter, // Maximum number of iterations11 double tolerance // Tolerance level before dying12 );13 7 // Return the source flux in each integration. 8 psVector *pmFlatNormalize(bool *converge, // Did we converge? 9 psVector *chipGains, // Initial guess of the chip gains; modified for return 10 const psImage *fluxLevels, // Fluxes for each integration (row) and chip (col) 11 unsigned int maxIter, // Maximum number of iterations 12 double tolerance // Tolerance level before dying 13 ); 14 14 15 15 #endif -
trunk/psModules/src/detrend/pmMaskBadPixels.h
r6910 r7060 24 24 * @author Ross Harman, MHPCC 25 25 * 26 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $27 * @date $Date: 2006-0 4-19 20:37:35$26 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 27 * @date $Date: 2006-05-04 03:57:32 $ 28 28 * 29 29 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 39 39 /** Mask values */ 40 40 typedef enum { 41 PM_MASK_CLEAR = 0x00, ///< The pixel is a charge trap.41 PM_MASK_CLEAR = 0x00, ///< The pixel is not masked 42 42 PM_MASK_TRAP = 0x01, ///< The pixel is a charge trap. 43 43 PM_MASK_BADCOL = 0x02, ///< The pixel is a bad column. -
trunk/psModules/src/psmodules.h
r7019 r7060 49 49 #include <pmFlatField.h> 50 50 #include <pmFlatFieldErrors.h> 51 #include <pmFlatNormalize.h> 51 52 #include <pmFringeStats.h> 52 53 #include <pmMaskBadPixels.h>
Note:
See TracChangeset
for help on using the changeset viewer.
