Skip to main content

Fit exponential and harmonic functions using Chebyshev polynomials

Project description

Chebyfit is a Python library that implements the algorithms described in:

Analytic solutions to modelling exponential and harmonic functions using Chebyshev polynomials: fitting frequency-domain lifetime images with photobleaching. G C Malachowski, R M Clegg, and G I Redford. J Microsc. 2007; 228(3): 282-295. doi: 10.1111/j.1365-2818.2007.01846.x

Author:

Christoph Gohlke

License:

BSD 3-Clause

Version:

2022.8.26

Requirements

This release has been tested with the following requirements and dependencies (other versions may work):

Revisions

2022.8.26

  • Update metadata

  • Remove support for Python 3.7 (NEP 29).

2021.6.6

  • Fix compile error on Python 3.10.

  • Remove support for Python 3.6 (NEP 29).

2020.1.1

  • Remove support for Python 2.7 and 3.5.

2019.10.14

  • Support Python 3.8.

  • Fix numpy 1type FutureWarning.

2019.4.22

  • Fix setup requirements.

2019.1.28

  • Move modules into chebyfit package.

  • Add Python wrapper for _chebyfit C extension module.

  • Fix static analysis issues in _chebyfit.c.

Examples

Fit two-exponential decay function:

>>> deltat = 0.5
>>> t = numpy.arange(0, 128, deltat)
>>> data = 1.1 + 2.2 * numpy.exp(-t / 33.3) + 4.4 * numpy.exp(-t / 55.5)
>>> params, fitted = fit_exponentials(data, numexps=2, deltat=deltat)
>>> numpy.allclose(data, fitted)
True
>>> params['offset']
array([1.1])
>>> params['amplitude']
array([[4.4, 2.2]])
>>> params['rate']
array([[55.5, 33.3]])

Fit harmonic function with exponential decay:

>>> tt = t * (2 * math.pi / (t[-1] + deltat))
>>> data = 1.1 + numpy.exp(-t / 22.2) * (3.3 - 4.4 * numpy.sin(tt)
...                                          + 5.5 * numpy.cos(tt))
>>> params, fitted = fit_harmonic_decay(data, deltat=0.5)
>>> numpy.allclose(data, fitted)
True
>>> params['offset']
array([1.1])
>>> params['rate']
array([22.2])
>>> params['amplitude']
array([[3.3, 4.4, 5.5]])

Fit experimental time-domain image:

>>> data = numpy.fromfile('test.b&h', dtype='float32').reshape((256, 256, 256))
>>> data = data[64:64+64]
>>> params, fitted = fit_exponentials(data, numexps=1, numcoef=16, axis=0)
>>> numpy.allclose(data.sum(axis=0), fitted.sum(axis=0))
True

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

chebyfit-2022.8.26.tar.gz (15.9 kB view details)

Uploaded Source

Built Distributions

chebyfit-2022.8.26-pp38-pypy38_pp73-win_amd64.whl (28.2 kB view details)

Uploaded PyPy Windows x86-64

chebyfit-2022.8.26-cp311-cp311-win_amd64.whl (28.2 kB view details)

Uploaded CPython 3.11 Windows x86-64

chebyfit-2022.8.26-cp311-cp311-win32.whl (24.6 kB view details)

Uploaded CPython 3.11 Windows x86

chebyfit-2022.8.26-cp310-cp310-win_amd64.whl (28.2 kB view details)

Uploaded CPython 3.10 Windows x86-64

chebyfit-2022.8.26-cp310-cp310-win32.whl (24.6 kB view details)

Uploaded CPython 3.10 Windows x86

chebyfit-2022.8.26-cp39-cp39-win_amd64.whl (28.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

chebyfit-2022.8.26-cp39-cp39-win32.whl (24.6 kB view details)

Uploaded CPython 3.9 Windows x86

chebyfit-2022.8.26-cp38-cp38-win_amd64.whl (28.1 kB view details)

Uploaded CPython 3.8 Windows x86-64

chebyfit-2022.8.26-cp38-cp38-win32.whl (24.6 kB view details)

Uploaded CPython 3.8 Windows x86

File details

Details for the file chebyfit-2022.8.26.tar.gz.

File metadata

  • Download URL: chebyfit-2022.8.26.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for chebyfit-2022.8.26.tar.gz
Algorithm Hash digest
SHA256 1f88cabaa596ac570dab01c102b16614be3c850cf2d75b2008aeb5e4292be77c
MD5 3084db20d1832b9aee0b7094c7207059
BLAKE2b-256 448e92585025760a8cec842ed84d1d4954c7e72241c633ccb744d6b6e3b1cbe3

See more details on using hashes here.

File details

Details for the file chebyfit-2022.8.26-pp38-pypy38_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for chebyfit-2022.8.26-pp38-pypy38_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 0fbbe3f32bd219faed8ec09cdfd567e68d858fac2aa08c54b87f1373d9ed25ba
MD5 16a77ebc699c3ae4c53e2cfa879998f6
BLAKE2b-256 05f856a39e7a8de1c086713085a8c7d5949390b41f1d5cfe01e5352d0943afc3

See more details on using hashes here.

File details

Details for the file chebyfit-2022.8.26-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for chebyfit-2022.8.26-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a0b43e03d0ad6e47e70d209107b143f4a82f87164c39496cb5e9549a73bacbf8
MD5 5b3374b46c899faaeecb2bc7333b01ff
BLAKE2b-256 d49b18a338f75d3e58ca3a851e4336448168ba4dd8430a7026be1adb6f002edb

See more details on using hashes here.

File details

Details for the file chebyfit-2022.8.26-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for chebyfit-2022.8.26-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 9e3f393e75c38fbe2a223c56904c02880a0faded6a3c3f8fbb47f4f80ec15d26
MD5 a4a073b03849f08523f41a42db825017
BLAKE2b-256 810027b959cad256c82bef36fb69b681b689fb87c57fa91b09d6b1b8a8fe3892

See more details on using hashes here.

File details

Details for the file chebyfit-2022.8.26-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for chebyfit-2022.8.26-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e1d7ff85b5b02cd14abdf999057bcc1c3f1b64931e3d76695898723753b1b345
MD5 6c48200e9ad820e168ec8d4ff25d6d34
BLAKE2b-256 43f4d563b0a75049a0fe537c65ec07e4f3a2306159aeb22e0cb65c92a006c90e

See more details on using hashes here.

File details

Details for the file chebyfit-2022.8.26-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for chebyfit-2022.8.26-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 43675cc7765e3b5aa3e45072cc9b08c7bb16ee8f05b226d7b1e7f90c33414fbb
MD5 a6b182fc1dae915ef22568c5d6b707f7
BLAKE2b-256 714da97a4c0be925c8f35536d4cc0727136409156639528c28d0c1d3cb11c97e

See more details on using hashes here.

File details

Details for the file chebyfit-2022.8.26-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for chebyfit-2022.8.26-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 341f6e0423bfb3f7c7194cd699c7870a2a7ad40a664c0ed0969050d9c262a2da
MD5 f7eb9c686ac66684395b8d6f0f47e520
BLAKE2b-256 a3a02645df36763756e2d082d7449ae0081124a4533f064ab5511bc0ff288b66

See more details on using hashes here.

File details

Details for the file chebyfit-2022.8.26-cp39-cp39-win32.whl.

File metadata

  • Download URL: chebyfit-2022.8.26-cp39-cp39-win32.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for chebyfit-2022.8.26-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 ce2e2473309011d7118593bdc64c46fcc669bfb7e2c9b5ab9de4c1fc4eb67713
MD5 2b6f33e4c67794a5544f501406dbfa8e
BLAKE2b-256 f9d3fbcb25804e6b2a3a46b3252e47b8ffaa22b6d8f4e4b58426a4469c581214

See more details on using hashes here.

File details

Details for the file chebyfit-2022.8.26-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for chebyfit-2022.8.26-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c02a7bddc0afc28da5589c2a05d7078239cf10a956f5bc51150d264a80903cdf
MD5 71daae6e76cdfdab84e9f15fce7dc646
BLAKE2b-256 8547ea21f9a9b4f4e1c3958d805727a1923588b3422908431005083faa464265

See more details on using hashes here.

File details

Details for the file chebyfit-2022.8.26-cp38-cp38-win32.whl.

File metadata

  • Download URL: chebyfit-2022.8.26-cp38-cp38-win32.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for chebyfit-2022.8.26-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 db5cbaac80f968626c8faa814a0655ae11e600c59798dbb942c819a0696a677e
MD5 7c62f5d7faac928e1c06a79bd397223a
BLAKE2b-256 75be7f6cdfe4912c9f077d8d034357a8dec0a150ea0a411b6c802d007909ff41

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