IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1438


Ignore:
Timestamp:
Aug 9, 2004, 1:24:12 PM (22 years ago)
Author:
Paul Price
Message:

Name changes, bit of reorganisation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/modules/include/phase2.h

    r1146 r1438  
    2222/************************************************************************************************************/
    2323
     24/* Bias/overscan subtraction and trim */
     25
     26/** Overscan axis */
     27typedef enum {
     28    PM_OVERSCAN_NONE,                   ///< No overscan subtraction
     29    PM_OVERSCAN_ROWS,                   ///< Subtract rows
     30    PM_OVERSCAN_COLUMNS,                ///< Subtract columns
     31    PM_OVERSCAN_ALL                     ///< Subtract the statistic of all pixels in overscan region
     32} pmOverscanAxis;
     33
     34/** Fit types */
     35typedef enum {
     36    PM_FIT_NONE,                        ///< No fit
     37    PM_FIT_POLYNOMIAL,                  ///< Fit polynomial
     38    PM_FIT_SPLINE                       ///< Fit cubic splines
     39} pmFit;
     40
     41/** Subtracts an overscan and bias from the input image. */
     42psReadout *pmSubtractBias(psReadout *in, ///< Input image to be de-biased, and output
     43                          void *fitSpec, ///< Polynomial/Spline/Some other function(?) specification,
     44                                         ///< Also outputted
     45                          const psList *overscans, ///< Linked list of subimages of overscans
     46                          pmOverscanAxis overscanAxis, ///< Overscan axis
     47                          const psStats *stat, ///< Statistic to use
     48                          int nBin, ///< Number of bins for overscan vector before fitting
     49                          pmFit fit, ///< How to fit the bias
     50                          const psReadout *bias ///< Bias (or dark) image to subtract
     51    );
     52
     53/************************************************************************************************************/
     54
     55/* Correction for non-linearity */
     56
     57/** Non-linearity correction via polynomial */
     58psReadout *pmNonLinearityPolynomial(psReadout *in, ///< Input image to be corrected, and output
     59                                    const psPolynomial1D *coeff ///< Polynomial with which to correct
     60    );
     61
     62/** Non-linearity correction via lookup table */
     63psReadout *pmNonLinearityLookup(psReadout *in, ///< Input image to be corrected, and output
     64                                const psVector *inFlux, ///< Input flux values
     65                                const psVector *outFlux ///< Output flux values
     66    );
     67
     68/************************************************************************************************************/
     69
     70/** Flat-fields the image. */
     71psReadout *pmFlatField(psReadout *in, ///< Input image to be flat-fielded, and output
     72                       const psReadout *flat ///< Flat-field image
     73    );
     74
     75/************************************************************************************************************/
     76
     77/* Masking */
     78
     79/** Mask values */
     80typedef enum {
     81    PM_MASK_TRAP,                       ///< The pixel is a charge trap
     82    PM_MASK_BADCOL,                     ///< The pixel is a bad column
     83    PM_MASK_SAT,                        ///< The pixel is saturated
     84    PM_MASK_FLAT,                       ///< The pixel is non-positive in the flat-field
     85    PM_MASK_CR_MORPH                    ///< The pixel is determined to be a cosmic ray, from morphology
     86} pmMaskValue;
     87
     88/** Returns an image that has the bad pixels masked.  Also masks saturated pixels */
     89psReadout *pmMaskBadPixels(psReadout *in, ///< Image to be masked, and output
     90                           const psImage *mask, ///< Bad pixel mask to apply
     91                           int maskVal, ///< Mask the pixels for which mask & maskVal > 0.
     92                           float sat, ///< Saturation level: pixels brighter than this level are masked
     93                           int grow ///< Radius to grow the bad pixels
     94    );
     95
     96/************************************************************************************************************/
     97/************************************************************************************************************/
     98/************************************************************************************************************/
     99
     100/* Below functions are still under development */
     101
     102/************************************************************************************************************/
     103/************************************************************************************************************/
     104/************************************************************************************************************/
     105
    24106/* Reading in an image */
    25107
     
    48130                          );
    49131
    50 
    51 /************************************************************************************************************/
    52 
    53 /* Convolution */
    54 
    55 /** A convolution kernel */
    56 typedef struct {
    57     int xMin, yMin;                     ///< Most negative indices
    58     int xMax, yMax;                     ///< Most positive indices
    59     float **kernel;                     ///< The kernel data
    60 } psKernel;
    61 
    62 /** Constructor */
    63 psKernel *psKernelAlloc(int xMin,       ///< Size of the kernel in the negative x direction
    64                         int xMax,       ///< Size of the kernel in the positive x direction
    65                         int yMin,       ///< Size of the kernel in the negative y direction
    66                         int yMax        ///< Size of the kernel in the positive y direction
    67                         );
    68 /** Destructor */
    69 void psKernelFree(psKernel *myKernel    ///< Kernel to destroy
    70                   );
    71 
    72 /** Returns the kernel of OT shifts made during the course of the exposure. */
    73 psKernel *psPhase2GetKernel(const psVector *xShifts, ///< List of OT shifts in x; integers
    74                             const psVector *yShifts ///< List of OT shifts in y; integers;
    75                                                     ///< xshifts->n == yShifts->n
    76                             );
    77 
    78 /** Returns an image that is the result of convolving the input image with the specified kernel. */
    79 psImage *psConvolveWithKernel(psImage *out, ///< Output image, or NULL
    80                               const psImage *in, ///< Input image to be convolved
    81                               const psKernel *kernel, ///< Kernel by which to convolve
    82                               bool direct ///< Do direct convolution?  If not, use FFT
    83                               );
    84 
    85 /************************************************************************************************************/
    86 
    87 /* Bias/overscan subtraction and trim */
    88 
    89 /** Image regions */
    90 typedef struct {
    91     const int x0, y0;                   ///< Offset to region
    92     const int nX, nY;                   ///< Size of region
    93 } psImageRegion;
    94 
    95 /** Constructor */
    96 psImageRegion *psImageRegionAlloc(int x0, ///< x offset to region
    97                                   int y0, ///< y offset to region
    98                                   int nX, ///< Size of region in x
    99                                   int nY ///< Size of region in y
    100                                   );
    101 /** Destructor */
    102 void psImageRegionFree(psImageRegion *reg ///< Region to destroy
    103                        );
    104 
    105 /** A 1D cubic-spline */
    106 typedef struct {
    107     int n;                              ///< Number of spline pieces
    108     float *coeff[4];                    ///< Coefficients.  There are 4 coefficients for each spline piece.
    109     float *coeffErr[4];                 ///< Errors in the coefficients.
    110     bool *mask[4];                      ///< Mask for the coefficients.
    111     float *domains;                     ///< The boundaries between each spline piece.  Size is n+1.
    112 } psSpline1D;
    113 
    114 /** Constructors */
    115 psSpline1D *psSpline1DAlloc(int n,      ///< Number of spline pieces
    116                             float min,  ///< Minimum data value
    117                             float max   ///< Maximum data value
    118                             );
    119 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds ///< Boundaries between each spline piece.  Number
    120                                                           ///< of spline pieces can hence be inferred.
     132/************************************************************************************************************/
     133
     134/** Masks Cosmic Rays on the input image on the basis of morphology. */
     135psReadout *psPhase2MaskCRs(psReadout *in, ///< Input image to be masked, and output
     136                           int algorithm, ///< Algorithm number to use
     137                           const void *params ///< Parameters for algorithm
     138                           );
     139
     140/** Masks optical defects in the input image */
     141psChip *psPhase2MaskOpticalDefects(psChip *in, ///< Image to be masked (with astrometry), and output
     142                                   const psDlist *catalog, ///< Catalog stars nearby: a list of psObjects
     143                                   int grow ///< Number of pixels to grow
    121144                                   );
    122 /** Destructor */
    123 void psSpline1DFree(psSpline1D *mySpline ///< Spline to destroy
    124                     );
    125 /** Evaluator */
    126 float psSpline1DEval(const psSpline1D *spline, ///< Spline to evaluate
    127                      float x            ///< Coordinates at which to evaluate
    128                      );
    129 
    130 
    131 /** Overscan axis */
    132 typedef enum {
    133     PS_OVERSCAN_NONE,                   ///< No overscan subtraction
    134     PS_OVERSCAN_ROWS,                   ///< Subtract rows
    135     PS_OVERSCAN_COLUMNS,                ///< Subtract columns
    136     PS_OVERSCAN_ALL                     ///< Subtract the statistic of all pixels in overscan region
    137 } psOverscanAxis;
    138 
    139 /** Fit types */
    140 typedef enum {
    141     PS_FIT_NONE,                        ///< No fit
    142     PS_FIT_LINEAR,                      ///< Do linear interpolation
    143     PS_FIT_POLYNOMIAL,                  ///< Fit polynomial
    144     PS_FIT_CHEBYSHEV,                   ///< Fit chebyshev
    145     PS_FIT_SPLINE                       ///< Fit cubic splines
    146 } psFit;
    147 
    148 /** Subtracts an overscan and bias from the input image. */
    149 psReadout *psPhase2SubtractBias(psReadout *in, ///< Input image to be de-biased, and output
    150                                 void *fitSpec, ///< Polynomial/Spline/Some other function(?) specification,
    151                                                ///< Also outputted
    152                                 psOverscanAxis overscanAxis, ///< Overscan axis
    153                                 psFit fit, ///< How to fit the bias
    154                                 int nBin, ///< Number of bins for overscan vector before fitting
    155                                 const psList *regions, ///< Linked list of psImageRegion types.
    156                                 const psStats *stat, ///< Statistic to use
    157                                 const psImage *bias ///< Bias (or dark) image to subtract
    158                                 );
    159 
    160 /** Trims the input image to remove the edges corrupted by OT shifting, and the overscan. */
    161 psReadout *psPhase2Trim(psReadout *in,  ///< Input image to be trimmed, and output
    162                         const psImageRegion *region ///< Region to keep
    163                         );
    164 
    165 /************************************************************************************************************/
    166 
    167 /* Reduce to counts proportional to photons */
    168 
    169 
    170 /** Applies the correction for detector non-linearity.  Non-linearity coefficients are provided by the caller.
    171  *  Two functions: one to do via a polynomial, the other via a lookup table.
    172  */
    173 psReadout *psPhase2NonLinearityPolynomial(psReadout *in, ///< Input image to be corrected, and output
    174                                           const psPolynomial1D *coeff ///< Polynomial with which to correct
    175                                           );
    176 
    177 psReadout *psPhase2NonLinearityLookup(psReadout *in, ///< Input image to be corrected, and output
    178                                       const psVector *inFlux, ///< Input flux values
    179                                       const psVector *outFlux ///< Output flux values
    180                                       );
    181 
    182 /** Flat-fields the image. */
    183 psReadout *psPhase2FlatField(psReadout *in, ///< Input image to be flat-fielded, and output
    184                              const psImage *flat ///< Flat-field image
    185                              );
     145
     146/************************************************************************************************************/
    186147
    187148/** Simple sky subtraction */
     
    196157/************************************************************************************************************/
    197158
    198 /* Masking */
    199 
    200 /** Mask values */
    201 typedef enum {
    202     PS_MASK_TRAP,                       ///< The pixel is a charge trap
    203     PS_MASK_BADCOL,                     ///< The pixel is a bad column
    204     PS_MASK_SAT,                        ///< The pixel is saturated
    205     PS_MASK_FLAT,                       ///< The pixel is non-positive in the flat-field
    206     PS_MASK_CR_MORPH                    ///< The pixel is determined to be a cosmic ray, from morphology
    207 } psMaskValue;
    208 
    209 /** Returns an image that has the bad pixels masked.  Also masks saturated pixels */
    210 psReadout *psPhase2MaskBadPixels(psReadout *in, ///< Image to be masked, and output
    211                                  const psImage *mask, ///< Bad pixel mask to apply
    212                                  int maskVal, ///< Mask the pixels for which mask & maskVal > 0.
    213                                  float sat, ///< Saturation level: pixels brighter than this level are masked
    214                                  int grow ///< Radius to grow the bad pixels
    215                                  );
    216 
    217 /** Masks Cosmic Rays on the input image on the basis of morphology. */
    218 psReadout *psPhase2MaskCRs(psReadout *in, ///< Input image to be masked, and output
    219                            int algorithm, ///< Algorithm number to use
    220                            const void *params ///< Parameters for algorithm
    221                            );
    222 
    223 /** Masks optical defects in the input image */
    224 psChip *psPhase2MaskOpticalDefects(psChip *in, ///< Image to be masked (with astrometry), and output
    225                                    const psDlist *catalog, ///< Catalog stars nearby: a list of psObjects
    226                                    int grow ///< Number of pixels to grow
    227                                    );
    228 
    229 /************************************************************************************************************/
    230 
    231159/* Object finding */
    232160
Note: See TracChangeset for help on using the changeset viewer.