Onepredict / onebone

An Open Source Signal Processing Library for Sensor Signals about vibration, current, etc.
MIT License
18 stars 3 forks source link

feat: Adding 'snr' function to onebone.feature #59

Closed seone-kim closed 2 years ago

seone-kim commented 2 years ago

Summary

Write the summary about this PR. SNR(signal to noise ratio) is the ratio of signal to noise power on STFT. The source of how to calculate SNR is from the paper "High-Accuracy Unsupervised Fault Detection of Industrial Robots Using Current Signal Analysis" published in 2019 IEEE. link : https://ieeexplore.ieee.org/abstract/document/8819374

Changes

Write changes in detail. Add snr function on onebone/feature/init.py Add snr function on onebone/feature Add test_snr.py for testing snr function

Get the frequency, time, power of signal by using signal.spectrogram. p = the max power intensity over the entire frequency range at time point t. res = (the sum of power intensity over the entire frequency range at time point t) - p snr = p/res

How to Test?

Check that snr can't work on complex signal by using the function 'check_bad_args' in test_snr.py Generate the 1D real signal by using the function 'generate_signal' in test_snr.py. Check that output and expected_return are the same.

Checklist

kyunghwan-onepredict commented 2 years ago

@all-contributors please add @seone-kim code

allcontributors[bot] commented 2 years ago

@kyunghwan-onepredict

I've put up a pull request to add @seone-kim! :tada: