IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 9, 2007, 3:09:20 PM (19 years ago)
Author:
eugene
Message:

updating all changes from from eam_branch_20071023

File:
1 edited

Legend:

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

    r15227 r15562  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-10-05 22:46:34 $
     5 *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-11-10 01:09:20 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4747int pmSourceGetDophotType (pmSource *source)
    4848{
     49    PS_ASSERT_PTR_NON_NULL(source, -1);
     50
    4951    switch (source->type) {
    5052
     
    7476bool pmSourceSetDophotType (pmSource *source, int type)
    7577{
     78    PS_ASSERT_PTR_NON_NULL(source, false);
     79
    7680    if (type == 4) {
    7781        source->mode |= PM_SOURCE_MODE_FAIL;
     
    106110bool pmFPAviewWriteObjects (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    107111{
     112    PS_ASSERT_PTR_NON_NULL(view, false);
     113    PS_ASSERT_PTR_NON_NULL(file, false);
     114    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
    108115
    109116    pmFPA *fpa = file->fpa;
     
    165172bool pmFPAWriteObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    166173{
     174    PS_ASSERT_PTR_NON_NULL(view, false);
     175    PS_ASSERT_PTR_NON_NULL(fpa, false);
     176    PS_ASSERT_PTR_NON_NULL(fpa->chips, false);
     177
    167178    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    168179    *thisView = *view;
     
    184195bool pmChipWriteObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    185196{
     197    PS_ASSERT_PTR_NON_NULL(chip, false);
     198    PS_ASSERT_PTR_NON_NULL(chip->cells, false);
     199    PS_ASSERT_PTR_NON_NULL(view, false);
     200
    186201    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    187202    *thisView = *view;
     
    203218bool pmCellWriteObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    204219{
     220    PS_ASSERT_PTR_NON_NULL(cell, false);
     221    PS_ASSERT_PTR_NON_NULL(cell->readouts, false);
     222    PS_ASSERT_PTR_NON_NULL(view, false);
     223
    205224    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    206225    *thisView = *view;
     
    222241bool pmReadoutWriteObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    223242{
     243    PS_ASSERT_PTR_NON_NULL(readout, false);
     244    PS_ASSERT_PTR_NON_NULL(view, false);
     245    PS_ASSERT_PTR_NON_NULL(file, false);
     246    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
    224247
    225248    bool status;
    226     char *exttype;
    227     char *dataname;
    228     char *headname;
    229249    pmHDU *hdu;
    230250    psMetadata *updates;
    231251    psMetadata *outhead;
     252
     253    char *exttype  = NULL;
     254    char *dataname = NULL;
     255    char *xsrcname = NULL;
     256    char *headname = NULL;
    232257
    233258    // XXX if sources is NULL, skip the cell or write out empty tables?
     
    284309        // get the current header
    285310        hdu = pmFPAviewThisHDU (view, file->fpa);
     311
     312        // determine the output table format
     313        psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PSPHOT");
     314        if (!status) {
     315          psError(PS_ERR_UNKNOWN, true, "missing recipe PSPHOT in config data");
     316          return false;
     317        }
     318
     319        // if this is not TRUE, the output files only contain the psf measurements.
     320        bool XSRC_OUTPUT = psMetadataLookupBool(&status, recipe, "SAVE.XSRC");
    286321
    287322        // define the EXTNAME values for the different data segments:
     
    312347            }
    313348            dataname = pmFPAfileNameFromRule (rule, file, view);
     349
     350            if (XSRC_OUTPUT) {
     351              // EXTNAME for extended source data table
     352              rule = psMetadataLookupStr(&status, menu, "CMF.XSRC");
     353              if (!rule) {
     354                psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.XSRC in EXTNAME.RULES in camera.config");
     355                return false;
     356              }
     357              xsrcname = pmFPAfileNameFromRule (rule, file, view);
     358            }
    314359        }
    315360
     
    350395            outhead = psMetadataAlloc ();
    351396
    352             // determine the output table format
    353             psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PSPHOT");
    354             if (!status) {
    355                 psError(PS_ERR_UNKNOWN, true, "missing recipe PSPHOT in config data");
    356                 return false;
    357             }
    358397            exttype = psMemIncrRefCounter (psMetadataLookupStr(&status, recipe, "OUTPUT.FORMAT"));
    359398            if (!exttype) {
     
    375414            }
    376415            if (!strcmp (exttype, "PS1_DEV_1")) {
    377                 status = pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname);
     416                status = pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname, xsrcname);
    378417            }
    379 
    380418            if (!status) {
    381419                psError(PS_ERR_IO, false, "writing CMF data to %s with format %s\n", file->filename, exttype);
     
    403441
    404442// if this file needs to have a PHU written out, write one
    405 bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) {
     443bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
     444{
     445    PS_ASSERT_PTR_NON_NULL(view, false);
     446    PS_ASSERT_PTR_NON_NULL(file, false);
    406447
    407448    bool status;
     
    512553bool pmFPAviewReadObjects (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    513554{
     555    PS_ASSERT_PTR_NON_NULL(view, false);
     556    PS_ASSERT_PTR_NON_NULL(file, false);
     557    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     558
    514559    pmFPA *fpa = file->fpa;
    515560
     
    551596bool pmFPAReadObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    552597{
     598    PS_ASSERT_PTR_NON_NULL(view, false);
     599    PS_ASSERT_PTR_NON_NULL(file, false);
     600    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     601    PS_ASSERT_PTR_NON_NULL(file->fpa->chips, false);
     602
    553603    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    554604    *thisView = *view;
     
    572622bool pmChipReadObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    573623{
     624    PS_ASSERT_PTR_NON_NULL(view, false);
     625    PS_ASSERT_PTR_NON_NULL(chip, false);
     626    PS_ASSERT_PTR_NON_NULL(chip->cells, false);
     627
    574628    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    575629    *thisView = *view;
     
    596650bool pmCellReadObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    597651{
     652    PS_ASSERT_PTR_NON_NULL(view, false);
     653    PS_ASSERT_PTR_NON_NULL(cell, false);
     654    PS_ASSERT_PTR_NON_NULL(cell->readouts, false);
     655
    598656    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    599657    *thisView = *view;
     
    637695bool pmReadoutReadObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    638696{
     697    PS_ASSERT_PTR_NON_NULL(view, false);
     698    PS_ASSERT_PTR_NON_NULL(file, false);
    639699
    640700    bool status;
     
    774834bool pmFPAviewCheckDataStatusForSources (const pmFPAview *view, const pmFPAfile *file)
    775835{
     836    PS_ASSERT_PTR_NON_NULL(view, false);
     837    PS_ASSERT_PTR_NON_NULL(file, false);
     838    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     839
    776840    pmFPA *fpa = file->fpa;
    777841
     
    811875}
    812876
    813 bool pmFPACheckDataStatusForSources (const pmFPA *fpa) {
     877bool pmFPACheckDataStatusForSources (const pmFPA *fpa)
     878{
     879    PS_ASSERT_PTR_NON_NULL(fpa, false);
     880    PS_ASSERT_PTR_NON_NULL(fpa->chips, false);
    814881
    815882    for (int i = 0; i < fpa->chips->n; i++) {
     
    821888}
    822889
    823 bool pmChipCheckDataStatusForSources (const pmChip *chip) {
     890bool pmChipCheckDataStatusForSources (const pmChip *chip)
     891{
     892    PS_ASSERT_PTR_NON_NULL(chip, false);
     893    PS_ASSERT_PTR_NON_NULL(chip->cells, false);
    824894
    825895    for (int i = 0; i < chip->cells->n; i++) {
     
    831901}
    832902
    833 bool pmCellCheckDataStatusForSources (const pmCell *cell) {
     903bool pmCellCheckDataStatusForSources (const pmCell *cell)
     904{
     905    PS_ASSERT_PTR_NON_NULL(cell, false);
     906    PS_ASSERT_PTR_NON_NULL(cell->readouts, false);
    834907
    835908    for (int i = 0; i < cell->readouts->n; i++) {
     
    841914}
    842915
    843 bool pmReadoutCheckDataStatusForSources (const pmReadout *readout) {
     916bool pmReadoutCheckDataStatusForSources (const pmReadout *readout)
     917{
     918    PS_ASSERT_PTR_NON_NULL(readout, false);
    844919
    845920    bool status;
Note: See TracChangeset for help on using the changeset viewer.