phasorpy 0.7__cp314-cp314-macosx_10_13_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
phasorpy/utils.py ADDED
@@ -0,0 +1,172 @@
1
+ """Utility functions.
2
+
3
+ The ``phasorpy.utils`` module provides auxiliary and convenience functions
4
+ that do not fit naturally into other modules.
5
+
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ __all__ = [
11
+ 'logger',
12
+ 'number_threads',
13
+ 'versions',
14
+ ]
15
+
16
+ import logging
17
+ import os
18
+
19
+
20
+ def logger() -> logging.Logger:
21
+ """Return PhasorPy logger instance.
22
+
23
+ Returns
24
+ -------
25
+ logging.Logger
26
+ Logger instance for 'phasorpy' namespace.
27
+
28
+ Examples
29
+ --------
30
+ >>> logger().info('This is a log message')
31
+
32
+ """
33
+ return logging.getLogger('phasorpy')
34
+
35
+
36
+ def number_threads(
37
+ num_threads: int | None = None,
38
+ max_threads: int | None = None,
39
+ /,
40
+ ) -> int:
41
+ """Return number of threads for parallel computations across CPU cores.
42
+
43
+ This function is used to parse ``num_threads`` parameters.
44
+
45
+ Parameters
46
+ ----------
47
+ num_threads : int, optional
48
+ Number of threads to use for parallel computations on CPU cores.
49
+ If None (default), return 1, disabling multi-threading.
50
+ If greater than zero, return value up to `max_threads` if set.
51
+ If zero, return the value of the ``PHASORPY_NUM_THREADS`` environment
52
+ variable if set, else half the CPU cores up to `max_threads` or 32.
53
+ max_threads : int, optional
54
+ Maximum number of threads to return.
55
+
56
+ Returns
57
+ -------
58
+ int
59
+ Number of threads for parallel computations.
60
+
61
+ Examples
62
+ --------
63
+ >>> number_threads()
64
+ 1
65
+ >>> number_threads(0) # doctest: +SKIP
66
+ 8 # actual value depends on system
67
+
68
+ """
69
+ if num_threads is None or num_threads < 0:
70
+ # disable multi-threading by default
71
+ return 1
72
+ if num_threads == 0:
73
+ # return default number of threads
74
+ if max_threads is None:
75
+ max_threads = 32
76
+ else:
77
+ max_threads = max(max_threads, 1)
78
+ if 'PHASORPY_NUM_THREADS' in os.environ:
79
+ return min(
80
+ max_threads, max(1, int(os.environ['PHASORPY_NUM_THREADS']))
81
+ )
82
+ cpu_count: int | None
83
+ if hasattr(os, 'sched_getaffinity'):
84
+ cpu_count = len(os.sched_getaffinity(0))
85
+ else:
86
+ # sched_getaffinity not available on Windows
87
+ cpu_count = os.cpu_count()
88
+ if cpu_count is None:
89
+ return 1
90
+ return min(max_threads, max(1, cpu_count // 2))
91
+ # return num_threads up to max_threads
92
+ if max_threads is None:
93
+ return num_threads
94
+ return min(num_threads, max(max_threads, 1))
95
+
96
+
97
+ def versions(
98
+ *, sep: str = '\n', dash: str = '-', verbose: bool = False
99
+ ) -> str:
100
+ """Return version information for PhasorPy and its dependencies.
101
+
102
+ Parameters
103
+ ----------
104
+ sep : str, optional
105
+ Separator between version items. Defaults to newline.
106
+ dash : str, optional
107
+ Separator between module name and version. Defaults to dash.
108
+ verbose : bool, optional
109
+ Include paths to Python interpreter and modules.
110
+
111
+ Returns
112
+ -------
113
+ str
114
+ Formatted string containing version information.
115
+ Format: ``"<package><dash><version>[<space>(<path>)]<sep>"``
116
+
117
+ Examples
118
+ --------
119
+ >>> print(versions()) # doctest: +SKIP
120
+ Python-3.13.5
121
+ phasorpy-0.6
122
+ numpy-2.3.1
123
+ ...
124
+
125
+ """
126
+ import importlib.metadata
127
+ import os
128
+ import sys
129
+
130
+ if verbose:
131
+ version_strings = [f'Python{dash}{sys.version} ({sys.executable})']
132
+ else:
133
+ version_strings = [f'Python{dash}{sys.version.split()[0]}']
134
+
135
+ for module in (
136
+ 'phasorpy',
137
+ 'numpy',
138
+ 'tifffile',
139
+ 'imagecodecs',
140
+ 'lfdfiles',
141
+ 'sdtfile',
142
+ 'ptufile',
143
+ 'liffile',
144
+ 'matplotlib',
145
+ 'scipy',
146
+ 'skimage',
147
+ 'sklearn',
148
+ 'pandas',
149
+ 'xarray',
150
+ 'click',
151
+ 'pooch',
152
+ ):
153
+ try:
154
+ __import__(module)
155
+ except ModuleNotFoundError:
156
+ version_strings.append(f'{module.lower()}{dash}n/a')
157
+ continue
158
+ lib = sys.modules[module]
159
+ try:
160
+ ver = importlib.metadata.version(module)
161
+ except importlib.metadata.PackageNotFoundError:
162
+ ver = getattr(lib, '__version__', 'unknown')
163
+ ver = f'{module.lower()}{dash}{ver}'
164
+ if verbose:
165
+ try:
166
+ path = getattr(lib, '__file__')
167
+ except NameError:
168
+ pass
169
+ else:
170
+ ver += f' ({os.path.dirname(path)})'
171
+ version_strings.append(ver)
172
+ return sep.join(version_strings)
@@ -0,0 +1,74 @@
1
+ Metadata-Version: 2.4
2
+ Name: phasorpy
3
+ Version: 0.7
4
+ Summary: Analysis of fluorescence lifetime and hyperspectral images using the phasor approach
5
+ Author: PhasorPy Contributors
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://www.phasorpy.org
8
+ Project-URL: Documentation, https://www.phasorpy.org/docs/stable/
9
+ Project-URL: Download, https://pypi.org/project/phasorpy/#files
10
+ Project-URL: Source code, https://github.com/phasorpy/phasorpy
11
+ Project-URL: Issue tracker, https://github.com/phasorpy/phasorpy/issues
12
+ Project-URL: Release notes, https://www.phasorpy.org/docs/stable/release
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Programming Language :: Python
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Requires-Python: >=3.11
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE.txt
27
+ Requires-Dist: numpy>=1.26.0
28
+ Requires-Dist: matplotlib>=3.8.0
29
+ Requires-Dist: scipy>=1.11.0
30
+ Requires-Dist: click
31
+ Requires-Dist: pooch
32
+ Requires-Dist: tqdm
33
+ Requires-Dist: scikit-learn>=1.5.0
34
+ Requires-Dist: xarray>=2023.4.0
35
+ Requires-Dist: tifffile>=2024.8.30
36
+ Provides-Extra: docs
37
+ Requires-Dist: sphinx; extra == "docs"
38
+ Requires-Dist: sphinx-issues; extra == "docs"
39
+ Requires-Dist: sphinx_gallery; extra == "docs"
40
+ Requires-Dist: sphinx-copybutton; extra == "docs"
41
+ Requires-Dist: sphinx_click; extra == "docs"
42
+ Requires-Dist: pydata-sphinx-theme>=0.16.0; extra == "docs"
43
+ Requires-Dist: numpydoc; extra == "docs"
44
+ Provides-Extra: all
45
+ Requires-Dist: lfdfiles>=2024.5.24; extra == "all"
46
+ Requires-Dist: sdtfile>=2024.5.24; extra == "all"
47
+ Requires-Dist: ptufile>=2024.9.14; extra == "all"
48
+ Requires-Dist: liffile>=2025.2.10; extra == "all"
49
+ Requires-Dist: pawflim; extra == "all"
50
+ Dynamic: license-file
51
+
52
+ # PhasorPy
53
+
54
+ PhasorPy is an open-source Python library for the analysis of fluorescence
55
+ lifetime and hyperspectral images using the phasor approach.
56
+
57
+ - [Homepage](https://www.phasorpy.org)
58
+ - [Documentation](https://www.phasorpy.org/docs/stable/)
59
+ - [Source code](https://github.com/phasorpy/phasorpy)
60
+ - [Install with pip](https://pypi.org/project/phasorpy/) or [conda](https://anaconda.org/conda-forge/phasorpy).
61
+ - [Data files](https://zenodo.org/communities/phasorpy/)
62
+ - [Issues and questions](https://github.com/phasorpy/phasorpy/issues)
63
+
64
+ PhasorPy is a community-maintained project.
65
+ [Contributions](https://www.phasorpy.org/docs/stable/contributing/)
66
+ in the form of bug reports, bug fixes, feature implementations, documentation,
67
+ datasets, and enhancement proposals are welcome.
68
+
69
+ This software project was supported in part by the
70
+ [Essential Open Source Software for Science (EOSS)](https://chanzuckerberg.com/eoss/)
71
+ program at
72
+ [Chan Zuckerberg Initiative](https://chanzuckerberg.com/).
73
+
74
+ [![CZI's Essential Open Source Software for Science](https://chanzuckerberg.github.io/open-science/badges/CZI-EOSS.svg)](https://czi.co/EOSS)
@@ -0,0 +1,35 @@
1
+ phasorpy-0.7.dist-info/RECORD,,
2
+ phasorpy-0.7.dist-info/WHEEL,sha256=0sjTc0SOuYqctK05sjzLj4iGhB1-_Kdc6i4NFQAA7pQ,138
3
+ phasorpy-0.7.dist-info/entry_points.txt,sha256=VRhsl3qGiIKwtMraKapmduchTMbdReUi1AoVTe9f3ss,47
4
+ phasorpy-0.7.dist-info/top_level.txt,sha256=4Y0uYzya5R2loleAxZ6s2n53_FysUbgFTfFaU0i9rbo,9
5
+ phasorpy-0.7.dist-info/METADATA,sha256=WncXFi2PVwqY7tR4v2hQm328bZmh0YbqcY_DXGn9nn8,3249
6
+ phasorpy-0.7.dist-info/licenses/LICENSE.txt,sha256=_tILgnRubmlP5ruZnGa2U3c8Eyb3_KFf22OoVMiUkkk,1083
7
+ phasorpy/lifetime.py,sha256=L4erooa4rPHswXAF5R9nfTWSw-b5fCbnMhYmzuTxBjc,67180
8
+ phasorpy/conftest.py,sha256=WiZkBu9txp9N1rZujbpoRYiOAqxeMHxu5NkGj2Muk-M,938
9
+ phasorpy/color.py,sha256=TQj4XsrxbJYmalB__f6nLOa8oCWfv1PApmqataRN2oA,17070
10
+ phasorpy/experimental.py,sha256=88FOUmqXcFjggQMk1lp7e1n9hKjUO80a6a18DarAfsA,9556
11
+ phasorpy/_typing.py,sha256=bEh59izC7V94Zo5Dua0_LKGhJwet_at7PFTVWlV4HpY,1247
12
+ phasorpy/_phasorpy.pyx,sha256=CnID2KLp7U36gapzBBYJZXBi4BFMZSCIWl8qt565r7s,75848
13
+ phasorpy/datasets.py,sha256=29sMmccoEtbtXI4bVRY8yZGRTNmMEBy2losG_eJQgKg,24250
14
+ phasorpy/phasor.py,sha256=mBb3K3SUdv3pv7Ghu5iec3GsqPTegI4KFgrtq3YWRxA,64874
15
+ phasorpy/__init__.py,sha256=fwmgFOFphvdFo_X6s9blzG22jhgjPv7rwdpMVOIrrV8,140
16
+ phasorpy/cli.py,sha256=wLGCgS1pJtbCM8wVztGjwpLftPtbZ9xYjWjuMLFJwTU,3532
17
+ phasorpy/utils.py,sha256=PZulJmdVXHH1pCuF3jaC4wlneEA4LdrH9e2ZSAK7nw8,4535
18
+ phasorpy/cluster.py,sha256=kSXIqFlCl7iUjasig4fskaN3KVtzETr5iVcNpEYW6nA,5941
19
+ phasorpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ phasorpy/component.py,sha256=SkmVMGe9txMQ2uE0QJRIWTFddHJ3GKzqrdGMxBJZu-o,24631
21
+ phasorpy/__main__.py,sha256=vkjfLooAnV7rSJwF_PEIM329cJI1Oh-Y5SYjFpqmuF4,142
22
+ phasorpy/_phasorpy.cpython-314-darwin.so,sha256=OyZzIxoPJV6ohTaN2A1VbwBlYUD6PYGg84UaX7RUBdY,1156816
23
+ phasorpy/_utils.py,sha256=Jy1XDfW20R9IkDW14vR2icdrjmk5DS99VG89DELuVao,22296
24
+ phasorpy/cursor.py,sha256=GuPbuL83DeUniyYcFr5IfbO_CoeyPkm3E1qVWEnUqeY,15165
25
+ phasorpy/plot/_phasorplot_fret.py,sha256=bLlDb_becdU2FxP-F3TIkSbmKZYPmm3gVKVVTjmJTrs,19161
26
+ phasorpy/plot/_phasorplot.py,sha256=_DtTvHjZ-eJxvS66N7Mw0j8gkXPY0mF6hKfZ6l0IGQU,51942
27
+ phasorpy/plot/_functions.py,sha256=axi5nC0raV4DMQVxk0NOo90AsckdEl3PcOByQCTe03g,21318
28
+ phasorpy/plot/__init__.py,sha256=z2uzQkJtM_oCLt1Jlnb0GOZP77aYBP8b0zPdBszax0U,766
29
+ phasorpy/plot/_lifetime_plots.py,sha256=-cw79SATN620a6mPHlb8QmMrldwcZorPgeMPutxRQLo,18750
30
+ phasorpy/io/_other.py,sha256=4U0riWvAojGtd9WVyacrpWxB65ZitrmFYiTXOoqe8gk,27193
31
+ phasorpy/io/_leica.py,sha256=owTu0j9tiSekUUbWjiY7gnSQaU-zu_DsIuxrKcT4mj8,10706
32
+ phasorpy/io/_flimlabs.py,sha256=g9TAVt_xyHcJ8SGo1XeHhaNBWq3GlQv3nyoyOmBX3g8,10724
33
+ phasorpy/io/_simfcs.py,sha256=FZggIPZRxy6ucapABjic4qkx-zATbIO26XjGQGgLwFg,19525
34
+ phasorpy/io/__init__.py,sha256=f4A9xRNxz_v6vDH17CnmBYv1Oie-dk88A-7Y0TPqYls,4782
35
+ phasorpy/io/_ometiff.py,sha256=_ZPOEU_jp_xjncbWkbJ8xndlXF_FexDczgFVpUHthII,15396
@@ -0,0 +1,6 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp314-cp314-macosx_10_13_x86_64
5
+ Generator: delocate 0.13.0
6
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ phasorpy = phasorpy.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022-2025 PhasorPy Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ phasorpy