Python TCSPC (Time Correlated Single Photon Counting) FCS (Fluorescence Correlation Spectroscopy) data visualiser.
This is the source code repository for the FoCuS-point software. For full details please refer to the project website: FoCuS-point project page.
The latest and historical releases of the software and manual for Windows, Linux and OSX are available here: Releases.
FoCuS-point's correlation and fitting now continue in FoCuS-fit-JS, which runs in any web browser with nothing to install:
- Use it online: https://dwaithe.github.io/FCSfitJS/
- Source code: https://github.com/dwaithe/FCSfitJS
FoCuS-fit-JS correlates raw photon files (.pt3, .ptu, .pt2, .spc, .asc and time-tag .csv), shows the photon decay and intensity trace with lifetime gating, and fits correlated curves (.sin, .fcs, .csv) with the same models as FoCuS-point. It also includes the scanning FCS carpets of FoCuS-scan. Its correlator and fitting were tested against the results of this Python code, and it fixes the issue listed under Known issue below.
This repository is kept so that FoCuS-point continues to run on current versions of Python. It has only been updated to work with newer Python and libraries; what it calculates is unchanged.
FoCuS-point needs Python 3.9 or newer (tested with Python 3.11 and 3.13).
It is best installed in its own virtual environment, so that it does not change the packages other software relies on (FoCuS-point needs NumPy 2, for example, which some older packages cannot use). In a terminal:
python3 -m venv focus-env
source focus-env/bin/activate # Windows: focus-env\Scripts\activate
pip install git+https://github.com/dwaithe/FCS_point_correlator
python -m focuspoint.FCS_point_correlator
The next time, activate the environment again (source focus-env/bin/activate) and run the last line.
Or, from a copy of this repository (with the environment activated):
pip install -r requirements.txt
cd focuspoint
python FCS_point_correlator.py
Installing with pip compiles a small Cython routine that speeds up the correlation (focuspoint/fib4.pyx). This needs a C compiler (on macOS: xcode-select --install). Without one, FoCuS-point still installs and runs, and the correlator uses NumPy instead, with the same results.
The About window uses PyQtWebEngine if it is installed (pip install PyQtWebEngine); otherwise it shows its text in a plain Qt window.
Troubleshooting. ValueError: numpy.dtype size changed, may indicate binary incompatibility means a package built for NumPy 1 (often pandas, which lmfit uses if it is present) was found alongside NumPy 2: install FoCuS-point in a new virtual environment as above. An error that mentions focuspoint-0.1 or QtWebEngineWidgets comes from an old installation of FoCuS-point in that Python; remove it with pip uninstall focuspoint, or use a new virtual environment.
The code was last changed for Python 3.6-era libraries, and a number of things had stopped working. They have been fixed without changing what the software calculates. The correlation of the example file topfluorPE_2_1_1_1.pt3 is identical, value for value, to the output of the previous version.
- Installation:
setup.pycompiledfocuspoint/fib4.c, a file generated by Cython in 2015 that no longer compiles with current Python and NumPy, sopip installfailed. The routine is now built from its source,fib4.pyx(the old generatedfib4.cand the compiledfib4.soandfib4.pydfor old Python versions were removed), apyproject.tomldeclares the build tools, and the dependencies are listed in full (tifffilewas missing). Arequirements.txtis included. - Running:
python -m focuspoint.FCS_point_correlator(as previously documented) failed on Python 3. Both this andpython FCS_point_correlator.pyfrom thefocuspointfolder now work. - lmfit 1.0+:
report_errorsno longer exists in lmfit; the unused import was removed. - matplotlib 3.5+: the Qt4 backend was removed; FoCuS-point now uses the Qt5 backend throughout.
- NumPy 1.24+:
np.boolwas removed;boolis used instead. - NumPy 1.25+: comparing an array with an empty list (
array == []) now raises an error. This stopped files with three or more channels from loading, and stopped the plots after a fit. The checks now test for an empty list explicitly, with the same result as before. - tifffile:
tifffile.imsavewas removed;tifffile.imwriteis used to export intensity traces as TIFF. - Triplet equation 2B: fitting with two dark states failed with an error: in
fitting_methods_SE.pythe lineT1 = param['T2'].valueshould readT2 = .... The GS (neuron) model had the same mistake with two and with three dark states. Both are corrected; the triplet term now follows equation 2B for one, two and three dark states. - Parameter table, PB / GS / vesicle models: under Python 3, values typed into the parameter table for these models were silently replaced by the defaults (they were read back with
exec, which cannot set local variables in Python 3). They are now read as in the original Python 2 version. - SciPy and Qt WebEngine: the import of a private SciPy module used only for PyInstaller builds, and of Qt WebEngine, no longer stop FoCuS-point from starting if they are unavailable.
This was found while porting FoCuS-point to JavaScript. It is left as it is here, so that FoCuS-point gives the same results as it always has. FoCuS-fit-JS fixes it.
- Binning of photons that arrive at the same time. To reach long lag times, the correlator (Wahl, Gregor, Patting and Enderlein) merges photons into coarser time bins, and each bin should carry the total number of photons in it. The original MATLAB code relied on
uniquereturning the last occurrence of each value, as MATLAB did until R2013a;numpy.uniquereturns the first, so FoCuS-point shifts some weight between neighbouring bins and drops part of the last bin. OntopfluorPE_2_1_1_1.pt3, G(τ) changes by up to 0.012 (autocorrelation) and 0.015 (cross-correlation). FoCuS-fit-JS sums the weights exactly, and has a "FoCuS-point legacy binning" option that reproduces FoCuS-point's results.
Q: What data files does FoCuS-point support? A: FoCuS-point supports '.pt3' and '.ptu' uncorrelated files (and Becker & Hickl '.spc' and '.asc'), and under the fitting tab '.SIN' and '.fcs' correlated files and '.csv' files correlated in FoCuS-point's own format.
Q: I have data files which are not '.pt3' or any of the current formats, what can I do? A: Please try FoCuS-fit-JS, which reads more formats. You can also create an issue on GitHub.