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
Metadata
Release files for snifa 0.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| snifa-0.5.3.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| snifa-0.5.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.2 kB
Release files / snifa-0.5.3.tar.gz
| Download URL | snifa-0.5.3.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f0afbea21327e0672eaa3f73c9293e6fca07e497653cb2cf941a75be5e8ff92
|
|
BLAKE2b-256 checksum How to use checksums |
6c98cb3eab3b240aade0b680fc4bfbf746933fad24b633e141082acd34da8788
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / snifa-0.5.3-py3-none-any.whl
| Download URL | snifa-0.5.3-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1238c4abb6c8e509a9a40e0ab53e829aff3c8a45a3d385c3c34c88b503b57407
|
|
BLAKE2b-256 checksum How to use checksums |
d2690dd45f4de1711ed1eb146899a61cfe82b96fbf25d38141efaa42a1af904c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|