IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 3, 2007, 10:04:01 AM (19 years ago)
Author:
magnier
Message:

added functions to check pmFPA/Chip/Cell/Readout data_exists flags

File:
1 edited

Legend:

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

    r12696 r13190  
    88#include "pmHDU.h"
    99#include "pmFPA.h"
     10#include "pmFPALevel.h"
     11#include "pmFPAview.h"
    1012#include "pmFPAFlags.h"
    1113
     
    128130}
    129131
     132// pmFPA does not have its own data_exists flag; check its children
     133bool pmFPACheckDataStatus (const pmFPA *fpa) {
     134
     135    PS_ASSERT_PTR_NON_NULL(fpa, false);
     136
     137    for (int i = 0; i < fpa->chips->n; i++) {
     138        pmChip *chip = fpa->chips->data[i];
     139        if (chip == NULL) continue;
     140        if (chip->data_exists) return true;
     141    }
     142    return false;
     143}
     144
     145bool pmChipCheckDataStatus (const pmChip *chip) {
     146
     147    PS_ASSERT_PTR_NON_NULL(chip, false);
     148
     149    return (chip->data_exists);
     150}
     151
     152bool pmCellCheckDataStatus (const pmCell *cell) {
     153
     154    PS_ASSERT_PTR_NON_NULL(cell, false);
     155
     156    return (cell->data_exists);
     157}
     158
     159bool pmReadoutCheckDataStatus (const pmReadout *readout) {
     160
     161    PS_ASSERT_PTR_NON_NULL(readout, false);
     162
     163    return (readout->data_exists);
     164}
     165
     166bool pmFPAviewCheckDataStatus (const pmFPA *fpa, const pmFPAview *view) {
     167
     168    PS_ASSERT_PTR_NON_NULL(fpa, false);
     169    PS_ASSERT_PTR_NON_NULL(view, false);
     170
     171    if (view->chip == -1) {
     172        bool exists = pmFPACheckDataStatus (fpa);
     173        return exists;
     174    }
     175
     176    if (view->chip >= fpa->chips->n) {
     177        psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %ld", view->chip, fpa->chips->n);
     178        return false;
     179    }
     180    pmChip *chip = fpa->chips->data[view->chip];
     181
     182    if (view->cell == -1) {
     183        bool exists = pmChipCheckDataStatus (chip);
     184        return exists;
     185    }
     186
     187    if (view->cell >= chip->cells->n) {
     188        psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %ld", view->cell, chip->cells->n);
     189        return false;
     190    }
     191    pmCell *cell = chip->cells->data[view->cell];
     192
     193    if (view->readout == -1) {
     194        bool exists = pmCellCheckDataStatus (cell);
     195        return exists;
     196    }
     197
     198    if (view->readout >= cell->readouts->n) {
     199        psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouds->n == %ld", view->readout, cell->readouts->n);
     200        return false;
     201    }
     202    pmReadout *readout = cell->readouts->data[view->readout];
     203
     204    bool exists = pmReadoutCheckDataStatus (readout);
     205    return exists;
     206}
    130207
    131208// Set cells within a chip to be processed or not
Note: See TracChangeset for help on using the changeset viewer.