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.9.29

Requirements

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

Revisions

2022.9.29

  • Add type hints.

  • Convert to Google style docstrings.

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.9.29.tar.gz (16.2 kB view details)

Uploaded Source

Built Distributions

chebyfit-2022.9.29-pp38-pypy38_pp73-win_amd64.whl (28.4 kB view details)

Uploaded PyPy Windows x86-64

chebyfit-2022.9.29-cp311-cp311-win_arm64.whl (22.4 kB view details)

Uploaded CPython 3.11 Windows ARM64

chebyfit-2022.9.29-cp311-cp311-win_amd64.whl (28.4 kB view details)

Uploaded CPython 3.11 Windows x86-64

chebyfit-2022.9.29-cp311-cp311-win32.whl (24.8 kB view details)

Uploaded CPython 3.11 Windows x86

chebyfit-2022.9.29-cp310-cp310-win_amd64.whl (28.4 kB view details)

Uploaded CPython 3.10 Windows x86-64

chebyfit-2022.9.29-cp310-cp310-win32.whl (24.8 kB view details)

Uploaded CPython 3.10 Windows x86

chebyfit-2022.9.29-cp39-cp39-win_amd64.whl (28.4 kB view details)

Uploaded CPython 3.9 Windows x86-64

chebyfit-2022.9.29-cp39-cp39-win32.whl (24.8 kB view details)

Uploaded CPython 3.9 Windows x86

chebyfit-2022.9.29-cp38-cp38-win_amd64.whl (28.4 kB view details)

Uploaded CPython 3.8 Windows x86-64

chebyfit-2022.9.29-cp38-cp38-win32.whl (24.8 kB view details)

Uploaded CPython 3.8 Windows x86

File details

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

File metadata

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

File hashes

Hashes for chebyfit-2022.9.29.tar.gz
Algorithm Hash digest
SHA256 b17043881fb26b9f0cee5ee016298240a9b70e0c9ca20aeffd3ce45f7d675e7d
MD5 b7ece7df1076ef4b73fd011cc322a715
BLAKE2b-256 3c4920fd15a15eef5007ae5ee7223c7fda4e16ac2b99b6d1d07cedd00b7c3152

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chebyfit-2022.9.29-pp38-pypy38_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 e332966a5bf9498a3c2906118f00dc446fda22f1f77dca6332007f4c268b10f7
MD5 74d5abef170390cbd74605f051c14737
BLAKE2b-256 9fa09bd5fc77791e9d270c5526cc4707855ef701235de14afca0fd85d10a4d58

See more details on using hashes here.

File details

Details for the file chebyfit-2022.9.29-cp311-cp311-win_arm64.whl.

File metadata

File hashes

Hashes for chebyfit-2022.9.29-cp311-cp311-win_arm64.whl
Algorithm Hash digest
SHA256 7a5b50841b2c81f9f726c112793bd06846940f3911376a06d13fe291bed2c70e
MD5 8fc1c1fef77e24f1372ab0926f12f6d0
BLAKE2b-256 a9cfb61f7a1ddbcbbeada0ceba5ed77e9f64c34ca553b2992f3a057547d2b3cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chebyfit-2022.9.29-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b30c86a11eccba260357900724891fb4e30b86ae27ec73f1b584fe422a30a545
MD5 2b09f24a053aed07f1d64a88dfdaabba
BLAKE2b-256 14c82e1dc25e1a006adcff2ec9754968d2f7ec2c592f91fae3f845fae58f345b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chebyfit-2022.9.29-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 f1dd56f190228b4c48939d962fbc3541f95d9f1a40c309ec9f08187836325764
MD5 791a534b2a1dc075753eaf22c33088f1
BLAKE2b-256 1842c485b8071dd5960f946fb025b0fa8d30afa9b1d6465470ec36b08b57e98c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chebyfit-2022.9.29-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 506c58a0eb207fe757905391b422583b952f5eafdf2fda40092f6e808b7a68e9
MD5 58d5534ef581f740c8488df0490e28d0
BLAKE2b-256 c5b3b5184185b10392557a668e6972f2714defd3190bd15dcb63f5ec387e21b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chebyfit-2022.9.29-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 041e9637ee661c2359021a015c4bb540c914cba60413f6efe1c5f9d1844de2b9
MD5 c57474bedd59a6f884b023fb2c12b077
BLAKE2b-256 93dd8798b475fd62d0a2e2ddb88b028f9ccb724ac3a0fc04f6f7f8b24fe2ffd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chebyfit-2022.9.29-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 52f9b1ab9716b41f9abe5f0c7b560a2790827f3ffb3f348b912bc273b08823e6
MD5 d3251a73f00975f5ad1d3871f461cf60
BLAKE2b-256 2886737b8db1a86dbf7fe17b10e7100e5541a598e8f9b3de29e69043cb8e1d26

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for chebyfit-2022.9.29-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 ca6d1d64251232d04a4addd8729538a2183f55654ec66c6f59f11e7819b51004
MD5 14c1d37748afc922a7ac2bf4d4547e25
BLAKE2b-256 fa7d98fec2f3d66c4755ddb558dfb45288667b0255095ed2db3635f9f7ae8896

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chebyfit-2022.9.29-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 aa7a3d011448b438b9f968f6565ba457a87cd0985b8aaa356ea50f963e64688b
MD5 60388be3dd96ab934f1f85e5185b5fec
BLAKE2b-256 128ad7b3239eb099c70e407edc4140280fe5dbc3ddb19698d6eed740f28e2894

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for chebyfit-2022.9.29-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 1d4f6b7f732fffa0b80ba570d4d90abb4bba937045fddc15bf4f72c6ea602efa
MD5 b5fa21ad52901cc995ebe2e915ba7183
BLAKE2b-256 6268046ce289bf60c5c6e7e303dc19d4fa0fa62fdbcfa8369b88b3182a24a50b

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