[3] | 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 ); |
---|
[53] | 36 | float findMean(float *&array, int size); |
---|
| 37 | float findSigma(float *&array, int size); |
---|
| 38 | float findMedian(float *&array, int size); |
---|
| 39 | float findMADFM(float *&array, int size); |
---|
[3] | 40 | void findMedianStats(float *&array, int size, float &median, float &madfm); |
---|
| 41 | void findMedianStats(float *&array, long size, float &median, float &madfm); |
---|
| 42 | void findNormalStats(float *&array, int size, float &mean, float &sig); |
---|
| 43 | void getRandomSpectrum(int length, float *x, float *y); |
---|
| 44 | void getRandomSpectrum(int length, float *x, double *y); |
---|
| 45 | void getRandomSpectrum(int length, float mean, float sigma, float *x, double *y); |
---|
| 46 | void getRandomSpectrum(int length, float mean, float sigma, float *x, float *y); |
---|
| 47 | float getNormalRV(); |
---|
| 48 | float getNormalRV(float mean, float sigma); |
---|
| 49 | void getSigmaFactors(int &numScales, float *factors); |
---|
| 50 | void getSigmaFactors2D(int &numScales, float *factors); |
---|
| 51 | void getSigmaFactors3D(int &numScales, float *factors); |
---|
| 52 | void getSigmaFactors1DNew(int &numScales); |
---|
| 53 | void getSigmaFactors2DNew(int &numScales); |
---|
| 54 | void getSigmaFactors3DNew(int &numScales); |
---|
| 55 | |
---|
| 56 | void cpgwedglog(const char* side, float disp, float width, float fg, float bg, const char *label); |
---|
| 57 | void cpghistlog(int npts, float *data, float datamin, float datamax, int nbin, int pgflag); |
---|
| 58 | |
---|
| 59 | string getIAUNameEQ(double ra, double dec, float equinox); |
---|
| 60 | string getIAUNameGAL(double ra, double dec); |
---|
[38] | 61 | string decToDMS(double dec, string type); |
---|
[3] | 62 | double dmsToDec(string dms); |
---|
| 63 | double angularSeparation(double &ra1, double &dec1, double &ra2, double &dec2); |
---|
| 64 | |
---|
| 65 | double pixelToVelocity(wcsprm *wcs, double &x, double &y, double &z); |
---|
| 66 | int wcsToPixSingle(wcsprm *wcs, const double *world, double *pix); |
---|
| 67 | int pixToWCSSingle(wcsprm *wcs, const double *pix, double *world); |
---|
[22] | 68 | int wcsToPixMulti(wcsprm *wcs, const double *world, double *pix, const int npts); |
---|
| 69 | int pixToWCSMulti(wcsprm *wcs, const double *pix, double *world, const int npts); |
---|
[3] | 70 | float setVel_kms(wcsprm *wcs, const double coord); |
---|
| 71 | double velToCoord(wcsprm *wcs, const float velocity); |
---|
| 72 | |
---|
| 73 | bool isDetection(float value, float mean, float sigma, float cut); |
---|
| 74 | |
---|
| 75 | #endif |
---|