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:

2023.4.22

Quickstart

Install the chebyfit package and all dependencies from the Python Package Index:

python -m pip install -U chebyfit

See Examples for using the programming interface.

Source code and support are available on GitHub.

Requirements

This revision was tested with the following requirements and dependencies (other versions may work):

Revisions

2023.4.22

  • Drop support for Python 3.8 and numpy < 1.21 (NEP29).

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

Uploaded Source

Built Distributions

chebyfit-2023.4.22-pp39-pypy39_pp73-win_amd64.whl (28.8 kB view details)

Uploaded PyPy Windows x86-64

chebyfit-2023.4.22-cp311-cp311-win_arm64.whl (22.5 kB view details)

Uploaded CPython 3.11 Windows ARM64

chebyfit-2023.4.22-cp311-cp311-win_amd64.whl (27.9 kB view details)

Uploaded CPython 3.11 Windows x86-64

chebyfit-2023.4.22-cp311-cp311-win32.whl (24.5 kB view details)

Uploaded CPython 3.11 Windows x86

chebyfit-2023.4.22-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (68.4 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

chebyfit-2023.4.22-cp311-cp311-macosx_11_0_arm64.whl (28.7 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

chebyfit-2023.4.22-cp311-cp311-macosx_10_9_x86_64.whl (32.2 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

chebyfit-2023.4.22-cp310-cp310-win_amd64.whl (27.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

chebyfit-2023.4.22-cp310-cp310-win32.whl (24.5 kB view details)

Uploaded CPython 3.10 Windows x86

chebyfit-2023.4.22-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (67.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

chebyfit-2023.4.22-cp310-cp310-macosx_11_0_arm64.whl (28.7 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

chebyfit-2023.4.22-cp310-cp310-macosx_10_9_x86_64.whl (32.2 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

chebyfit-2023.4.22-cp39-cp39-win_amd64.whl (27.9 kB view details)

Uploaded CPython 3.9 Windows x86-64

chebyfit-2023.4.22-cp39-cp39-win32.whl (24.5 kB view details)

Uploaded CPython 3.9 Windows x86

chebyfit-2023.4.22-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (67.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

chebyfit-2023.4.22-cp39-cp39-macosx_11_0_arm64.whl (28.7 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

chebyfit-2023.4.22-cp39-cp39-macosx_10_9_x86_64.whl (32.2 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: chebyfit-2023.4.22.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for chebyfit-2023.4.22.tar.gz
Algorithm Hash digest
SHA256 edd636ee0cb1df0e6e8e37330fa199253240afd477e5bd2f9f1dc2c5a5eeae2f
MD5 b77823b2909df6b2b79ee6a050a0f56c
BLAKE2b-256 380d44f60cd002f01239827071a9f488c2ddf563976bbb1f8eca5de7a2f9177d

See more details on using hashes here.

File details

Details for the file chebyfit-2023.4.22-pp39-pypy39_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for chebyfit-2023.4.22-pp39-pypy39_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 2a776ed77c061250993748637d4bd0857bd2188b838f7569919a5c61f4d9636a
MD5 a3a50f8192d948ee366a1818fdeac2d0
BLAKE2b-256 a26212149b117799b968ae2c7d8aee3eb284c8c8d6bfce05b01b7eeb3c938b25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp311-cp311-win_arm64.whl
Algorithm Hash digest
SHA256 cb39c40bbc3de0f85a0d6628a0d657ff2e2d009261acf40629c33b02bd6bb422
MD5 85c40a310969e355e30d1a08ab7ef517
BLAKE2b-256 31adb4b5686030976f71cc3d667ec2bd9090bdeab58bd2dd15ea36e295372780

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1374dd6b6a743bff75595824e4685431ad7883966106639f8a3eeb3a3923925c
MD5 51fa07f0ead9bc3a188c734c184a350b
BLAKE2b-256 2dfef674bd05620ceffff63ea7413f13e1838ae171d93bb2d065ae6f4a185b79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 aa6e1337e193c9a6aca91fde31737e82fd9ae4c0c860934bb9f85fdb55ca3524
MD5 02b82567c063bd0aaec19a1f2d5c1be3
BLAKE2b-256 330eb62cb59ea9296a6aae73bc2847f7624378cc8ab397c93871fcf069baa756

See more details on using hashes here.

File details

Details for the file chebyfit-2023.4.22-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08a686cfced8e29d499ddc144dc9b58f3cf2d18fe808e6d952dde7f84bd30ebd
MD5 264393fbd924b3ee4054e34d8e6ee7b9
BLAKE2b-256 ad8f87bebf8f3fbf72b3dc672d936d4772875ed5d08e9cab88e30c8965d4414b

See more details on using hashes here.

File details

Details for the file chebyfit-2023.4.22-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ce7904cc87a390d4e7d6a01bba783c86b3fbd20c0f21f3678933cff989e9420
MD5 35a7154355206bd200316131396a72f2
BLAKE2b-256 3803b055b734457261b9c09eb8833cad778a4979cba9a1a56ebb51e1e6032763

See more details on using hashes here.

File details

Details for the file chebyfit-2023.4.22-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5aaf6efb5154af7037bc52bcbdbe1df764914e71f72d8b05f15ad8e932766158
MD5 e3d0e223d9e02bcce9c4ebd5074d9227
BLAKE2b-256 804c4510c95043003ea596b0f46e723bf44083c28da7d2057d9c38077e4ca6c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 03a920b42f9ff31cd80a870bd1a57ab6c586478165f29eca2fb5b59ab56afa66
MD5 36d6b9a8062ef0e7a550435b6c63da10
BLAKE2b-256 fefd33077cfcb42c6352ee835ebda354bef45cc83e420b88d79232af338e1398

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 9addbad013b470af046c29037976b815c8ea7e49dcfd103920ad42127f260e16
MD5 105795f42230c392f5573322d11eeeaf
BLAKE2b-256 fb68bb8d4189ead7327efb61e535b3642c98388bf0973d499461b82ae14ad637

See more details on using hashes here.

File details

Details for the file chebyfit-2023.4.22-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0b1e1f96014ddb92e53b4d769e03a1cddd8892e5938992134a765cb34729ffc0
MD5 1a85cdefd5614c59a5adaf27ab7a8ba1
BLAKE2b-256 908eef000a93afea58e36b7a71b44d1e128e1f9c852f687b1948d781edb1cb8e

See more details on using hashes here.

File details

Details for the file chebyfit-2023.4.22-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e24fd760a0e7d3f59e7c2af6f27c4738a7ac03ee5ba2a76f9d406c1593ea325e
MD5 8c19eb9e1906a1f9819836fd5c9f60ae
BLAKE2b-256 e29670f52c7510e172eb1550bb9e4ac734e5602b6dd70da2653351ba28e6b1ba

See more details on using hashes here.

File details

Details for the file chebyfit-2023.4.22-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c17a27af642711cdc1545adff86ed3388e002f5b914d13bdcad3a7d16c21105e
MD5 99821498e57708227aa435916d2c723b
BLAKE2b-256 7f4ea7bee86cf6a62e9c17563bf8181bbcf0e2d29ba9ce91a3836cb66de1d687

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 58bfde7edb4f56d9123549da9394766542f517dcb112f31ee0aff31faaafa117
MD5 3494894ebecd5282a2c5081a3073d114
BLAKE2b-256 e72719e1549ef9c439b123c294c76d83d052c601760d383f279dccb15a7e7a1d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chebyfit-2023.4.22-cp39-cp39-win32.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for chebyfit-2023.4.22-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 e7fc34dd5529f4411e2b24968e192633040f29a1ff1de77a06daaad39298d8be
MD5 e28606f2e20ae80e461a9434807c52e5
BLAKE2b-256 d8db78b5b84aa82b88f8c3a429ca961b5d41276ca7fd60fed41b69920012869c

See more details on using hashes here.

File details

Details for the file chebyfit-2023.4.22-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3c8b23a4859738d6c712b05cc1ef227e058f5377ec834b7151c9522b3a57299f
MD5 36d937e5bab2f5e918eb0a91c4a84155
BLAKE2b-256 7ded4b1224f9798e363b4ddaf3f2773be488a04a23e408fb954e561a8e582d57

See more details on using hashes here.

File details

Details for the file chebyfit-2023.4.22-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48f0e0e18808c0982d87158e8a9a26a3ced0f5c126bef209754f7f80cc819069
MD5 64f21fec247ab211cd2845a651892074
BLAKE2b-256 1d6c0690c511812f25d4d4e718c50f96d390126184f6d5ee862beb7a2e0761b7

See more details on using hashes here.

File details

Details for the file chebyfit-2023.4.22-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for chebyfit-2023.4.22-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b7f8b96324eb26972223bb31b474deaa89d0b03ce071199b4968617499404b30
MD5 a0aaddf47a71247d1e6d09892af975b9
BLAKE2b-256 8a68eeff30d6adccf35e28ab3d8612f0c2f0badcb96bfd339415d5b630b57103

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