IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15093


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.

Location:
trunk/psModules/src/camera
Files:
2 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
  • trunk/psModules/src/camera/pmFPAview.h

    r12696 r15093  
    44 * @author Eugene Magnier, IfA
    55 *
    6  * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-03-30 21:12:56 $
     6 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2007-09-29 01:19:47 $
    88 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    99 */
     
    114114                       );
    115115
     116/// Generate a view, given a chip, cell, readout.
     117///
     118/// Uses the pointer value in the array of the parent to locate the child
     119pmFPAview *pmFPAviewGenerate(const pmFPA *fpa, ///< FPA of interest
     120                             const pmChip *chip, ///< Chip of interest, or NULL
     121                             const pmCell *cell, ///< Cell of interest, or NULL
     122                             const pmReadout *reaodut ///< Readout of interest, or NULL
     123    );
     124
     125
    116126/// @}
    117127#endif
Note: See TracChangeset for help on using the changeset viewer.