CFEL - ASG Software Suite
2.5.0
CASS
|
low / high pass filter of 1D result More...
#include <operations.h>
Public Member Functions | |
pp89 (const name_t &name) | |
constructor More... | |
virtual void | process (const CASSEvent &, result_t &) |
process event More... | |
virtual void | loadSettings (size_t) |
load the settings of the pp More... | |
![]() | |
Processor (const name_t &name) | |
constructor More... | |
virtual | ~Processor () |
virtual destructor More... | |
virtual void | processEvent (const CASSEvent &event) |
process the event More... | |
virtual const result_t & | result (const CASSEvent::id_t eventid=0) |
retrieve a result for a given id. More... | |
virtual void | releaseEvent (const CASSEvent &event) |
tell the list that the result for event can be overwritten More... | |
result_t::shared_pointer | resultCopy (const uint64_t eventid) |
retrieve histogram for id More... | |
virtual void | load () |
load the general settings More... | |
virtual void | aboutToQuit () |
function that will be called when the processor is about to be deleted More... | |
const names_t & | dependencies () |
Define all processors keys a processor depends on. More... | |
void | clearDependencies () |
clear the dependenies More... | |
void | clearHistograms () |
clear the histograms More... | |
virtual void | processCommand (std::string command) |
process command in pp More... | |
const name_t | name () const |
retrieve the name of this processor More... | |
bool | hide () const |
retrieve the hide flag of this processor More... | |
const std::string & | comment () const |
retrieve the comment of this processor More... | |
Protected Member Functions | |
void | highPass (result_t::const_iterator orig, result_t::iterator filtered) |
high pass filtering function More... | |
void | lowPass (result_t::const_iterator orig, result_t::iterator filtered) |
low pass filtering function More... | |
![]() | |
virtual void | createHistList (result_t::shared_pointer result) |
create result list. More... | |
void | setupGeneral () |
general setup of the processor More... | |
bool | setupCondition (bool defaultConditionType=true) |
setup the condition. More... | |
shared_pointer | setupDependency (const std::string &depVarName, const name_t &name="") |
setup the dependecy. More... | |
Protected Attributes | |
shared_pointer | _pHist |
processor containing input result More... | |
float | _alpha |
factor used for filtering More... | |
std::tr1::function< void(result_t::const_iterator, result_t::iterator)> | _func |
function to retrieve the parameter from the axis More... | |
![]() | |
const name_t | _name |
the processors name More... | |
bool | _hide |
flag to tell whether this pp should be hidden in the dropdown list More... | |
std::string | _comment |
optional comment that one can add to a processor. More... | |
CachedList | _resultList |
the list of results More... | |
names_t | _dependencies |
the list of dependencies More... | |
shared_pointer | _condition |
pointer to the processor that will contain the condition More... | |
Additional Inherited Members | |
![]() | |
typedef std::tr1::shared_ptr< Processor > | shared_pointer |
a shared pointer of this More... | |
typedef std::string | name_t |
define the name type More... | |
typedef std::list< name_t > | names_t |
define the list of names More... | |
typedef CachedList::item_type | result_t |
define the results More... | |
typedef CachedList::item_sp | resultsp_t |
define the shared pointer to the result More... | |
low / high pass filter of 1D result
inspired by code found at http://stackoverflow.com/questions/13882038/implementing-simple-high-and-low-pass-filters-in-c copright Slater Tyrus
HighPass function:
float RC = 1.0/(CUTOFF*2*3.14); float dt = 1.0/SAMPLE_RATE; float alpha = RC/(RC + dt); float filteredArray[numSamples]; filteredArray[0] = data.recordedSamples[0]; for (i = 1; i<numSamples; i++){ filteredArray[i] = alpha * (filteredArray[i-1] + data.recordedSamples[i] - data.recordedSamples[i-1]); } data.recordedSamples = filteredArray;
LowPass function:
float RC = 1.0/(CUTOFF*2*3.14); float dt = 1.0/SAMPLE_RATE; float alpha = dt/(RC+dt); float filteredArray[numSamples]; filteredArray[0] = data.recordedSamples[0]; for(i=1; i<numSamples; i++){ filteredArray[i] = filteredArray[i-1] + (alpha*(data.recordedSamples[i] - filteredArray[i-1])); } data.recordedSamples = filteredArray;
Processor/%name%/{InputName}
Name of the processor that contains the 1D result to filter
Processor/%name%/{FilterType}
The filter type to use. Default is "LowPass". Possible values are:
Processor/%name%/{Cutoff}
The cutoff of the filter.
Processor/%name%/{SampleRate}
The sampling rate of the filter
Definition at line 2300 of file operations.h.
pp89::pp89 | ( | const name_t & | name | ) |
|
protected |
high pass filtering function
orig | iterator to the original value |
filtered | iterator to the filtered value |
Definition at line 3231 of file operations.cpp.
References _alpha.
Referenced by loadSettings().
|
virtual |
load the settings of the pp
Reimplemented from cass::Processor.
Definition at line 3184 of file operations.cpp.
References _alpha, cass::Processor::_condition, _func, _pHist, cass::Log::add(), QSettings::beginGroup(), cass::Processor::createHistList(), QString::fromStdString(), highPass(), cass::Log::INFO, lowPass(), cass::Processor::name(), cass::Processor::setupCondition(), cass::Processor::setupDependency(), cass::Processor::setupGeneral(), and QSettings::value().
Referenced by pp89().
|
protected |
low pass filtering function
orig | iterator to the original value |
filtered | iterator to the filtered value |
Definition at line 3248 of file operations.cpp.
References _alpha.
Referenced by loadSettings().
process event
Reimplemented from cass::Processor.
Definition at line 3264 of file operations.cpp.
References _func, _pHist, cass::Result< T >::begin(), cass::Result< T >::datasize(), cass::CASSEvent::id(), and cass::Result< T >::lock.
|
protected |
factor used for filtering
Definition at line 2333 of file operations.h.
Referenced by highPass(), loadSettings(), and lowPass().
|
protected |
function to retrieve the parameter from the axis
Definition at line 2337 of file operations.h.
Referenced by loadSettings(), and process().
|
protected |
processor containing input result
Definition at line 2330 of file operations.h.
Referenced by loadSettings(), and process().