IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14639


Ignore:
Timestamp:
Aug 23, 2007, 12:30:43 PM (19 years ago)
Author:
magnier
Message:

update to sync with HEAD dev work

Location:
branches/eam_branch_20070817/psModules
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20070817/psModules/src/camera/pmFPA.c

    r14201 r14639  
    162162void pmReadoutFreeData (pmReadout *readout)
    163163{
     164    if (!readout) {
     165        return;
     166    }
    164167    psFree(readout->image);
    165168    psFree(readout->mask);
     
    177180void pmCellFreeData(pmCell *cell)
    178181{
    179     PS_ASSERT_PTR_NON_NULL(cell,);
     182    if (!cell) {
     183        return;
     184    }
    180185
    181186    for (int i = 0; i < cell->readouts->n; i++) {
     
    197202void pmChipFreeData(pmChip *chip)
    198203{
    199     PS_ASSERT_PTR_NON_NULL(chip,);
     204    if (!chip) {
     205        return;
     206    }
    200207
    201208    for (int i = 0; i < chip->cells->n; i++) {
     
    217224void pmFPAFreeData(pmFPA *fpa)
    218225{
    219     PS_ASSERT_PTR_NON_NULL(fpa,);
     226    if (!fpa) {
     227        return;
     228    }
    220229
    221230    for (int i = 0; i < fpa->chips->n; i++) {
  • branches/eam_branch_20070817/psModules/src/imcombine/Makefile.am

    r13457 r14639  
    77        pmReadoutCombine.c      \
    88        pmStack.c               \
     9        pmStackReject.c         \
    910        pmSubtraction.c         \
    1011        pmSubtractionKernels.c  \
    11         pmSubtractionStamps.c
     12        pmSubtractionStamps.c   \
     13        pmSubtractionMatch.c
    1214
    1315pkginclude_HEADERS = \
    1416        pmReadoutCombine.h      \
    1517        pmStack.h               \
     18        pmStackReject.h         \
    1619        pmSubtraction.h         \
    1720        pmSubtractionKernels.h  \
    18         pmSubtractionStamps.h
     21        pmSubtractionStamps.h   \
     22        pmSubtractionMatch.h
    1923
    2024CLEANFILES = *~
  • branches/eam_branch_20070817/psModules/src/imcombine/pmStack.c

    r14459 r14639  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2007-08-10 00:34:04 $
     10 *  @version $Revision: 1.11.2.1 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2007-08-23 22:30:43 $
    1212 *
    1313 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    7373static void stackDataFree(pmStackData *data)
    7474{
    75     psFree(data->detector);
    76     psFree(data->sky);
     75    psFree(data->readout);
    7776    psFree(data->pixels);
    7877    return;
     
    222221    for (int i = 0; i < num; i++) {
    223222        pmStackData *data = inputs->data[i]; // Stack data of interest
    224         psImage *image = data->sky->image; // Image of interest
    225         psImage *weight = data->sky->weight; // Weight map of interest
    226         psImage *mask = data->sky->mask; // Mask of interest
     223        psImage *image = data->readout->image; // Image of interest
     224        psImage *weight = data->readout->weight; // Weight map of interest
     225        psImage *mask = data->readout->mask; // Mask of interest
    227226        pixelData->data.F32[i] = image->data.F32[y][x];
    228227        if (weight) {
     
    306305
    307306// Ensure the input array of pmStackData is valid, and get some details out of it
    308 static bool validateInputData(bool *haveDetector, // Do we have the detector images?
    309                               bool *haveSky, // Do we have the sky images?
    310                               bool *haveSkyWeights, // Do we have weights in the sky images?
     307static bool validateInputData(bool *haveWeights, // Do we have weights in the sky images?
    311308                              bool *havePixels, // Do we have lists of pixels?
    312309                              int *num,    // Number of inputs
     
    317314    PS_ASSERT_ARRAY_NON_NULL(input, false);
    318315    *num = input->n;
    319     {
    320         pmStackData *data = input->data[0]; // First image off the rank
    321         PS_ASSERT_PTR_NON_NULL(data, false);
    322         assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type
    323         *haveDetector = (data->detector != NULL);
    324         if (*haveDetector) {
    325             PS_ASSERT_IMAGE_NON_NULL(data->detector->image, false);
    326             PS_ASSERT_IMAGE_NON_NULL(data->detector->mask, false);
    327             PS_ASSERT_IMAGES_SIZE_EQUAL(data->detector->image, data->detector->mask, false);
    328             PS_ASSERT_IMAGE_TYPE(data->detector->image, PS_TYPE_F32, false);
    329             PS_ASSERT_IMAGE_TYPE(data->detector->mask, PS_TYPE_MASK, false);
    330         }
    331         *haveSky = (data->sky != NULL);
    332         *haveSkyWeights = false;
    333         if (*haveSky) {
    334             PS_ASSERT_IMAGE_NON_NULL(data->sky->image, false);
    335             PS_ASSERT_IMAGE_TYPE(data->sky->image, PS_TYPE_F32, false);
    336             PS_ASSERT_IMAGE_NON_NULL(data->sky->mask, false);
    337             PS_ASSERT_IMAGE_TYPE(data->sky->mask, PS_TYPE_MASK, false);
    338             PS_ASSERT_IMAGES_SIZE_EQUAL(data->sky->image, data->sky->mask, false);
    339             *numCols = data->sky->image->numCols;
    340             *numRows = data->sky->image->numRows;
    341             if (data->sky->weight) {
    342                 *haveSkyWeights = true;
    343                 PS_ASSERT_IMAGE_NON_NULL(data->sky->weight, false);
    344                 PS_ASSERT_IMAGES_SIZE_EQUAL(data->sky->image, data->sky->weight, false);
    345                 PS_ASSERT_IMAGE_TYPE(data->sky->weight, PS_TYPE_F32, false);
    346             }
    347         }
    348         *havePixels = (data->pixels != NULL);
    349     }
     316
     317    // The first is a template
     318    pmStackData *data = input->data[0]; // First image off the rank
     319    PS_ASSERT_PTR_NON_NULL(data, false);
     320    assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type
     321    *haveWeights = false;
     322    PS_ASSERT_IMAGE_NON_NULL(data->readout->image, false);
     323    PS_ASSERT_IMAGE_TYPE(data->readout->image, PS_TYPE_F32, false);
     324    PS_ASSERT_IMAGE_NON_NULL(data->readout->mask, false);
     325    PS_ASSERT_IMAGE_TYPE(data->readout->mask, PS_TYPE_MASK, false);
     326    PS_ASSERT_IMAGES_SIZE_EQUAL(data->readout->image, data->readout->mask, false);
     327    *numCols = data->readout->image->numCols;
     328    *numRows = data->readout->image->numRows;
     329    if (data->readout->weight) {
     330        *haveWeights = true;
     331        PS_ASSERT_IMAGE_NON_NULL(data->readout->weight, false);
     332        PS_ASSERT_IMAGES_SIZE_EQUAL(data->readout->image, data->readout->weight, false);
     333        PS_ASSERT_IMAGE_TYPE(data->readout->weight, PS_TYPE_F32, false);
     334    }
     335    *havePixels = (data->pixels != NULL);
     336
     337    // Make sure the rest correspond with the first
    350338    for (int i = 1; i < *num; i++) {
    351339        pmStackData *data = input->data[i]; // Stack data for this input
    352340        assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type
    353         if ((*haveDetector && !data->detector) || (data->detector && !*haveDetector)) {
    354             psError(PS_ERR_UNEXPECTED_NULL, true,
    355                     "The detector readout is specified in some but not all inputs.");
    356             return false;
    357         }
    358         if ((*haveSky && !data->sky) || (data->sky && !*haveSky)) {
    359             psError(PS_ERR_UNEXPECTED_NULL, true, "The sky cell is specified in some but not all inputs.");
     341        if (!data->readout) {
     342            psError(PS_ERR_UNEXPECTED_NULL, true, "The readout is specified in some but not all inputs.");
    360343            return false;
    361344        }
     
    364347            return false;
    365348        }
    366         if (*haveDetector) {
    367             PS_ASSERT_IMAGE_NON_NULL(data->detector->image, false);
    368             PS_ASSERT_IMAGE_NON_NULL(data->detector->mask, false);
    369             PS_ASSERT_IMAGE_TYPE(data->detector->image, PS_TYPE_F32, false);
    370             PS_ASSERT_IMAGE_TYPE(data->detector->mask, PS_TYPE_MASK, false);
    371             PS_ASSERT_IMAGES_SIZE_EQUAL(data->detector->image, data->detector->mask, false);
    372         }
    373         if (*haveSky) {
    374             PS_ASSERT_IMAGE_NON_NULL(data->sky->image, false);
    375             PS_ASSERT_IMAGE_NON_NULL(data->sky->mask, false);
    376             PS_ASSERT_IMAGE_TYPE(data->sky->image, PS_TYPE_F32, false);
    377             PS_ASSERT_IMAGE_TYPE(data->sky->mask, PS_TYPE_MASK, false);
    378             PS_ASSERT_IMAGE_SIZE(data->sky->image, *numCols, *numRows, false);
    379             PS_ASSERT_IMAGES_SIZE_EQUAL(data->sky->image, data->sky->mask, false);
    380             if (*haveSkyWeights) {
    381                 PS_ASSERT_IMAGE_NON_NULL(data->sky->weight, false);
    382                 PS_ASSERT_IMAGES_SIZE_EQUAL(data->sky->image, data->sky->weight, false);
    383                 PS_ASSERT_IMAGE_TYPE(data->sky->weight, PS_TYPE_F32, false);
    384             }
     349        PS_ASSERT_IMAGE_NON_NULL(data->readout->image, false);
     350        PS_ASSERT_IMAGE_NON_NULL(data->readout->mask, false);
     351        PS_ASSERT_IMAGE_TYPE(data->readout->image, PS_TYPE_F32, false);
     352        PS_ASSERT_IMAGE_TYPE(data->readout->mask, PS_TYPE_MASK, false);
     353        PS_ASSERT_IMAGE_SIZE(data->readout->image, *numCols, *numRows, false);
     354        PS_ASSERT_IMAGES_SIZE_EQUAL(data->readout->image, data->readout->mask, false);
     355        if (*haveWeights) {
     356            PS_ASSERT_IMAGE_NON_NULL(data->readout->weight, false);
     357            PS_ASSERT_IMAGES_SIZE_EQUAL(data->readout->image, data->readout->weight, false);
     358            PS_ASSERT_IMAGE_TYPE(data->readout->weight, PS_TYPE_F32, false);
    385359        }
    386360    }
     
    390364
    391365
    392 
     366#if 0
    393367// Examine a pixel carefully to see if it should be rejected in the stack by convolving all the input images
    394368// to the same seeing, and clipping there.
     
    416390        pmStackData *data = input->data[i]; // Stacking data
    417391        int radius = extent * seeing->data.F32[i]; // How much to convolve
    418         psImage *image = data->sky->image; // Image to convolve
    419         psImage *mask = data->sky->mask; // Image mask
     392        psImage *image = data->readout->image; // Image to convolve
     393        psImage *mask = data->readout->mask; // Image mask
    420394
    421395        int xMin = PS_MAX(xPix - radius, 0);
     
    476450    return true;
    477451}
    478 
     452#endif
    479453
    480454
     
    530504
    531505/// Constructor
    532 pmStackData *pmStackDataAlloc(pmReadout *sky, float seeing, float weight)
     506pmStackData *pmStackDataAlloc(pmReadout *readout, float weight)
    533507{
    534508    pmStackData *data = psAlloc(sizeof(pmStackData)); // Stack data, to return
    535509    psMemSetDeallocator(data, (psFreeFunc)stackDataFree);
    536510
    537     data->detector = NULL;
    538 
    539     data->sky = psMemIncrRefCounter(sky);
     511    data->readout = psMemIncrRefCounter(readout);
    540512    data->pixels = NULL;
    541     data->seeing = seeing;
    542513    data->weight = weight;
    543514
     
    550521{
    551522    PS_ASSERT_PTR_NON_NULL(combined, false);
    552     bool haveDetector;                  // Do we have the detector images?
    553     bool haveSky;                       // Do we have the sky images?
    554     bool haveSkyWeights;                // Do we have the sky weight maps?
     523    bool haveWeights;                   // Do we have the weight maps?
    555524    bool havePixels;                    // Do we have lists of pixels?
    556525    int num;                            // Number of inputs
    557526    int numCols, numRows;               // Size of (sky) images
    558     if (!validateInputData(&haveDetector, &haveSky, &haveSkyWeights, &havePixels, &num,
    559                            &numCols, &numRows, input)) {
     527    if (!validateInputData(&haveWeights, &havePixels, &num, &numCols, &numRows, input)) {
    560528        return false;
    561529    }
     
    571539        PS_ASSERT_IMAGES_SIZE_EQUAL(combined->image, combined->mask, false);
    572540    }
    573     if (!haveDetector && !haveSky) {
    574         psError(PS_ERR_UNEXPECTED_NULL, true, "Nothing to combine!");
    575         return false;
    576     }
    577 
    578 
    579     if (!haveSky) {
    580         // Need to generate the sky cell images
    581 
    582         // ...
    583 
    584 #if 0
    585         numCols = data->sky->image->numCols;
    586         numRows = data->sky->image->numRows;
    587 #endif
    588     }
    589541
    590542    // Pull out the weightings
     
    635587
    636588        psImage *combinedWeights = combined->weight; // Combined weight map
    637         if (haveSkyWeights && !combinedWeights) {
     589        if (haveWeights && !combinedWeights) {
    638590            combined->weight = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    639591            combinedWeights = combined->weight;
     
    668620    psFree(buffer);
    669621
    670     psList *cells = psListAlloc(NULL);  // List of cells, for concept update
    671     for (int i = 0; i < num; i++) {
    672         pmStackData *data = input->data[i]; // Stacking data; contains the list of pixels
    673         psListAdd(cells, PS_LIST_TAIL, data->sky->parent);
    674     }
    675     if (!pmConceptsAverageCells(combined->parent, cells, NULL, NULL, false)) {
    676         psError(PS_ERR_UNKNOWN, false, "Unable to average concepts for input sky readouts.");
    677         psFree(cells);
    678         return false;
    679     }
    680     psFree(cells);
    681 
    682622    return true;
    683623}
    684624
     625#if 0
    685626bool pmStackReject(psArray *input, psMaskType maskVal, float extent, float threshold)
    686627{
    687     bool haveDetector;                  // Do we have the detector images?
    688     bool haveSky;                       // Do we have the sky images?
    689     bool haveSkyWeights;                // Do we have the sky weight maps?
     628    bool haveWeights;                   // Do we have the sky weight maps?
    690629    bool havePixels;                    // Do we have lists of pixels?
    691630    int num;                            // Number of inputs
    692631    int numCols, numRows;               // Size of (sky) images
    693     if (!validateInputData(&haveDetector, &haveSky, &haveSkyWeights, &havePixels,
    694                            &num, &numCols, &numRows, input)) {
     632    if (!validateInputData(&haveWeights, &havePixels, &num, &numCols, &numRows, input)) {
    695633        return false;
    696634    }
     
    768706    return true;
    769707}
    770 
     708#endif
  • branches/eam_branch_20070817/psModules/src/imcombine/pmStack.h

    r13457 r14639  
    88 * @author GLG, MHPCC
    99 *
    10  * @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    11  * @date $Date: 2007-05-22 03:59:32 $
     10 * @version $Revision: 1.1.6.1 $ $Name: not supported by cvs2svn $
     11 * @date $Date: 2007-08-23 22:30:43 $
    1212 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii
    1313 */
     
    2626/// Container for input image
    2727typedef struct {
    28     pmReadout *detector;                ///< Original (unwarped) readout from the detector
    29     pmReadout *sky;                     ///< Warped readout (sky cell)
     28    pmReadout *readout;                 ///< Warped readout (sky cell)
    3029    psPixels *pixels;                   ///< Pixels to inspect or reject
    31     float seeing;                       ///< Seeing FWHM (pixels)
    3230    float weight;                       ///< Weight to apply
    3331} pmStackData;
    3432
    3533/// Constructor
    36 pmStackData *pmStackDataAlloc(pmReadout *sky, ///< Warped readout (sky cell)
    37                               float seeing, ///< Seeing FWHM (pixels)
     34pmStackData *pmStackDataAlloc(pmReadout *readout, ///< Warped readout (sky cell)
    3835                              float weight ///< Weight to apply
    3936    );
     
    6158#endif
    6259
     60#if 0
    6361/// Reject pixles in input images
    6462bool pmStackReject(psArray *input,      ///< Input array of pmStackData
     
    6765                   float threshold      ///< Rejection threshold, in standard deviations
    6866                   );
     67#endif
    6968
    7069#if 0
  • branches/eam_branch_20070817/psModules/src/imcombine/pmSubtraction.c

    r14540 r14639  
    44 *  @author GLG, MHPCC
    55 *
    6  *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2007-08-17 01:50:50 $
     6 *  @version $Revision: 1.42.2.1 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2007-08-23 22:30:43 $
    88 *
    99 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    2424
    2525#include "pmSubtraction.h"
     26
     27#define PIXEL_LIST_BUFFER 100           // Number of entries to add to pixel list at a time
     28
    2629
    2730//////////////////////////////////////////////////////////////////////////////////////////////////////////////
     
    136139
    137140              // Normalising sum of kernel component to unity
    138               float norm = kernelWeighting(1.0 / (float)((uStop - uStart) * (vStop - vStart)),
     141              float norm = kernelWeighting(1.0 / (float)((uStop - uStart + 1) * (vStop - vStart + 1)),
    139142                                           varianceWeighting);
    140143
     
    245248              }
    246249          }
    247           sum /= (uStop - uStart) * (vStop - vStart); // Normalising sum of kernel component to unity
     250          sum /= (uStop - uStart + 1) * (vStop - vStart + 1); // Normalising sum of kernel component to unity
    248251          if (kernels->spatialOrder > 0 && index != kernels->subIndex) {
    249252              // The (0,0) element is subtracted from most kernels to preserve photometric scaling
     
    880883    }
    881884
    882     float background = solution->data.F64[solution->n-1]; // The difference in background
     885    int numBackground = polyTerms(kernels->bgOrder); // Number of background terms
     886    float background = solution->data.F64[solution->n - numBackground]; // The difference in background
    883887    int numCols = inImage->numCols, numRows = inImage->numRows; // Image dimensions
    884888
     
    10171021    return true;
    10181022}
     1023
     1024
  • branches/eam_branch_20070817/psModules/src/imcombine/pmSubtraction.h

    r14524 r14639  
    66 * @author GLG, MHPCC
    77 *
    8  * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    9  * @date $Date: 2007-08-16 02:57:34 $
     8 * @version $Revision: 1.9.2.1 $ $Name: not supported by cvs2svn $
     9 * @date $Date: 2007-08-23 22:30:43 $
    1010 * Copyright 2004-207 Institute for Astronomy, University of Hawaii
    1111 */
  • branches/eam_branch_20070817/psModules/src/psmodules.h

    r14613 r14639  
    5454#include <pmFPACalibration.h>
    5555#include <pmReadoutStack.h>
     56#include <pmFPAUtils.h>
    5657
    5758// the following headers are from psModule:detrend
     
    7374// the following headers are from psModule:imcombine
    7475#include <pmStack.h>
     76#include <pmStackReject.h>
    7577#include <pmSubtraction.h>
    7678#include <pmSubtractionStamps.h>
    7779#include <pmSubtractionKernels.h>
     80#include <pmSubtractionMatch.h>
    7881#include <pmReadoutCombine.h>
    7982
  • branches/eam_branch_20070817/psModules/test/camera/Makefile.am

    r13644 r14639  
    1111        $(PSMODULES_LIBS)
    1212
    13 TEST_PROGS =
     13TEST_PROGS = \
     14        tap_pmFPAReadWrite
    1415
    1516if BUILD_TESTS
  • branches/eam_branch_20070817/psModules/test/config/data/SampleIPPConfig

    r5735 r14639  
    11### Example .ipprc file
     2    PATH            STR     .
     3    DATAPATH    str     datapath
    24
    35### Database configuration
    4 DBSERVER        STR     ippdb.ifa.hawaii.edu    # Database host name (for psDBInit)
    5 DBUSER          STR     ipp                     # Database user name (for psDBInit)
    6 DBPASSWORD      STR     password                # Database password (for psDBInit)
     6    DBSERVER    STR     localhost
     7    DBUSER              STR     test
     8    DBPASSWORD  STR     ""
     9    DBNAME          STR     test
     10    DBPORT              S32     0
    711
    812### Setups for each camera system
    9 CAMERAS         METADATA
    10         MEGACAM_RAW     STR     megacam_raw.config
    11         MEGACAM_SPLICE  STR     megacam_splice.config
    12         GPC1_RAW        STR     gpc1_raw.config
    13         LRIS_BLUE       STR     lris_blue.config
    14         LRIS_RED        STR     lris_red.config
    15 END
     13    CAMERAS             METADATA
     14        CAMERA0         STR     camera0/camera.config
     15        CAMERA1         STR     camera1/camera.config
     16    END
    1617
    17 ### psLib setup
    18 #TIME           STR     /home/mithrandir/price/pan-starrs/jhroot/i686-pc-linux-gnu/etc/pslib/psTime.config      # Time configuration file
    19 LOGLEVEL        S32     3                       # Logging level; 3=INFO
    20 LOGFORMAT       STR     HLNM                    # Log format
    21 LOGDEST STR     STDOUT                          # Log destination
    22 TRACE           METADATA                        # Trace levels
    23         dummyTraceFunc01        S32     1
    24         dummyTraceFunc02        S32     2
    25 END
    26 ARBITRARY_STRING_S32    S32     20
    27 ARBITRARY_STRING_F32    F32     21.0
    28 ARBITRARY_STRING_F64    F64     22.0
    29 ARBITRARY_STRING_STR    STR     19.0
    30 ARBITRARY_STRING_BOOL_T BOOL    true
    31 ARBITRARY_STRING_BOOL_F BOOL    false
     18### Setups for psLib
     19    TIME                STR     time.config
     20    LOGLEVEL    S32     3
     21    LOGFORMAT   STR     HLNM
     22    LOGDEST     STR     STDOUT
    3223
     24### Default trace logging initializations
     25    TRACE               METADATA
     26        dummyTraceFacility01    S32     1
     27        dummyTraceFacility02    S32     2
     28    END
     29
     30### Predefined recipe files
     31    RECIPES         METADATA                # Site-level recipes
     32        R00             STR     recipes/R00.config
     33        R01             STR     recipes/R01.config
     34        R02             STR     recipes/R02.config
     35        R03             STR     recipes/R03.config
     36    END
     37
     38### Misc arbitraty metadata
     39    ARBITRARY_STRING_S32        S32     20
     40    ARBITRARY_STRING_F32        F32     21.0
     41    ARBITRARY_STRING_F64        F64     22.0
     42    ARBITRARY_STRING_STR        STR     19.0
     43    ARBITRARY_STRING_BOOL_T     BOOL    true
     44    ARBITRARY_STRING_BOOL_F     BOOL    false
     45
Note: See TracChangeset for help on using the changeset viewer.