32#include <unordered_map>
34#define NPOINTS_DEFAULT 129
35#define NLEFT_DEFAULT 64
36#define NRIGHT_DEFAULT 64
37#define POLYORDER_DEFAULT 1
57 "The \"FILTER\" statement defines a 1 dimensional filter to be "
58 "applied on histogram."),
61 (
"TYPE",
"Specifies the type of filter.",
62 {
"SAVITZKY-GOLAY",
"FIXEDFFTLOWPASS",
"RELATIVEFFTLOWPASS",
"STENCIL"});
65 (
"NFREQ",
"Number of frequencies to use in fixedFFTLowPass filter", 9.);
68 (
"THRESHOLD",
"Relative threshold for amplitude of frequencies in relativeFFTLowPass filter", 1.e-6);
71 (
"NPOINTS",
"Number of points in Savitzky-Golay filter",
NPOINTS_DEFAULT);
74 (
"NLEFT",
"Number of points to the left in Savitzky-Golay filter",
NLEFT_DEFAULT);
77 (
"NRIGHT",
"Number of points to the right in Savitzky-Golay filter",
NRIGHT_DEFAULT);
80 (
"POLYORDER",
"Polynomial order for local fit-function in Savitzky-Golay filter",
POLYORDER_DEFAULT);
110 return dynamic_cast<OpalFilter*
>(object) != 0;
129 "OpalFilter \"" +
name +
"\" not found.");
143 *
gmsg <<
"* ************* F I L T E R ************************************************************" <<
endl;
144 *
gmsg <<
"OpalFilter::initOpalFilterfunction " <<
endl;
145 *
gmsg <<
"* **********************************************************************************" <<
endl;
147 static const std::unordered_map<std::string, FilterType> stringFilterType_s = {
162 Inform svg(
"Savitzky-Golay: ");
163 if (num_points_left < 0) {
164 svg <<
"Number of points to the left negative; using default (" <<
NLEFT_DEFAULT <<
");" <<
endl;
167 if (num_points_right < 0) {
168 svg <<
"Number of points to the right negative; using default (" <<
NRIGHT_DEFAULT <<
");" <<
endl;
171 if (num_points < num_points_left + num_points_right) {
172 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;
173 num_points = num_points_left + num_points_right + 1;
175 if (polynomial_order > num_points_left + num_points_right) {
176 svg <<
"Polynomial order bigger than sum of points to the left and to the right; using default (NLEFT + NRIGHT);" <<
endl;
177 polynomial_order = num_points_left + num_points_right;
205 os <<
"* ************* F I L T E R ********************************************************\n"
214 <<
"* ********************************************************************************** " <<
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.