IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 26, 2009, 1:59:32 PM (17 years ago)
Author:
beaumont
Message:

merged with trunk

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
1 deleted
9 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/pswarp/src

    • Property svn:ignore
      •  

        old new  
        1313config.h.in
        1414stamp-h1
         15pswarpVersionDefinitions.h
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/Makefile.am

    r23352 r24244  
    11bin_PROGRAMS = pswarp
    22
    3 PSWARP_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi`
    4 PSWARP_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`
    5 PSWARP_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi`
     3if HAVE_SVNVERSION
     4PSWARP_VERSION=`$(SVNVERSION) ..`
     5else
     6PSWARP_VERSION="UNKNOWN"
     7endif
     8
     9if HAVE_SVN
     10PSWARP_BRANCH=`$(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 }'`
     11PSWARP_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
     12else
     13PSWARP_BRANCH="UNKNOWN"
     14PSWARP_SOURCE="UNKNOWN"
     15endif
    616
    717# Force recompilation of pswarpVersion.c, since it gets the version information
    8 pswarpVersion.c: FORCE
    9         touch pswarpVersion.c
     18pswarpVersion.c: pswarpVersionDefinitions.h
     19pswarpVersionDefinitions.h: pswarpVersionDefinitions.h.in FORCE
     20        -$(RM) pswarpVersionDefinitions.h
     21        $(SED) -e "s|@PSWARP_VERSION@|\"$(PSWARP_VERSION)\"|" -e "s|@PSWARP_BRANCH@|\"$(PSWARP_BRANCH)\"|" -e "s|@PSWARP_SOURCE@|\"$(PSWARP_SOURCE)\"|" pswarpVersionDefinitions.h.in > pswarpVersionDefinitions.h
    1022FORCE: ;
    1123
    12 pswarp_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PSWARP_CFLAGS) -DPSWARP_VERSION=\"$(PSWARP_VERSION)\" -DPSWARP_BRANCH=\"$(PSWARP_BRANCH)\" -DPSWARP_SOURCE=\"$(PSWARP_SOURCE)\"
     24pswarp_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PSWARP_CFLAGS)
    1325pswarp_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PPSTATS_LIBS) $(PSPHOT_LIBS) $(PSWARP_LIBS)
    1426
     
    2436        pswarpMatchRange.c              \
    2537        pswarpParseCamera.c             \
    26         pswarpPixelFraction.c           \
     38        pswarpPixelsLit.c               \
    2739        pswarpSetMaskBits.c             \
    2840        pswarpSetThreads.c              \
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarp.h

    r23594 r24244  
    102102                          const char *filename, const char *argname);
    103103
    104 /// Check to see if the readout has a minimum fraction of "lit" pixels
    105 bool pswarpPixelFraction(const pmReadout *readout, ///< Readout to inspect
    106                          psMetadata *stats, ///< Statistics to update with the result
    107                          const pmConfig *config ///< Configuration
     104/// Get the range of lit pixels
     105bool pswarpPixelsLit(const pmReadout *readout, ///< Readout to inspect
     106                     psMetadata *stats, ///< Statistics to update with the result
     107                     const pmConfig *config ///< Configuration
    108108    );
    109109
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpArguments.c

    r23352 r24244  
    163163    }
    164164
    165     float acceptFrac = psMetadataLookupF32(&status, recipe, "ACCEPT.FRAC"); ///< Min fraction of good pixels
    166     if (!status) {
    167         acceptFrac = 0.0;
    168         psWarning("ACCEPT.FRAC is not set in the %s recipe --- defaulting to %f.", PSWARP_RECIPE, poorFrac);
    169     }
    170 
    171165    // Set recipe values in the recipe (since we've possibly altered some)
    172166    psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NX", PS_META_REPLACE,
     
    180174    psMetadataAddF32(recipe, PS_LIST_TAIL, "POOR.FRAC", PS_META_REPLACE,
    181175                     "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
    182     psMetadataAddF32(recipe, PS_LIST_TAIL, "ACCEPT.FRAC", PS_META_REPLACE,
    183                      "Minimum fraction of good pixels for result to be accepted", acceptFrac);
    184176
    185177    // Set recipe values in the arguments
     
    194186    psMetadataAddF32(config->arguments, PS_LIST_TAIL, "POOR.FRAC", 0,
    195187                     "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
    196     psMetadataAddF32(config->arguments, PS_LIST_TAIL, "ACCEPT.FRAC", 0,
    197                      "Minimum fraction of good pixels for result to be accepted", acceptFrac);
    198188
    199189    psTrace("pswarp", 1, "Done with pswarpArguments...\n");
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpErrorCodes.dat

    r11268 r24244  
    22# This file is used to generate pswarpErrorClasses.h
    33#
    4 BASE = 800              First value we use; lower values belong to psLib
    5 UNKNOWN                 Unknown PM error code
     4BASE = 8000             First value we use; lower values belong to psLib
     5UNKNOWN                 Unknown PSWARP error code
    66NOT_IMPLEMENTED         Desired feature is not yet implemented
    77ARGUMENTS               Incorrect arguments
     
    99IO                      Problem in FITS I/O
    1010DATA                    Problem in data values
     11NO_OVERLAP              No overlap between input and skycell
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpErrorCodes.h.in

    r21323 r24244  
    2121 */
    2222typedef enum {
    23     PSWARP_ERR_BASE = 600,
     23    PSWARP_ERR_BASE = 8000,
    2424    PSWARP_ERR_${ErrorCode},
    2525    PSWARP_ERR_NERROR
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpLoop.c

    r23352 r24244  
    142142        psFree(resolved);
    143143        stats = psMetadataAlloc();
     144        psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", 0, "No problems", 0);
    144145    }
    145146
     
    273274    }
    274275
     276    if (!output->data_exists) {
     277        psWarning("No overlap between input and skycell.");
     278        if (stats) {
     279            psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,
     280                             "No overlap between input and skycell", PSWARP_ERR_NO_OVERLAP);
     281        }
     282        psphotFilesActivate(config, false);
     283        psFree(cells);
     284        psFree(view);
     285        goto DONE;
     286    }
     287
    275288    pmCell *outCell = output->parent;   ///< Output cell
    276289    pmChip *outChip = outCell->parent;  ///< Output chip
    277290    pmFPA *outFPA = outChip->parent;    ///< Output FP
    278291
    279     if (!pswarpPixelFraction(output, stats, config)) {
    280         // Don't write output images, and don't bother about anything else
    281         output->data_exists = outCell->data_exists = outChip->data_exists = false;
     292    if (!pswarpPixelsLit(output, stats, config)) {
     293        psError(PS_ERR_UNKNOWN, false, "Unable to calculate pixel regions.");
    282294        psFree(cells);
    283295        psFree(view);
    284         goto COMPLETED;
     296        return false;
    285297    }
    286298
    287299    // Set variance factor
    288300    {
    289         float varFactor = psMetadataLookupF32(NULL, output->analysis, PSWARP_ANALYSIS_VARFACTOR);
    290         psAssert(isfinite(varFactor), "Should be something here.");
    291         long goodPix = psMetadataLookupS64(NULL, output->analysis, PSWARP_ANALYSIS_GOODPIX);
    292         psAssert(goodPix > 0, "Should be something here.");
     301        bool mdok;                      // Status of MD lookup
     302        float varFactor = psMetadataLookupF32(&mdok, output->analysis, PSWARP_ANALYSIS_VARFACTOR);
     303        long goodPix = psMetadataLookupS64(&mdok, output->analysis, PSWARP_ANALYSIS_GOODPIX);
    293304        varFactor /= goodPix;
    294305
     
    364375    fileActivation(config, independentFiles, false);
    365376
    366     // We need a new PSF model for the warped frame.  It would be good to generate this analytically, but that's going to be tricky.
    367     // We have a list of sources, so we use those to redetermine the PSF model.
     377    // We need a new PSF model for the warped frame.  It would be good to generate this analytically, but
     378    // that's going to be tricky.  We have a list of sources, so we use those to redetermine the PSF model.
    368379
    369380    if (psMetadataLookupBool(&mdok, config->arguments, "PSF")) {
     
    394405        // measure the PSF using these sources
    395406        if (!psphotReadoutFindPSF(config, view, sources)) {
    396             psError(PS_ERR_UNKNOWN, false, "Unable to determine PSF for warped image.");
    397             return false;
     407            // This is likely a data quality issue
     408            // XXX Split into multiple cases using error codes?
     409            psErrorStackPrint(stderr, "Unable to determine PSF");
     410            psWarning("Unable to determine PSF --- suspect bad data quality.");
     411            if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) {
     412                psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,
     413                                 "Unable to determine PSF", psErrorCodeLast());
     414            }
     415            psErrorClear();
     416            psphotFilesActivate(config, false);
    398417        }
    399418
     
    448467    // Now done with the skycell side of things
    449468
    450     COMPLETED:
     469 DONE:
     470
    451471    // Write out summary statistics
    452472    if (stats) {
     
    464484        psFree((void*)statsMDC);
    465485        fclose(statsFile);
     486        pmConfigRunFilenameAddWrite(config, "STATS", statsName);
    466487
    467488        psFree(stats);
     
    471492    psString dump_file = psMetadataLookupStr(&status, config->arguments, "DUMP_CONFIG");
    472493    if (dump_file) {
    473         pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT"); // Input file
    474         pmConfigDump(config, input->fpa, dump_file);
     494        pmConfigDump(config, dump_file);
    475495    }
    476496
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpVersion.c

    r24243 r24244  
    2020#include <ppStats.h>
    2121
    22 psString pswarpVersion(void)
    23 {
     22#include "pswarp.h"
     23#include "pswarpVersionDefinitions.h"
     24
    2425#ifndef PSWARP_VERSION
    2526#error "PSWARP_VERSION is not set"
     
    2829#error "PSWARP_BRANCH is not set"
    2930#endif
    30     return psStringCopy(PSWARP_BRANCH "@" PSWARP_VERSION);
     31#ifndef PSWARP_SOURCE
     32#error "PSWARP_SOURCE is not set"
     33#endif
     34
     35psString pswarpVersion(void)
     36{
     37    char *value = NULL;
     38    psStringAppend(&value, "%s@%s", PSWARP_BRANCH, PSWARP_VERSION);
     39    return value;
    3140}
    3241
    3342psString pswarpSource(void)
    3443{
    35 #ifndef PSWARP_SOURCE
    36 #error "PSWARP_SOURCE is not set"
    37 #endif
    3844    return psStringCopy(PSWARP_SOURCE);
    3945}
Note: See TracChangeset for help on using the changeset viewer.