IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 671


Ignore:
Timestamp:
May 13, 2004, 1:16:19 PM (22 years ago)
Author:
eugene
Message:

psFloatArray, psDoubleArray, psIntArray, etc merged into
psVector. psVector is analogous to psImage. reference to the old
forms have been converted to psVector. the file psStdArrays.h has
been removed and replaced with psVector.h (containing the vector
functions) and psTypes.h (containing the basic data types)

Location:
trunk/archive/pslib/include
Files:
2 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/include/psFFT.h

    r613 r671  
    1414 */
    1515
    16 /** Forward FFT an image.  Returns a complex float image. */
     16/**** Image FFT & Complex functions ****/
     17
     18/** FFT an image.  in: psF32 or psC32, out: psC32 */
    1719psImage *
    18 psImageFFT(const psImage *image         ///< Image to transform
    19     );
    20 
    21 /** Forward FFT an array of floating-point numbers. */
    22 psFloatArray *
    23 psFloatArrayFFT(const psFloatArray *arr ///< Array to transform
    24     );
    25 
    26 /** Inverse FFT an image. */
    27 psImage *
    28 psImageInverseFFT(const psImage *fftImage ///< FFT-ed image to inverse-transform
    29     );
    30 
    31 /** Inverse FFT an array of complex floating-point numbers */
    32 psComplexArray *
    33 psComplexArrayInverseFFT(const psComplexArray *fftArray ///< FFT-ed array to inverse-transform
    34     );
     20psImageFFT(const psImage *image,        ///< image to transform (if forward, may be real)
     21           int dir)                     ///< FFT direction (1: forward, -1: reverse)
     22;
    3523
    3624/** Calculate power spectrum of an image */
    3725psImage *
    38 psImagePowerSpectrum(const psImage *image ///< Image to obtain power spectrum of
    39     );
    40 
    41 /** Calculate power spectrum of an array of floating-point numbers */
    42 psFloatArray *
    43 psFloatArrayPowerSpectrum(const psFloatArray *arr ///< Array to obtain power spectrum of
    44     );
    45 
    46 /* The below functions are provided to allow cross-correlations etc. */
     26psImagePowerSpectrum(const psImage *image) ///< Image to obtain power spectrum of
     27;
    4728
    4829/** Get the real part of an image */
    4930psImage *
    5031psImageReal(psImage *out,               ///< Image for output (or NULL)
    51             const psImage *in           ///< Image to get the real part of
    52             );
     32            const psImage *in)          ///< Image to get the real part of
     33;
    5334
    54 /** Get the real part of an array of complex floating-point numbers */
    55 psFloatArray *
    56 psComplexArrayReal(psFloatArray *out,   ///< Array for output (or NULL)
    57                    const psComplexArray *in ///< Array to get the real part of
    58     );
     35/** Get the imaginary part of an image */
     36psImage *
     37psImageImaginary(psImage *out,          ///< Image for output (or NULL)
     38                 const psImage *in)     ///< Image to get the imaginary part of
     39;
     40
     41/** Construct a complex image from real & imaginary parts */
     42psImage *
     43psImageComplex(psImage *out,            ///< Image for output (or NULL)
     44               const psImage *real)     ///< real part of image
     45               const psImage *imag)     ///< imaginary part of image
     46;
    5947
    6048/** Get the complex conjugate of an image */
    6149psImage *
    6250psImageConjugate(psImage *out,          ///< Image for output (or NULL)
    63                  const psImage *in      ///< Image to get the complex conjugate of
    64     );
     51                 const psImage *in)     ///< Image to get the complex conjugate of
     52;
    6553
    66 /** Get the complex conjugate of an array of complex floating-point numbers */
    67 psComplexArray *
    68 psComplexArrayConjugate(psComplexArray *out, ///< Array for output (or NULL)
    69                         const psComplexArray *in ///< Array to get the complex conjugate of
    70     );
     54/**** Vector FFT & Complex functions ****/
     55
     56/** FFT a vector. in: psF32 or psC32, out: psC32 */
     57psVector *
     58psVectorFFT(const psVector *vector)     ///< Vector to transform
     59;
     60
     61/** Calculate power spectrum of a vector of floating-point numbers */
     62psVector *
     63psVectorPowerSpectrum(const psVector *vector) ///< Vector to obtain power spectrum of
     64;
     65
     66/** Get the real part of a vector */
     67psVector *
     68psVectorReal(psVector *out,             ///< Vector for output (or NULL)
     69             const psVector *in)        ///< Vector to get the real part of
     70;
     71
     72/** Get the imaginary part of a vector */
     73psVector *
     74psVectorImaginary(psVector *out,        ///< Vector for output (or NULL)
     75             const psVector *in)        ///< Vector to get the imaginary part of
     76;
     77
     78/** Construct a complex vector from real & imaginary parts */
     79psVector *
     80psVectorComplex(psVector *out,          ///< Vector for output (or NULL)
     81               const psVector *real)    ///< real part of vector
     82               const psVector *imag)    ///< imaginary part of vector
     83;
     84
     85/** Get the complex conjugate of an vector of complex floating-point numbers */
     86psVector *
     87psVectorConjugate(psVector *out,        ///< Vector for output (or NULL)
     88                  const psVector *in)   ///< Vector to get the complex conjugate of
     89;
    7190
    7291/* \} */ // End of MathGroup Functions
  • trunk/archive/pslib/include/psImage.h

    r617 r671  
    2626    const struct psImage *parent;       ///< parent, if a subimage
    2727    int Nchildren;                      ///< number of subimages
    28     struct psImage *children;           ///< children of this region; array of Nchildren pointers
     28    struct psImage **children;          ///< children of this region; array of Nchildren pointers
    2929} psImage;
    3030
     
    4040psImageAlloc (int nx,                   ///< image width
    4141              int ny,                   ///< image height
    42               psElemType type           ///< image data type
    43     );
     42              psElemType type)          ///< image data type
     43;
    4444
    4545/// Create a subimage of the specified area.
     
    4949              int ny,                   ///< subimage width (<= image.ny - y0) 
    5050              int x0,                   ///< subimage x-offset (0 <= x0 < nx)   
    51               int y0                    ///< subimage y-offset (0 <= y0 < ny)   
    52     );
     51              int y0)                   ///< subimage y-offset (0 <= y0 < ny)   
     52;
    5353
    5454/// Destroy the specified image (destroy children if they exist).
    5555void
    56 psImageFree(psImage *restrict image     ///< free this image
    57     );
     56psImageFree(psImage *restrict image)    ///< free this image
     57;
    5858
    5959/** Destroy the pixels of the specified image */
    6060psImage *
    61 psImageFreePixels(psImage *restrict image ///< Image whose pixels are to be freed
    62     );
     61psImageFreePixels(psImage *restrict image) ///< Image whose pixels are to be freed
     62;
    6363
    6464/// Create a copy of the specified image.
     
    6666psImageCopy(psImage *output,            ///< target structure for output image data
    6767            const psImage *input,       ///< copy this image
    68             psElemType type             ///< element type of output image
    69     );
     68            psElemType type)            ///< element type of output image
     69;
    7070
    7171/*** various image pixel extractions ***/
    7272
    7373/// Extract pixels from rectlinear region to a vector.
    74 psFloatArray *
    75 psImageSlice(psFloatArray *out,         ///< Vector to output, or NULL
     74psVector *
     75psImageSlice(psVector *out,             ///< Vector to output, or NULL
    7676             const psImage *input,      ///< extract slice from this image
    7777             int x,                     ///< starting x coord of region to slice
     
    8080             int ny,                    ///< width of region in y
    8181             int direction,             ///< direction of vector along slice
    82              const psStats *stats       ///< defines statistics used to find output values
    83     );
     82             const psStats *stats)      ///< defines statistics used to find output values
     83;
    8484
    8585/// Extract pixels along a line to a vector.
    86 psFloatArray *
    87 psImageCut(psFloatArray *out,           ///< Vector to output, or NULL
     86psVector *
     87psImageCut(psVector *out,               ///< Vector to output, or NULL
    8888           const psImage *input,        ///< extract cut from this image
    8989           float xs,                    ///< starting x coord of cut
     
    9292           float ye,                    ///< ending y coord of cut
    9393           float dw,                    ///< width of cut
    94            const psStats *stats         ///< defines statistics used to find output values
    95     );
     94           const psStats *stats)                ///< defines statistics used to find output values
     95;
    9696
    9797/// Extract radial annulii data to a vector.
    98 psFloatArray *
    99 psImageRadialCut(psFloatArray *out,     ///< Vector to output, or NULL
     98psVector *
     99psImageRadialCut(psVector *out,         ///< Vector to output, or NULL
    100100                 const psImage *input,  ///< extract profile from this image
    101101                 float x,               ///< center x coord of annulii
    102102                 float y,               ///< center y coord of annulii
    103                  const psFloatArray *radii, ///< Radii of the annuli
    104                  const psStats *stats   ///< defines statistics used to find output values
    105     );
     103                 const psVector *radii, ///< Radii of the annuli
     104                 const psStats *stats)  ///< defines statistics used to find output values
     105;
    106106
    107107/*** various image geometry manipulation ***/
     
    111111             const psImage *input,      ///< rebin this image
    112112             float scale,               ///< rebinning scale: doutput = scale*dinput
    113              const psStats *stats       ///< defines statistics used to find output values
    114     );
     113             const psStats *stats)      ///< defines statistics used to find output values
     114;
    115115
    116116/// Rotate image by given angle.
     
    118118psImageRotate(psImage *out,             ///< Image to output, or NULL
    119119              const psImage *input,     ///< rotate this image
    120               float angle               ///< rotate by this amount anti-clockwise (degrees)
    121     );
     120              float angle)              ///< rotate by this amount anti-clockwise (degrees)
     121;
    122122
    123123/// Shift image by an arbitrary number of pixels in either direction.
     
    128128             float dx,                  ///< shift by this amount in x
    129129             float dy,                  ///< shift by this amount in y
    130              float exposed              ///< set exposed pixels to this value
    131     );
     130             float exposed)             ///< set exposed pixels to this value
     131;
    132132
    133133/// Roll image by an integer number of pixels in either direction.
     
    137137            const psImage *input,       ///< roll this image
    138138            int dx,                     ///< roll this amount in x
    139             int dy                      ///< roll this amount in y
    140     );
     139            int dy)                     ///< roll this amount in y
     140;
    141141
    142142/// Determine statistics for image (or subimage).
    143143psStats *
    144144psImageGetStats(psStats *stats,         ///< defines statistics to be calculated & target
    145                 const psImage *input    ///< image (or subimage) to calculate stats
    146                 );
     145                const psImage *input)   ///< image (or subimage) to calculate stats
     146;
    147147
    148148/// Construct a histogram from an image (or subimage).
    149149psHistogram *
    150150psImageHistogram(psHistogram *hist,     ///< input histogram description & target
    151                  const psImage *input   ///< determine histogram of this image
    152     );
     151                 const psImage *input)  ///< determine histogram of this image
     152;
    153153
    154154/// Fit a 2-D polynomial surface to an image.
    155155psPolynomial2D *
    156156psImageFitPolynomial(psPolynomial2D *coeffs, ///< coefficient structure carries in desired terms & target
    157                      const psImage *input ///< image to fit
    158     );
     157                     const psImage *input) ///< image to fit
     158;
    159159
    160160/// Evaluate a 2-D polynomial surface to image pixels.
    161161psImage *
    162162psImageEvalPolynomial(const psImage *input, ///< image to produce
    163                       const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms
    164     );
     163                      const psPolynomial2D *coeffs) ///< coefficient structure carries in desired terms
     164;
    165165
    166166/*** image input/output routines ***/
     
    175175                   const char *extname, ///< MEF extension name ("PHU" for primary header)
    176176                   int extnum,          ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    177                    const char *filename ///< file to read data from
    178     );
     177                   const char *filename)        ///< file to read data from
     178;
    179179
    180180/// Read an image or subimage from file descriptor.
     
    188188                    const char *extname, ///< MEF extension name ("PHU" for primary header)
    189189                    int extnum,         ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    190                     FILE *f             ///< file descriptor to read data from             
    191     );
     190                    FILE *f)            ///< file descriptor to read data from             
     191;
    192192
    193193/// Write an image section to named file (which may exist).
     
    199199                    const char *extname, ///< MEF extension name ("PHU" for primary header)
    200200                    int extnum,         ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    201                     const char *filename ///< file to write data to               
    202     );
     201                    const char *filename) ///< file to write data to               
     202;
    203203
    204204/// Write an image section to named file (which may exist).
     
    210210                     const char *extname, ///< MEF extension name                         
    211211                     int extnum,        ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    212                      FILE *f            ///< file descriptor to write data to             
    213     );
     212                     FILE *f)           ///< file descriptor to write data to             
     213;
    214214
    215215/// Read only header from image file.
     
    218218                  const char *extname,  ///< MEF extension name ("PHU" for primary header)
    219219                  int extnum,           ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    220                   const char *filename  ///< file to read from
    221     );
     220                  const char *filename) ///< file to read from
     221;
    222222
    223223/// Read only header from image file descriptor.
     
    226226                   const char *extname, ///< MEF extension name ("PHU" for primary header)
    227227                   int extnum,          ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    228                    FILE *f              ///< file descriptor to read from
    229     );
     228                   FILE *f)             ///< file descriptor to read from
     229;
    230230
    231231/*** basic pixel manipulations ***/
     
    236236            float vmin,                 ///< set min-clipped pixels to vmin
    237237            float max,                  ///< clip pixels with values > max
    238             float vmax                  ///< set max-clipped pixels to vmax
    239     );
     238            float vmax)                 ///< set max-clipped pixels to vmax
     239;
    240240
    241241/// Clip NaN image pixels to given value.  Return number of clipped pixels.
    242242int
    243243psImageClipNaN(psImage *input,          ///< clip this image & target
    244                float value              ///< set nan pixels to this value
    245     );
     244               float value)             ///< set nan pixels to this value
     245;
    246246
    247247/// Overlay subregion of image with another image.  Return number of pixels replaced.
     
    251251                      int x0,           ///< x offset of overlay subimage
    252252                      int y0,           ///< y offset of overlay subimage
    253                       const char *op    ///< overlay operation
    254     );
     253                      const char *op)   ///< overlay operation
     254;
    255255
    256256/* \} */ // End of AstroGroup Functions
  • trunk/archive/pslib/include/psLib.h

    r523 r671  
    1616/** @defgroup AstroGroup Astronomy-Specific Utilities */
    1717
    18 
    1918/** @ingroup SystemGroup */
    2019# include <psMemory.h>
     
    2524
    2625/** @ingroup DataGroup */
    27 # include <psStdArrays.h>
     26# include <psTypes.h>
     27# include <psVectors.h>
    2828# include <psHash.h>
    2929# include <psDlist.h>
  • trunk/archive/pslib/include/psMinimize.h

    r615 r671  
    1313
    1414/** Find the minimum of a particular non-linear function */
    15 psFloatArray *
    16 psMinimize(psFloatArray *restrict initialGuess, ///< Initial guess and answer
    17            float (*myFunction)(const psFloatArray *restrict), ///< Function to minimize
    18            float (*myFuncDeriv)(const psFloatArray *restrict), ///< Derivatives of function, or NULL
    19            const psIntArray *restrict paramMask //!< 1 = fit for parameter, 0 = hold parameter constant
    20            );
     15psVector *
     16psMinimize(psVector *restrict initialGuess, ///< Initial guess and answer
     17           float (*myFunction)(const psVector *restrict), ///< Function to minimize
     18           float (*myFuncDeriv)(const psVector *restrict), ///< Derivatives of function, or NULL
     19           const psVector *restrict paramMask) ///< 1 = fit for parameter, 0 = hold parameter constant
     20;
    2121
    2222
    2323/** Minimize chi^2 for input data */
    24 psFloatArray *
    25 psMinimizeChi2(psFloatArray *restrict initialGuess, ///< Initial guess and answer
    26                float (*evalModel)(const psFloatArray *restrict,
    27                                   const psFloatArray *restrict), ///< Model to fit; (domain and params)
    28                const psFloatArray *restrict domain, ///< The domain values for the corresponding measurements
    29                const psFloatArray *restrict data, ///< Data to fit
    30                const psFloatArray *restrict errors, ///< Errors in the data
    31                const psIntArray *restrict paramMask ///< 1 = fit for parameter, 0 = hold parameter constant
    32     );
     24psVector *
     25psMinimizeChi2(psVector *restrict initialGuess, ///< Initial guess and answer
     26               float (*evalModel)(const psVector *restrict,
     27                                  const psVector *restrict), ///< Model to fit; (domain and params)
     28               const psVector *restrict domain, ///< The domain values for the corresponding measurements
     29               const psVector *restrict data, ///< Data to fit
     30               const psVector *restrict errors, ///< Errors in the data
     31               const psVector *restrict paramMask) ///< 1 = fit for parameter, 0 = hold parameter constant
     32;
    3333
    3434/** Derive a polynomial fit by chi^2 minimisation --- can be done analytically */
    3535psPolynomial1D *
    36 psGetArrayPolynomial(psPolynomial1D myPoly, ///< Polynomial to fit
    37                      const psFloatArray *restrict x, ///< Ordinates (or NULL to just use the indices)
    38                      const psFloatArray *restrict y, ///< Coordinates
    39                      const psFloatArray *restrict yErr ///< Errors in coordinates, or NULL
    40     );
     36psVectorFitPolynomial(psPolynomial1D myPoly, ///< Polynomial to fit
     37                     const psVector *restrict x, ///< Ordinates (or NULL to just use the indices)
     38                     const psVector *restrict y, ///< Coordinates
     39                     const psVector *restrict yErr) ///< Errors in coordinates, or NULL
     40;
    4141
    4242/* \} */ // End of MathGroup Functions
  • trunk/archive/pslib/include/psSort.h

    r519 r671  
    1313
    1414/** Sort an array. Inputs not restrict-ed to allow sort in place */
    15 psFloatArray *
    16 psSort(psFloatArray *out,               ///< Sorted array to return. May be NULL
    17        const psFloatArray *restrict myArray     ///< Array to sort
    18     );
     15psVector *
     16psSort(psVector *out,                   ///< Sorted array to return. May be NULL
     17       const psVector *restrict in)     ///< Array to sort
     18;
    1919
    2020/** Sort an array, along with some other stuff.  Returns an index array */
    21 psIntArray *
    22 psSortIndex(psIntArray *restrict out,   ///< Output index array (may be NULL)
    23             const psFloatArray *restrict myArray ///< Array to sort
    24     );
     21psVector *
     22psSortIndex(psVector *restrict out,     ///< Output index array (may be NULL)
     23            const psVector *restrict in) ///< Array to sort
     24;
    2525
    2626/* \} */ // End of MathGroup Functions
  • trunk/archive/pslib/include/psStats.h

    r609 r671  
    3939    double sampleUQ;                    ///< upper quartile of sample
    4040    double sampleLQ;                    ///< lower quartile of sample
    41     double robustMean;                  ///< robust mean of array
     41    double robustMean;                  ///< robust mean of data
    4242    int    robustMeanNvalues;           ///< number of measurements used for robust mean
    43     double robustMedian;                ///< robust median of array
     43    double robustMedian;                ///< robust median of data
    4444    int    robustMedianNvalues;         ///< number of measurements used for robust median
    45     double robustMode;                  ///< Robust mode of array
     45    double robustMode;                  ///< Robust mode of data
    4646    int    robustModeNvalues;           ///< Number of measurements used for robust mode
    47     double robustStdev;                 ///< robust standard deviation of array
     47    double robustStdev;                 ///< robust standard deviation of data
    4848    double robustUQ;                    ///< robust upper quartile
    4949    double robustLQ;                    ///< robust lower quartile
     
    5353    double clipSigma;                   ///< Nsigma used for clipping; user input
    5454    int    clipIter;                    ///< Number of clipping iterations; user input
    55     double min;                         ///< minimum data value in array
    56     double max;                         ///< maximum data value in array
    57     int    nValues;                     ///< number of data values in array
     55    double min;                         ///< minimum data value in data
     56    double max;                         ///< maximum data value in data
     57    int    nValues;                     ///< number of data values in data
    5858    psStatsOptions options;             ///< bitmask of calculated values
    5959} psStats;
    6060
    6161
    62 /** Do Statistics on an array.  Returns a status value. \ingroup MathGroup */
     62/** Do Statistics on a vector.  Returns a status value. \ingroup MathGroup */
    6363psStats *
    64 psArrayStats(psStats *stats,            ///< stats structure defines stats to be calculated, how and result
    65              const psFloatArray *restrict myArray, ///< Array to be analysed
    66              const psIntArray *restrict maskArray, ///< Ignore elements where (maskArray & maskVal) != 0
    67                                                    ///< May be NULL
    68              unsigned int maskVal       ///< Only mask elements with one of these bits set in maskArray
    69     );
     64psVectorStats(psStats *stats,           ///< stats structure defines stats to be calculated, how and result
     65             const psVector *restrict myArray, ///< Array to be analysed
     66             const psVector *restrict maskArray, ///< Ignore elements where (maskArray & maskVal) != 0
     67                                        ///< May be NULL
     68             unsigned int maskVal)      ///< Only mask elements with one of these bits set in maskArray
     69;
    7070
    7171/** Constructor */
    7272psStats *
    73 psStatsAlloc(psStatsOptions options     ///< Statistics to measure
    74     );
     73psStatsAlloc(psStatsOptions options)    ///< Statistics to measure
     74;
    7575
    7676/** Destructor */
    7777void
    78 psStatsFree(psStats *restrict stats     ///< Stats structure to destroy
    79     );
     78psStatsFree(psStats *restrict stats)    ///< Stats structure to destroy
     79;
    8080
    8181/***********************************************************************************************************/
     
    8383/** Histograms  */
    8484typedef struct {
    85     const psFloatArray *restrict bounds; ///< Bounds for the bins
    86     psIntArray *nums;                   ///< Number in each of the bins
     85    const psVector *restrict bounds;    ///< Bounds for the bins
     86    psVector *nums;                     ///< Number in each of the bins
    8787    const float minVal, maxVal;         ///< Minimum and maximum values
    8888    int minNum, maxNum;                 ///< Number below the minimum and above the maximum
     
    9494psHistogramAlloc(float lower,           ///< Lower limit for the bins
    9595                 float upper,           ///< Upper limit for the bins
    96                  int n                  ///< Number of the bins
    97     );
     96                 int n)                 ///< Number of the bins
     97;
    9898
    9999/** Generic constructor \ingroup MathGroup */
    100100psHistogram *
    101 psHistogramAllocGeneric(const psFloatArray *restrict bounds, ///< Bounds for the bins
     101psHistogramAllocGeneric(const psVector *restrict bounds, ///< Bounds for the bins
    102102                        float minVal,   ///< Minimum value
    103                         float maxVal    ///< Maximum value
    104     );
     103                        float maxVal)   ///< Maximum value
     104;
    105105
    106106/** Destructor \ingroup MathGroup **/
    107107void
    108 psHistogramFree(psHistogram *restrict myHist ///< Histogram to destroy
    109     );
     108psHistogramFree(psHistogram *restrict myHist) ///< Histogram to destroy
     109;
    110110
    111111
    112112/** Calculate a histogram \ingroup MathGroup **/
    113113psHistogram *
    114 psGetArrayHistogram(psHistogram *restrict myHist, ///< Histogram data
    115                     const psFloatArray *restrict myArray ///< Array to analyse
    116     );
     114psVectorHistogram(psHistogram *restrict myHist, ///< Histogram data
     115                  const psVector *restrict myArray) ///< Array to analyse
     116;
    117117
    118118#endif
Note: See TracChangeset for help on using the changeset viewer.