added functions from raw signal processing scripts