Simple Numerical Instantaneous Frequency Approximation (SNIFA)
Project description
SNIFA
SNIFA is a tiny Python library for computing an instantaneous frequency approximation numerically using a very simple algorithm. This algorithm was originally created for the purpose of analysing the gyrotropic dynamics of vortex based nano-oscillators but it can be used for any kind of varying monocomponent-frequency signal (only the main frequency is captured by the algorithm).
Installation
Use the package manager pip to install snifa.
pip install snifa
This package is also available in this private GitLab instance and can be installed using the --extra-index-url parameter.
pip install snifa --extra-index-url https://gitlab.flavio.be/api/v4/projects/9/packages/pypi/simple
Usage
import snifa
import numpy as np
ti, tf, nb_pts = 0, 1, 400
fs = nb_pts/(tf-ti) # sampling frequency
t = np.linspace(ti, tf, nb_pts)
f = 20+((100*t)**1)/2 # my shirp :-)
x = np.sin(2*np.pi*f*t)
y = np.cos(2*np.pi*f*t)
x *= (1.0 + 0.5 * np.sin(2*np.pi*3.0*t))
y *= (1.0 + 0.5 * np.sin(2*np.pi*3.0*t))
# Uncomment if only x-component is available
# and comment the other line with filt_freq
# t_, f_ = snifa.filt_freq(t, x, w_filt=0)
t_, f_ = snifa.filt_freq(t, x, y, w_filt=0)
# w_filt is a multiplyer of the number of cycles over which to
# perform a moving avereage. The default value is w_filt=1
# (w_filt=0 means no filtering)
import pylab as pp
pp.plot(t_, f_)
pp.xlabel('Time (s)')
pp.ylabel('Frequency (Hz)')
pp.show()
Contributing
Pull requests are welcome.
License
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snifa-0.5.3.tar.gz.
File metadata
- Download URL: snifa-0.5.3.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f0afbea21327e0672eaa3f73c9293e6fca07e497653cb2cf941a75be5e8ff92
|
|
| MD5 |
c92c82f75eb50e453861a7a8fe77e46b
|
|
| BLAKE2b-256 |
6c98cb3eab3b240aade0b680fc4bfbf746933fad24b633e141082acd34da8788
|
File details
Details for the file snifa-0.5.3-py3-none-any.whl.
File metadata
- Download URL: snifa-0.5.3-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1238c4abb6c8e509a9a40e0ab53e829aff3c8a45a3d385c3c34c88b503b57407
|
|
| MD5 |
e2c8c64e462c10a31a2b1f2fb7b6a474
|
|
| BLAKE2b-256 |
d2690dd45f4de1711ed1eb146899a61cfe82b96fbf25d38141efaa42a1af904c
|