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