IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 11, 2008, 4:15:51 PM (18 years ago)
Author:
Paul Price
Message:

Using readout->imageScan/maskScan/weightScan to track the number of
scans read, rather than row0,col0. Need separate values for each of
image/mask/weight --- if they all use the same one, then the reads do
not correspond to each other.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPARead.c

    r16395 r16397  
    4343// File-static functions
    4444//////////////////////////////////////////////////////////////////////////////////////////////////////////////
     45
     46// Return pointer to appropriate value for tracking scans
     47static int *readoutScansByType(pmReadout *readout, // Readout of interest
     48                               fpaReadType type // Type of image
     49    )
     50{
     51    switch (type) {
     52      case FPA_READ_TYPE_IMAGE:
     53        return &readout->imageScan;
     54      case FPA_READ_TYPE_MASK:
     55        return &readout->maskScan;
     56      case FPA_READ_TYPE_WEIGHT:
     57        return &readout->weightScan;
     58      default:
     59        psAbort("Unknown read type: %x\n", type);
     60    }
     61}
     62
     63// Return pointer to appropriate image
     64static psImage **readoutImageByType(pmReadout *readout, // Readout of interest
     65                                    fpaReadType type // Type of image
     66    )
     67{
     68    switch (type) {
     69      case FPA_READ_TYPE_IMAGE:
     70        return &readout->image;
     71      case FPA_READ_TYPE_MASK:
     72        return &readout->mask;
     73      case FPA_READ_TYPE_WEIGHT:
     74        return &readout->weight;
     75      default:
     76        psAbort("Unknown read type: %x\n", type);
     77    }
     78}
    4579
    4680// Determine number of readouts in the FITS file
     
    116150    assert(readout);
    117151
    118     psImage *image;                     // Appropriate image from readout
    119     switch (type) {
    120       case FPA_READ_TYPE_IMAGE:
    121         image = readout->image;
    122         break;
    123       case FPA_READ_TYPE_MASK:
    124         image = readout->mask;
    125         break;
    126       case FPA_READ_TYPE_WEIGHT:
    127         image = readout->weight;
    128         break;
    129       default:
    130         psAbort("Unknown read type: %x\n", type);
    131     }
     152    psImage *image = *readoutImageByType(readout, type); // Appropriate image from readout
    132153
    133154    // Header and concepts have been read by a call to cellNumReadouts(), so we can just assume they're there.
     
    167188    }
    168189
    169 
    170190    // Calculate the segment offset and upper limit
    171     if (readdir == 1) {
    172         // Reading rows
    173         if (numScans == 0) {
    174             *next = trimsec->x0;
    175         } else {
    176             *next = image ? readout->row0 + numScans - overlap : 0;
    177         }
    178         *last = trimsec->y1;
     191    if (numScans == 0) {
     192        *next = (readdir == 1) ? trimsec->x0 : trimsec->y0;
    179193    } else {
    180         // Reading cols
    181         if (numScans == 0) {
    182             *next = trimsec->y0;
    183         } else {
    184             *next = image ? readout->col0 + numScans - overlap : 0;
    185         }
    186         *last = trimsec->x1;
    187     }
     194        *next = image ? *readoutScansByType(readout, type) + numScans - overlap : 0;
     195    }
     196    *last = (readdir == 1) ? trimsec->y1 : trimsec->x1;
    188197
    189198    return true;
    190199}
    191 
    192 static psImage **readoutImageByType(pmReadout *readout, // Readout of interest
    193                                     fpaReadType type // Type of image
    194     )
    195 {
    196     switch (type) {
    197       case FPA_READ_TYPE_IMAGE:
    198         return &readout->image;
    199       case FPA_READ_TYPE_MASK:
    200         return &readout->mask;
    201       case FPA_READ_TYPE_WEIGHT:
    202         return &readout->weight;
    203       default:
    204         psAbort("Unknown read type: %x\n", type);
    205     }
    206 }
    207 
    208200
    209201static bool readoutMore(pmReadout *readout, // Readout of interest
     
    469461    }
    470462
     463    // Update number of scans read
     464    int *scansTracker = readoutScansByType(readout, type); // Tracker for how many scans have been read
     465    *scansTracker = next;
     466
    471467    // Calculate limits, adjust readout->row0,col0
     468    // XXX Should row0,col0 be adjusted, since they are used for astrometry???
     469    // Just moved to using the "scansTracker" for tracking position in chunk reads, so row0,col0 not required
    472470    if (readdir == 1) {
    473471        // Reading rows
Note: See TracChangeset for help on using the changeset viewer.