Skip to main content

A Python module that implements the Numerical Analysis of Fundamental Frequencies (NAFF) algorithm

Project description

PyNAFF

Authors:

  • Foteini Asvesta (fasvesta .at. cern .dot. ch)
  • Nikos Karastathis (nkarast .at. cern .dot. ch)
  • Panagiotis Zisopoulos (pzisopou .at. cern .dot. ch)

A Python module that implements the Numerical Analysis of Fundamental Frequencies method of J. Laskar. The code works either as a script (as the original code of Laskar) or loaded as a module in Python/Julia code or jupyter-like notebooks (i.e. SWAN).

Installation:

The module is ported in PyPi so the user can simply run:

pip install --user PyNAFF

or from Git:

pip install --user git+https://github.com/nkarast/PyNAFF.git

Example of Usage

import PyNAFF as pnf
import numpy as np

t = np.linspace(1, 3000, num=3000, endpoint=True)
Q = 0.12345
signal = np.sin(2.0*np.pi*Q*t)


# Signature: pnf.naff(data, turns=300, nterms=1, skipTurns=0, getFullSpectrum=False, window=1)
# Docstring:
# The driving function for the NAFF algorithm.
# Inputs :
# *  data : NumPy array with TbT data
# *  turns : number of points to consider from the input data
# *  nterms : maximum number of harmonics to search for in the data sample
# *  skipTurns : number of observations (data points) to skip from the start of the input iterable
# *  getFullSpectrum : [True | False]
#                                   If True, a normal FFT is used (both negative and positive freq.)
#                                   If False, an rFFT is used (only positive frequencies)
# *  window : the order of window to be applied on the input data (default =1)
# Returns : Array with frequencies and amplitudes in the format:
#           [order of harmonic, frequency, Amplitude, Re{Amplitude}, Im{Amplitude}]

pnf.naff(signal, turns=500, nterms=1, skipTurns=0, getFullSpectrum=False, window=1)

# outputs an array of arrays for each frequency. Each sub-array includes:
# [order of harmonic, frequency, Amplitude, Re{Amplitude}, Im{Amplitude]


# My frequency is simply 
pnf.naff(signal, 500, 1, 0 , False)[0][1]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyNAFF-1.1.6.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

PyNAFF-1.1.6-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file PyNAFF-1.1.6.tar.gz.

File metadata

  • Download URL: PyNAFF-1.1.6.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for PyNAFF-1.1.6.tar.gz
Algorithm Hash digest
SHA256 cc57efadcd895f4af14be5de83bab83ecbd1fc481488a210ae81f57b7b0d3a5c
MD5 bd7f5213c2b0cf4834dbda787359be36
BLAKE2b-256 b4e475222b59bbf7ce98d7ce15a8d9699ad87ba72e18ebdac552c52f83df9bcd

See more details on using hashes here.

File details

Details for the file PyNAFF-1.1.6-py3-none-any.whl.

File metadata

  • Download URL: PyNAFF-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for PyNAFF-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c862aa8d4281332ff6809f721b3fdca5ff1008880bbe689c0d0e476578ccf65c
MD5 a5317df0c77424ee1d5a91f157a23b8d
BLAKE2b-256 de4b8a41628e48cd51d48ac8dce90b0c7a4ce870d50585bafb3b327adff9417b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page