IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7508


Ignore:
Timestamp:
Jun 9, 2006, 6:25:41 PM (20 years ago)
Author:
eugene
Message:

configuration updates, added new mask functions, added psphot support

Location:
trunk/ppImage
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/configure.ac

    r6902 r7508  
    1818  [AS_HELP_STRING(--enable-optimize,enable compiler optimization)],
    1919  [AC_MSG_RESULT(compile optimization enabled)
    20    CFLAGS="${CFLAGS=} -O2"],
     20   CFLAGS="-O2"],
    2121  [AC_MSG_RESULT([compile optimization disabled])
    22    CFLAGS="${CFLAGS=} -O0 -g"]
     22   CFLAGS="-O0 -g"]
    2323)
    2424
    2525PKG_CHECK_MODULES([PSLIB], [pslib >= 0.9.0])
    2626PKG_CHECK_MODULES([PSMODULE], [psmodule >= 0.0.0])
     27PKG_CHECK_MODULES([PSPHOT], [psphot >= 0.0.0])
    2728
    2829CFLAGS="${CFLAGS} -Wall -Werror -std=c99"
  • trunk/ppImage/src/Makefile.am

    r7217 r7508  
    66        ppMem.h
    77
    8 ppImage_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(ppImage_CFLAGS)
    9 ppImage_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS)
     8ppImage_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSPHOT_CFLAGS) $(ppImage_CFLAGS)
     9ppImage_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PSPHOT_LIBS)
    1010ppImage_SOURCES = \
    1111        ppImage.c \
     
    1515        ppImageLoop.c \
    1616        ppImageDetrendReadout.c \
    17         ppImageDetrendMask.c \
    1817        ppImageDetrendBias.c \
    1918        ppImageDetrendNonLinear.c \
    2019        ppImageRebinReadout.c \
     20        ppImagePhot.c \
    2121        ppMem.c
     22
    2223#       ppImageParseCamera.c \
    2324#       ppDetrendFlat.c \
  • trunk/ppImage/src/ppImage.h

    r6849 r7508  
    55#include "pslib.h"
    66#include "psmodules.h"
     7#include "psphot.h"
    78#include "ppImageOptions.h"
    89#include "ppMem.h"
     
    3233bool ppImageRebinReadout (pmConfig *config, pmFPAview *view, char *filename);
    3334
     35bool ppImagePhotom (pmConfig *config, pmFPAview *view);
     36
    3437#endif // Pau.
  • trunk/ppImage/src/ppImageDetrendMask.c

    r6817 r7508  
    3232// by identifying the image type as a mask (in pmFPAfile).
    3333// currently, pmFPAfileReadImage converts the image to F32
     34
     35
     36// XXX this function needs to use pmReadoutSetMask to construct the initial mask
     37// then the pixels will correspond and pmMaskBadPixels can be correctly applied.
     38// this function should not have to lookup the value of CELL.SATURATION, nor should it have to
     39// apply it. 
  • trunk/ppImage/src/ppImageDetrendReadout.c

    r7360 r7508  
    1010    // find the currently selected readout
    1111    pmReadout *input = pmFPAfileThisReadout (config->files, view, "PPIMAGE.INPUT");
    12     pmReadoutSetWeight (input);
    1312
    14     // Mask bad pixels
     13    // create the target mask and weight images
     14    pmReadoutSetMaskWeight (input);
     15
     16    // apply the externally supplied mask to the input->mask pixels
    1517    if (options->doMask) {
    1618        pmReadout *mask = pmFPAfileThisReadout (config->files, detview, "PPIMAGE.MASK");
    17         ppImageDetrendMask(input, mask);
     19        pmMaskBadPixels (input, mask, options->maskValue);
     20        // ppImageDetrendMask(input, mask);
    1821    }
    1922
  • trunk/ppImage/src/ppImageLoop.c

    r6849 r7508  
    3737                ppImageDetrendReadout (options, config, view);
    3838
    39                 if (options->doBin1) {
    40                     ppImageRebinReadout (config, view, "PPIMAGE.BIN1");
    41                 }
    42 
    43                 if (options->doBin2) {
    44                     ppImageRebinReadout (config, view, "PPIMAGE.BIN2");
    45                 }
     39                if (options->doBin1) ppImageRebinReadout (config, view, "PPIMAGE.BIN1");
     40                if (options->doBin2) ppImageRebinReadout (config, view, "PPIMAGE.BIN2");
    4641
    4742                pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER);
     
    5146
    5247        // ppImageChipMosaic (config, view);
    53         // ppImagePSPhot (config, view);
    54         // ppImagePSAstro (config, view);
     48
     49        // we perform photometry on the readouts of this chip in the output
     50        ppImagePhotom (config, view);
    5551
    5652        pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER);
     
    6662    }
    6763
     64    // ppImageAstrom (config);
     65   
    6866    // ppImageFPAMosaic (config, view);
    6967    // ppImageJpegFPA (config, view);
     
    7573}
    7674
     75// input image is: PPIMAGE.INPUT
     76// output image is: PPIMAGE.OUTPUT
  • trunk/ppImage/src/ppImageOptions.c

    r6849 r7508  
    2828    // default flags for various activities
    2929    options->doMask     = false;        // Mask bad pixels
     30    options->maskValue  = 0xff;         // Default mask value
     31
    3032    options->doNonLin   = false;        // Non-linearity correction
    3133    options->doBias     = false;        // Bias subtraction
     
    138140    // Mask recipe options
    139141    options->doMask = psMetadataLookupBool(NULL, recipe, "MASK");
     142    psMaskType maskValue = psMetadataLookupU8(&status, recipe, "MASK.VALUE");
     143    if (status) {
     144        options->maskValue = maskValue;
     145    }
     146
    140147    options->doBias = psMetadataLookupBool(NULL, recipe, "BIAS");
    141148    options->doDark = psMetadataLookupBool(NULL, recipe, "DARK");
  • trunk/ppImage/src/ppImageOptions.h

    r6849 r7508  
    55typedef struct {
    66    bool doMask;                        // Mask bad pixels
     7    psMaskType maskValue;               // apply this bit-mask to choose masked bits
     8
    79    bool doBias;                        // Bias subtraction
    810    bool doDark;                        // Dark subtraction
  • trunk/ppImage/src/ppImagePhot.c

    r6747 r7508  
    1 #include <stdio.h>
    2 #include "pslib.h"
    3 #include "psmodules.h"
    4 #include "ppImage.h"
     1# include "ppImage.h"
    52
    6 bool ppImagePhot(ppData *data, ppOptions *options, pmConfig *config)
    7 {
    8     ppFile *input = data->input;        // The input file information
    9     pmFPA *fpa = input->fpa;       // The input FPA
     3bool ppImagePhotom (pmConfig *config, pmFPAview *view) {
    104
    11     int numMosaicked = pmFPAMosaicCells(fpa, 1, 1); // Number of chips mosaicked together
    12     psLogMsg(__func__, PS_LOG_INFO, "%d chips mosaicked.\n", numMosaicked);
     5    bool status;
     6    pmCell *cell;
     7    pmReadout *readout;
    138
    14 #if 1
    15     // Write out the mosaicked chip, just to see; this wouldn't normally happen
    16     psFits *mosaicFile = psFitsOpen("mosaic.fits", "w");
    17     psArray *chips = fpa->chips;
    18     for (int i = 0; i < chips->n; i++) {
    19         pmChip *chip = chips->data[i];
    20         if (! chip || ! chip->exists || ! chip->process) {
    21             continue;
    22         }
    23         psArray *cells = chip->cells;
    24         pmCell *cell = cells->data[0];
    25         psArray *readouts = cell->readouts;
    26         pmReadout *readout = readouts->data[0];
    27         psImage *image = readout->image;
    28         psFitsWriteImage(mosaicFile, NULL, image, 0);
     9    psphotModelGroupInit ();
     10
     11    // select recipe options supplied on command line
     12    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes,   "PSPHOT");
     13
     14    // set default recipe values here
     15    // XXX place this in a psphot library function?
     16    psMetadataAddStr (recipe, PS_LIST_TAIL, "FITMODE",         PS_META_NO_REPLACE, "default fitting mode", "NONE");
     17    psMetadataAddStr (recipe, PS_LIST_TAIL, "PHOTCODE",        PS_META_NO_REPLACE, "default photcode",     "NONE");
     18    psMetadataAddStr (recipe, PS_LIST_TAIL, "BREAK_POINT",     PS_META_NO_REPLACE, "default break point",  "NONE");
     19    psMetadataAddF32 (recipe, PS_LIST_TAIL, "ZERO_PT",         PS_META_NO_REPLACE, "default zero point",    25.00);
     20    psMetadataAddS32 (recipe, PS_LIST_TAIL, "BACKGROUND.XBIN", PS_META_NO_REPLACE, "default binning",          64);
     21    psMetadataAddS32 (recipe, PS_LIST_TAIL, "BACKGROUND.YBIN", PS_META_NO_REPLACE, "default binning",          64);
     22
     23    // find or define a pmFPAfile PSPHOT.INPUT
     24    pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT");
     25    if (!status) {
     26
     27        // psphotReadout requires a pmFPAfile supplied with the name PSPHOT.INPUT
     28        // create a pmFPAfile which points at PPIMAGE.OUTPUT
     29        // mode is 'REFERENCE' to prevent double frees of the fpa
     30        pmFPAfile *output = psMetadataLookupPtr (&status, config->files, "PPIMAGE.OUTPUT");
     31        input = pmFPAfileDefine (config->files, config->camera, output->fpa, "PSPHOT.INPUT");
     32        input->mode = PM_FPA_MODE_REFERENCE;
     33
     34        pmFPAfileDefine (config->files, config->camera, input->fpa, "PSPHOT.OUTPUT");
     35
     36        // supply the output name (from cmd-line) to all output (WRITE) files
     37        // XXX does this cause trouble with existing files?
     38        char *outname = psMetadataLookupPtr(&status, config->arguments, "OUTPUT");
     39        pmFPAfileAddFileNames (config->files, "OUTPUT", outname, PM_FPA_MODE_WRITE);
    2940    }
    30 #endif
    3141
    32     // XXX EAM: Insert psphot stuff here
     42    // XXX add the option output files here
     43
     44    // int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN");
     45    // int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN");
     46
     47    // we only was to operate on PSPHOT pmFPAfiles here:
     48    pmFPAfileActivate (config->files, false, NULL);
     49    pmFPAfileActivate (config->files, true, "PSPHOT.INPUT");
     50    pmFPAfileActivate (config->files, true, "PSPHOT.RESID");
     51    pmFPAfileActivate (config->files, true, "PSPHOT.OUTPUT");
     52
     53    pmFPAfileActivate (config->files, true, "PSPHOT.BACKSUB");
     54    pmFPAfileActivate (config->files, true, "PSPHOT.BACKGND");
     55    pmFPAfileActivate (config->files, true, "PSPHOT.BACKMDL");
     56
     57
     58    // iterate over the cells in the current chip
     59    // view->cell = -1;
     60
     61    while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
     62        psLogMsg ("ppImagePhot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     63        if (! cell->process || ! cell->file_exists) { continue; }
     64        pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE);
     65
     66        // process each of the readouts
     67        while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
     68            pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE);
     69            if (! readout->data_exists) { continue; }
     70
     71            // run the actual photometry analysis
     72            psphotReadout (config, view);
     73
     74            pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER);
     75        }
     76        pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER);
     77    }
     78
     79    // de-activate the PSPHOT image files, activate the PPIMAGE ones
     80    pmFPAfileActivate (config->files, false, NULL);
     81    pmFPAfileActivate (config->files, true, "PPIMAGE.INPUT");
     82    pmFPAfileActivate (config->files, true, "PPIMAGE.BIAS");
     83    pmFPAfileActivate (config->files, true, "PPIMAGE.DARK");
     84    pmFPAfileActivate (config->files, true, "PPIMAGE.MASK");
     85    pmFPAfileActivate (config->files, true, "PPIMAGE.FLAT");
     86    pmFPAfileActivate (config->files, true, "PPIMAGE.OUTPUT");
     87
     88    pmFPAfileActivate (config->files, true, "PPIMAGE.BIN1");
     89    pmFPAfileActivate (config->files, true, "PPIMAGE.JPEG1");
     90    pmFPAfileActivate (config->files, true, "PPIMAGE.BIN2");
     91    pmFPAfileActivate (config->files, true, "PPIMAGE.JPEG2");
    3392
    3493    return true;
Note: See TracChangeset for help on using the changeset viewer.