IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 6, 2007, 3:57:15 PM (18 years ago)
Author:
Paul Price
Message:

Implementing dual-convolution. This required reworking those
functions involved with calculating and solving the equations; moved
these into a separate file and made various other cleanups (e.g.,
assertions for pmSubtractionKernels). Removed the normalisation
(central pixel) term from all kernels, because this shouldn't be in
the second kernel (there's only one normalisation term between the two
kernels); the normalisation is treated explicitly in the equations,
along with the background (still only a constant background is
supported for now, but there's a lot of support for a polynomial
background for when I get around to putting it in the equations).
Tested the single convolution, and it's working; same results as
before, apparently. Haven't tested dual convolution yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmSubtractionKernels.h

    r15443 r15756  
    3131    long num;                           ///< Number of kernel components (not including the spatial ones)
    3232    psVector *u, *v;                    ///< Offset (for POIS) or polynomial order (for ISIS)
    33     psVector *widths;                   ///< Gaussian FWHMs (ISIS) or ring radius (RINGS)
     33    psVector *widths;                   ///< Gaussian FWHMs (ISIS)
    3434    psVector *uStop, *vStop;            ///< Width of kernel element (SPAM,FRIES only)
    35     int subIndex;                       ///< Index of kernel to be subtracted (to maintain flux conservation)
    3635    psArray *preCalc;                   ///< Array of images containing pre-calculated kernel (for ISIS)
    3736    int size;                           ///< The half-size of the kernel
     
    3938    int spatialOrder;                   ///< The spatial order of the kernels
    4039    int bgOrder;                        ///< The order for the background fitting
     40    pmSubtractionMode mode;             ///< Mode for subtraction
     41    psVector *solution1, *solution2;    ///< Solution for the PSF matching
    4142} pmSubtractionKernels;
     43
     44// Assertion to check pmSubtractionKernels
     45#define PM_ASSERT_SUBTRACTION_KERNELS_NON_NULL(KERNELS, RETURNVALUE) { \
     46    PS_ASSERT_PTR_NON_NULL(KERNELS, RETURNVALUE); \
     47    PS_ASSERT_STRING_NON_EMPTY((KERNELS)->description, RETURNVALUE); \
     48    PS_ASSERT_INT_POSITIVE((KERNELS)->num, RETURNVALUE); \
     49    PS_ASSERT_VECTOR_NON_NULL((KERNELS)->u, RETURNVALUE); \
     50    PS_ASSERT_VECTOR_NON_NULL((KERNELS)->v, RETURNVALUE); \
     51    PS_ASSERT_VECTOR_TYPE((KERNELS)->u, PS_TYPE_S32, RETURNVALUE); \
     52    PS_ASSERT_VECTOR_TYPE((KERNELS)->v, PS_TYPE_S32, RETURNVALUE); \
     53    PS_ASSERT_VECTOR_SIZE((KERNELS)->u, (KERNELS)->num, RETURNVALUE); \
     54    PS_ASSERT_VECTOR_SIZE((KERNELS)->v, (KERNELS)->num, RETURNVALUE); \
     55    if ((KERNELS)->type == PM_SUBTRACTION_KERNEL_ISIS) { \
     56        PS_ASSERT_VECTOR_NON_NULL((KERNELS)->widths, RETURNVALUE); \
     57        PS_ASSERT_VECTOR_TYPE((KERNELS)->widths, PS_TYPE_F32, RETURNVALUE); \
     58        PS_ASSERT_VECTOR_SIZE((KERNELS)->widths, (KERNELS)->num, RETURNVALUE); \
     59    } \
     60    if ((KERNELS)->uStop || (KERNELS)->vStop) { \
     61        PS_ASSERT_VECTOR_NON_NULL((KERNELS)->uStop, RETURNVALUE); \
     62        PS_ASSERT_VECTOR_NON_NULL((KERNELS)->vStop, RETURNVALUE); \
     63        PS_ASSERT_VECTOR_TYPE((KERNELS)->uStop, PS_TYPE_S32, RETURNVALUE); \
     64        PS_ASSERT_VECTOR_TYPE((KERNELS)->vStop, PS_TYPE_S32, RETURNVALUE); \
     65        PS_ASSERT_VECTOR_SIZE((KERNELS)->uStop, (KERNELS)->num, RETURNVALUE); \
     66        PS_ASSERT_VECTOR_SIZE((KERNELS)->vStop, (KERNELS)->num, RETURNVALUE); \
     67    } \
     68    if ((KERNELS)->preCalc) { \
     69        PS_ASSERT_ARRAY_NON_NULL((KERNELS)->preCalc, RETURNVALUE); \
     70        PS_ASSERT_ARRAY_SIZE((KERNELS)->preCalc, (KERNELS)->num, RETURNVALUE); \
     71    } \
     72    PS_ASSERT_INT_NONNEGATIVE((KERNELS)->size, RETURNVALUE); \
     73    PS_ASSERT_INT_NONNEGATIVE((KERNELS)->inner, RETURNVALUE); \
     74    PS_ASSERT_INT_NONNEGATIVE((KERNELS)->spatialOrder, RETURNVALUE); \
     75    PS_ASSERT_INT_NONNEGATIVE((KERNELS)->bgOrder, RETURNVALUE); \
     76}
     77
     78// Assertion to check that the solution is attached
     79#define PM_ASSERT_SUBTRACTION_KERNELS_SOLUTION(KERNELS, RETURNVALUE) { \
     80    PS_ASSERT_VECTOR_NON_NULL((KERNELS)->solution1, RETURNVALUE); \
     81    PS_ASSERT_VECTOR_TYPE((KERNELS)->solution1, PS_TYPE_F64, RETURNVALUE); \
     82    PS_ASSERT_VECTOR_SIZE((KERNELS)->solution1, \
     83                          (KERNELS)->num * PM_SUBTRACTION_POLYTERMS((KERNELS)->spatialOrder) + 1 + \
     84                              PM_SUBTRACTION_POLYTERMS((KERNELS)->bgOrder), \
     85                          RETURNVALUE); \
     86    if (kernels->mode == PM_SUBTRACTION_MODE_DUAL) { \
     87        PS_ASSERT_VECTOR_NON_NULL(kernels->solution2, RETURNVALUE); \
     88        PS_ASSERT_VECTOR_TYPE((KERNELS)->solution2, PS_TYPE_F64, RETURNVALUE); \
     89        PS_ASSERT_VECTOR_SIZE((KERNELS)->solution2, \
     90                              (KERNELS)->num * PM_SUBTRACTION_POLYTERMS((KERNELS)->spatialOrder), \
     91                               RETURNVALUE); \
     92    } \
     93}
    4294
    4395/// Generate a delta-function grid for subtraction kernels (like the POIS kernel)
     
    54106                                                pmSubtractionKernelsType type, ///< Kernel type
    55107                                                int size, ///< Half-size of kernel
    56                                                 int spatialOrder ///< Order of spatial variations
     108                                                int spatialOrder, ///< Order of spatial variations
     109                                                pmSubtractionMode mode ///< Mode for subtraction
    57110    );
    58111
    59112/// Generate POIS kernels
    60113pmSubtractionKernels *pmSubtractionKernelsPOIS(int size, ///< Half-size of the kernel (in both dims)
    61                                                int spatialOrder ///< Order of spatial variations
     114                                               int spatialOrder, ///< Order of spatial variations
     115                                               pmSubtractionMode mode ///< Mode for subtraction
    62116    );
    63117
     
    66120                                                    int spatialOrder, ///< Order of spatial variations
    67121                                                    const psVector *fwhms, ///< Gaussian FWHMs
    68                                                     const psVector *orders ///< Polynomial order of gaussians
     122                                                    const psVector *orders, ///< Polynomial order of gaussians
     123                                                    pmSubtractionMode mode ///< Mode for subtraction
    69124    );
    70125
     
    73128                                               int spatialOrder, ///< Order of spatial variations
    74129                                               const psVector *fwhms, ///< Gaussian FWHMs
    75                                                const psVector *orders ///< Polynomial order of gaussians
     130                                               const psVector *orders, ///< Polynomial order of gaussians
     131                                               pmSubtractionMode mode ///< Mode for subtraction
    76132                                               );
    77133
     
    80136                                               int spatialOrder, ///< Order of spatial variations
    81137                                               int inner, ///< Inner radius to preserve unbinned
    82                                                int binning ///< Kernel binning factor
     138                                               int binning, ///< Kernel binning factor
     139                                               pmSubtractionMode mode ///< Mode for subtraction
    83140    );
    84141
     
    86143pmSubtractionKernels *pmSubtractionKernelsFRIES(int size, ///< Half-size of the kernel
    87144                                                int spatialOrder, ///< Order of spatial variations
    88                                                 int inner ///< Inner radius to preserve unbinned
     145                                                int inner, ///< Inner radius to preserve unbinned
     146                                                pmSubtractionMode mode ///< Mode for subtraction
    89147    );
    90148
     
    94152                                               const psVector *fwhms, ///< Gaussian FWHMs
    95153                                               const psVector *orders, ///< Polynomial order of gaussians
    96                                                int inner ///< Inner radius containing grid of delta functions
     154                                               int inner, ///< Inner radius containing grid of delta functions
     155                                               pmSubtractionMode mode ///< Mode for subtraction
    97156    );
    98157
     
    101160                                                int spatialOrder, ///< Order of spatial variations
    102161                                                int inner, ///< Inner radius to preserve unbinned
    103                                                 int ringsOrder ///< Polynomial order
     162                                                int ringsOrder, ///< Polynomial order
     163                                                pmSubtractionMode mode ///< Mode for subtraction
    104164    );
    105165
     
    113173                                                   int inner, ///< Inner radius to preserve unbinned
    114174                                                   int binning, ///< Kernel binning factor
    115                                                    int ringsOrder ///< Polynomial order for RINGS
     175                                                   int ringsOrder, ///< Polynomial order for RINGS
     176                                                   pmSubtractionMode mode ///< Mode for subtraction
    116177    );
    117178
Note: See TracChangeset for help on using the changeset viewer.