Changeset 671
- Timestamp:
- May 13, 2004, 1:16:19 PM (22 years ago)
- Location:
- trunk/archive/pslib/include
- Files:
-
- 2 added
- 1 deleted
- 6 edited
-
psFFT.h (modified) (1 diff)
-
psImage.h (modified) (18 diffs)
-
psLib.h (modified) (2 diffs)
-
psMinimize.h (modified) (1 diff)
-
psSort.h (modified) (1 diff)
-
psStats.h (modified) (4 diffs)
-
psStdArrays.h (deleted)
-
psType.h (added)
-
psVector.h (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/include/psFFT.h
r613 r671 14 14 */ 15 15 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 */ 17 19 psImage * 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 ); 20 psImageFFT(const psImage *image, ///< image to transform (if forward, may be real) 21 int dir) ///< FFT direction (1: forward, -1: reverse) 22 ; 35 23 36 24 /** Calculate power spectrum of an image */ 37 25 psImage * 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. */ 26 psImagePowerSpectrum(const psImage *image) ///< Image to obtain power spectrum of 27 ; 47 28 48 29 /** Get the real part of an image */ 49 30 psImage * 50 31 psImageReal(psImage *out, ///< Image for output (or NULL) 51 const psImage *in ///< Image to get the real part of52 );32 const psImage *in) ///< Image to get the real part of 33 ; 53 34 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 */ 36 psImage * 37 psImageImaginary(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 */ 42 psImage * 43 psImageComplex(psImage *out, ///< Image for output (or NULL) 44 const psImage *real) ///< real part of image 45 const psImage *imag) ///< imaginary part of image 46 ; 59 47 60 48 /** Get the complex conjugate of an image */ 61 49 psImage * 62 50 psImageConjugate(psImage *out, ///< Image for output (or NULL) 63 const psImage *in ///< Image to get the complex conjugate of64 );51 const psImage *in) ///< Image to get the complex conjugate of 52 ; 65 53 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 */ 57 psVector * 58 psVectorFFT(const psVector *vector) ///< Vector to transform 59 ; 60 61 /** Calculate power spectrum of a vector of floating-point numbers */ 62 psVector * 63 psVectorPowerSpectrum(const psVector *vector) ///< Vector to obtain power spectrum of 64 ; 65 66 /** Get the real part of a vector */ 67 psVector * 68 psVectorReal(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 */ 73 psVector * 74 psVectorImaginary(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 */ 79 psVector * 80 psVectorComplex(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 */ 86 psVector * 87 psVectorConjugate(psVector *out, ///< Vector for output (or NULL) 88 const psVector *in) ///< Vector to get the complex conjugate of 89 ; 71 90 72 91 /* \} */ // End of MathGroup Functions -
trunk/archive/pslib/include/psImage.h
r617 r671 26 26 const struct psImage *parent; ///< parent, if a subimage 27 27 int Nchildren; ///< number of subimages 28 struct psImage * children; ///< children of this region; array of Nchildren pointers28 struct psImage **children; ///< children of this region; array of Nchildren pointers 29 29 } psImage; 30 30 … … 40 40 psImageAlloc (int nx, ///< image width 41 41 int ny, ///< image height 42 psElemType type ///< image data type43 );42 psElemType type) ///< image data type 43 ; 44 44 45 45 /// Create a subimage of the specified area. … … 49 49 int ny, ///< subimage width (<= image.ny - y0) 50 50 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 ; 53 53 54 54 /// Destroy the specified image (destroy children if they exist). 55 55 void 56 psImageFree(psImage *restrict image ///< free this image57 );56 psImageFree(psImage *restrict image) ///< free this image 57 ; 58 58 59 59 /** Destroy the pixels of the specified image */ 60 60 psImage * 61 psImageFreePixels(psImage *restrict image ///< Image whose pixels are to be freed62 );61 psImageFreePixels(psImage *restrict image) ///< Image whose pixels are to be freed 62 ; 63 63 64 64 /// Create a copy of the specified image. … … 66 66 psImageCopy(psImage *output, ///< target structure for output image data 67 67 const psImage *input, ///< copy this image 68 psElemType type ///< element type of output image69 );68 psElemType type) ///< element type of output image 69 ; 70 70 71 71 /*** various image pixel extractions ***/ 72 72 73 73 /// Extract pixels from rectlinear region to a vector. 74 ps FloatArray*75 psImageSlice(ps FloatArray*out, ///< Vector to output, or NULL74 psVector * 75 psImageSlice(psVector *out, ///< Vector to output, or NULL 76 76 const psImage *input, ///< extract slice from this image 77 77 int x, ///< starting x coord of region to slice … … 80 80 int ny, ///< width of region in y 81 81 int direction, ///< direction of vector along slice 82 const psStats *stats ///< defines statistics used to find output values83 );82 const psStats *stats) ///< defines statistics used to find output values 83 ; 84 84 85 85 /// Extract pixels along a line to a vector. 86 ps FloatArray*87 psImageCut(ps FloatArray*out, ///< Vector to output, or NULL86 psVector * 87 psImageCut(psVector *out, ///< Vector to output, or NULL 88 88 const psImage *input, ///< extract cut from this image 89 89 float xs, ///< starting x coord of cut … … 92 92 float ye, ///< ending y coord of cut 93 93 float dw, ///< width of cut 94 const psStats *stats ///< defines statistics used to find output values95 );94 const psStats *stats) ///< defines statistics used to find output values 95 ; 96 96 97 97 /// Extract radial annulii data to a vector. 98 ps FloatArray*99 psImageRadialCut(ps FloatArray *out,///< Vector to output, or NULL98 psVector * 99 psImageRadialCut(psVector *out, ///< Vector to output, or NULL 100 100 const psImage *input, ///< extract profile from this image 101 101 float x, ///< center x coord of annulii 102 102 float y, ///< center y coord of annulii 103 const ps FloatArray*radii, ///< Radii of the annuli104 const psStats *stats ///< defines statistics used to find output values105 );103 const psVector *radii, ///< Radii of the annuli 104 const psStats *stats) ///< defines statistics used to find output values 105 ; 106 106 107 107 /*** various image geometry manipulation ***/ … … 111 111 const psImage *input, ///< rebin this image 112 112 float scale, ///< rebinning scale: doutput = scale*dinput 113 const psStats *stats ///< defines statistics used to find output values114 );113 const psStats *stats) ///< defines statistics used to find output values 114 ; 115 115 116 116 /// Rotate image by given angle. … … 118 118 psImageRotate(psImage *out, ///< Image to output, or NULL 119 119 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 ; 122 122 123 123 /// Shift image by an arbitrary number of pixels in either direction. … … 128 128 float dx, ///< shift by this amount in x 129 129 float dy, ///< shift by this amount in y 130 float exposed ///< set exposed pixels to this value131 );130 float exposed) ///< set exposed pixels to this value 131 ; 132 132 133 133 /// Roll image by an integer number of pixels in either direction. … … 137 137 const psImage *input, ///< roll this image 138 138 int dx, ///< roll this amount in x 139 int dy ///< roll this amount in y140 );139 int dy) ///< roll this amount in y 140 ; 141 141 142 142 /// Determine statistics for image (or subimage). 143 143 psStats * 144 144 psImageGetStats(psStats *stats, ///< defines statistics to be calculated & target 145 const psImage *input ///< image (or subimage) to calculate stats146 );145 const psImage *input) ///< image (or subimage) to calculate stats 146 ; 147 147 148 148 /// Construct a histogram from an image (or subimage). 149 149 psHistogram * 150 150 psImageHistogram(psHistogram *hist, ///< input histogram description & target 151 const psImage *input ///< determine histogram of this image152 );151 const psImage *input) ///< determine histogram of this image 152 ; 153 153 154 154 /// Fit a 2-D polynomial surface to an image. 155 155 psPolynomial2D * 156 156 psImageFitPolynomial(psPolynomial2D *coeffs, ///< coefficient structure carries in desired terms & target 157 const psImage *input ///< image to fit158 );157 const psImage *input) ///< image to fit 158 ; 159 159 160 160 /// Evaluate a 2-D polynomial surface to image pixels. 161 161 psImage * 162 162 psImageEvalPolynomial(const psImage *input, ///< image to produce 163 const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms164 );163 const psPolynomial2D *coeffs) ///< coefficient structure carries in desired terms 164 ; 165 165 166 166 /*** image input/output routines ***/ … … 175 175 const char *extname, ///< MEF extension name ("PHU" for primary header) 176 176 int extnum, ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1) 177 const char *filename ///< file to read data from178 );177 const char *filename) ///< file to read data from 178 ; 179 179 180 180 /// Read an image or subimage from file descriptor. … … 188 188 const char *extname, ///< MEF extension name ("PHU" for primary header) 189 189 int extnum, ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1) 190 FILE *f ///< file descriptor to read data from191 );190 FILE *f) ///< file descriptor to read data from 191 ; 192 192 193 193 /// Write an image section to named file (which may exist). … … 199 199 const char *extname, ///< MEF extension name ("PHU" for primary header) 200 200 int extnum, ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1) 201 const char *filename ///< file to write data to202 );201 const char *filename) ///< file to write data to 202 ; 203 203 204 204 /// Write an image section to named file (which may exist). … … 210 210 const char *extname, ///< MEF extension name 211 211 int extnum, ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1) 212 FILE *f ///< file descriptor to write data to213 );212 FILE *f) ///< file descriptor to write data to 213 ; 214 214 215 215 /// Read only header from image file. … … 218 218 const char *extname, ///< MEF extension name ("PHU" for primary header) 219 219 int extnum, ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1) 220 const char *filename ///< file to read from221 );220 const char *filename) ///< file to read from 221 ; 222 222 223 223 /// Read only header from image file descriptor. … … 226 226 const char *extname, ///< MEF extension name ("PHU" for primary header) 227 227 int extnum, ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1) 228 FILE *f ///< file descriptor to read from229 );228 FILE *f) ///< file descriptor to read from 229 ; 230 230 231 231 /*** basic pixel manipulations ***/ … … 236 236 float vmin, ///< set min-clipped pixels to vmin 237 237 float max, ///< clip pixels with values > max 238 float vmax ///< set max-clipped pixels to vmax239 );238 float vmax) ///< set max-clipped pixels to vmax 239 ; 240 240 241 241 /// Clip NaN image pixels to given value. Return number of clipped pixels. 242 242 int 243 243 psImageClipNaN(psImage *input, ///< clip this image & target 244 float value ///< set nan pixels to this value245 );244 float value) ///< set nan pixels to this value 245 ; 246 246 247 247 /// Overlay subregion of image with another image. Return number of pixels replaced. … … 251 251 int x0, ///< x offset of overlay subimage 252 252 int y0, ///< y offset of overlay subimage 253 const char *op ///< overlay operation254 );253 const char *op) ///< overlay operation 254 ; 255 255 256 256 /* \} */ // End of AstroGroup Functions -
trunk/archive/pslib/include/psLib.h
r523 r671 16 16 /** @defgroup AstroGroup Astronomy-Specific Utilities */ 17 17 18 19 18 /** @ingroup SystemGroup */ 20 19 # include <psMemory.h> … … 25 24 26 25 /** @ingroup DataGroup */ 27 # include <psStdArrays.h> 26 # include <psTypes.h> 27 # include <psVectors.h> 28 28 # include <psHash.h> 29 29 # include <psDlist.h> -
trunk/archive/pslib/include/psMinimize.h
r615 r671 13 13 14 14 /** Find the minimum of a particular non-linear function */ 15 ps FloatArray*16 psMinimize(ps FloatArray *restrict initialGuess,///< Initial guess and answer17 float (*myFunction)(const ps FloatArray*restrict), ///< Function to minimize18 float (*myFuncDeriv)(const ps FloatArray*restrict), ///< Derivatives of function, or NULL19 const ps IntArray *restrict paramMask //!< 1 = fit for parameter, 0 = hold parameter constant20 );15 psVector * 16 psMinimize(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 ; 21 21 22 22 23 23 /** Minimize chi^2 for input data */ 24 ps FloatArray*25 psMinimizeChi2(ps FloatArray *restrict initialGuess,///< Initial guess and answer26 float (*evalModel)(const ps FloatArray*restrict,27 const ps FloatArray*restrict), ///< Model to fit; (domain and params)28 const ps FloatArray*restrict domain, ///< The domain values for the corresponding measurements29 const ps FloatArray*restrict data, ///< Data to fit30 const ps FloatArray*restrict errors, ///< Errors in the data31 const ps IntArray *restrict paramMask///< 1 = fit for parameter, 0 = hold parameter constant32 );24 psVector * 25 psMinimizeChi2(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 ; 33 33 34 34 /** Derive a polynomial fit by chi^2 minimisation --- can be done analytically */ 35 35 psPolynomial1D * 36 ps GetArrayPolynomial(psPolynomial1D myPoly, ///< Polynomial to fit37 const ps FloatArray*restrict x, ///< Ordinates (or NULL to just use the indices)38 const ps FloatArray*restrict y, ///< Coordinates39 const ps FloatArray *restrict yErr///< Errors in coordinates, or NULL40 );36 psVectorFitPolynomial(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 ; 41 41 42 42 /* \} */ // End of MathGroup Functions -
trunk/archive/pslib/include/psSort.h
r519 r671 13 13 14 14 /** Sort an array. Inputs not restrict-ed to allow sort in place */ 15 ps FloatArray*16 psSort(ps FloatArray *out,///< Sorted array to return. May be NULL17 const ps FloatArray *restrict myArray///< Array to sort18 );15 psVector * 16 psSort(psVector *out, ///< Sorted array to return. May be NULL 17 const psVector *restrict in) ///< Array to sort 18 ; 19 19 20 20 /** Sort an array, along with some other stuff. Returns an index array */ 21 ps IntArray*22 psSortIndex(ps IntArray*restrict out, ///< Output index array (may be NULL)23 const ps FloatArray *restrict myArray///< Array to sort24 );21 psVector * 22 psSortIndex(psVector *restrict out, ///< Output index array (may be NULL) 23 const psVector *restrict in) ///< Array to sort 24 ; 25 25 26 26 /* \} */ // End of MathGroup Functions -
trunk/archive/pslib/include/psStats.h
r609 r671 39 39 double sampleUQ; ///< upper quartile of sample 40 40 double sampleLQ; ///< lower quartile of sample 41 double robustMean; ///< robust mean of array41 double robustMean; ///< robust mean of data 42 42 int robustMeanNvalues; ///< number of measurements used for robust mean 43 double robustMedian; ///< robust median of array43 double robustMedian; ///< robust median of data 44 44 int robustMedianNvalues; ///< number of measurements used for robust median 45 double robustMode; ///< Robust mode of array45 double robustMode; ///< Robust mode of data 46 46 int robustModeNvalues; ///< Number of measurements used for robust mode 47 double robustStdev; ///< robust standard deviation of array47 double robustStdev; ///< robust standard deviation of data 48 48 double robustUQ; ///< robust upper quartile 49 49 double robustLQ; ///< robust lower quartile … … 53 53 double clipSigma; ///< Nsigma used for clipping; user input 54 54 int clipIter; ///< Number of clipping iterations; user input 55 double min; ///< minimum data value in array56 double max; ///< maximum data value in array57 int nValues; ///< number of data values in array55 double min; ///< minimum data value in data 56 double max; ///< maximum data value in data 57 int nValues; ///< number of data values in data 58 58 psStatsOptions options; ///< bitmask of calculated values 59 59 } psStats; 60 60 61 61 62 /** Do Statistics on a n array. Returns a status value. \ingroup MathGroup */62 /** Do Statistics on a vector. Returns a status value. \ingroup MathGroup */ 63 63 psStats * 64 ps ArrayStats(psStats *stats, ///< stats structure defines stats to be calculated, how and result65 const ps FloatArray*restrict myArray, ///< Array to be analysed66 const ps IntArray*restrict maskArray, ///< Ignore elements where (maskArray & maskVal) != 067 ///< May be NULL68 unsigned int maskVal ///< Only mask elements with one of these bits set in maskArray69 );64 psVectorStats(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 ; 70 70 71 71 /** Constructor */ 72 72 psStats * 73 psStatsAlloc(psStatsOptions options ///< Statistics to measure74 );73 psStatsAlloc(psStatsOptions options) ///< Statistics to measure 74 ; 75 75 76 76 /** Destructor */ 77 77 void 78 psStatsFree(psStats *restrict stats ///< Stats structure to destroy79 );78 psStatsFree(psStats *restrict stats) ///< Stats structure to destroy 79 ; 80 80 81 81 /***********************************************************************************************************/ … … 83 83 /** Histograms */ 84 84 typedef struct { 85 const ps FloatArray *restrict bounds;///< Bounds for the bins86 ps IntArray*nums; ///< Number in each of the bins85 const psVector *restrict bounds; ///< Bounds for the bins 86 psVector *nums; ///< Number in each of the bins 87 87 const float minVal, maxVal; ///< Minimum and maximum values 88 88 int minNum, maxNum; ///< Number below the minimum and above the maximum … … 94 94 psHistogramAlloc(float lower, ///< Lower limit for the bins 95 95 float upper, ///< Upper limit for the bins 96 int n ///< Number of the bins97 );96 int n) ///< Number of the bins 97 ; 98 98 99 99 /** Generic constructor \ingroup MathGroup */ 100 100 psHistogram * 101 psHistogramAllocGeneric(const ps FloatArray*restrict bounds, ///< Bounds for the bins101 psHistogramAllocGeneric(const psVector *restrict bounds, ///< Bounds for the bins 102 102 float minVal, ///< Minimum value 103 float maxVal ///< Maximum value104 );103 float maxVal) ///< Maximum value 104 ; 105 105 106 106 /** Destructor \ingroup MathGroup **/ 107 107 void 108 psHistogramFree(psHistogram *restrict myHist ///< Histogram to destroy109 );108 psHistogramFree(psHistogram *restrict myHist) ///< Histogram to destroy 109 ; 110 110 111 111 112 112 /** Calculate a histogram \ingroup MathGroup **/ 113 113 psHistogram * 114 ps GetArrayHistogram(psHistogram *restrict myHist, ///< Histogram data115 const psFloatArray *restrict myArray///< Array to analyse116 );114 psVectorHistogram(psHistogram *restrict myHist, ///< Histogram data 115 const psVector *restrict myArray) ///< Array to analyse 116 ; 117 117 118 118 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
