SourceXtractorPlusPlus
0.12
Please provide a description of the project.
SEImplementation
SEImplementation
Background
SE2
SE2BackgroundUtils.h
Go to the documentation of this file.
1
17
/*
18
* Created on Jan 05, 2015
19
* @author: mkuemmel@usm.lmu.de
20
* Date: $Date$
21
* Revision: $Revision$
22
* Author: $Author$
23
*/
24
#ifndef SE2BACKGROUNDUTILS_H
25
#define SE2BACKGROUNDUTILS_H
26
27
#include <sstream>
28
#include "
ElementsKernel/Logging.h
"
// for Logging::LogMessageStream, etc
29
#include "
SEImplementation/Background/SE2/BackgroundDefine.h
"
30
31
namespace
SourceXtractor
{
32
33
class
SE2BackgroundUtils
{
34
35
public
:
36
//SE2BackgroundUtils(){};
37
static
int
fqCmp
(
const
void
*p1,
const
void
*p2) {
38
PIXTYPE
f1=*((
float
*)p1);
39
PIXTYPE
f2=*((
float
*)p2);
40
return
f1>f2? 1 : (f1<f2? -1 : 0);
41
};
42
43
static
PIXTYPE
fqMedian
(
PIXTYPE
*ra,
size_t
n){
44
qsort
(ra, n,
sizeof
(
PIXTYPE
),
fqCmp
);
45
if
(n<2)
46
return
*ra;
47
else
48
return
n&1? ra[n/2] : (ra[n/2-1]+ra[n/2])/2.0;
49
};
50
//static void weightToVar(PIXTYPE *data, const size_t npix, const int wTypeFlag, const PIXTYPE sigFac=1.0);
51
//static void generalLogger(std::string logString);
52
//static void throwElementsException(std::string exceptionString);
53
};
54
55
// general conversion from primitive types to string;
56
// mainly to avoid the C++11 featire "std::to_string()"
57
//template <typename T> std::string tostr(const T& t) {
58
// std::ostringstream os;
59
// os<<t;
60
// return os.str();
61
//}
62
}
// end of namespace SourceXtractor
63
#endif // SE2BACKGROUNDUTILS_H
64
Logging.h
SourceXtractor::SE2BackgroundUtils::fqCmp
static int fqCmp(const void *p1, const void *p2)
Definition:
SE2BackgroundUtils.h:37
SourceXtractor::SE2BackgroundUtils
Definition:
SE2BackgroundUtils.h:33
SourceXtractor
Definition:
Aperture.h:30
SourceXtractor::PIXTYPE
float PIXTYPE
Definition:
BackgroundDefine.h:30
SourceXtractor::SE2BackgroundUtils::fqMedian
static PIXTYPE fqMedian(PIXTYPE *ra, size_t n)
Definition:
SE2BackgroundUtils.h:43
BackgroundDefine.h
std::qsort
T qsort(T... args)
Generated by
1.8.14