How to do unsigned saturating addition in C?

You probably want portable C code here, which your compiler will turn into proper ARM assembly. ARM has conditional moves, and these can be conditional on overflow. The algorithm then becomes: add and conditionally set the destination to unsigned(-1), if overflow was detected. uint16_t add16(uint16_t a, uint16_t b) { uint16_t c = a + b; if … Read more

Intuitive understanding of 1D, 2D, and 3D convolutions in convolutional neural networks [closed]

I want to explain with picture from C3D. In a nutshell, convolutional direction & output shape is important! ↑↑↑↑↑ 1D Convolutions – Basic ↑↑↑↑↑ just 1-direction (time-axis) to calculate conv input = [W], filter = [k], output = [W] ex) input = [1,1,1,1,1], filter = [0.25,0.5,0.25], output = [1,1,1,1,1] output-shape is 1D array example) graph … Read more

How to implement band-pass Butterworth filter with Scipy.signal.butter

You could skip the use of buttord, and instead just pick an order for the filter and see if it meets your filtering criterion. To generate the filter coefficients for a bandpass filter, give butter() the filter order, the cutoff frequencies Wn=[lowcut, highcut], the sampling rate fs (expressed in the same units as the cutoff … Read more

Creating sine or square wave in C#

This lets you give frequency, duration, and amplitude, and it is 100% .NET CLR code. No external DLL’s. It works by creating a WAV-formatted MemoryStream which is like creating a file in memory only, without storing it to disk. Then it plays that MemoryStream with System.Media.SoundPlayer. using System; using System.Collections.Generic; using System.IO; using System.Linq; using … Read more

Peak signal detection in realtime timeseries data

Robust peak detection algorithm (using z-scores) I came up with an algorithm that works very well for these types of datasets. It is based on the principle of dispersion: if a new datapoint is a given x number of standard deviations away from some moving mean, the algorithm signals (also called z-score). The algorithm is … Read more