IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6573


Ignore:
Timestamp:
Mar 13, 2006, 4:21:07 PM (20 years ago)
Author:
magnier
Message:

updates to pmFPAview, pmFPAfile

Location:
branches/rel10_ifa/psModules/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/rel10_ifa/psModules/src/astrom/Makefile.am

    r6568 r6573  
    1313        pmConceptsWrite.c \
    1414        pmConceptsStandard.c \
    15         pmFPAfile.c \
    16         pmFPAview.c
     15        pmFPAview.c \
     16        pmFPAfile.c
    1717
    1818#       pmFPAAstrometry.c
     
    3333        pmConceptsWrite.h \
    3434        pmConceptsStandard.h \
    35         pmFPAfile.h \
    36         pmFPAview.h
     35        pmFPAview.h \
     36        pmFPAfile.h
    3737
    3838#       pmFPAAstrometry.h
  • branches/rel10_ifa/psModules/src/astrom/pmFPAfile.c

    r6568 r6573  
    33#include "pmHDU.h"
    44#include "pmFPA.h"
     5#include "pmFPAConstruct.h"
    56#include "pmFPAview.h"
    67#include "pmFPAfile.h"
     8#include "pmFPARead.h"
     9#include "pmFPAWrite.h"
    710#include "pmFPAviewObjectsIO.h"
    811
     
    4043
    4144// XXX is a file allowed to be both READ and WRITE?
    42 pmFPAfile *pmFPAfileDefine (pmFPAview *view, psMetadata *camera, char *name)
     45pmFPAfile *pmFPAfileDefine (psMetadata *files, psMetadata *camera, pmFPA *fpa, char *name)
    4346{
    4447
     
    4952    psMetadata *data = psMetadataLookupPtr (&status, camera, name);
    5053    if (data == NULL) {
    51         return false;
     54        return NULL;
    5255    }
    5356
     
    114117    }
    115118
     119    if (fpa == NULL) {
     120        fpa = pmFPAConstruct (camera);
     121    }
     122    file->fpa = fpa;
     123
     124    psMetadataAddPtr (files, PS_LIST_TAIL, name, PS_META_REPLACE, "", file);
    116125    return (file);
    117126}
    118127
    119 bool pmFPAfileOpen (pmFPAfile *file, pmFPAview *view, psMetadata *camera)
     128bool pmFPAfileOpen (pmFPAfile *file, pmFPAview *view)
    120129{
    121130
     
    130139
    131140    // determine the file name
    132     file->filename = pmFPAviewNameFromRule (file->filerule, view);
     141    file->filename = pmFPAviewNameFromRule (file->filerule, view, file->fpa);
    133142
    134143    // indirect filenames
    135144    if (!strcasecmp (file->filename, "@FPAIO")) {
    136         extra = pmFPAviewNameFromRule (file->filextra, view);
    137         file->filename = psMetadataLookupStr (&status, view->IO, extra);
     145        extra = pmFPAviewNameFromRule (file->filextra, view, file->fpa);
     146        file->filename = psMetadataLookupStr (&status, file->names, extra);
    138147    }
    139148    if (!strcasecmp (file->filename, "@DETDB")) {
    140         extra = pmFPAviewNameFromRule (file->filextra, view);
     149        extra = pmFPAviewNameFromRule (file->filextra, view, file->fpa);
    141150        // file->filename = pmDetrendSelect (extra);
    142151    }
     
    165174    switch (file->type) {
    166175    case PM_FPA_FILE_IMAGE:
    167         pmFPAviewReadFitsImage (view, file->fits);
     176        pmFPAviewReadFitsImage (view, file);
    168177        break;
    169178
     
    216225}
    217226
     227bool pmFPAfileClose (pmFPAfile *file, pmFPAview *view)
     228{
     229    // is current depth == open depth?
     230    pmFPAdepth depth = pmFPAviewDepth (view);
     231    if (file->openDepth != depth) {
     232        return false;
     233    }
     234
     235    // check if we are actually open
     236    psFitsClose (file->fits);
     237    return true;
     238}
     239
    218240// attempt open and read for all pmFPAfiles in view->IO
    219 bool pmFPAfileIOCheck (pmFPAview *view, psMetadata *camera)
    220 {
    221 
     241bool pmFPAfileReadChecks (psMetadata *files, pmFPAview *view)
     242{
    222243    // recipe override values (command-line options):
    223244    psMetadataItem *item = NULL;
    224     psMetadataIterator *iter = psMetadataIteratorAlloc (view->IO, PS_LIST_HEAD, NULL);
     245    psMetadataIterator *iter = psMetadataIteratorAlloc (files, PS_LIST_HEAD, NULL);
    225246    while ((item = psMetadataGetAndIncrement (iter)) != NULL) {
    226247        pmFPAfile *file = item->data.V;
    227248
    228         pmFPAfileOpen (file, view, camera);
     249        pmFPAfileOpen (file, view);
    229250        pmFPAfileRead (file, view);
    230251    }
     
    232253    return true;
    233254}
     255
     256// attempt open and read for all pmFPAfiles in view->IO
     257bool pmFPAfileWriteChecks (psMetadata *files, pmFPAview *view)
     258{
     259    // recipe override values (command-line options):
     260    psMetadataItem *item = NULL;
     261    psMetadataIterator *iter = psMetadataIteratorAlloc (files, PS_LIST_HEAD, NULL);
     262    while ((item = psMetadataGetAndIncrement (iter)) != NULL) {
     263        pmFPAfile *file = item->data.V;
     264
     265        pmFPAfileWrite (file, view);
     266        pmFPAfileClose (file, view);
     267    }
     268    psFree (iter);
     269    return true;
     270}
     271
     272psImage *pmFPAfileReadoutImage (psMetadata *files, pmFPAview *view, char *name, int Nx, int Ny, int type)
     273{
     274    bool status;
     275    psImage *image = NULL;
     276
     277    // I want an image from the
     278    pmFPA *fpa = psMetadataLookupPtr (&status, files, name);
     279    if (fpa == NULL) {
     280        // use Nx or Ny == 0 to avoid creating an image
     281        if (Nx*Ny <= 0) {
     282            return NULL;
     283        }
     284        image = psImageAlloc (Nx, Ny, type);
     285        return (image);
     286    }
     287
     288    // inconsistent result: return NULL
     289    pmReadout *readout = pmFPAviewThisReadout (view, fpa);
     290    if (readout == NULL) {
     291        return NULL;
     292    }
     293
     294    // resize the existing readout??? this is wrong...
     295    // need to allocate it if it does not exist...
     296    image = psImageRecycle (readout->image, Nx, Ny, type);
     297    psMemIncrRefCounter (image);
     298    return (image);
     299}
     300
     301# if (0)
     302    // return the named pmFPAfile
     303    pmFPAfile *pmFPAfileSelect (pmFPAview *view, char *name)
     304{
     305
     306    // select the name from the camera config data
     307    pmFPAfile *file = psMetadataLookupPtr (&status, view->IO, name);
     308    if (file == NULL) {
     309        return NULL;
     310    }
     311    return file;
     312}
     313
     314bool pmFPAfileWriteChecks (pmFPAview *view, char *name)
     315{
     316
     317    pmFPAfile *file = pmFPAfileSelect (view, name);
     318    pmFPAfileWrite (file, view);
     319    return true;
     320}
     321#endif
     322
     323// given an already-opened fits file, read the components corresponding
     324// to the specified view
     325bool pmFPAviewReadFitsImage (pmFPAview *view, pmFPAfile *file)
     326{
     327    pmFPA *fpa = file->fpa;
     328    psFits *fits = file->fits;
     329
     330    if (view->chip == -1) {
     331        pmFPARead (fpa, fits, NULL);
     332        return true;
     333    }
     334
     335    if (view->chip >= fpa->chips->n) {
     336        return false;
     337    }
     338    pmChip *chip = fpa->chips->data[view->chip];
     339
     340    if (view->cell == -1) {
     341        pmChipRead (chip, fits, NULL);
     342        return true;
     343    }
     344
     345    if (view->cell >= chip->cells->n) {
     346        return false;
     347    }
     348    pmCell *cell = chip->cells->data[view->cell];
     349
     350    if (view->readout == -1) {
     351        pmCellRead (cell, fits, NULL);
     352        return true;
     353    }
     354
     355    // XXX pmReadoutRead, pmReadoutReadSegement disabled for now
     356    return false;
     357
     358    # if (0)
     359
     360        if (view->readout >= cell->readouts->n) {
     361            return false;
     362        }
     363    pmReadout *readout = cell->readouts->data[view->readout];
     364
     365    if (view->nRows == 0) {
     366        pmReadoutRead (readout, fits, NULL);
     367    } else {
     368        pmReadoutReadSegment (readout, fits, view->nRows, view->iRows, NULL, NULL);
     369    }
     370    return true;
     371    # endif
     372}
     373
     374// XXX image writes disabled for now
     375# if (0)
     376    // given an already-opened fits file, write the components corresponding
     377    // to the specified view
     378    bool pmFPAviewWriteFitsImage (pmFPAview *view, pmFPAfile *file)
     379{
     380
     381    pmFPA *fpa = file->fpa;
     382    psFits *fits = file->fits;
     383
     384    if (view->chip == -1) {
     385        pmFPAWrite (fpa, fits, NULL, NULL);
     386        return true;
     387    }
     388
     389    if (view->chip >= fpa->chips->n) {
     390        return false;
     391    }
     392    pmChip *chip = fpa->chips->data[view->chip];
     393
     394    if (view->cell == -1) {
     395        pmChipWrite (chip, fits, NULL, NULL);
     396        return true;
     397    }
     398
     399    if (view->cell >= chip->cells->n) {
     400        return false;
     401    }
     402    pmCell *cell = chip->cells->data[view->cell];
     403
     404    if (view->readout == -1) {
     405        pmCellWrite (cell, fits, NULL, NULL);
     406        return true;
     407    }
     408
     409    if (view->readout >= cell->readouts->n) {
     410        return false;
     411    }
     412    pmReadout *readout = cell->readouts->data[view->readout];
     413
     414    if (view->nRows == 0) {
     415        pmReadoutWrite (readout, fits, NULL, NULL);
     416    } else {
     417        pmReadoutWriteSegment (readout, fits, view->nRows, view->iRows, NULL, NULL);
     418    }
     419    return true;
     420}
     421# endif
  • branches/rel10_ifa/psModules/src/astrom/pmFPAfile.h

    r6568 r6573  
    77*  @author EAM, IfA
    88*
    9 *  @version $Revision: 1.1.2.4 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-03-09 20:56:39 $
     9*  @version $Revision: 1.1.2.5 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2006-03-14 02:21:07 $
    1111*
    1212*  Copyright 2004-2005 Institute for Astronomy, University of Hawaii
     
    1717
    1818typedef enum {
    19     PM_FPA_FILE_IMAGE,
    2019    PM_FPA_FILE_SX,
    2120    PM_FPA_FILE_OBJ,
     
    2322    PM_FPA_FILE_CMF,
    2423    PM_FPA_FILE_RAW,
     24    PM_FPA_FILE_IMAGE,
    2525} pmFPAfileType;
    2626
     
    4141
    4242    pmFPAfileType type;
     43
     44    psMetadata *names;
     45    pmFPA *fpa;
    4346}
    4447pmFPAfile;
    4548
    4649pmFPAfile *pmFPAfileAlloc ();
    47 pmFPAfile *pmFPAfileDefine (pmFPAview *view, psMetadata *camera, char *name);
    48 bool pmFPAfileOpen (pmFPAfile *file, pmFPAview *view, psMetadata *camera);
     50pmFPAfile *pmFPAfileDefine (psMetadata *files, psMetadata *camera, pmFPA *fpa, char *name);
     51bool pmFPAfileOpen (pmFPAfile *file, pmFPAview *view);
    4952bool pmFPAfileRead (pmFPAfile *file, pmFPAview *view);
    5053bool pmFPAfileWrite (pmFPAfile *file, pmFPAview *view);
    51 bool pmFPAfileIOCheck (pmFPAview *view, psMetadata *camera);
     54bool pmFPAfileClose (pmFPAfile *file, pmFPAview *view);
     55
     56bool pmFPAfileReadChecks (psMetadata *files, pmFPAview *view);
     57bool pmFPAfileWriteChecks (psMetadata *files, pmFPAview *view);
     58
     59psImage *pmFPAfileReadoutImage (psMetadata *files, pmFPAview *view, char *name, int Nx, int Ny, int type);
     60
     61// read an image into the current view
     62bool pmFPAviewReadFitsImage (pmFPAview *view, pmFPAfile *file);
     63
     64// write the components for the specified view
     65bool pmFPAviewWriteFitsImage (pmFPAview *view, pmFPAfile *file);
    5266
    5367# endif
  • branches/rel10_ifa/psModules/src/astrom/pmFPAview.c

    r6568 r6573  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-03-09 20:56:39 $
     5 *  @version $Revision: 1.1.2.4 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-03-14 02:21:07 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1717#include "pmFPA.h"
    1818#include "pmFPAview.h"
    19 #include "pmFPARead.h"
    20 #include "pmFPAWrite.h"
    2119
    2220static void pmFPAviewFree (pmFPAview *view)
    2321{
    24 
    2522    if (view == NULL)
    2623        return;
    27 
    28     psFree (view->IO);
    2924    return;
    3025}
    3126
    32 pmFPAview *pmFPAviewAlloc (pmFPA *fpa, psMetadata *camera, int nRows)
    33 {
    34 
     27pmFPAview *pmFPAviewAlloc (int nRows)
     28{
    3529    pmFPAview *view = psAlloc (sizeof(pmFPAview));
    3630    psMemSetDeallocator (view, (psFreeFunc) pmFPAviewFree);
    37 
    38     view->fpa     = fpa;
    39     view->nRows   = nRows;
    40     view->camera  = camera;
    4131
    4232    view->chip    = -1;
    4333    view->cell    = -1;
    4434    view->readout = -1;
    45     view->iRows   = 0;
    46 
    47     view->IO      = psMetadataAlloc ();
     35    view->iRows   =  0;
     36    view->nRows   = nRows;
    4837    return (view);
    4938}
     
    6453}
    6554
    66 pmChip *pmFPAviewThisChip (pmFPAview *view)
     55pmChip *pmFPAviewThisChip (pmFPAview *view, pmFPA *fpa)
    6756{
    6857
     
    7160    }
    7261
    73     if (view->chip >= view->fpa->chips->n) {
    74         return NULL;
    75     }
    76 
    77     pmChip *chip = view->fpa->chips->data[view->chip];
     62    if (view->chip >= fpa->chips->n) {
     63        return NULL;
     64    }
     65
     66    pmChip *chip = fpa->chips->data[view->chip];
    7867    return chip;
    7968}
    8069
    81 pmChip *pmFPAviewNextChip (pmFPAview *view, int nStep)
    82 {
    83 
     70pmChip *pmFPAviewNextChip (pmFPAview *view, pmFPA *fpa, int nStep)
     71{
    8472    view->cell = -1;
    8573    view->readout = -1;
     
    8775
    8876    // if there are no available chips, return NULL
    89     if (view->fpa->chips->n <= 0) {
     77    if (fpa->chips->n <= 0) {
    9078        view->chip = -1;
    9179        return NULL;
     
    10189
    10290    // if we are at the end of the stack, return NULL
    103     if (view->chip >= view->fpa->chips->n) {
     91    if (view->chip >= fpa->chips->n) {
    10492        view->chip = -1;
    10593        return NULL;
     
    10795
    10896    // get the correct chip pointer
    109     pmChip *chip = view->fpa->chips->data[view->chip];
     97    pmChip *chip = fpa->chips->data[view->chip];
    11098    return (chip);
    11199}
    112100
    113 pmCell *pmFPAviewThisCell (pmFPAview *view)
     101pmCell *pmFPAviewThisCell (pmFPAview *view, pmFPA *fpa)
    114102{
    115103
     
    118106    }
    119107
    120     pmChip *chip = pmFPAviewThisChip (view);
     108    pmChip *chip = pmFPAviewThisChip (view, fpa);
    121109    if (chip == NULL) {
    122110        return NULL;
     
    131119}
    132120
    133 pmCell *pmFPAviewNextCell (pmFPAview *view, int nStep)
    134 {
    135 
    136     pmChip *chip = pmFPAviewThisChip (view);
     121pmCell *pmFPAviewNextCell (pmFPAview *view, pmFPA *fpa, int nStep)
     122{
     123
     124    pmChip *chip = pmFPAviewThisChip (view, fpa);
    137125    if (chip == NULL) {
    138126        return NULL;
     
    167155}
    168156
    169 pmReadout *pmFPAviewThisReadout (pmFPAview *view)
     157pmReadout *pmFPAviewThisReadout (pmFPAview *view, pmFPA *fpa)
    170158{
    171159
     
    174162    }
    175163
    176     pmCell *cell = pmFPAviewThisCell (view);
     164    pmCell *cell = pmFPAviewThisCell (view, fpa);
    177165    if (cell == NULL) {
    178166        return NULL;
     
    187175}
    188176
    189 pmReadout *pmFPAviewNextReadout (pmFPAview *view, int nStep)
    190 {
    191 
    192     pmCell *cell = pmFPAviewThisCell (view);
     177pmReadout *pmFPAviewNextReadout (pmFPAview *view, pmFPA *fpa, int nStep)
     178{
     179
     180    pmCell *cell = pmFPAviewThisCell (view, fpa);
    193181    if (cell == NULL) {
    194182        return NULL;
     
    222210}
    223211
    224 pmHDU *pmFPAviewThisHDU (pmFPAview *view)
     212pmHDU *pmFPAviewThisHDU (pmFPAview *view, pmFPA *fpa)
    225213{
    226214
     
    230218
    231219    if (view->chip < 0) {
    232         return pmHDUFromFPA (view->fpa);
     220        return pmHDUFromFPA (fpa);
    233221    }
    234222    if (view->cell < 0) {
    235         return pmHDUFromChip (pmFPAviewThisChip (view));
     223        return pmHDUFromChip (pmFPAviewThisChip (view, fpa));
    236224    }
    237225    if (view->readout < 0) {
    238         return pmHDUFromCell (pmFPAviewThisCell (view));
     226        return pmHDUFromCell (pmFPAviewThisCell (view, fpa));
    239227    }
    240228    return NULL;
     
    242230
    243231// select the rule from the camera configuration, perform substitutions as needed
    244 char *pmFPAviewNameFromRule (char *rule, pmFPAview *view)
     232char *pmFPAviewNameFromRule (char *rule, pmFPAview *view, pmFPA *fpa)
    245233{
    246234
     
    250238
    251239    if (strstr (newName, "{CHIP.NAME}") != NULL) {
    252         pmChip *chip = pmFPAviewThisChip (view);
     240        pmChip *chip = pmFPAviewThisChip (view, fpa);
    253241        if (chip != NULL) {
    254242            char *name = psMetadataLookupStr (NULL, chip->concepts, "CHIP.NAME");
     
    259247    }
    260248    if (strstr (newName, "{CELL.NAME}") != NULL) {
    261         pmCell *cell = pmFPAviewThisCell (view);
     249        pmCell *cell = pmFPAviewThisCell (view, fpa);
    262250        if (cell != NULL) {
    263251            char *name = psMetadataLookupStr (NULL, cell->concepts, "CELL.NAME");
     
    268256    }
    269257    if (strstr (newName, "{EXTNAME}") != NULL) {
    270         pmHDU *hdu = pmFPAviewThisHDU (view);
     258        pmHDU *hdu = pmFPAviewThisHDU (view, fpa);
    271259        if (hdu->extname != NULL) {
    272260            newName = psStringSubstitute (newName, hdu->extname, "{EXTNAME}");
     
    275263    return newName;
    276264}
    277 
    278 // given an already-opened fits file, read the components corresponding
    279 // to the specified view
    280 bool pmFPAviewReadFitsImage (pmFPAview *view, psFits *fits)
    281 {
    282 
    283     pmFPA *fpa = view->fpa;
    284 
    285     if (view->chip == -1) {
    286         pmFPARead (fpa, fits, NULL);
    287         return true;
    288     }
    289 
    290     if (view->chip >= fpa->chips->n) {
    291         return false;
    292     }
    293     pmChip *chip = fpa->chips->data[view->chip];
    294 
    295     if (view->cell == -1) {
    296         pmChipRead (chip, fits, NULL);
    297         return true;
    298     }
    299 
    300     if (view->cell >= chip->cells->n) {
    301         return false;
    302     }
    303     pmCell *cell = chip->cells->data[view->cell];
    304 
    305     if (view->readout == -1) {
    306         pmCellRead (cell, fits, NULL);
    307         return true;
    308     }
    309 
    310     // XXX pmReadoutRead, pmReadoutReadSegement disabled for now
    311     return false;
    312 
    313     # if (0)
    314 
    315         if (view->readout >= cell->readouts->n) {
    316             return false;
    317         }
    318     pmReadout *readout = cell->readouts->data[view->readout];
    319 
    320     if (view->nRows == 0) {
    321         pmReadoutRead (readout, fits, NULL);
    322     } else {
    323         pmReadoutReadSegment (readout, fits, view->nRows, view->iRows, NULL, NULL);
    324     }
    325     return true;
    326     # endif
    327 }
    328 
    329 // XXX image writes disabled for now
    330 # if (0)
    331     // given an already-opened fits file, write the components corresponding
    332     // to the specified view
    333     bool pmFPAviewWriteFitsImage (pmFPAview *view, psFits *fits)
    334 {
    335 
    336     pmFPA *fpa = view->fpa;
    337 
    338     if (view->chip == -1) {
    339         pmFPAWrite (fpa, fits, NULL, NULL);
    340         return true;
    341     }
    342 
    343     if (view->chip >= fpa->chips->n) {
    344         return false;
    345     }
    346     pmChip *chip = fpa->chips->data[view->chip];
    347 
    348     if (view->cell == -1) {
    349         pmChipWrite (chip, fits, NULL, NULL);
    350         return true;
    351     }
    352 
    353     if (view->cell >= chip->cells->n) {
    354         return false;
    355     }
    356     pmCell *cell = chip->cells->data[view->cell];
    357 
    358     if (view->readout == -1) {
    359         pmCellWrite (cell, fits, NULL, NULL);
    360         return true;
    361     }
    362 
    363     if (view->readout >= cell->readouts->n) {
    364         return false;
    365     }
    366     pmReadout *readout = cell->readouts->data[view->readout];
    367 
    368     if (view->nRows == 0) {
    369         pmReadoutWrite (readout, fits, NULL, NULL);
    370     } else {
    371         pmReadoutWriteSegment (readout, fits, view->nRows, view->iRows, NULL, NULL);
    372     }
    373     return true;
    374 }
    375 # endif
  • branches/rel10_ifa/psModules/src/astrom/pmFPAview.h

    r6568 r6573  
    77*  @author EAM, IfA
    88*
    9 *  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-03-09 20:56:39 $
     9*  @version $Revision: 1.1.2.4 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2006-03-14 02:21:07 $
    1111*
    1212*  Copyright 2004-2005 Institute for Astronomy, University of Hawaii
     
    3030typedef struct
    3131{
    32     pmFPA *fpa;
    33     psMetadata *IO;
    34     psMetadata *camera;
    3532    int chip;
    3633    int cell;
     
    3835    int nRows;
    3936    int iRows;
     37    pmFPA *fpa;
    4038}
    4139pmFPAview;
    4240
    4341// allocate a pmFPAview structure for this fpa and camera
    44 pmFPAview *pmFPAviewAlloc (pmFPA *fpa, psMetadata *camera, int nRows);
     42pmFPAview *pmFPAviewAlloc (int nRows);
    4543
    4644// determine the current view depth
     
    4846
    4947// return the currently selected chip for this view
    50 pmChip *pmFPAviewThisChip (pmFPAview *view);
     48pmChip *pmFPAviewThisChip (pmFPAview *view, pmFPA *fpa);
    5149
    5250// advance view to the next chip
    53 pmChip *pmFPAviewNextChip (pmFPAview *view, int nStep);
     51pmChip *pmFPAviewNextChip (pmFPAview *view, pmFPA *fpa, int nStep);
    5452
    5553// return the currently selected cell for this view
    56 pmCell *pmFPAviewThisCell (pmFPAview *view);
     54pmCell *pmFPAviewThisCell (pmFPAview *view, pmFPA *fpa);
    5755
    5856// advance view to the next cell
    59 pmCell *pmFPAviewNextCell (pmFPAview *view, int nStep);
     57pmCell *pmFPAviewNextCell (pmFPAview *view, pmFPA *fpa, int nStep);
    6058
    6159// return the currently selected readout for this view
    62 pmReadout *pmFPAviewThisReadout (pmFPAview *view);
     60pmReadout *pmFPAviewThisReadout (pmFPAview *view, pmFPA *fpa);
    6361
    6462// advance view to the next readout
    65 pmReadout *pmFPAviewNextReadout (pmFPAview *view, int nStep);
     63pmReadout *pmFPAviewNextReadout (pmFPAview *view, pmFPA *fpa, int nStep);
    6664
    6765// return the HDU corresponding to the current view
    68 pmHDU *pmFPAviewThisHDU (pmFPAview *view);
     66pmHDU *pmFPAviewThisHDU (pmFPAview *view, pmFPA *fpa);
    6967
    7068// convert the rule to a name based on the current view
    71 char *pmFPAviewNameFromRule (char *rule, pmFPAview *view);
    72 
    73 // read an image into the current view
    74 bool pmFPAviewReadFitsImage (pmFPAview *view, psFits *fits);
    75 
    76 // write the components for the specified view
    77 bool pmFPAviewWriteFitsImage (pmFPAview *view, psFits *fits);
     69char *pmFPAviewNameFromRule (char *rule, pmFPAview *view, pmFPA *fpa);
    7870
    7971# endif
  • branches/rel10_ifa/psModules/src/objects/pmFPAviewReadObjects.c

    r6556 r6573  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-03-09 03:14:23 $
     5 *  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-03-14 02:21:07 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3030bool pmFPAviewReadObjects (pmFPAview *view, pmFPAfile *file)
    3131{
    32 
    33     pmFPA *fpa = view->fpa;
     32    pmFPA *fpa = file->fpa;
    3433
    3534    if (view->chip == -1) {
     
    124123
    125124        // read in header, if not yet loaded
    126         hdu = pmFPAviewThisHDU (view);
     125        hdu = pmFPAviewThisHDU (view, file->fpa);
    127126
    128         char *filename = pmFPAviewNameFromRule (file->filerule, view);
     127        char *filename = pmFPAviewNameFromRule (file->filerule, view, file->fpa);
    129128        file->fits = psFitsOpen (filename, "r");
    130129        hdu->header = psFitsReadHeader (NULL, file->fits);
     
    135134    case PM_FPA_FILE_CMF:
    136135        // read in header, if not yet loaded
    137         hdu = pmFPAviewThisHDU (view);
     136        hdu = pmFPAviewThisHDU (view, file->fpa);
    138137        if (hdu->header == NULL) {
    139             char *headname = pmFPAviewNameFromRule (file->extxtra, view);
     138            char *headname = pmFPAviewNameFromRule (file->extxtra, view, file->fpa);
    140139            psFitsMoveExtName (file->fits, headname);
    141140            hdu->header = psFitsReadHeader (NULL, file->fits);
    142141        }
    143142
    144         char *dataname = pmFPAviewNameFromRule (file->extrule, view);
     143        char *dataname = pmFPAviewNameFromRule (file->extrule, view, file->fpa);
    145144        psFitsMoveExtName (file->fits, dataname);
    146145        sources  = pmSourcesReadCMF (file->fits, hdu->header);
  • branches/rel10_ifa/psModules/src/objects/pmFPAviewWriteObjects.c

    r6556 r6573  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-03-09 03:14:23 $
     5 *  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-03-14 02:21:07 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    117117    switch (file->type) {
    118118    case PM_FPA_FILE_OBJ:
    119         filename = pmFPAviewNameFromRule (file->filerule, view);
     119        filename = pmFPAviewNameFromRule (file->filerule, view, file->fpa);
    120120        pmSourcesWriteOBJ (sources, filename);
    121121        break;
    122122
    123123    case PM_FPA_FILE_SX:
    124         filename = pmFPAviewNameFromRule (file->filerule, view);
     124        filename = pmFPAviewNameFromRule (file->filerule, view, file->fpa);
    125125        pmSourcesWriteSX (sources, filename);
    126126        break;
     
    128128    case PM_FPA_FILE_CMP:
    129129        // a SPLIT format : only one header and object table per file
    130         hdu = pmFPAviewThisHDU (view);
    131         filename = pmFPAviewNameFromRule (file->filerule, view);
     130        hdu = pmFPAviewThisHDU (view, file->fpa);
     131        filename = pmFPAviewNameFromRule (file->filerule, view, file->fpa);
    132132        pmSourcesWriteCMP (sources, filename, hdu->header);
    133133        break;
     
    135135    case PM_FPA_FILE_CMF:
    136136        // write header, if not yet written?
    137         hdu = pmFPAviewThisHDU (view);
     137        hdu = pmFPAviewThisHDU (view, file->fpa);
    138138
    139139        // XXX is this needed? is it automatically added?
     
    143143        if (hdu->header) {
    144144            psMetadataItem *mdi = NULL;
    145             headname = pmFPAviewNameFromRule (file->extxtra, view);
     145            headname = pmFPAviewNameFromRule (file->extxtra, view, file->fpa);
    146146
    147147            // set NAXIS to 0 (we don't write out the data array)
     
    156156            psFitsWriteHeader (hdu->header, file->fits);
    157157        }
    158         dataname = pmFPAviewNameFromRule (file->extrule, view);
     158        dataname = pmFPAviewNameFromRule (file->extrule, view, file->fpa);
    159159        pmSourcesWriteCMF (file->fits, sources, hdu->header, dataname);
    160160        break;
Note: See TracChangeset for help on using the changeset viewer.