# 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](http://www.sciencedirect.com/science/article/pii/001910359090084M).
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](https://pypi.org/project/PyNAFF/) so the user can simply run:
```bash
pip install --user PyNAFF
```
or from Git:
```bash
pip install --user git+https://github.com/nkarast/PyNAFF.git
```
## Example of Usage
```python
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]
```
Raw data
{
"_id": null,
"home_page": "https://github.com/nkarast/PyNAFF",
"name": "PyNAFF",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "NAFF,FREQUENCY ANALYSIS",
"author": "Nikos Karastathis",
"author_email": "nkarast@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b4/e4/75222b59bbf7ce98d7ce15a8d9699ad87ba72e18ebdac552c52f83df9bcd/PyNAFF-1.1.6.tar.gz",
"platform": null,
"description": "# PyNAFF\n\nAuthors:\n\n* Foteini Asvesta (fasvesta .at. cern .dot. ch)\n* Nikos Karastathis (nkarast .at. cern .dot. ch)\n* Panagiotis Zisopoulos (pzisopou .at. cern .dot. ch)\n\nA Python module that implements the [Numerical Analysis of Fundamental Frequencies method of J. Laskar](http://www.sciencedirect.com/science/article/pii/001910359090084M).\nThe 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).\n\n\n## Installation:\n\nThe module is ported in [PyPi](https://pypi.org/project/PyNAFF/) so the user can simply run:\n\n```bash\npip install --user PyNAFF\n```\n\nor from Git:\n```bash\npip install --user git+https://github.com/nkarast/PyNAFF.git\n```\n\n\n## Example of Usage\n```python\nimport PyNAFF as pnf\nimport numpy as np\n\nt = np.linspace(1, 3000, num=3000, endpoint=True)\nQ = 0.12345\nsignal = np.sin(2.0*np.pi*Q*t)\n\n\n# Signature: pnf.naff(data, turns=300, nterms=1, skipTurns=0, getFullSpectrum=False, window=1)\n# Docstring:\n# The driving function for the NAFF algorithm.\n# Inputs :\n# * data : NumPy array with TbT data\n# * turns : number of points to consider from the input data\n# * nterms : maximum number of harmonics to search for in the data sample\n# * skipTurns : number of observations (data points) to skip from the start of the input iterable\n# * getFullSpectrum : [True | False]\n# If True, a normal FFT is used (both negative and positive freq.)\n# If False, an rFFT is used (only positive frequencies)\n# * window : the order of window to be applied on the input data (default =1)\n# Returns : Array with frequencies and amplitudes in the format:\n# [order of harmonic, frequency, Amplitude, Re{Amplitude}, Im{Amplitude}]\n\npnf.naff(signal, turns=500, nterms=1, skipTurns=0, getFullSpectrum=False, window=1)\n\n# outputs an array of arrays for each frequency. Each sub-array includes:\n# [order of harmonic, frequency, Amplitude, Re{Amplitude}, Im{Amplitude]\n\n\n# My frequency is simply \npnf.naff(signal, 500, 1, 0 , False)[0][1]\n\n```\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "A Python module that implements the Numerical Analysis of Fundamental Frequencies (NAFF) algorithm",
"version": "1.1.6",
"project_urls": {
"Homepage": "https://github.com/nkarast/PyNAFF"
},
"split_keywords": [
"naff",
"frequency analysis"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "de4b8a41628e48cd51d48ac8dce90b0c7a4ce870d50585bafb3b327adff9417b",
"md5": "a5317df0c77424ee1d5a91f157a23b8d",
"sha256": "c862aa8d4281332ff6809f721b3fdca5ff1008880bbe689c0d0e476578ccf65c"
},
"downloads": -1,
"filename": "PyNAFF-1.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a5317df0c77424ee1d5a91f157a23b8d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 18250,
"upload_time": "2023-12-06T13:34:25",
"upload_time_iso_8601": "2023-12-06T13:34:25.078401Z",
"url": "https://files.pythonhosted.org/packages/de/4b/8a41628e48cd51d48ac8dce90b0c7a4ce870d50585bafb3b327adff9417b/PyNAFF-1.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b4e475222b59bbf7ce98d7ce15a8d9699ad87ba72e18ebdac552c52f83df9bcd",
"md5": "bd7f5213c2b0cf4834dbda787359be36",
"sha256": "cc57efadcd895f4af14be5de83bab83ecbd1fc481488a210ae81f57b7b0d3a5c"
},
"downloads": -1,
"filename": "PyNAFF-1.1.6.tar.gz",
"has_sig": false,
"md5_digest": "bd7f5213c2b0cf4834dbda787359be36",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17633,
"upload_time": "2023-12-06T13:34:26",
"upload_time_iso_8601": "2023-12-06T13:34:26.184244Z",
"url": "https://files.pythonhosted.org/packages/b4/e4/75222b59bbf7ce98d7ce15a8d9699ad87ba72e18ebdac552c52f83df9bcd/PyNAFF-1.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-06 13:34:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nkarast",
"github_project": "PyNAFF",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "numpy",
"specs": [
[
"~=",
"1.25.0"
]
]
},
{
"name": "setuptools",
"specs": [
[
"~=",
"65.5.1"
]
]
}
],
"lcname": "pynaff"
}