29#include "Utility/IpplInfo.h"
32#include <unordered_map>
34#define NPOINTS_DEFAULT 129
35#define NLEFT_DEFAULT 64
36#define NRIGHT_DEFAULT 64
37#define POLYORDER_DEFAULT 1
58 "The \"FILTER\" statement defines a 1 dimensional filter to be "
59 "applied on histogram."),
62 "TYPE",
"Specifies the type of filter.",
63 {
"SAVITZKY-GOLAY",
"FIXEDFFTLOWPASS",
"RELATIVEFFTLOWPASS",
"STENCIL"});
69 "THRESHOLD",
"Relative threshold for amplitude of frequencies in relativeFFTLowPass filter",
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",
109 return dynamic_cast<OpalFilter*
>(object) != 0;
124 throw OpalException(
"OpalFilter::find()",
"OpalFilter \"" + name +
"\" not found.");
137 *
gmsg <<
"* ************* F I L T E R "
138 "************************************************************"
140 *
gmsg <<
"OpalFilter::initOpalFilterfunction " << endl;
143 "**********************************************************************************"
146 static const std::unordered_map<std::string, FilterType> stringFilterType_s = {
160 Inform svg(
"Savitzky-Golay: ");
161 if (num_points_left < 0) {
162 svg <<
"Number of points to the left negative; using default (" <<
NLEFT_DEFAULT
166 if (num_points_right < 0) {
167 svg <<
"Number of points to the right negative; using default ("
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 "
173 "the right plus 1; using default (NLEFT + NRIGHT + 1);"
175 num_points = num_points_left + num_points_right + 1;
177 if (polynomial_order > num_points_left + num_points_right) {
178 svg <<
"Polynomial order bigger than sum of points to the left and to the "
179 "right; using default (NLEFT + NRIGHT);"
181 polynomial_order = num_points_left + num_points_right;
185 num_points, num_points_left, num_points_right, polynomial_order);
204 *ippl::Info <<
"No filter attached" << endl;
212 os <<
"* ************* F I L T E R ********************************************************\n"
221 <<
"* ********************************************************************************** "
#define POLYORDER_DEFAULT
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.
Definition(int size, const char *name, const char *help)
Constructor for exemplars.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
const std::string & getOpalName() const
Return object name.
Object(int size, const char *name, const char *help)
Constructor for exemplars.
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.