estimate sine frequency, amp, phase and offset from 1D raw data
Project description
Sine properties estimation
Estimating sine properties from 1D array of raw data
Let say you have a noisy record of a sine, and you want to know its properties.
Frequency estimation done by polynomial interpolation on fft values.
Estimating amp, phase and offset using least square on trigonometric sine identity.
Probably useful for DSP (signal processing) and spectral analysis.
usage example:
input:
import numpy as np
from sine_properties_estimation import calc_sine_properties
# sine with random noise
samples = 1000
seconds = 10
amp_mv = 340
phase_rad = 2.2
offset_mv = 60
freq_ghz = 1.834
t = np.linspace(0, seconds, samples)
signal = amp_mv * np.sin(2 * np.pi * freq_ghz * t + phase_rad) + offset_mv + np.random.normal(0, 50, samples)
estimation = calc_sine_properties(signal, seconds)
print(f'estimated freq is {estimation.est_freq} Hz')
print(f'estimated sine amp is {estimation.est_sine_amp}')
estimation.print_estimation()
output:
estimate freq is 1.8372033171227042 Hz
estimated sine amp is 338.5901422611014
samples : 1000
total_seocnds : 10
freq : 1.8372033171227042
sine_amp : 338.5901422611014
phase_rad : 2.0986036955592624
offset : 63.01041660377115
--------------------------------------------------
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sine_properties_estimation-0.1.1.tar.gz
.
File metadata
- Download URL: sine_properties_estimation-0.1.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.62.2 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b4c50f12ddf0a4dd79c37dd1137cfdff75a907df679d010a4a949b0f485ae3a |
|
MD5 | fa4ad6f56727265a5ea1a63f37aab3a7 |
|
BLAKE2b-256 | ddd91669dcda78809f69abfc61800251894e0c43f654c48faf0fb72592015511 |
File details
Details for the file sine_properties_estimation-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: sine_properties_estimation-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.62.2 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c88ddbc8cb8025c5498ea940a864bb59587b873e6ce4cf52186b3a34be231760 |
|
MD5 | da84b75e4a365cf8066fb24c2ba5a6a0 |
|
BLAKE2b-256 | 6c832cce777a792887a596aa28f201677cab86ba584ad6fbab2278ee462ecad4 |