Changeset 14798 for trunk/ppSim/src/ppSimUtils.c
- Timestamp:
- Sep 10, 2007, 9:10:43 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/ppSim/src/ppSimUtils.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSimUtils.c
r14531 r14798 4 4 // this function is called with only one of fpa, chip, cell not NULL 5 5 bool ppSimInitHeader(pmConfig *config, 6 pmFPA *fpa,7 pmChip *chip,8 pmCell *cell)6 pmFPA *fpa, 7 pmChip *chip, 8 pmCell *cell) 9 9 { 10 10 … … 17 17 int binning = psMetadataLookupS32(NULL, config->arguments, "BINNING"); // Binning in x and y 18 18 19 float x0 , y0;20 int xParity , yParity;19 float x0 = 0.0, y0 = 0.0; 20 int xParity = 0, yParity = 0; 21 21 if (cell) { 22 int x0Chip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.X0");23 int y0Chip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.Y0");24 int xParityChip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.XPARITY");25 int yParityChip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.YPARITY");22 int x0Chip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.X0"); 23 int y0Chip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.Y0"); 24 int xParityChip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.XPARITY"); 25 int yParityChip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.YPARITY"); 26 26 27 int x0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0");28 int y0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0");29 int xParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.XPARITY");30 int yParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.YPARITY");27 int x0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0"); 28 int y0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0"); 29 int xParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.XPARITY"); 30 int yParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.YPARITY"); 31 31 32 x0 = PPSIM_FPA_TO_CELL(0.0, x0Cell, xParityCell, binning, x0Chip, xParityChip);33 y0 = PPSIM_FPA_TO_CELL(0.0, y0Cell, yParityCell, binning, y0Chip, yParityChip);34 xParity = xParityCell * xParityChip;35 yParity = yParityCell * yParityChip;32 x0 = PPSIM_FPA_TO_CELL(0.0, x0Cell, xParityCell, binning, x0Chip, xParityChip); 33 y0 = PPSIM_FPA_TO_CELL(0.0, y0Cell, yParityCell, binning, y0Chip, yParityChip); 34 xParity = xParityCell * xParityChip; 35 yParity = yParityCell * yParityChip; 36 36 } 37 37 if (chip) { 38 int x0Chip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.X0");39 int y0Chip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.Y0");40 int xParityChip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.XPARITY");41 int yParityChip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.YPARITY");38 int x0Chip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.X0"); 39 int y0Chip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.Y0"); 40 int xParityChip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.XPARITY"); 41 int yParityChip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.YPARITY"); 42 42 43 x0 = PPSIM_FPA_TO_CELL(0.0, 0, 1, binning, x0Chip, xParityChip);44 y0 = PPSIM_FPA_TO_CELL(0.0, 0, 1, binning, y0Chip, yParityChip);45 xParity = xParityChip;46 yParity = yParityChip;43 x0 = PPSIM_FPA_TO_CELL(0.0, 0, 1, binning, x0Chip, xParityChip); 44 y0 = PPSIM_FPA_TO_CELL(0.0, 0, 1, binning, y0Chip, yParityChip); 45 xParity = xParityChip; 46 yParity = yParityChip; 47 47 } 48 48 if (fpa) { 49 psRegion *bounds = ppSimFPABounds (fpa);50 x0 = 0.5 * (bounds->x1 - bounds->x0);51 y0 = 0.5 * (bounds->y1 - bounds->y0);52 xParity = 1;53 yParity = 1;54 psFree (bounds);49 psRegion *bounds = ppSimFPABounds (fpa); 50 x0 = 0.5 * (bounds->x1 - bounds->x0); 51 y0 = 0.5 * (bounds->y1 - bounds->y0); 52 xParity = 1; 53 yParity = 1; 54 psFree (bounds); 55 55 } 56 assert(xParity != 0 && yParity != 0); 56 57 57 58 psMetadata *header = psMetadataAlloc(); // Header, to return … … 77 78 78 79 if (cell) { 79 cell->hdu->header = header;80 cell->data_exists = true;80 cell->hdu->header = header; 81 cell->data_exists = true; 81 82 } 82 83 if (chip) { 83 chip->hdu->header = header;84 chip->hdu->header = header; 84 85 chip->data_exists = true; 85 86 } 86 87 if (fpa) { 87 fpa->hdu->header = header;88 fpa->hdu->header = header; 88 89 } 89 90 … … 131 132 132 133 psMetadataAddF32(cell->concepts, PS_LIST_TAIL, "CELL.EXPOSURE", PS_META_REPLACE, 133 "Exposure time (sec)", expTime);134 "Exposure time (sec)", expTime); 134 135 psMetadataAddF32(cell->concepts, PS_LIST_TAIL, "CELL.DARKTIME", PS_META_REPLACE, 135 "Dark time (sec)", expTime);136 "Dark time (sec)", expTime); 136 137 psMetadataAddS32(cell->concepts, PS_LIST_TAIL, "CELL.XBIN", PS_META_REPLACE, 137 "Binning in x", binning);138 "Binning in x", binning); 138 139 psMetadataAddS32(cell->concepts, PS_LIST_TAIL, "CELL.YBIN", PS_META_REPLACE, 139 "Binning in y", binning);140 "Binning in y", binning); 140 141 141 142 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
