Skip to content

Add ptu support and pyproject.toml, deprecate cython#213

Merged
paulmueller merged 1 commit intoFCS-analysis:mainfrom
tsbischof:add-ptu-support
Jan 19, 2026
Merged

Add ptu support and pyproject.toml, deprecate cython#213
paulmueller merged 1 commit intoFCS-analysis:mainfrom
tsbischof:add-ptu-support

Conversation

@tsbischof
Copy link
Collaborator

Closes #204, Closes #208, Closes #84

A user requested the ability to load ptu (t2) files from a PicoQuant PicoHarp. The test suite covers HydraHarp (t2, t3) and PicoHarp (t2) but the code should be as general as the underlying ptufile package.

In the process of setting this up I debugged a bit and made a few changes:

  • rewrite fib4.pyx as fib4.py, which deprecates cython
  • bump minimum Python version to 3.11 to support ptufile
  • migrated from setup.py to pyproject.toml (tested on Linux)
  • set up tox.ini for running the test suite
  • set up ruff, ty, and codespell placeholders for gradual linting (remove the exclusions as desired)
  • fix some stray numpy bugs (np.float_ deprecation)
  • remove distutils due to deprecation in Python 3.12
  • do version generation through setuptools_scm
  • ensure the test suite fully passes for all versions supported
  • ensure the CI check stage works up through testing

Deprecating cython

There was only one function that required cython. I have replaced it with a pure numpy implementation that seems to perform equivalently and gets the same results for both random and test data.

In tests/test_file_format.py:test_pt3_basic the behavior is the same as before (expected 2037 is actually 2037.5) but I have no insight as to why that happened in the first place. The correlation data (last two lines of that test) pass on my machine though. So all I can say is that no observable behavior has changed for loading pt3 or running dividAndConquer, not that the trace value is actually correct.

Broken

I had to disable the checks for the execution of the macos and windows apps for now. With macos the main issue is that the matplotlib font cache is taking forever to run, so either there is a speedup I am missing or we just need to cache it. So the actual gui might be broken there but I have confirmed it works on Linux

I made no attempt to fix the downstream CI stages for github and PyPI

@tsbischof tsbischof force-pushed the add-ptu-support branch 2 times, most recently from 9bba109 to 13159e5 Compare January 16, 2026 13:47
A user requested the ability to load ptu (t2) files from a PicoQuant PicoHarp.
The test suite covers HydraHarp (t2, t3) and PicoHarp (t2) but the code should
be as general as the underlying ptufile package.

In the process of setting this up I debugged a bit and made a few changes:

* rewrite fib4.pyx as fib4.py, which deprecates cython
* bump minimum Python version to 3.11 to support ptufile
* migrated from setup.py to pyproject.toml (tested on Linux)
* set up tox.ini for running the test suite
* set up ruff, ty, and codespell placeholders for gradual linting
  (remove the exclusions as desired)
* fix some stray numpy bugs (np.float_ deprecation)
* remove distutils due to deprecation in Python 3.12
* do version generation through setuptools_scm
* ensure the test suite fully passes for all versions supported
* ensure the CI check stage works up through testing

Deprecating cython

There was only one function that required cython. I have replaced it with a
pure numpy implementation that seems to perform equivalently and gets the same
results for both random and test data.

In tests/test_file_format.py:test_pt3_basic the behavior is the same as before
(expected 2037 is actually 2037.5) but I have no insight as to why that
happened in the first place. The correlation data (last two lines of that test)
pass on my machine though. So all I can say is that no observable behavior has
changed for loading pt3 or running dividAndConquer, not that the trace value is
actually correct.
@tsbischof
Copy link
Collaborator Author

A user on Windows (anaconda, Python 3.13) reports that the app works

@paulmueller paulmueller merged commit 337a0ec into FCS-analysis:main Jan 19, 2026
3 of 4 checks passed
@paulmueller
Copy link
Member

Thank you for the heavy lifting ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use importlib instead of imp module on Python3.12 Drop Cython Picoquant 64-bit .ptu file support

2 participants