source: trunk/Utils/utils.hh @ 53

Last change on this file since 53 was 53, checked in by Matthew Whiting, 18 years ago

Added some improved stats and image segmenting routines:
Utils/getStats.cc -- added functions to calculate the individual stats,

so eg. if one only wants the median, one calculates
it and not the madfm as well.

Utils/utils.hh -- prototypes for above functions added
Cubes/cubes.cc -- added extractImage and extractSpectrum as easy tasks

to get a particular spectrum or channel map.
Also findStats, which calculates the correct stats
for the image.

Cubes/cubes.hh -- Prototypes for above functions
Cubes/cubicSearch.cc -- Made use of the above functions
ATrous/ReconSearch.cc -- Made use of the above functions

File size: 3.4 KB
Line 
1#ifndef UTILS_H
2#define UTILS_H
3
4#include <wcs.h>
5#include <string>
6using std::string;
7// #include <functional>
8// #include <algorithm>
9// #include <iterator>
10
11// define the speed of light for WCS-related accessor functions
12const float C_kms = 299792.458;
13
14// Divide by the following correction factor to convert from MADFM to sigma estimator.
15const float correctionFactor = 0.6744888;
16
17string menu();
18string specMenu();
19string orionMenu();
20string imageMenu();
21string twoblMenu();
22
23void waveletSmooth(int dim,float *array, int arraySize, float sigma);
24void hanningSmooth(float *array, int arraySize, int hanningSize);
25void tophatSmooth(float *array, int arraySize, int width);
26void linear_regression(int num, float *x, float *y, int ilow, int ihigh, float &slope, float &errSlope, float &intercept, float &errIntercept, float &r);
27void zscale(long imagesize, float *image, float &z1, float &z2);
28void zscale(long imagesize, float *image, float &z1, float &z2, float nullVal);
29void swap(float &a, float &b);
30void sort(float *arr, int begin, int end);
31void sort(float *arr, float *matchingArray, int begin, int end);
32// template< typename BidirectionalIterator, typename Compare >
33// void quick_sort( BidirectionalIterator first, BidirectionalIterator last, Compare cmp );
34// template< typename BidirectionalIterator >
35// inline void quick_sort( BidirectionalIterator first, BidirectionalIterator last );
36float findMean(float *&array, int size);
37float findSigma(float *&array, int size);
38float findMedian(float *&array, int size);
39float findMADFM(float *&array, int size);
40void findMedianStats(float *&array, int size, float &median, float &madfm);
41void findMedianStats(float *&array, long size, float &median, float &madfm);
42void findNormalStats(float *&array, int size, float &mean, float &sig);
43void getRandomSpectrum(int length, float *x, float *y);
44void getRandomSpectrum(int length, float *x, double *y);
45void getRandomSpectrum(int length, float mean, float sigma, float *x, double *y);
46void getRandomSpectrum(int length, float mean, float sigma, float *x, float *y);
47float getNormalRV();
48float getNormalRV(float mean, float sigma);
49void getSigmaFactors(int &numScales, float *factors);
50void getSigmaFactors2D(int &numScales, float *factors);
51void getSigmaFactors3D(int &numScales, float *factors);
52void getSigmaFactors1DNew(int &numScales);
53void getSigmaFactors2DNew(int &numScales);
54void getSigmaFactors3DNew(int &numScales);
55
56void cpgwedglog(const char* side, float disp, float width, float fg, float bg, const char *label);
57void cpghistlog(int npts, float *data, float datamin, float datamax, int nbin, int pgflag);
58
59string getIAUNameEQ(double ra, double dec, float equinox);
60string getIAUNameGAL(double ra, double dec);
61string decToDMS(double dec, string type);
62double dmsToDec(string dms);
63double angularSeparation(double &ra1, double &dec1, double &ra2, double &dec2);
64
65double pixelToVelocity(wcsprm *wcs, double &x, double &y, double &z);
66int wcsToPixSingle(wcsprm *wcs, const double *world, double *pix);
67int pixToWCSSingle(wcsprm *wcs, const double *pix, double *world);
68int wcsToPixMulti(wcsprm *wcs, const double *world, double *pix, const int npts);
69int pixToWCSMulti(wcsprm *wcs, const double *pix, double *world, const int npts);
70float setVel_kms(wcsprm *wcs, const double coord);
71double velToCoord(wcsprm *wcs, const float velocity);
72
73bool isDetection(float value, float mean, float sigma, float cut);
74
75#endif
Note: See TracBrowser for help on using the repository browser.