IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 17, 2009, 12:08:50 PM (17 years ago)
Author:
beaumont
Message:

merged with head

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/psastro

  • branches/cnb_branches/cnb_branch_20090301/psastro/src/Makefile.am

    r21422 r23352  
     1lib_LTLIBRARIES = libpsastro.la
    12
    2 lib_LTLIBRARIES = libpsastro.la
    3 libpsastro_la_CFLAGS = $(PSASTRO_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS)
    4 libpsastro_la_LDFLAGS = $(PSASTRO_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS)
     3libpsastro_la_CFLAGS = $(PSASTRO_CFLAGS) $(PPSTATS_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -DPSASTRO_VERSION=$(SVN_VERSION) -DPSASTRO_BRANCH=$(SVN_BRANCH) -DPSASTRO_SOURCE=$(SVN_SOURCE)
     4libpsastro_la_LDFLAGS = $(PSASTRO_LIBS) $(PPSTATS_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS)
     5
     6# Force recompilation of psastroVersion.c, since it gets the version information
     7# can we do this with dependency info?
     8# psastroVersion.c: FORCE
     9# touch psastroVersion.c
     10# FORCE: ;
    511
    612bin_PROGRAMS = psastro psastroModel psastroModelFit gpcModel
  • branches/cnb_branches/cnb_branch_20090301/psastro/src/psastro.c

    r21409 r23352  
    3434    if (!config) usage ();
    3535
     36    psastroVersionPrint();
     37
    3638    // load identify the data sources
    3739    if (!psastroParseCamera (config)) {
    38         psErrorStackPrint(stderr, "error setting up the camera\n");
    39         exit (1);
     40        psErrorStackPrint(stderr, "error setting up the camera\n");
     41        exit (1);
    4042    }
    4143
     
    4345    // select subset of stars for astrometry
    4446    if (!psastroDataLoad (config)) {
    45         psErrorStackPrint(stderr, "error loading input data\n");
    46         exit (1);
     47        psErrorStackPrint(stderr, "error loading input data\n");
     48        exit (1);
    4749    }
    4850
    4951    // run the full astrometry analysis (chip and/or mosaic)
    5052    if (!psastroAnalysis (config)) {
    51         psErrorStackPrint(stderr, "failure in psastro analysis\n");
    52         exit (1);
     53        psErrorStackPrint(stderr, "failure in psastro analysis\n");
     54        exit (1);
    5355    }
    54    
     56
    5557    // write out the results
    5658    if (!psastroDataSave (config)) {
    57         psErrorStackPrint(stderr, "failed to write out data\n");
    58         exit (1);
     59        psErrorStackPrint(stderr, "failed to write out data\n");
     60        exit (1);
    5961    }
    6062
  • branches/cnb_branches/cnb_branch_20090301/psastro/src/psastro.h

    r21422 r23352  
    9595// Return version strings.
    9696psString          psastroVersion(void);
     97psString          psastroSource(void);
    9798psString          psastroVersionLong(void);
     99bool              psastroVersionHeader(psMetadata *header);
     100bool              psastroVersionHeaderFull(psMetadata *header);
     101void              psastroVersionPrint(void);
    98102
    99103// demo plots
  • branches/cnb_branches/cnb_branch_20090301/psastro/src/psastroArguments.c

    r21422 r23352  
    66 *
    77 *  @author IfA
    8  *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2009-02-09 21:25:34 $
     8 *  @version $Revision: 1.34.2.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2009-02-19 17:59:50 $
    1010 *  Copyright 2009 Institute for Astronomy, University of Hawaii
    1111 */
     
    100100    if ((N = psArgumentGet (argc, argv, "-visual"))) {
    101101        psArgumentRemove (N, &argc, argv);
    102         pmAstromSetVisual (true);
     102        pmVisualSetVisual (true);
    103103    }
    104104
  • branches/cnb_branches/cnb_branch_20090301/psastro/src/psastroCleanup.c

    r21422 r23352  
    66 *
    77 *  @author IfA
    8  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2009-02-09 21:25:34 $
     8 *  @version $Revision: 1.8.2.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2009-02-19 17:59:50 $
    1010 *  Copyright 2009 Institute for Astronomy, University of Hawaii
    1111 */
     
    1616
    1717    psFree (config);
    18     pmAstromVisualClose ();
     18    pmVisualClose ();
    1919
    2020    psTimerStop ();
  • branches/cnb_branches/cnb_branch_20090301/psastro/src/psastroConvert.c

    r21409 r23352  
    9999        int n = index->data.S32[i];
    100100        pmSource *source = sources->data[n];
    101         // XXX this needs to be flexible
     101
     102        psTrace ("psastro", 6, "mag: %f +/- %f, mode: %x, skip: %x\n", source->psfMag, source->errMag, source->mode, skip);
     103
    102104        if (source->mode & skip) {
    103105          nModeSkip ++;
    104106          continue;
    105107        }
     108
    106109        if ((iMagMax != 0.0) && (source->psfMag > iMagMax)) {
    107110          nFaintSkip ++;
  • branches/cnb_branches/cnb_branch_20090301/psastro/src/psastroDataSave.c

    r21409 r23352  
    1818  return false; \
    1919}
    20  
     20
    2121/**
    2222 * this loop saves the photometry/astrometry data files
     
    3131    psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, PSASTRO_RECIPE);
    3232    if (!recipe) {
    33         psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe!\n");
    34         return false;
     33        psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe!\n");
     34        return false;
    3535    }
    3636
     
    3838    pmFPAfile *output = psMetadataLookupPtr (NULL, config->files, "PSASTRO.OUTPUT");
    3939    if (!output) {
    40         psError(PSASTRO_ERR_CONFIG, true, "Can't find or interpret output file rule PSASTRO.OUTPUT!\n");
    41         return false;
     40        psError(PSASTRO_ERR_CONFIG, true, "Can't find or interpret output file rule PSASTRO.OUTPUT!\n");
     41        return false;
    4242    }
    4343
     
    4848
    4949    pmFPAview *view = pmFPAviewAlloc (0);
     50    pmHDU *lastHDU = NULL;              // Last HDU updated
    5051
    5152    // open/load files as needed
     
    5556        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    5657        if (!chip->process || !chip->file_exists) { continue; }
    57         if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
     58        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    5859
    59         while ((cell = pmFPAviewNextCell (view, output->fpa, 1)) != NULL) {
     60        while ((cell = pmFPAviewNextCell (view, output->fpa, 1)) != NULL) {
    6061            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    6162            if (!cell->process || !cell->file_exists) { continue; }
    62             if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
     63            if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    6364
    64             // process each of the readouts
    65             while ((readout = pmFPAviewNextReadout (view, output->fpa, 1)) != NULL) {
    66                 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    67                 if (!readout->data_exists) { continue; }
     65            // process each of the readouts
     66            while ((readout = pmFPAviewNextReadout (view, output->fpa, 1)) != NULL) {
     67                if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
     68                if (!readout->data_exists) { continue; }
    6869
    69                 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
    70             }
    71             if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
    72         }
    73         if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
     70                // Put version information into the header
     71                pmHDU *hdu = pmHDUGetHighest(output->fpa, chip, cell);
     72                if (hdu && hdu != lastHDU) {
     73                    psastroVersionHeaderFull(hdu->header);
     74                    lastHDU = hdu;
     75                }
     76
     77                if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
     78            }
     79            if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
     80        }
     81        if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
    7482    }
    7583    if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
  • branches/cnb_branches/cnb_branch_20090301/psastro/src/psastroVersion.c

    r21409 r23352  
    55 *  @ingroup libpsastro
    66 *
    7  *  @author IfA
    8  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2009-02-07 02:03:34 $
    107 *  Copyright 2009 Institute for Astronomy, University of Hawaii
    118 */
     
    1310#include "psastroInternal.h"
    1411
    15 static const char *cvsTag = "$Name: not supported by cvs2svn $";///< CVS tag name
     12#ifndef PSASTRO_VERSION
     13#error "PSASTRO_VERSION is not set"
     14#endif
     15#ifndef PSASTRO_BRANCH
     16#error "PSASTRO_BRANCH is not set"
     17#endif
     18#ifndef PSASTRO_SOURCE
     19#error "PSASTRO_SOURCE is not set"
     20#endif
     21
     22#define xstr(s) str(s)
     23#define str(s) #s
    1624
    1725psString psastroVersion(void)
    1826{
    19     psString version = NULL;            // Version, to return
    20     psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION);
    21     return version;
     27    char *value = NULL;
     28    psStringAppend(&value, "%s@%s", xstr(PSASTRO_BRANCH), xstr(PSASTRO_VERSION));
     29    return value;
     30}
     31
     32psString psastroSource(void)
     33{
     34  return psStringCopy(xstr(PSASTRO_SOURCE));
    2235}
    2336
    2437psString psastroVersionLong(void)
    2538{
    26     psString version = psastroVersion(); // Version, to return
    27     psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag
    28     psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__);
    29     psFree(tag);
     39    psString version = psastroVersion();  // Version, to return
     40    psString source = psastroSource();    // Source
     41
     42    psStringPrepend(&version, "psastro ");
     43    psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__);
     44    psFree(source);
     45
     46#ifdef __OPTIMIZE__
     47    psStringAppend(&version, " optimised");
     48#else
     49    psStringAppend(&version, " unoptimised");
     50#endif
     51
    3052    return version;
     53};
     54
     55bool psastroVersionHeader(psMetadata *header)
     56{
     57    PS_ASSERT_METADATA_NON_NULL(header, false);
     58
     59    psString version = psastroVersion(); // Software version
     60    psString source = psastroSource();   // Software source
     61
     62    psStringPrepend(&version, "psastro version: ");
     63    psStringPrepend(&source, "psastro source: ");
     64
     65    psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, version);
     66    psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, source);
     67
     68    psFree(version);
     69    psFree(source);
     70
     71    return true;
    3172}
    3273
     74bool psastroVersionHeaderFull(psMetadata *header)
     75{
     76    PS_ASSERT_METADATA_NON_NULL(header, false);
     77
     78    psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now
     79    psString timeString = psTimeToISO(time); // The time in an ISO string
     80    psFree(time);
     81    psString history = NULL;               // History string
     82    psStringAppend(&history, "psastro at %s", timeString);
     83    psFree(timeString);
     84    psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history);
     85    psFree(history);
     86
     87    psLibVersionHeader(header);
     88    psModulesVersionHeader(header);
     89    ppStatsVersionHeader(header);
     90    psastroVersionHeader(header);
     91
     92    return true;
     93}
     94
     95void psastroVersionPrint(void)
     96{
     97    psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now
     98    psString timeString = psTimeToISO(time); // The time in an ISO string
     99    psFree(time);
     100    psLogMsg("psastro", PS_LOG_INFO, "psastro at %s", timeString);
     101    psFree(timeString);
     102
     103    psString pslib = psLibVersionLong();// psLib version
     104    psString psmodules = psModulesVersionLong(); // psModules version
     105    psString ppStats = ppStatsVersionLong(); // ppStats version
     106    psString psastro = psastroVersionLong(); // psastro version
     107
     108    psLogMsg("psastro", PS_LOG_INFO, "%s", pslib);
     109    psLogMsg("psastro", PS_LOG_INFO, "%s", psmodules);
     110    psLogMsg("psastro", PS_LOG_INFO, "%s", ppStats);
     111    psLogMsg("psastro", PS_LOG_INFO, "%s", psastro);
     112
     113    psFree(pslib);
     114    psFree(psmodules);
     115    psFree(ppStats);
     116    psFree(psastro);
     117
     118    return;
     119}
Note: See TracChangeset for help on using the changeset viewer.