source: tags/release-0.9/Utils/utils.hh @ 813

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

Utils/wcsFunctions.cc Added a single-pixel-offset that had been missed in

rev.22.

Utils/position_related.cc Improved decToDMS to take into account different

axis types, and format the string accordingly.

Utils/utils.hh Corrected header call to match decToDMS change.
Detection/detection.cc Changed calls of decToDMS. Removed use of

Detection::lngRatio, as now unnecessary.

Detection/detection.hh Removed lngRatio and accessor functions from

Detection definition.

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