IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13931


Ignore:
Timestamp:
Jun 21, 2007, 12:45:27 PM (19 years ago)
Author:
magnier
Message:

adding error traps to pmFPAfileDefine functions

Location:
trunk/psModules/src/camera
Files:
2 edited

Legend:

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

    r13897 r13931  
    9494
    9595// Define an output pmFPAfile
    96 static pmFPAfile *fpaFileDefineOutput(const pmConfig *config, // Configuration
    97                                       pmFPA *fpa, // Optional FPA to bind
    98                                       const char *name, // Name of file rule
    99                                       const char *cameraName, // Name of camera configuration to use
    100                                       const char *formatName // Name of camera format to use
     96pmFPAfile *pmFPAfileDefineOutputForFormat(const pmConfig *config, // Configuration
     97                                          pmFPA *fpa, // Optional FPA to bind
     98                                          const char *name, // Name of file rule
     99                                          const char *cameraName, // Name of camera configuration to use
     100                                          const char *formatName // Name of camera format to use
    101101    )
    102102{
     
    257257    PS_ASSERT_STRING_NON_EMPTY(name, NULL);
    258258
    259     return fpaFileDefineOutput(config, fpa, name, NULL, NULL);
     259    return pmFPAfileDefineOutputForFormat(config, fpa, name, NULL, NULL);
    260260}
    261261
     
    472472    }
    473473
    474 // XXX this hack should now not be needed: the PSF is stored in a MEF fits table file
    475 # if (0)
    476     // XXX temporary hack : force PSF input onto filename
    477     // XXX EAM : I need to define a PSF container which specifies the chip/cell element
    478     // XXX we could use the flat metadata style IF we restrict it to SIMPLE cameras
    479     // XXX (ie, one readout per cell, one cell per chip, one chip per fpa)
    480     if (file->type == PM_FPA_FILE_PSF) {
    481         file->filerule = psStringCopy (infiles->data[0]);
    482         if (found) {
    483             *found = true;
    484         }
    485         return file;
    486     }
    487 # endif
    488 
    489474    // set derived values
    490475    file->fileLevel = input->fileLevel;
     
    979964        strcmp(config->cameraName + strlen(config->cameraName) - 8, "-SKYCELL") == 0) {
    980965        // The input camera is already a skycell
    981         file = fpaFileDefineOutput(config, fpa, filename, config->cameraName, "SKYCELL");
     966        file = pmFPAfileDefineOutputForFormat(config, fpa, filename, config->cameraName, "SKYCELL");
    982967    } else {
    983968        psString cameraName = NULL;         // Name of the old camera configuration
     
    993978        psString newCameraName = NULL;  // Name of the new (automatically-generated) camera configuration
    994979        psStringAppend(&newCameraName, "_%s-SKYCELL", cameraName);
    995         file = fpaFileDefineOutput(config, fpa, filename, newCameraName, "SKYCELL");
     980        file = pmFPAfileDefineOutputForFormat(config, fpa, filename, newCameraName, "SKYCELL");
    996981        psFree(cameraName);
    997982        psFree(newCameraName);
     983    }
     984    if (!file) {
     985        psErrorStackPrint(stderr, "file %s not defined\n", filename);
     986        return NULL;
    998987    }
    999988
     
    10181007        strcmp(config->cameraName + strlen(config->cameraName) - 5, "-CHIP") == 0) {
    10191008        // The input camera has already been mosaicked to this level
    1020         file = fpaFileDefineOutput(config, NULL, filename, config->cameraName, config->formatName);
     1009        file = pmFPAfileDefineOutputForFormat(config, NULL, filename, config->cameraName, config->formatName);
    10211010    } else {
    10221011        psString cameraName = NULL;         // Name of the new (automatically-generated) camera configuration
     
    10241013
    10251014        // Find the correct camera configuration
    1026         file = fpaFileDefineOutput(config, NULL, filename, cameraName, config->formatName);
     1015        file = pmFPAfileDefineOutputForFormat(config, NULL, filename, cameraName, config->formatName);
    10271016        psFree(cameraName);
     1017    }
     1018    if (!file) {
     1019        psErrorStackPrint(stderr, "file %s not defined\n", filename);
     1020        return NULL;
    10281021    }
    10291022
     
    10461039            strcmp(config->cameraName + strlen(config->cameraName) - 4 , "-FPA") == 0) {
    10471040        // The input camera has already been mosaicked to this level
    1048         file = fpaFileDefineOutput(config, NULL, filename, config->cameraName, config->formatName);
     1041        file = pmFPAfileDefineOutputForFormat(config, NULL, filename, config->cameraName, config->formatName);
    10491042    } else {
    10501043
     
    10611054        psFree(original);
    10621055
    1063         file = fpaFileDefineOutput(config, NULL, filename, cameraName, config->formatName);
     1056        file = pmFPAfileDefineOutputForFormat(config, NULL, filename, cameraName, config->formatName);
    10641057        psFree(cameraName);
     1058    }
     1059    if (!file) {
     1060        psErrorStackPrint(stderr, "file %s not defined\n", filename);
     1061        return NULL;
    10651062    }
    10661063
  • trunk/psModules/src/camera/pmFPAfileDefine.h

    r13704 r13931  
    44 * @author EAM, IfA
    55 *
    6  * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-06-08 00:31:50 $
     6 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2007-06-21 22:45:27 $
    88 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii
    99 */
     
    2626// Note that the returned pmFPAfile is a view only, so it should not be freed by the caller --- the only
    2727// reference count is held by the config->files metadata.
    28 pmFPAfile *pmFPAfileDefineOutput (const pmConfig *config, pmFPA *fpa, const char *name);
     28// Define an output pmFPAfile
     29pmFPAfile *pmFPAfileDefineOutput(const pmConfig *config, // Configuration
     30                                 pmFPA *fpa, // Optional FPA to bind
     31                                 const char *name // Name of camera format to use
     32    );
     33
     34pmFPAfile *pmFPAfileDefineOutputForFormat(const pmConfig *config, // Configuration
     35                                          pmFPA *fpa, // Optional FPA to bind
     36                                          const char *name, // Name of file rule
     37                                          const char *cameraName, // Name of camera configuration to use
     38                                          const char *formatName // Name of camera format to use
     39    );
    2940
    3041// look for the given argname on the argument list.  find the give filename from the file rules
Note: See TracChangeset for help on using the changeset viewer.