Fit gradient orthogonal Q-polynomials to 2D data
Project description
Scikit-Qfit is a package that supports fitting gradient orthogonal Q-polynomials to 2D data.
Description
This package implements the algorithm described in:
G W Fobes, Fitting freeform shapes with orthogonal bases, Opt. Express 21, 19061-19081 (2013)
Additional project documentation and references for Q- freeform polynomials can be found at: http://scikit-qfit.readthedocs.org/.
Installation
The package can be installed through pip:
> pip install scikit-qfit
Usage
To generate a Q-freeform spectrum from a data map, pass the coordinate arrays x and y and 2-D array of data with shape (x.size,y.size) as arguments to the method qspec(). The azimuthal and radial spectrum limits are set by m_max and n_max respectively.
>>> import skqfit.qspectre as qf >>> ... >>> qspec = qf.qspec(x, y, zmap, m_max=500, n_max=500)
To observe the contribution of spectrum components it is necessary to use the sine and cosine elements in the forward processing step. After modifying the spectrum, an inverse process creates a data map along with the x and y derivatives.
>>> qs = qf.QSpectrum() >>> qs.data_map(x, y, zmap) >>> a_nm, b_nm = qs.q_fit(mmax, nmax) >>> ... # modify spectrum >>> nmap, dfdx, dfdy = qs.build_map(x, y, a_nm, b_nm, inc_deriv=True)
A 1D trace across the fitted data can also be generated by passing a set of xv, yv arrays that represent the (x, y) coordinates.
>>> zv, dfdx, dfdy = qs.build_profile(xv, yv, a_nm, b_nm, inc_deriv=True)
Limitations
The Jacobian polynomial calculation required by the algorithm can generate very large numbers which limits spectral resolution to a maximum of 1500 for the radial and azimuthal terms (n, m). Using values greater than this can lead to an overflow. If the nominal spectral resolution for a datamap is greater than this limit the data should be filtered prior to processing to avoid aliasing.
Note that the process is an N^2 algorithm, so doubling the number of radial and azimuthal terms takes four times as long.
Dependencies
The package requires numpy and scipy and was tested on Linux with:
Python 2.7.6
numpy 1.14.5
scipy 1.0.0
These python, numpy and scipy versions were available on the Ubuntu 18.04 Linux release at the time of testing. The package has been informally tested with python 3.6 successfully and I am not aware of reason it should not work with later releases of these packages.
Acknowledge
Greg Forbes for support with the implementation and validation of the algorithm.
Andreas Beutler, Mahr GmbH, for choosing to make this work available as open source.
Note
This project has been set up using PyScaffold 3.2.1. For details and usage information on PyScaffold see https://pyscaffold.org/.
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
Built Distribution
File details
Details for the file Scikit-Qfit-0.1.5.tar.gz
.
File metadata
- Download URL: Scikit-Qfit-0.1.5.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17f719f8482ef336c7cd4e492b8ee61f8972b3c58be9c106db8595485dc6236e |
|
MD5 | 37f1532a84641e48422e37159742fbf1 |
|
BLAKE2b-256 | d2d5e45979c6c8e07b313273c198800848036b6b98fee1252cf78bca7765e531 |
File details
Details for the file Scikit_Qfit-0.1.5-py2.py3-none-any.whl
.
File metadata
- Download URL: Scikit_Qfit-0.1.5-py2.py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 895f2b7b6bd482b78ec41fe6818884a7194a229d3ff183ed4a4ffd97be0e804f |
|
MD5 | 82ff7dec17339870c25a32f87dbe9b65 |
|
BLAKE2b-256 | fb4b5298a71005854b7b5c2802c3cb10e690ecbf6fbc94b6f296d9fc84f4ffb1 |