IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18905


Ignore:
Timestamp:
Aug 4, 2008, 4:16:06 PM (18 years ago)
Author:
Paul Price
Message:

Adding functions to dump configuration to an MDC file on disk, so we can record what parameters we used.

Location:
trunk/psModules/src
Files:
2 added
6 edited

Legend:

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

    r15972 r18905  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2008-01-02 20:33:14 $
     5 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2008-08-05 02:16:06 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    374374}
    375375
     376pmFPAview *pmFPAviewTop(const pmFPA *fpa)
     377{
     378    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
     379
     380    pmFPAview *view = pmFPAviewAlloc(0);// View to top
     381
     382    int numChips = 0;                   // Number of active chips
     383    psArray *chips = fpa->chips;        // Chips of interest
     384    for (int i = 0; i < chips->n; i++) {
     385        pmChip *chip = chips->data[i];  // Chip of interest
     386        if (!chip || !chip->file_exists) {
     387            continue;
     388        }
     389        numChips++;
     390        view->chip = i;
     391
     392        int numCells = 0;               // Number of active cells
     393        psArray *cells = chip->cells;   // Cells of interest
     394        for (int j = 0; j < cells->n; j++) {
     395            pmCell *cell = cells->data[j]; // Cell of interest
     396            if (!cell || !cell->file_exists) {
     397                continue;
     398            }
     399            numCells++;
     400            view->cell = j;
     401        }
     402
     403        if (numCells > 1) {
     404            if (numCells != cells->n) {
     405                psWarning("More than one, but not all cells are active.");
     406            }
     407            view->cell = -1;
     408        }
     409    }
     410
     411    if (numChips > 1) {
     412        if (numChips != chips->n) {
     413            psWarning("More than one, but not all chips are active.");
     414        }
     415        view->chip = -1;
     416        view->cell = -1;
     417    }
     418
     419    return view;
     420}
     421
  • trunk/psModules/src/camera/pmFPAview.h

    r15972 r18905  
    44 * @author Eugene Magnier, IfA
    55 *
    6  * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2008-01-02 20:33:14 $
     6 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2008-08-05 02:16:06 $
    88 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    99 */
     
    124124
    125125
     126/// Determine the view suitable for the top level of the provided FPA
     127pmFPAview *pmFPAviewTop(const pmFPA *fpa ///< FPA of interest
     128    );
     129
    126130/// @}
    127131#endif
  • trunk/psModules/src/config/Makefile.am

    r13591 r18905  
    44libpsmodulesconfig_la_LDFLAGS  = -release $(PACKAGE_VERSION)
    55libpsmodulesconfig_la_SOURCES  = \
    6     pmConfig.c \
    7     pmConfigRecipes.c \
    8     pmConfigCamera.c \
    9     pmConfigCommand.c \
    10     pmConfigMask.c \
    11     pmVersion.c \
    12     pmErrorCodes.c
     6        pmConfig.c \
     7        pmConfigRecipes.c \
     8        pmConfigCamera.c \
     9        pmConfigCommand.c \
     10        pmConfigMask.c \
     11        pmConfigDump.c \
     12        pmVersion.c \
     13        pmErrorCodes.c
    1314
    1415pkginclude_HEADERS = \
    15     pmConfig.h \
    16     pmConfigRecipes.h \
    17     pmConfigCamera.h \
    18     pmConfigCommand.h \
    19     pmConfigMask.h \
    20     pmVersion.h \
    21     pmErrorCodes.h
     16        pmConfig.h \
     17        pmConfigRecipes.h \
     18        pmConfigCamera.h \
     19        pmConfigCommand.h \
     20        pmConfigMask.h \
     21        pmConfigDump.h \
     22        pmVersion.h \
     23        pmErrorCodes.h
    2224
    2325# Error codes.
  • trunk/psModules/src/config/pmConfig.c

    r18830 r18905  
    6868    psFree(config->arguments);
    6969    psFree(config->database);
     70    psFree(config->program);
    7071
    7172    // Close log and trace files
     
    150151    config->database = NULL;
    151152    config->defaultRecipe = NULL;
     153    config->program = NULL;
    152154
    153155    config->traceFD = DEFAULT_TRACE;
     
    442444
    443445    pmConfig *config = pmConfigAlloc(); // The configuration, containing site, camera and recipes
     446    config->program = psStringCopy(argv[0]);
    444447    config->defaultRecipe = defaultRecipe;
    445448
     
    17451748}
    17461749
    1747 
    1748 #if 0
    1749 bool pmConfigDump(const pmConfig *config, const pmFPA *source, const char *outroot)
    1750 {
    1751     PS_ASSERT_PTR_NON_NULL(config, false);
    1752     PS_ASSERT_STRING_NON_EMPTY(outroot, false);
    1753 
    1754     pmFPAview *view = source ? pmFPAviewTop(source) : pmFPAviewAlloc(0);// View to top level
    1755     if (!view) {
    1756         psError(PS_ERR_UNKNOWN, false, "Unable to determine top view for FPA.");
    1757         return false;
    1758     }
    1759 
    1760     psMetadata *dumpRules = psMetadataLookupMetadata(NULL, config->system, "CONFIG.RULES"); // Name rules
    1761     if (!dumpRules) {
    1762         psError(PS_ERR_UNKNOWN, false, "Unable to find CONFIG.RULES in system configuration");
    1763         psFree(view);
    1764         return false;
    1765     }
    1766 
    1767     const char *name =
    1768 #endif
  • trunk/psModules/src/config/pmConfig.h

    r18073 r18905  
    55 *  @author Eugene Magnier, IfA
    66 *
    7  *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2008-06-10 21:53:09 $
     7 *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2008-08-05 02:16:06 $
    99 *  Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    1010 */
     
    3737/// command-line arguments, the pmFPAfiles used, and the database handle.
    3838typedef struct {
    39     psMetadata *user;                   ///< User configuration
    40     psMetadata *site;                   ///< Site configuration
    41     psMetadata *system;                 ///< System configuration
     39    psMetadata *user;                   ///< User configuration
     40    psMetadata *site;                   ///< Site configuration
     41    psMetadata *system;                 ///< System configuration
    4242    psMetadata *complete;               ///< Full merged configuration
    4343    psMetadata *camera;                 ///< Camera specification
     
    5151    psDB *database;                     ///< Database handle
    5252    const char *defaultRecipe;          ///< name of top-level recipe for this program
     53    psString program;                   ///< Name of program
    5354    // Private members
    5455    pmRecipeSource recipesRead;         ///< Which recipe sources have been read
     
    108109/// configuration.  The accepted format is returned.
    109110psMetadata *pmConfigCameraFormatFromHeader(psMetadata **camera, // selected camera (or meta-camera)
    110                                            psString *formatName, // selected format name
    111                                            pmConfig *config, ///< The configuration
     111                                           psString *formatName, // selected format name
     112                                           pmConfig *config, ///< The configuration
    112113                                           const psMetadata *header, ///< The FITS header
    113114                                           bool readRecipes ///< optionally read the recipes as well as the format
  • trunk/psModules/src/psmodules.h

    r18893 r18905  
    2626#include <pmConfigCommand.h>
    2727#include <pmConfigMask.h>
     28#include <pmConfigDump.h>
    2829#include <pmVersion.h>
    2930
Note: See TracChangeset for help on using the changeset viewer.