IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 28, 2007, 3:19:47 PM (19 years ago)
Author:
Paul Price
Message:

Adding function pmFPAviewGenerate to generate a pmFPAview from pointers to the fpa, chip, cell, readout.

File:
1 edited

Legend:

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

    r12696 r15093  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-03-30 21:12:56 $
     5 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-09-29 01:19:47 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5353
    5454// return a view restricted to the level (must be >= the input level)
    55 pmFPAview *pmFPAviewForLevel(pmFPALevel level, const pmFPAview *input) 
     55pmFPAview *pmFPAviewForLevel(pmFPALevel level, const pmFPAview *input)
    5656{
    5757    PS_ASSERT_PTR_NON_NULL(input, NULL);
     
    6262    switch (level) {
    6363      case PM_FPA_LEVEL_FPA:
    64         output->chip = -1;
     64        output->chip = -1;
    6565      case PM_FPA_LEVEL_CHIP:
    66         output->cell = -1;
     66        output->cell = -1;
    6767      case PM_FPA_LEVEL_CELL:
    68         output->readout = -1;
    69         break;
     68        output->readout = -1;
     69        break;
    7070      default:
    71         break;
     71        break;
    7272    }
    7373    return output;
     
    321321    return NULL;
    322322}
     323
     324pmFPAview *pmFPAviewGenerate(const pmFPA *fpa, const pmChip *chip, const pmCell *cell,
     325                             const pmReadout *reaodut)
     326{
     327    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
     328
     329    pmFPAview *view = pmFPAviewAlloc(0);// View to return
     330
     331    if (!chip) {
     332        return view;
     333    }
     334
     335    for (view->chip = 0; view->chip < fpa->chips->n && fpa->chips->data[view->chip] != chip; view->chip++);
     336    if (view->chip == fpa->chips->n) {
     337        psError(PS_ERR_UNKNOWN, true, "Unable to find chip %x in fpa.", chip);
     338        psFree(view);
     339        return NULL;
     340    }
     341
     342    if (!cell) {
     343        return view;
     344    }
     345
     346    for (view->cell = 0; view->cell < chip->cells->n && chip->cells->data[view->cell] != cell; view->cell++);
     347    if (view->cell == chip->cells->n) {
     348        psError(PS_ERR_UNKNOWN, true, "Unable to find cell %x in chip.", cell);
     349        psFree(view);
     350        return NULL;
     351    }
     352
     353    if (!readout) {
     354        return view;
     355    }
     356
     357    for (view->readout = 0;
     358         view->readout < cell->readouts->n && cell->readouts->data[view->readout] != readout;
     359         view->readout++);
     360    if (view->readout == cell->readouts->n) {
     361        psError(PS_ERR_UNKNOWN, true, "Unable to find readout %x in cell.", readout);
     362        psFree(view);
     363        return NULL;
     364    }
     365
     366    return view;
     367}
     368
Note: See TracChangeset for help on using the changeset viewer.