Changeset 5371 for trunk/archive/scripts/src/phase2/pmFPA.c
- Timestamp:
- Oct 18, 2005, 4:19:41 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/archive/scripts/src/phase2/pmFPA.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/scripts/src/phase2/pmFPA.c
r5104 r5371 7 7 #include "pmFPA.h" 8 8 9 // Get the bias images for a readout, using the CELL.BIASSEC 10 psList *pmReadoutGetBias(pmReadout *readout // Readout for which to get the bias sections 11 ) 12 { 13 pmCell *cell = readout->parent; // The parent cell 14 psList *sections = (psList*)psMetadataLookupPtr(NULL, cell->concepts, "CELL.BIASSEC"); // CELL.BIASSEC 15 16 psImage *image = readout->image; // The image that contains both the biassec and the trimsec 17 18 psList *images = psListAlloc(NULL); // List of images from bias sections 19 psListIterator *sectionsIter = psListIteratorAlloc(sections, PS_LIST_HEAD, true); // Iterator 20 psRegion *region = NULL; // Bias region from list 21 while (region = psListGetAndIncrement(sectionsIter)) { 22 #if 0 23 // Convert from FITS standard to PS standard 24 // We don't touch the x1 and y1 values because they aren't included by psImageSubset. 25 region->x0 -= 1; 26 region->y0 -= 1; 27 #endif 28 29 psImage *bias = psImageSubset(image, *region); // Image from bias section 30 psListAdd(images, PS_LIST_TAIL, bias); 31 psFree(bias); 32 } 33 psFree(sectionsIter); 34 35 return images; 36 } 37 9 38 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 10 39 // Allocators 11 40 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 12 41 13 p_pmHDU *p_pmHDUAlloc(const char *extname) 14 { 15 p_pmHDU *hdu = psAlloc(sizeof(p_pmHDU)); 16 psMemSetDeallocator(hdu, (psFreeFunc)p_pmHDUFree); 17 18 hdu->extname = extname; 19 hdu->pixels = NULL; 20 hdu->header = NULL; 21 22 return hdu; 23 } 24 25 void p_pmHDUFree(p_pmHDU *hdu) 26 { 27 psFree(hdu->pixels); 28 psFree(hdu->header); 42 pmPixelData *pmPixelDataAlloc(const char *extname) 43 { 44 pmPixelData *pd = psAlloc(sizeof(pmPixelData)); 45 psMemSetDeallocator(pd, (psFreeFunc)p_pmPixelDataFree); 46 47 pd->extname = extname; 48 pd->header = NULL; 49 pd->images = NULL; 50 pd->masks = NULL; 51 pd->weights = NULL; 52 53 return pd; 54 } 55 56 void p_pmPixelDataFree(pmPixelData *pd) 57 { 58 psFree(pd->header); 59 psFree(pd->images); 60 psFree(pd->masks); 61 psFree(pd->weights); 29 62 } 30 63 … … 44 77 fpa->chips = psArrayAlloc(0); 45 78 46 fpa-> private= NULL;79 fpa->data = NULL; 47 80 48 81 return fpa; … … 59 92 psFree(fpa->chips); 60 93 61 psFree(fpa-> private);94 psFree(fpa->data); 62 95 } 63 96 … … 86 119 chip->valid = true; 87 120 88 chip-> private= NULL;121 chip->data = NULL; 89 122 90 123 psMetadataAddStr(chip->concepts, PS_LIST_HEAD, "CHIP.NAME", 0, "Chip name added at pmChipAlloc", name); … … 101 134 psFree(chip->cells); 102 135 103 psFree(chip-> private);136 psFree(chip->data); 104 137 105 138 // We don't free the parent member, since that would generate a circular call. We don't increment the … … 138 171 cell->valid = true; 139 172 140 cell-> private= NULL;173 cell->data = NULL; 141 174 142 175 return cell; … … 155 188 psFree(cell->readouts); 156 189 157 psFree(cell-> private);190 psFree(cell->data); 158 191 159 192 // We don't free the parent member, since that would generate a circular call. We don't increment the … … 163 196 pmReadout *pmReadoutAlloc(pmCell *cell, // Cell to which the readout belongs 164 197 psImage *image, // The pixels 165 ps List *overscans, // The overscan images198 psImage *mask,// The mask pixels 166 199 int col0, int row0, int colParity, int rowParity, int colBin, int rowBin // Data 167 200 ) … … 173 206 // Set the components 174 207 readout->image = psMemIncrRefCounter(image); 175 readout->mask = NULL;176 readout-> overscans = psMemIncrRefCounter(overscans);208 readout->mask = psMemIncrRefCounter(mask); 209 readout->weight = NULL; 177 210 178 211 //readout->concepts = psMetadataAlloc(); … … 185 218 *(int*)&readout->rowBins = rowBin; 186 219 220 readout->parent = cell; 221 187 222 return readout; 188 223 } … … 191 226 { 192 227 psFree(readout->image); 193 psFree(readout->mask); 194 psFree(readout-> overscans);228 psFree(readout->mask); 229 psFree(readout->weight); 195 230 //psFree(readout->concepts); 196 231 }
Note:
See TracChangeset
for help on using the changeset viewer.
