跳转到主要内容

使用切比雪夫多项式拟合指数和调和函数

项目描述

Chebyfit是一个Python库,实现了以下论文中描述的算法:

使用切比雪夫多项式建模指数和调和函数的解析解:使用光漂白拟合频域寿命图像。G C Malachowski, R M Clegg, 和 G I Redford. J Microsc. 2007; 228(3): 282-295. doi: 10.1111/j.1365-2818.2007.01846.x

作者:

Christoph Gohlke

许可证:

BSD 3-Clause

版本:

2024.5.24

快速入门

Python包索引安装chebyfit包及其所有依赖项

python -m pip install -U chebyfit

请参阅示例了解如何使用编程接口。

源代码和支持可在GitHub上找到。

需求

此修订版已测试以下需求和相关依赖项(其他版本可能也适用)

修订版

2024.5.24

  • 修复GitHub上docstring示例未正确渲染的问题。

2024.4.24

  • 支持NumPy 2。

2024.1.6

  • 支持Python 3.12。

2023.4.22

  • 取消支持Python 3.8和numpy < 1.21 (NEP29)。

2022.9.29

  • 添加类型提示。

  • 转换为Google风格docstrings。

2022.8.26

  • 更新元数据。

  • 取消支持Python 3.7 (NEP 29)。

2021.6.6

  • 修复Python 3.10上的编译错误。

  • 取消支持Python 3.6 (NEP 29)。

2020.1.1

  • 取消支持Python 2.7和3.5。

2019.10.14

  • 支持Python 3.8。

  • 修复numpy 1type FutureWarning。

2019.4.22

  • 修复setup要求。

2019.1.28

  • 将模块移动到chebyfit包中。

  • 为_chebyfit C扩展模块添加Python包装器。

  • 修复了_chebyfit.c中的静态分析问题。

示例

拟合双指数衰减函数

>>> 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]])

拟合具有指数衰减的谐波函数

>>> 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]])

拟合实验时域图像

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

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

chebyfit-2024.5.24.tar.gz (18.0 kB 查看哈希值)

上传时间 源代码

构建分发

chebyfit-2024.5.24-cp312-cp312-win_arm64.whl (23.5 kB 查看哈希值)

上传时间 CPython 3.12 Windows ARM64

chebyfit-2024.5.24-cp312-cp312-win_amd64.whl (28.8 kB 查看哈希值)

上传时间 CPython 3.12 Windows x86-64

chebyfit-2024.5.24-cp312-cp312-win32.whl (25.6 kB 查看哈希值)

上传时间 CPython 3.12 Windows x86

chebyfit-2024.5.24-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (71.2 kB 查看哈希值)

上传时间 CPython 3.12 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

chebyfit-2024.5.24-cp312-cp312-macosx_11_0_arm64.whl (30.0 kB 查看哈希值)

上传时间 CPython 3.12 macOS 11.0+ ARM64

chebyfit-2024.5.24-cp312-cp312-macosx_10_9_x86_64.whl (33.5 kB 查看哈希值)

上传时间 CPython 3.12 macOS 10.9+ x86-64

chebyfit-2024.5.24-cp311-cp311-win_arm64.whl (23.4 kB 查看哈希值)

上传于 CPython 3.11 Windows ARM64

chebyfit-2024.5.24-cp311-cp311-win_amd64.whl (28.8 kB 查看哈希)

上传于 CPython 3.11 Windows x86-64

chebyfit-2024.5.24-cp311-cp311-win32.whl (25.5 kB 查看哈希)

上传于 CPython 3.11 Windows x86

chebyfit-2024.5.24-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (70.3 kB 查看哈希)

上传于 CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

chebyfit-2024.5.24-cp311-cp311-macosx_11_0_arm64.whl (29.9 kB 查看哈希)

上传于 CPython 3.11 macOS 11.0+ ARM64

chebyfit-2024.5.24-cp311-cp311-macosx_10_9_x86_64.whl (33.4 kB 查看哈希)

上传于 CPython 3.11 macOS 10.9+ x86-64

chebyfit-2024.5.24-cp310-cp310-win_amd64.whl (28.8 kB 查看哈希)

上传于 CPython 3.10 Windows x86-64

chebyfit-2024.5.24-cp310-cp310-win32.whl (25.5 kB 查看哈希)

上传于 CPython 3.10 Windows x86

chebyfit-2024.5.24-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (69.5 kB 查看哈希)

上传于 CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

chebyfit-2024.5.24-cp310-cp310-macosx_11_0_arm64.whl (29.9 kB 查看哈希)

上传于 CPython 3.10 macOS 11.0+ ARM64

chebyfit-2024.5.24-cp310-cp310-macosx_10_9_x86_64.whl (33.4 kB 查看哈希)

上传于 CPython 3.10 macOS 10.9+ x86-64

chebyfit-2024.5.24-cp39-cp39-win_amd64.whl (28.8 kB 查看哈希值)

上传于 CPython 3.9 Windows x86-64

chebyfit-2024.5.24-cp39-cp39-win32.whl (25.5 kB 查看哈希值)

上传于 CPython 3.9 Windows x86

chebyfit-2024.5.24-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (69.2 kB 查看哈希值)

上传于 CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

chebyfit-2024.5.24-cp39-cp39-macosx_11_0_arm64.whl (29.9 kB 查看哈希值)

上传于 CPython 3.9 macOS 11.0+ ARM64

chebyfit-2024.5.24-cp39-cp39-macosx_10_9_x86_64.whl (33.4 kB 查看哈希值)

上传于 CPython 3.9 macOS 10.9+ x86-64

由以下机构支持