IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

added functions to check pmFPA/Chip/Cell/Readout for psf data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmPSF_IO.c

    r13034 r13191  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-04-26 01:20:29 $
     8 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-05-03 20:04:18 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4343#include "pmModelGroup.h"
    4444#include "pmSourceIO.h"
     45
     46bool pmFPAviewCheckDataStatusForPSFmodel (const pmFPAview *view, const pmFPAfile *file)
     47{
     48    pmFPA *fpa = file->fpa;
     49
     50    if (view->chip == -1) {
     51        bool exists = pmFPACheckDataStatusForPSFmodel (fpa);
     52        return exists;
     53    }
     54    if (view->chip >= fpa->chips->n) {
     55        psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %ld", view->chip, fpa->chips->n);
     56        return false;
     57    }
     58    pmChip *chip = fpa->chips->data[view->chip];
     59
     60    if (view->cell == -1) {
     61        bool exists = pmChipCheckDataStatusForPSFmodel (chip);
     62        return exists;
     63    }
     64    if (view->cell >= chip->cells->n) {
     65        psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %ld", view->cell, chip->cells->n);
     66        return false;
     67    }
     68    pmCell *cell = chip->cells->data[view->cell];
     69
     70    if (view->readout == -1) {
     71        bool exists = pmCellCheckDataStatusForPSFmodel (cell);
     72        return exists;
     73    }
     74
     75    if (view->readout >= cell->readouts->n) {
     76        psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouds->n == %ld", view->readout, cell->readouts->n);
     77        return false;
     78    }
     79    pmReadout *readout = cell->readouts->data[view->readout];
     80
     81    bool exists = pmReadoutCheckDataStatusForPSFmodel (readout);
     82    return exists;
     83}
     84
     85bool pmFPACheckDataStatusForPSFmodel (const pmFPA *fpa) {
     86
     87    for (int i = 0; i < fpa->chips->n; i++) {
     88        pmChip *chip = fpa->chips->data[i];
     89        if (!chip) continue;
     90        if (pmChipCheckDataStatusForPSFmodel (chip)) return true;
     91    }
     92    return false;
     93}
     94
     95bool pmChipCheckDataStatusForPSFmodel (const pmChip *chip) {
     96
     97    for (int i = 0; i < chip->cells->n; i++) {
     98        pmCell *cell = chip->cells->data[i];
     99        if (!cell) continue;
     100        if (pmCellCheckDataStatusForPSFmodel (cell)) return true;
     101    }
     102    return false;
     103}
     104
     105bool pmCellCheckDataStatusForPSFmodel (const pmCell *cell) {
     106
     107    for (int i = 0; i < cell->readouts->n; i++) {
     108        pmReadout *readout = cell->readouts->data[i];
     109        if (!readout) continue;
     110        if (pmReadoutCheckDataStatusForPSFmodel (readout)) return true;
     111    }
     112    return false;
     113}
     114
     115bool pmReadoutCheckDataStatusForPSFmodel (const pmReadout *readout) {
     116
     117    bool status;
     118
     119    // select the psf of interest
     120    pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF");
     121    if (!psf) return false;
     122    return true;
     123}
    45124
    46125bool pmFPAviewWritePSFmodel (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
     
    618697
    619698    switch (file->type) {
    620     case PM_FPA_FILE_PSF:
     699      case PM_FPA_FILE_PSF:
    621700        filename = pmFPAfileNameFromRule (file->filerule, file, view);
    622701        bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
     
    630709        return true;
    631710
    632     default:
     711      default:
    633712        fprintf (stderr, "warning: type mismatch\n");
    634713        break;
     
    646725
    647726    switch (file->type) {
    648     case PM_FPA_FILE_PSF:
     727      case PM_FPA_FILE_PSF:
    649728        filename = pmFPAfileNameFromRule (file->filerule, file, view);
    650729        bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
     
    662741        return true;
    663742
    664     default:
     743      default:
    665744        fprintf (stderr, "warning: type mismatch\n");
    666745        break;
Note: See TracChangeset for help on using the changeset viewer.