IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7531


Ignore:
Timestamp:
Jun 12, 2006, 4:49:23 PM (20 years ago)
Author:
eugene
Message:

substantial work to make formats all work, added error checking

Location:
trunk/ppImage
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/configure.ac

    r7508 r7531  
    2626PKG_CHECK_MODULES([PSMODULE], [psmodule >= 0.0.0])
    2727PKG_CHECK_MODULES([PSPHOT], [psphot >= 0.0.0])
     28PKG_CHECK_MODULES([PSASTRO], [psastro >= 0.0.0])
    2829
    2930CFLAGS="${CFLAGS} -Wall -Werror -std=c99"
  • trunk/ppImage/src/Makefile.am

    r7522 r7531  
    66        ppMem.h
    77
    8 ppImage_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSPHOT_CFLAGS) $(ppImage_CFLAGS)
    9 ppImage_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PSPHOT_LIBS)
     8ppImage_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSPHOT_CFLAGS) $(PSASTRO_CFLAGS) $(ppImage_CFLAGS)
     9ppImage_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PSPHOT_LIBS) $(PSASTRO_LIBS)
    1010ppImage_SOURCES = \
    1111        ppImage.c \
     
    2020        ppImageRebinReadout.c \
    2121        ppImagePhotom.c \
    22         ppMem.c
     22        ppImageAstrom.c
    2323
    2424#       ppImageParseCamera.c \
  • trunk/ppImage/src/ppImage.c

    r7522 r7531  
    2626    ppImageLoop(config, options);
    2727
    28     psLogMsg ("psphot", 3, "complete psphot run: %f sec\n", psTimerMark ("complete"));
     28    psLogMsg ("ppImage", 3, "complete ppImage run: %f sec\n", psTimerMark ("complete"));
    2929
    3030    // Cleaning up
  • trunk/ppImage/src/ppImage.h

    r7522 r7531  
    66#include "psmodules.h"
    77#include "psphot.h"
     8#include "psastro.h"
    89#include "ppImageOptions.h"
    910
     
    3637
    3738bool ppImagePhotom (pmConfig *config, pmFPAview *view);
     39bool ppImageAstrom (pmConfig *config);
    3840
    3941#endif
  • trunk/ppImage/src/ppImageArguments.c

    r7522 r7531  
    5656    if ((N = psArgumentGet (*argc, argv, "-chip"))) {
    5757        psArgumentRemove (N, argc, argv);
    58         psMetadataAddStr (config->arguments, PS_LIST_TAIL, "CHIP_SELECTIONS", PS_DATA_STRING, "", psStringCopy(argv[N]));
     58        psMetadataAddStr (config->arguments, PS_LIST_TAIL, "CHIP_SELECTIONS", PS_DATA_STRING, "", argv[N]);
    5959        psArgumentRemove (N, argc, argv);
    6060    }
  • trunk/ppImage/src/ppImageCleanup.c

    r7522 r7531  
    1212    pmConfigDone();
    1313    fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "ppImage");
     14    // fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "ppImage");
    1415    return;
    1516}
  • trunk/ppImage/src/ppImageDetrendReadout.c

    r7522 r7531  
    3939
    4040    // Bias, dark and overscan subtraction are all merged.
    41     ppImageDetrendBias(input, bias, dark, options);
     41    if (options->doBias || options->doDark) {
     42        ppImageDetrendBias(input, bias, dark, options);
     43    }
    4244
    4345    // Flat-field correction (no options used?)
    4446    if (options->doFlat) {
    45         pmReadout *flat = pmFPAfileThisReadout (config->files, detview, "PPIMAGE.FLAT");
     47        pmReadout *flat = pmFPAfileThisReadout (config->files, detview, "PPIMAGE.FLAT");
    4648        pmFlatField(input, flat);
    4749    }
     
    5052    return true;
    5153}
    52 
    53     // XXX in psphot, the recipe options are parsed at this depth
    54     // XXX consider if we move ppImageOptions in here
    55     // psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, "PSPHOT");
    56 
  • trunk/ppImage/src/ppImageLoop.c

    r7522 r7531  
    2020
    2121    while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
    22         psLogMsg ("psphot", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     22        psLogMsg ("ppImageLoop", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    2323        if (!chip->process || !chip->file_exists) { continue; }
    2424        pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE);
    2525
    2626        while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
    27             psLogMsg ("psphot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     27            psLogMsg ("ppImageLoop", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    2828            if (!cell->process || !cell->file_exists) { continue; }
    2929            pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE);
     
    4848
    4949        // we perform photometry on the readouts of this chip in the output
    50         ppImagePhotom (config, view);
     50        if (options->doPhotom) ppImagePhotom (config, view);
    5151
    5252        pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER);
     
    6262    }
    6363
    64     // ppImageAstrom (config);
     64    // we perform astrometry on all chips after sources have been detected
     65    if (options->doAstrom) ppImageAstrom (config);
    6566   
    6667    // ppImageFPAMosaic (config, view);
  • trunk/ppImage/src/ppImageOptions.c

    r7508 r7531  
    1818    options->nonLinearSource = NULL;
    1919
    20     return options;
    21 }
    22 
    23 ppImageOptions *ppImageOptionsParse(pmConfig *config)
    24 {
    25     bool status;
    26     ppImageOptions *options = ppImageOptionsAlloc ();
    27 
    2820    // default flags for various activities
    2921    options->doMask     = false;        // Mask bad pixels
     
    3628    options->doFlat     = false;        // Flat-field normalisation
    3729    options->doFringe   = false;        // Fringe subtraction
    38     options->doSource   = false;        // Source identification and photometry
     30    options->doPhotom   = false;        // Source identification and photometry
    3931    options->doAstrom   = false;        // Astrometry
     32
     33    options->doBin1     = false;        // create binned image (scale 1)
     34    options->doBin2     = false;        // create binned image (scale 2)
     35    options->doBin1JPG  = false;        // create jpg of binned image (scale 1)
     36    options->doBin2JPG  = false;        // create jpg of binned image (scale 2)
    4037
    4138    // Overscan defaults
    4239    options->overscan      = NULL;      // Overscan options
    43     bool overscanSingle    = false;     // A single value for entire overscan?
    44     pmFit overscanFit      = PM_FIT_NONE; // Fit type for overscan
    45     int overscanOrder      = 0;         // Order for overscan fit
    46     psStats *overscanStats = NULL;      // Statistics for overscan
    4740
    4841    // Non-linearity default options
     
    5043    options->nonLinearData   = NULL;    // The non-linearity data
    5144    options->nonLinearSource = NULL;    // If the non-linearity data is a menu, this provides the key
     45
     46    return options;
     47}
     48
     49ppImageOptions *ppImageOptionsParse(pmConfig *config)
     50{
     51    bool status;
     52    ppImageOptions *options = ppImageOptionsAlloc ();
    5253
    5354    // select the recipe for this analysis
     
    105106
    106107        // Do the overscan as a single value?
    107         overscanSingle = psMetadataLookupBool(NULL, recipe, "OVERSCAN.SINGLE");
     108        bool overscanSingle = psMetadataLookupBool(NULL, recipe, "OVERSCAN.SINGLE");
    108109
    109110        // How do we fit it?
     111        pmFit overscanFit = PM_FIT_NONE; // Fit type for overscan
     112        int overscanOrder = 0;          // Order for overscan fit
    110113        psString fit = psMetadataLookupStr(NULL, recipe, "OVERSCAN.FIT");
    111114        if (! strcasecmp(fit, "POLYNOMIAL")) {
     
    118121            overscanFit = PM_FIT_SPLINE;
    119122        } else if (strcasecmp(fit, "NONE")) {
    120             psLogMsg(__func__, PS_LOG_WARN, "OVERSCAN.FIT (%s) in recipe %s is not one of NONE, "
    121                      "POLYNOMIAL, or SPLINE: assuming NONE.\n", fit, RECIPE_NAME);
     123            psLogMsg(__func__, PS_LOG_WARN, "OVERSCAN.FIT (%s) in recipe %s is not one of NONE, POLYNOMIAL, or SPLINE", fit, RECIPE_NAME);
     124            exit(EXIT_FAILURE);
    122125        }
    123126
     127        // What method do we use to measure the overscan statistics?
     128        psStats *overscanStats = NULL;  // Statistics for overscan
    124129        psString stat = psMetadataLookupStr(NULL, recipe, "OVERSCAN.STAT");
    125130        if (! strcasecmp(stat, "MEAN")) {
     
    128133            overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN);
    129134        } else {
    130             psErrorStackPrint(stderr, "OVERSCAN.STAT (%s) in recipe %s is not one of MEAN, MEDIAN: "
    131                               "assuming MEAN\n", stat, RECIPE_NAME);
    132             overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
     135            psErrorStackPrint(stderr, "OVERSCAN.STAT (%s) in recipe %s is not one of MEAN or MEDIAN", stat, RECIPE_NAME);
     136            exit(EXIT_FAILURE);
    133137        }
    134138
     
    161165
    162166    options->doBin1 = psMetadataLookupBool(NULL, recipe, "BIN1.FITS");
     167    options->doBin1JPG = psMetadataLookupBool(NULL, recipe, "BIN1.JPEG");
     168    if (options->doBin1JPG && !options->doBin1) {
     169        psLogMsg(__func__, PS_LOG_ERROR, "Invalid Phase2 Options: cannot make JPG of Bin1 image without Bin1 image");
     170        exit(EXIT_FAILURE);
     171    }
     172
    163173    options->doBin2 = psMetadataLookupBool(NULL, recipe, "BIN2.FITS");
     174    options->doBin2JPG = psMetadataLookupBool(NULL, recipe, "BIN2.JPEG");
     175    if (options->doBin2JPG && !options->doBin2) {
     176        psLogMsg(__func__, PS_LOG_ERROR, "Invalid Phase2 Options: cannot make JPG of Bin2 image without Bin2 image");
     177        exit(EXIT_FAILURE);
     178    }
     179   
     180    options->doPhotom = psMetadataLookupBool(NULL, recipe, "PHOTOM");
     181    options->doAstrom = psMetadataLookupBool(NULL, recipe, "ASTROM");
     182    if (options->doAstrom && !options->doPhotom) {
     183        psLogMsg(__func__, PS_LOG_ERROR, "Invalid Phase2 Options: cannot do ASTROMetry without PHOTOMetry");
     184        exit(EXIT_FAILURE);
     185    }
    164186
    165     // options->doBin1JPEG = psMetadataLookupBool(NULL, recipe, "BIN1.JPEG");
    166     // options->doBin2JPEG = psMetadataLookupBool(NULL, recipe, "BIN2.JPEG");
    167    
    168187    return options;
    169188}
  • trunk/ppImage/src/ppImageOptions.h

    r7508 r7531  
    1111    bool doFlat;                        // Flat-field normalisation
    1212    bool doFringe;                      // Fringe subtraction
    13     bool doSource;                      // Source identification and photometry
     13    bool doPhotom;                      // Source identification and photometry
    1414    bool doAstrom;                      // Astrometry
    1515
     
    2323
    2424    bool doBin1;
     25    bool doBin1JPG;
    2526    int xBin1, yBin1;
    2627
    2728    bool doBin2;
     29    bool doBin2JPG;
    2830    int xBin2, yBin2;
    2931
  • trunk/ppImage/src/ppImageParseCamera.c

    r7522 r7531  
    5353    if (options->doBin1) {
    5454        pmFPAfile *file = pmFPAfileFromFPA (config, input->fpa, options->xBin1, options->yBin1, "PPIMAGE.BIN1");
    55         pmFPAfileDefine (config->files, config->camera, file->fpa, "PPIMAGE.JPEG1");
     55        if (options->doBin1JPG) {
     56            pmFPAfileDefine (config->files, config->camera, file->fpa, "PPIMAGE.JPEG1");
     57        }
    5658    }
    5759    if (options->doBin2) {
    5860        pmFPAfile *file = pmFPAfileFromFPA (config, input->fpa, options->xBin2, options->yBin2, "PPIMAGE.BIN2");
    59         pmFPAfileDefine (config->files, config->camera, file->fpa, "PPIMAGE.JPEG2");
     61        if (options->doBin2JPG) {
     62            pmFPAfileDefine (config->files, config->camera, file->fpa, "PPIMAGE.JPEG2");
     63        }
    6064    }
    6165
Note: See TracChangeset for help on using the changeset viewer.