Important
This project is currently at a very early stage. Fundamental and breaking changes may occur over the next releases.
ProcessingNodes is a framework for online and offline time series signal processing.
It divides each signal processing step into one unit, a ProcessingNode. Multiple of such ProcessingNodes can be combined and form a ProcessingPipeline, which this way can include a whole chain of signal processing steps.
It also features a collection of ready-to-use ProcessingNodes, each implementing a common signal processing method, e.g. IIR filter, spectral estimation, dimensionality reduction, etc.
While this package may be useful for any kind of signal processing, it was developed in the context of biosignal processing, such as electromyography (muscle activity) or electroencephalography (brain activity). In consequence, it might be heavily influenced by some concepts predominantly found in the biosignal processing domain.
importnumpyasnpimportmatplotlib.pyplotaspltfromprocessingnodes.nodesimportIIRFilterNode# use a sampling frequency of 250Hz and a sinusoid of 15Hzfs=250f_sine=15# generate the time series datatimestamps=np.arange(fs) /fsnoisy_signal=np.sin(2*np.pi*f_sine*timestamps) +2*np.random.random(size=timestamps.size) # create an IIR filter node with a bandpass from 13 to 17 Hznode=IIRFilterNode(
in_channel_labels=["Ch1"],
sfreq=fs,
order=3,
btype="bandpass",
ftype="butter",
fpass=[13, 17],
fstop=[10, 20]
)
# apply the filterfiltered_sine, _=node.process(noisy_signal)
# plot resultsfig, axes=plt.subplots(2, 1, sharex="all", figsize=[10,4])
axes[0].plot(timestamps, noisy_signal)
axes[1].plot(timestamps, filtered_sine)
axes[0].set_title("raw signal")
axes[1].set_title("filtered signal")
plt.xlabel("time [s]")
plt.tight_layout()
plt.show()