Changeset 6113
- Timestamp:
- Jan 20, 2006, 6:33:38 PM (20 years ago)
- Location:
- branches/eam_rel9_p0/psModules/src/astrom
- Files:
-
- 3 edited
-
pmChipMosaic.c (modified) (5 diffs)
-
pmChipMosaic.h (modified) (1 diff)
-
pmFPA.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_rel9_p0/psModules/src/astrom/pmChipMosaic.c
r6080 r6113 132 132 133 133 // Mosaic a chip together into a single image 134 static bool mosaicChip(pmChip *chip,// Chip to mosaic135 int xBinChip, int yBinChip // Binning of mosaic image in x and y136 )134 int pmChipMosaic(pmChip *chip,// Chip to mosaic 135 int xBinChip, int yBinChip // Binning of mosaic image in x and y 136 ) 137 137 { 138 138 … … 149 149 150 150 // Set up the required inputs 151 psTrace(__func__, 1, "Mosaicking %d cells...\n", cells->n); 151 152 for (int i = 0; i < cells->n; i++) { 152 153 pmCell *cell = cells->data[i]; // The cell of interest 153 154 x0->data.S32[i] = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0"); 154 155 y0->data.S32[i] = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0"); 155 psTrace(__func__, 9, "Cell %d: x0=%d y0=%d\n", i, x0->data.S32[i], y0->data.S32[i]);156 psTrace(__func__, 5, "Cell %d: x0=%d y0=%d\n", i, x0->data.S32[i], y0->data.S32[i]); 156 157 xBin->data.S32[i] = psMetadataLookupS32(NULL, cell->concepts, "CELL.XBIN"); 157 158 yBin->data.S32[i] = psMetadataLookupS32(NULL, cell->concepts, "CELL.XBIN"); … … 204 205 psFree(weights); 205 206 psFree(masks); 207 int nCells = cells->n; 208 psFree(cells); 206 209 207 210 // Chop off all the component cells, and put in a new one … … 228 231 //psFree(readout); 229 232 230 return true;231 } 232 233 234 int pmFPAMosaicC hips(pmFPA *fpa, // FPA233 return nCells; 234 } 235 236 237 int pmFPAMosaicCells(pmFPA *fpa, // FPA 235 238 int xBinChip, int yBinChip // Binning of mosaic image in x and y 236 239 ) … … 247 250 248 251 numChips++; 249 mosaicChip(chip, xBinChip, yBinChip); // Mosaic of cells within the chip252 pmChipMosaic(chip, xBinChip, yBinChip); // Mosaic of cells within the chip 250 253 251 254 } -
branches/eam_rel9_p0/psModules/src/astrom/pmChipMosaic.h
r6062 r6113 14 14 ); 15 15 16 // Mosaic a chip together into a single cell with single readout 17 int pmChipMosaic(pmChip *chip,// Chip to mosaic 18 int xBinChip, int yBinChip // Binning of mosaic image in x and y 19 ); 20 16 21 // Mosaic all the cells in all (valid) chips together (neglecting the overscans); return number of chips 17 int pmFPAMosaicC hips(pmFPA *fpa, // FPA22 int pmFPAMosaicCells(pmFPA *fpa, // FPA 18 23 int xBinChip, int yBinChip // Binning of mosaic image in x and y 19 24 ); -
branches/eam_rel9_p0/psModules/src/astrom/pmFPA.c
r6080 r6113 12 12 * XXX: Should we implement non-linear cell->chip transforms? 13 13 * 14 * @version $Revision: 1.1.2. 2$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-01-2 0 09:47:06$14 * @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-01-21 04:33:38 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 36 36 { 37 37 if (readout != NULL) { 38 psTrace(__func__, 9, "Removing readout %x from cell %x...\n", (unsigned)readout, (unsigned)readout->parent); 39 if (readout->parent) { 40 psArray *readouts = readout->parent->readouts; 41 for (int i = 0; i < readouts->n; i++) { 42 if (readouts->data[i] == readout) { 43 readouts->data[i] = NULL; 44 break; 45 } 46 } 47 } 48 psTrace(__func__, 9, "Freeing readout %x\n", (unsigned)readout); 38 49 psFree(readout->image); 39 50 psFree(readout->mask); 40 51 psFree(readout->weight); 41 52 psFree(readout->analysis); 42 #if 043 44 ps Free(readout->parent);53 #if 1 54 55 psMemDecrRefCounter(readout->parent); 45 56 #endif 46 57 47 readout->parent = NULL;48 58 } 49 59 } … … 52 62 { 53 63 if (cell != NULL) { 64 psTrace(__func__, 9, "Removing cell %x from chip %x...\n", (unsigned)cell, (unsigned)cell->parent); 65 if (cell->parent) { 66 psArray *cells = cell->parent->cells; 67 for (int i = 0; i < cells->n; i++) { 68 if (cells->data[i] == cell) { 69 cells->data[i] = NULL; 70 break; 71 } 72 } 73 } 74 psTrace(__func__, 9, "Freeing cell %x\n", (unsigned)cell); 54 75 psFree(cell->toChip); 55 76 psFree(cell->toFPA); … … 58 79 psFree(cell->analysis); 59 80 psFree(cell->camera); 81 #if 1 60 82 // 61 83 // Set the parent to NULL in all cell->readouts before psFree(cell->readouts) 62 84 // in order to avoid memory reference counter problems. 63 85 // 64 #if 065 66 for (psS32 i = 0 ; i < cell->readouts->n ; i++) {67 pmReadout *tmpReadout = (pmReadout *) cell->readouts->data[i];86 psArray *readouts = cell->readouts; 87 for (psS32 i = 0 ; i < readouts->n ; i++) { 88 pmReadout *tmpReadout = readouts->data[i]; 89 readouts->data[i] = NULL; 68 90 tmpReadout->parent = NULL; 69 91 if (PS_FREE_HIERARCHY == 1) { 92 psTrace(__func__, 9, "Will now free readout %x...\n", (unsigned)tmpReadout); 70 93 psFree(tmpReadout); 71 94 } 72 95 } 73 ps Free(cell->parent);96 psMemDecrRefCounter(cell->parent); 74 97 #endif 75 98 76 cell->parent = NULL;77 78 psFree(cell->readouts);79 99 psFree(cell->hdu); 80 81 100 } 82 101 } … … 85 104 { 86 105 if (chip != NULL) { 106 psTrace(__func__, 9, "Removing chip %x from fpa %x...\n", (unsigned)chip, (unsigned)chip->parent); 107 if (chip->parent) { 108 psArray *chips = chip->parent->chips; 109 for (int i = 0; i < chips->n; i++) { 110 if (chips->data[i] == chip) { 111 chips->data[i] = NULL; 112 break; 113 } 114 } 115 } 116 psTrace(__func__, 9, "Freeing chip %x\n", (unsigned)chip); 117 87 118 psFree(chip->toFPA); 88 119 psFree(chip->fromFPA); 89 120 psFree(chip->concepts); 90 121 psFree(chip->analysis); 122 #if 1 91 123 // 92 124 // Set the parent to NULL in all chip->cells before psFree(chip->cells) 93 125 // in order to avoid memory reference counter problems. 94 126 // 95 #if 096 97 for (psS32 i = 0 ; i < chip->cells->n ; i++) {98 pmCell *tmpCell = (pmCell *) chip->cells->data[i];127 psArray *cells = chip->cells; 128 for (psS32 i = 0 ; i < cells->n ; i++) { 129 pmCell *tmpCell = cells->data[i]; 130 cells->data[i] = NULL; 99 131 tmpCell->parent = NULL; 100 132 if (PS_FREE_HIERARCHY == 1) { … … 102 134 } 103 135 } 104 ps Free(chip->parent);136 psMemDecrRefCounter(chip->parent); 105 137 #endif 106 138 107 chip->parent = NULL;108 psFree(chip->cells);109 139 psFree(chip->hdu); 110 140 } … … 115 145 { 116 146 if (fpa != NULL) { 147 psTrace(__func__, 9, "Freeing fpa %x\n", (unsigned)fpa); 117 148 psFree(fpa->fromTangentPlane); 118 149 psFree(fpa->toTangentPlane); … … 121 152 psFree(fpa->analysis); 122 153 psFree(fpa->camera); 154 #if 1 123 155 // 124 156 // Set the parent to NULL in all fpa->chips before psFree(fpa->chips) 125 157 // in order to avoid memory reference counter problems. 126 158 // 127 #if 0128 129 for (psS32 i = 0 ; i < fpa->chips->n ; i++) {130 pmChip *tmpChip = (pmChip *) fpa->chips->data[i];159 psArray *chips = fpa->chips; 160 for (psS32 i = 0 ; i < chips->n ; i++) { 161 pmChip *tmpChip = chips->data[i]; 162 chips->data[i] = NULL; 131 163 tmpChip->parent = NULL; 132 164 if (PS_FREE_HIERARCHY == 1) { … … 135 167 } 136 168 #endif 137 psFree(fpa->chips);138 169 psFree(fpa->hdu); 139 170 psFree(fpa->phu); … … 167 198 tmpReadout->bias = psListAlloc(NULL); 168 199 tmpReadout->analysis = psMetadataAlloc(); 169 tmpReadout->parent = cell;200 tmpReadout->parent = psMemIncrRefCounter(cell); 170 201 if (cell != NULL) { 171 202 cell->readouts = psArrayAdd(cell->readouts, 1, (psPtr) tmpReadout); … … 197 228 tmpCell->analysis = psMetadataAlloc(); 198 229 tmpCell->readouts = psArrayAlloc(0); 199 tmpCell->parent = chip;230 tmpCell->parent = psMemIncrRefCounter(chip); 200 231 if (chip != NULL) { 201 232 chip->cells = psArrayAdd(chip->cells, 1, (psPtr) tmpCell); … … 230 261 tmpChip->analysis = psMetadataAlloc(); 231 262 tmpChip->cells = psArrayAlloc(0); 232 tmpChip->parent = fpa;263 tmpChip->parent = psMemIncrRefCounter(fpa); 233 264 if (fpa != NULL) { 234 265 fpa->chips = psArrayAdd(fpa->chips, 1, (psPtr) tmpChip); … … 562 593 563 594 // Set weight image to the variance = g*f + rn^2 564 psBinaryOp(readout->weight, image, "*", psScalarAlloc(gain, PS_TYPE_F32)); 565 psBinaryOp(readout->weight, readout->weight, "+", psScalarAlloc(readnoise*readnoise, PS_TYPE_F32)); 595 psBinaryOp(readout->weight, image, "/", psScalarAlloc(gain, PS_TYPE_F32)); 596 psBinaryOp(readout->weight, readout->weight, "+", 597 psScalarAlloc(readnoise*readnoise/gain/gain, PS_TYPE_F32)); 566 598 } 567 599
Note:
See TracChangeset
for help on using the changeset viewer.
