SourceXtractorPlusPlus
0.10
Please provide a description of the project.
SEImplementation
SEImplementation
Background
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/BackgroundDefine.h
"
30
31
namespace
SourceXtractor
{
32
33
static
Elements::Logging
bck_model_logger
=
Elements::Logging::getLogger
(
"BackgroundModel"
);
34
35
class
SE2BackgroundUtils
{
36
37
public
:
38
//SE2BackgroundUtils(){};
39
static
int
fqCmp
(
const
void
*p1,
const
void
*p2) {
40
PIXTYPE
f1=*((
float
*)p1);
41
PIXTYPE
f2=*((
float
*)p2);
42
return
f1>f2? 1 : (f1<f2? -1 : 0);
43
};
44
45
static
PIXTYPE
fqMedian
(
PIXTYPE
*ra,
size_t
n){
46
qsort
(ra, n,
sizeof
(
PIXTYPE
),
fqCmp
);
47
if
(n<2)
48
return
*ra;
49
else
50
return
n&1? ra[n/2] : (ra[n/2-1]+ra[n/2])/2.0;
51
};
52
//static void weightToVar(PIXTYPE *data, const size_t npix, const int wTypeFlag, const PIXTYPE sigFac=1.0);
53
//static void generalLogger(std::string logString);
54
//static void throwElementsException(std::string exceptionString);
55
};
56
57
// general conversion from primitive types to string;
58
// mainly to avoid the C++11 featire "std::to_string()"
59
//template <typename T> std::string tostr(const T& t) {
60
// std::ostringstream os;
61
// os<<t;
62
// return os.str();
63
//}
64
}
// end of namespace SourceXtractor
65
#endif // SE2BACKGROUNDUTILS_H
66
Logging.h
SourceXtractor::SE2BackgroundUtils::fqCmp
static int fqCmp(const void *p1, const void *p2)
Definition:
SE2BackgroundUtils.h:39
SourceXtractor::bck_model_logger
static Elements::Logging bck_model_logger
Definition:
SE2BackgroundUtils.h:33
SourceXtractor::SE2BackgroundUtils
Definition:
SE2BackgroundUtils.h:35
SourceXtractor
Definition:
Aperture.h:30
Elements::Logging
SourceXtractor::PIXTYPE
float PIXTYPE
Definition:
BackgroundDefine.h:30
SourceXtractor::SE2BackgroundUtils::fqMedian
static PIXTYPE fqMedian(PIXTYPE *ra, size_t n)
Definition:
SE2BackgroundUtils.h:45
BackgroundDefine.h
std::qsort
T qsort(T... args)
Elements::Logging::getLogger
static Logging getLogger(const std::string &name="")
Generated by
1.8.15