IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 18, 2005, 4:19:41 PM (21 years ago)
Author:
Paul Price
Message:

Current state before I go on holiday. Not sure if it works or not. Not current for pslib8.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/scripts/src/phase2/pmFPA.c

    r5104 r5371  
    77#include "pmFPA.h"
    88
     9// Get the bias images for a readout, using the CELL.BIASSEC
     10psList *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
    938//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1039// Allocators
    1140//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1241
    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);
     42pmPixelData *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
     56void p_pmPixelDataFree(pmPixelData *pd)
     57{
     58    psFree(pd->header);
     59    psFree(pd->images);
     60    psFree(pd->masks);
     61    psFree(pd->weights);
    2962}
    3063
     
    4477    fpa->chips = psArrayAlloc(0);
    4578
    46     fpa->private = NULL;
     79    fpa->data = NULL;
    4780
    4881    return fpa;
     
    5992    psFree(fpa->chips);
    6093
    61     psFree(fpa->private);
     94    psFree(fpa->data);
    6295}
    6396
     
    86119    chip->valid = true;   
    87120
    88     chip->private = NULL;
     121    chip->data = NULL;
    89122
    90123    psMetadataAddStr(chip->concepts, PS_LIST_HEAD, "CHIP.NAME", 0, "Chip name added at pmChipAlloc", name);
     
    101134    psFree(chip->cells);
    102135
    103     psFree(chip->private);
     136    psFree(chip->data);
    104137
    105138    // We don't free the parent member, since that would generate a circular call.  We don't increment the
     
    138171    cell->valid = true;
    139172
    140     cell->private = NULL;
     173    cell->data = NULL;
    141174
    142175    return cell;
     
    155188    psFree(cell->readouts);
    156189
    157     psFree(cell->private);
     190    psFree(cell->data);
    158191
    159192    // We don't free the parent member, since that would generate a circular call.  We don't increment the
     
    163196pmReadout *pmReadoutAlloc(pmCell *cell, // Cell to which the readout belongs
    164197                          psImage *image, // The pixels
    165                           psList *overscans, // The overscan images
     198                          psImage *mask,// The mask pixels
    166199                          int col0, int row0, int colParity, int rowParity, int colBin, int rowBin // Data
    167200    )
     
    173206    // Set the components
    174207    readout->image = psMemIncrRefCounter(image);
    175     readout->mask = NULL;
    176     readout->overscans = psMemIncrRefCounter(overscans);
     208    readout->mask = psMemIncrRefCounter(mask);
     209    readout->weight = NULL;
    177210   
    178211    //readout->concepts = psMetadataAlloc();
     
    185218    *(int*)&readout->rowBins = rowBin;
    186219
     220    readout->parent = cell;
     221
    187222    return readout;
    188223}
     
    191226{
    192227    psFree(readout->image);
    193     psFree(readout->mask); 
    194     psFree(readout->overscans);
     228    psFree(readout->mask);
     229    psFree(readout->weight);
    195230    //psFree(readout->concepts);
    196231}
Note: See TracChangeset for help on using the changeset viewer.