29 #define NPOINTS_DEFAULT 129
30 #define NLEFT_DEFAULT 64
31 #define NRIGHT_DEFAULT 64
32 #define POLYORDER_DEFAULT 1
59 "The \"FILTER\" statement defines a 1 dimensional filter to be "
60 "applied on histogram."),
63 (
"TYPE",
"Specifies the type of filter.",
64 {
"SAVITZKY-GOLAY",
"FIXEDFFTLOWPASS",
"RELATIVEFFTLOWPASS",
"STENCIL"});
67 (
"NFREQ",
"Number of frequencies to use in fixedFFTLowPass filter", 9.);
70 (
"THRESHOLD",
"Relative threshold for amplitude of frequencies in relativeFFTLowPass filter", 1.e-6);
73 (
"NPOINTS",
"Number of points in Savitzky-Golay filter",
NPOINTS_DEFAULT);
76 (
"NLEFT",
"Number of points to the left in Savitzky-Golay filter",
NLEFT_DEFAULT);
79 (
"NRIGHT",
"Number of points to the right in Savitzky-Golay filter",
NRIGHT_DEFAULT);
82 (
"POLYORDER",
"Polynomial order for local fit-function in Savitzky-Golay filter",
POLYORDER_DEFAULT);
112 return dynamic_cast<OpalFilter *
>(object) != 0;
130 throw OpalException(
"OpalFilter::find()",
"OpalFilter \"" +
name +
"\" not found.");
144 *
gmsg <<
"* ************* F I L T E R ************************************************************" <<
endl;
145 *
gmsg <<
"OpalFilter::initOpalFilterfunction " <<
endl;
146 *
gmsg <<
"* **********************************************************************************" <<
endl;
149 if (
type ==
"SAVITZKY-GOLAY") {
155 Inform svg(
"Savitzky-Golay: ");
156 if (num_points_left < 0) {
157 svg <<
"Number of points to the left negative; using default (" <<
NLEFT_DEFAULT <<
");" <<
endl;
160 if (num_points_right < 0) {
161 svg <<
"Number of points to the right negative; using default (" <<
NRIGHT_DEFAULT <<
");" <<
endl;
164 if (num_points < num_points_left + num_points_right) {
165 svg <<
"Total number of points small than sum of the ones to the left and to the right plus 1; using default (NLEFT + NRIGHT + 1);" <<
endl;
166 num_points = num_points_left + num_points_right + 1;
168 if (polynomial_order > num_points_left + num_points_right) {
169 svg <<
"Polynomial order bigger than sum of points to the left and to the right; using default (NLEFT + NRIGHT);" <<
endl;
170 polynomial_order = num_points_left + num_points_right;
174 }
else if (
type ==
"FIXEDFFTLOWPASS") {
176 }
else if (
type ==
"RELATIVEFFTLOWPASS") {
178 }
else if (
type ==
"STENCIL") {
188 os <<
"* ************* F I L T E R ********************************************************\n"
197 <<
"* ********************************************************************************** " <<
std::endl;
#define POLYORDER_DEFAULT
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
Inform & endl(Inform &inf)
double getReal(const Attribute &attr)
Return real value.
Attribute makePredefinedString(const std::string &name, const std::string &help, const std::initializer_list< std::string > &predefinedStrings)
Make predefined string attribute.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
std::string getString(const Attribute &attr)
Get string value.
boost::function< boost::tuple< double, bool >arguments_t)> type
The base class for all OPAL definitions.
The base class for all OPAL objects.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
const std::string & getOpalName() const
Return object name.
void setOpalName(const std::string &name)
Set object name.
std::vector< Attribute > itsAttr
The object attributes.
bool builtin
Built-in flag.
Object * find(const std::string &name)
Find entry.
static OpalData * getInstance()
void define(Object *newObject)
Define a new object.
The base class for all OPAL exceptions.
virtual void execute()
Check the OpalFilter data.
static OpalFilter * find(const std::string &name)
Find named FILTER.
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.
virtual OpalFilter * clone(const std::string &name)
Make clone.
virtual void update()
Update the OpalFilter data.
OpalFilter()
Exemplar constructor.
void print(std::ostream &os) const
Print the object.