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:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

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

    r18839 r23352  
    11bin_PROGRAMS = pswarp
    2 pswarp_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PSWARP_CFLAGS)
     2
     3PSWARP_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi`
     4PSWARP_BRANCH=`if [ -e ../../BRANCH ]; then cat ../../BRANCH; else svn info | sed -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'; fi`
     5PSWARP_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi`
     6
     7# Force recompilation of pswarpVersion.c, since it gets the version information
     8pswarpVersion.c: FORCE
     9        touch pswarpVersion.c
     10FORCE: ;
     11
     12pswarp_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PSWARP_CFLAGS) -DPSWARP_VERSION=\"$(PSWARP_VERSION)\" -DPSWARP_BRANCH=\"$(PSWARP_BRANCH)\" -DPSWARP_SOURCE=\"$(PSWARP_SOURCE)\"
    313pswarp_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PPSTATS_LIBS) $(PSPHOT_LIBS) $(PSWARP_LIBS)
    414
     
    1828        pswarpSetThreads.c              \
    1929        pswarpTransformReadout.c        \
    20         pswarpTransformSources.c \
     30        pswarpTransformSources.c        \
    2131        pswarpTransformTile.c           \
    2232        pswarpVersion.c           
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarp.c

    r21442 r23352  
    3939    if (!config) usage();
    4040
     41    pswarpVersionPrint();
     42
    4143    // load identify the data sources
    4244    if (!pswarpParseCamera(config)) {
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarp.h

    r21368 r23352  
    112112 */
    113113bool pswarpSetThreads ();
     114
     115/// Return software version
     116psString pswarpVersion(void);
     117
     118/// Return software souce
     119psString pswarpSource(void);
     120
     121/// Return long software version information
     122psString pswarpVersionLong(void);
     123
     124/// Populate header with version information
     125bool pswarpVersionHeader(
     126    psMetadata *header                  ///< Header to populate
     127    );
     128
     129/// Print version information
     130void pswarpVersionPrint(void);
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpArguments.c

    r21368 r23352  
    4141        if ((arg = psArgumentGet(argc, argv, "-psphot-visual"))) {
    4242            psArgumentRemove(arg, &argc, argv);
    43             psphotSetVisual(true);
     43            pmVisualSetVisual(true);
    4444        }
    4545    }
     
    8787
    8888
    89     if (!pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list")) {
    90         psError(PSWARP_ERR_ARGUMENTS, true, "Missing -file (input) or -list (input)");
    91         return NULL;
    92     }
    93 
    94     // the mask and variance entries are optional (build from gain?)
    95     pmConfigFileSetsMD (config->arguments, &argc, argv, "MASK",   "-mask",   "-masklist");
     89    pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list");
     90    pmConfigFileSetsMD (config->arguments, &argc, argv, "MASK", "-mask", "-masklist");
    9691    pmConfigFileSetsMD (config->arguments, &argc, argv, "VARIANCE", "-variance", "-variancelist");
    9792
     
    105100
    106101    // output position is fixed
    107     psMetadataAddStr (config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "", argv[1]);
     102    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "", argv[1]);
    108103
    109104    // skycell position is fixed
    110105    array = psArrayAlloc(1);
    111     array->data[0] = psStringCopy (argv[2]);
    112     status = psMetadataAddPtr (config->arguments, PS_LIST_TAIL, "SKYCELL", PS_DATA_ARRAY, "", array);
    113     psFree (array);
     106    array->data[0] = psStringCopy(argv[2]);
     107    status = psMetadataAddPtr(config->arguments, PS_LIST_TAIL, "SKYCELL", PS_DATA_ARRAY, "", array);
     108    psFree(array);
    114109
    115110    psTrace("pswarp", 1, "Done with pswarpArguments...\n");
    116     return (config);
     111    return config;
    117112}
    118113
     
    204199    psTrace("pswarp", 1, "Done with pswarpArguments...\n");
    205200
    206     // Dump configuration, now that's it's settled
    207     psString dump_file =  psMetadataLookupStr(&status, config->arguments, "DUMP_CONFIG");
    208     if (dump_file) {
    209         const char *skyCamera = psMetadataLookupStr(NULL, config->arguments,
    210                                                     "SKYCELL.CAMERA");  ///< Name of camera for skycell
    211         pmConfigCamerasCull(config, skyCamera);
    212         pmConfigRecipesCull(config, "PSWARP,PPSTATS,PSPHOT,MASKS");
    213 
    214         pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT"); // Input file
    215         pmConfigDump(config, input->fpa, dump_file);
    216     }
    217 
    218201    return (config);
    219202}
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpLoop.c

    r21468 r23352  
    7676    bool status;
    7777
     78    const char *skyCamera = psMetadataLookupStr(NULL, config->arguments,
     79                                                "SKYCELL.CAMERA");  ///< Name of camera for skycell
     80    pmConfigCamerasCull(config, skyCamera);
     81    pmConfigRecipesCull(config, "PSWARP,PPSTATS,PSPHOT,MASKS,JPEG");
     82
     83
    7884    // load the recipe
    7985    psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSWARP_RECIPE);
     
    8187        psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE);
    8288        return false;
     89    }
     90
     91    if (!pswarpSetMaskBits(config)) {
     92        psError(PS_ERR_IO, false, "failed to set mask bits");
     93        return NULL;
    8394    }
    8495
     
    339350    }
    340351
     352    pswarpVersionHeader(hdu->header);
     353
    341354    if (!pmAstromWriteWCS(hdu->header, outFPA, outChip, WCS_NONLIN_TOL)) {
    342355        psError(PS_ERR_UNKNOWN, false, "Unable to generate WCS header.");
     
    455468    }
    456469
     470    // Dump configuration
     471    psString dump_file = psMetadataLookupStr(&status, config->arguments, "DUMP_CONFIG");
     472    if (dump_file) {
     473        pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT"); // Input file
     474        pmConfigDump(config, input->fpa, dump_file);
     475    }
     476
    457477    return true;
    458478}
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpParseCamera.c

    r21368 r23352  
    1111 */
    1212
    13 # include "pswarp.h"
     13#include "pswarp.h"
     14
     15// Define an input file
     16static pmFPAfile *defineInputFile(pmConfig *config,// Configuration
     17                                  pmFPAfile *bind,    // File to which to bind, or NULL
     18                                  char *filerule,     // Name of file rule
     19                                  char *argname,      // Argument name
     20                                  pmFPAfileType fileType // Type of file
     21    )
     22{
     23    bool status;
     24
     25    // look for the file on the RUN metadata
     26    pmFPAfile *file = pmFPAfileDefineFromRun(&status, config, filerule); // File to return
     27    if (!status) {
     28        psError(PSWARP_ERR_CONFIG, false, "Failed to load file definition for %s", filerule);
     29        return NULL;
     30    }
     31    if (!file) {
     32        // look for the file on the argument list
     33        if (bind) {
     34            file = pmFPAfileBindFromArgs(&status, bind, config, filerule, argname);
     35        } else {
     36            file = pmFPAfileDefineFromArgs(&status, config, filerule, argname);
     37        }
     38        if (!status) {
     39            psError(PSWARP_ERR_CONFIG, false, "Failed to load file definition for %s", filerule);
     40            return false;
     41        }
     42    }
     43
     44    if (!file) {
     45        return NULL;
     46    }
     47
     48    if (file->type != fileType) {
     49        psError(PSWARP_ERR_CONFIG, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType));
     50        return NULL;
     51    }
     52
     53    return file;
     54}
     55
     56
     57
    1458
    1559bool pswarpParseCamera(pmConfig *config)
    1660{
    17     bool status;
    18     bool mdok;                          ///< Status of MD lookup
    19     pmFPAfile *skycell = NULL;
    20     pmConfig *skyConfig = NULL;
     61    psAssert(config, "Require configuration");
    2162
    22     // the input image(s) are required arguments; they define the camera
    23     status = false;
    24     pmFPAfile *input = pmFPAfileDefineFromArgs(&status, config, "PSWARP.INPUT", "INPUT");
    25     if (!input || !status) {
     63    // The input image(s) is required: it defines the camera
     64    pmFPAfile *input = defineInputFile(config, NULL, "PSWARP.INPUT", "INPUT", PM_FPA_FILE_IMAGE);
     65    if (!input) {
    2666        psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.INPUT");
    2767        return false;
    2868    }
    2969
    30     // the input image(s) are required arguments; they define the camera
    31     status = false;
    32     pmFPAfile *astrom = pmFPAfileDefineFromArgs(&status, config, "PSWARP.ASTROM", "ASTROM");
    33     if (!status) {
    34         psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
    35         return NULL;
    36     }
    37     if (astrom) {
    38         psLogMsg ("pswarp", 3, "using supplied astrometry\n");
    39     } else {
    40         psLogMsg ("pswarp", 3, "using header astrometry\n");
     70    pmFPAfile *astrom = defineInputFile(config, NULL, "PSWARP.ASTROM", "ASTROM", PM_FPA_FILE_CMF);
     71    psLogMsg("pswarp", PS_LOG_INFO, "Astrometry source: %s", astrom ? "supplied" : "header");
     72
     73    pmFPAfile *inMask = defineInputFile(config, input, "PSWARP.MASK", "MASK", PM_FPA_FILE_MASK);
     74    if (!inMask) {
     75        psLogMsg("pswarp", PS_LOG_INFO, "No mask supplied");
    4176    }
    4277
    43     // the mask is not required - but must conform to input camera
    44     pmFPAfile *inMask = pmFPAfileBindFromArgs(&status, input, config, "PSWARP.MASK", "MASK");
    45     if (!status) {
    46         psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
    47         return NULL;
    48     }
    49     if (!inMask) {
    50         psLogMsg ("pswarp", 3, "no mask supplied\n");
     78    pmFPAfile *inVariance = defineInputFile(config, input, "PSWARP.VARIANCE", "VARIANCE",
     79                                            PM_FPA_FILE_VARIANCE);
     80    if (!inVariance) {
     81        psLogMsg("pswarp", PS_LOG_INFO, "No variance supplied");
    5182    }
    5283
    53     // loading the mask here should have invoked pmConfigMaskReadHeader()
    54     if (!pswarpSetMaskBits (config)) {
    55         psError(PS_ERR_IO, false, "failed to set mask bits");
    56         return NULL;
    57     }
    58 
    59     pmFPAfile *inVariance = pmFPAfileBindFromArgs(&status, input, config, "PSWARP.VARIANCE", "VARIANCE");
    60     if (!status) {
    61         psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
    62         return NULL;
    63     }
    64     if (!inVariance) {
    65         psLogMsg ("pswarp", 3, "no variance supplied\n");
    66     }
    67 
    68     // the input skycell is a required argument: it defines the output image
     84    // The input skycell is a required argument: it defines the output image
    6985    // XXX we may need a different skycell structure here
    70     status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL");
     86    pmFPAfile *skycell = NULL;
     87    pmConfig *skyConfig = NULL;
     88    bool status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL");
    7189    if (!status) {
    7290        psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.SKYCELL");
     
    8199        return false;
    82100    }
     101    output->save = true;
     102
    83103    pmFPAfile *outMask = pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.MASK");
    84104    if (!outMask) {
     
    86106        return false;
    87107    }
    88 
    89     output->save = true;
    90108    outMask->save = true;
    91109
     
    108126    }
    109127
     128    bool mdok;                          // Status of MD lookup
    110129    if (psMetadataLookupBool(&mdok, config->arguments, "PSF")) {
    111130        // This file, PSPHOT.INPUT, is just used as a carrier; output files (eg, PSPHOT.RESID) are defined by
     
    160179            }
    161180        }
    162         psFree (chips);
     181        psFree(chips);
    163182    }
    164183
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpVersion.c

    r21323 r23352  
    1818#include <pslib.h>
    1919#include <psmodules.h>
     20#include <psphot.h>
     21#include <ppStats.h>
    2022#include "pswarp.h"
    2123
    22 static const char *cvsTag = "$Name: not supported by cvs2svn $";///< CVS tag name
    2324
    2425psString pswarpVersion(void)
    2526{
    26     psString version = NULL;            ///< Version, to return
    27     psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION);
    28     return version;
     27#ifndef PSWARP_VERSION
     28#error "PSWARP_VERSION is not set"
     29#endif
     30#ifndef PSWARP_BRANCH
     31#error "PSWARP_BRANCH is not set"
     32#endif
     33    return psStringCopy(PSWARP_BRANCH "@" PSWARP_VERSION);
     34}
     35
     36psString pswarpSource(void)
     37{
     38#ifndef PSWARP_SOURCE
     39#error "PSWARP_SOURCE is not set"
     40#endif
     41    return psStringCopy(PSWARP_SOURCE);
    2942}
    3043
    3144psString pswarpVersionLong(void)
    3245{
    33     psString version = pswarpVersion(); ///< Version, to return
    34     psString tag = psStringStripCVS(cvsTag, "Name"); ///< CVS tag
    35     psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__);
    36     psFree(tag);
     46    psString version = pswarpVersion();  // Version, to return
     47    psString source = pswarpSource();    // Source
     48
     49    psStringPrepend(&version, "pswarp ");
     50    psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__);
     51    psFree(source);
     52
     53#ifdef __OPTIMIZE__
     54    psStringAppend(&version, " optimised");
     55#else
     56    psStringAppend(&version, " unoptimised");
     57#endif
     58
    3759    return version;
     60};
     61
     62
     63bool pswarpVersionHeader(psMetadata *header)
     64{
     65    PS_ASSERT_METADATA_NON_NULL(header, false);
     66
     67    psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now
     68    psString timeString = psTimeToISO(time); // The time in an ISO string
     69    psFree(time);
     70    psString history = NULL;               // History string
     71    psStringAppend(&history, "pswarp at %s", timeString);
     72    psFree(timeString);
     73    psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history);
     74    psFree(history);
     75
     76    psLibVersionHeader(header);
     77    psModulesVersionHeader(header);
     78    psphotVersionHeader(header);
     79    ppStatsVersionHeader(header);
     80
     81    psString version = pswarpVersion(); // Software version
     82    psString source  = pswarpSource();  // Software source
     83
     84    psStringPrepend(&version, "pswarp version: ");
     85    psStringPrepend(&source, "pswarp source: ");
     86
     87    psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, version);
     88    psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, source);
     89
     90    psFree(version);
     91    psFree(source);
     92
     93    return true;
    3894}
    3995
     96void pswarpVersionPrint(void)
     97{
     98    psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now
     99    psString timeString = psTimeToISO(time); // The time in an ISO string
     100    psFree(time);
     101    psLogMsg("pswarp", PS_LOG_INFO, "pswarp at %s", timeString);
     102    psFree(timeString);
     103
     104    psString pslib = psLibVersionLong();// psLib version
     105    psString psmodules = psModulesVersionLong(); // psModules version
     106    psString psphot = psphotVersionLong(); // psphot version
     107    psString ppStats = ppStatsVersionLong(); // ppStats version
     108    psString pswarp = pswarpVersionLong(); // pswarp version
     109
     110    psLogMsg("pswarp", PS_LOG_INFO, "%s", pslib);
     111    psLogMsg("pswarp", PS_LOG_INFO, "%s", psmodules);
     112    psLogMsg("pswarp", PS_LOG_INFO, "%s", psphot);
     113    psLogMsg("pswarp", PS_LOG_INFO, "%s", ppStats);
     114    psLogMsg("pswarp", PS_LOG_INFO, "%s", pswarp);
     115
     116    psFree(pslib);
     117    psFree(psmodules);
     118    psFree(psphot);
     119    psFree(ppStats);
     120    psFree(pswarp);
     121
     122    return;
     123}
Note: See TracChangeset for help on using the changeset viewer.