phasorpy 0.7__cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.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/datasets.py ADDED
@@ -0,0 +1,722 @@
1
+ """Manage sample data files for testing and tutorials.
2
+
3
+ The ``phasorpy.datasets`` module provides a :py:func:`fetch` function to
4
+ download data files from remote repositories and cache them in a local
5
+ directory.
6
+
7
+ Datasets from the following repositories are available:
8
+
9
+ - `PhasorPy tests <https://zenodo.org/records/8417894>`_
10
+ - `LFD Workshop <https://zenodo.org/records/8411056>`_
11
+ - `FLUTE <https://zenodo.org/records/8046636>`_
12
+ - `napari-flim-phasor-plotter
13
+ <https://github.com/zoccoler/napari-flim-phasor-plotter/tree/0.0.6/src/napari_flim_phasor_plotter/data>`_
14
+ - `Phasor-based multi-harmonic unmixing for in-vivo hyperspectral imaging
15
+ <https://zenodo.org/records/13625087>`_
16
+ (`second record <https://zenodo.org/records/14860228>`_)
17
+ - `Convallaria slice acquired with time-resolved 2-photon microscope
18
+ <https://zenodo.org/records/14026720>`_
19
+ - `Convallaria FLIM dataset in FLIM LABS JSON format
20
+ <https://zenodo.org/records/15007900>`_
21
+ - `FLIM and spectral dataset for GSLab
22
+ <https://figshare.com/articles/dataset/FLIM_dataset_for_GSLab/28067108>`_
23
+ - `Hyperspectral and FLIM dataset of LAURDAN-stained NIH-3T3 cells
24
+ <https://zenodo.org/records/16894639>`_
25
+
26
+ The implementation is based on the `Pooch <https://www.fatiando.org/pooch>`_
27
+ library.
28
+
29
+ The default cache location is determined by the Pooch library, but can be
30
+ overridden by setting the ``PHASORPY_DATA_DIR`` environment variable to
31
+ a custom directory path.
32
+
33
+ """
34
+
35
+ from __future__ import annotations
36
+
37
+ __all__ = ['fetch', 'REPOSITORIES']
38
+
39
+ import os
40
+ from typing import TYPE_CHECKING
41
+
42
+ if TYPE_CHECKING:
43
+ from ._typing import Any, Iterable
44
+
45
+ import pooch
46
+
47
+ ENV = 'PHASORPY_DATA_DIR'
48
+
49
+ DATA_ON_GITHUB = bool(
50
+ os.environ.get('PHASORPY_DATA_ON_GITHUB', False)
51
+ ) or bool(os.environ.get('GITHUB_ACTIONS', False))
52
+
53
+ TESTS = pooch.create(
54
+ path=pooch.os_cache('phasorpy'),
55
+ base_url=(
56
+ 'https://github.com/phasorpy/phasorpy-data/raw/main/tests'
57
+ if DATA_ON_GITHUB
58
+ else 'doi:10.5281/zenodo.8417894'
59
+ ),
60
+ env=ENV,
61
+ registry={
62
+ 'flimage.int.bin': (
63
+ 'sha256:'
64
+ '5d470ed31ed0611b43270261341bc1c41f55fda665eaf529d848a139fcae5fc8'
65
+ ),
66
+ 'flimage.int.bin.zip': (
67
+ 'sha256:'
68
+ '51062322891b4c22d577100395d8c02297c5494030d2c550a0fd6c90f73cc211'
69
+ ),
70
+ 'flimage.mod.bin': (
71
+ 'sha256:'
72
+ 'b0312f6f9f1f24e228b2c3a3cb07e18d80b35f31109f8c771b088b54419c5200'
73
+ ),
74
+ 'flimage.phi.bin': (
75
+ 'sha256:'
76
+ 'd593acc698a1226c7a4571fa61f6751128584dcca6ed4449d655283cd231b125'
77
+ ),
78
+ 'flimfast.flif': (
79
+ 'sha256:'
80
+ 'b12cedf299831a46baf80dcfe7bfb9f366fee30fb3e2b3039d4346f1bbaf3e2c'
81
+ ),
82
+ 'flimfast.flif.zip': (
83
+ 'sha256:'
84
+ 'b25642b1a2dbc547f0cdaadc13ce89ecaf372f90a20978910c02b13beb138c2e'
85
+ ),
86
+ 'frequency_domain.ifli': (
87
+ 'sha256:'
88
+ '56015b98a2edaf4ee1262b5e1034305aa29dd8b20e301ced9cd7a109783cd171'
89
+ ),
90
+ 'frequency_domain.ifli.zip': (
91
+ 'sha256:'
92
+ '93066cc48028360582f6e3380d09d2c5a6f540a8f931639da3cfca158926df9b'
93
+ ),
94
+ 'paramecium.lsm': (
95
+ 'sha256:'
96
+ 'b3b3b80be244a41352c56390191a50e4010d52e5ca341dc51bd1d7c89f10cedf'
97
+ ),
98
+ 'paramecium.lsm.zip': (
99
+ 'sha256:'
100
+ '7828a80e878ee7ab88f9bd9a6cda72e5d698394d37f69a7bee5b0b31b3856919'
101
+ ),
102
+ 'simfcs.b64': (
103
+ 'sha256:'
104
+ '5ccccd0bcd46c66ea174b6074975f631bdf163fcb047e35f9310aaf67c320fb8'
105
+ ),
106
+ 'simfcs.b64.zip': (
107
+ 'sha256:'
108
+ 'b176761905fc5916d0770bd6baaa0e31af5981f92ec323e588f9ce398324818e'
109
+ ),
110
+ 'simfcs.b&h': (
111
+ 'sha256:'
112
+ '6a406c4fd862318a51370461c7607390f022afdcb2ce27c4600df4b5af83c26e'
113
+ ),
114
+ 'simfcs.b&h.zip': (
115
+ 'sha256:'
116
+ 'ec14666be76bd5bf2dcaee63435332857795173c8dc94be8778697f32b041aa1'
117
+ ),
118
+ 'simfcs.bhz': (
119
+ 'sha256:'
120
+ '14f8b5287e257514945ca17a8398425fc040c00bfad2d8a3c6adb4790862d211'
121
+ ),
122
+ 'simfcs.r64': (
123
+ 'sha256:'
124
+ 'ead3b2df45c1dff91e91a325f97225f4837c372db04c2e49437ee9ec68532946'
125
+ ),
126
+ 'simfcs.ref': (
127
+ 'sha256:'
128
+ '697dad17fb3a3cf7329a45b43ba9ae5f7220c1f3d5f08749f2ce3eadb0598420'
129
+ ),
130
+ 'simfcs.ref.zip': (
131
+ 'sha256:'
132
+ '482331ec5586973e9eb5c2e4f793d9621cc756ce8f4093f5e21906a7ce5726f8'
133
+ ),
134
+ 'simfcs.z64': (
135
+ 'sha256:'
136
+ 'f1dd861f80528c77bb581023c05c7bf7293d6ad3c4a3d10f9a50b8b5618a8099'
137
+ ),
138
+ 'simfcs_1000.int': (
139
+ 'sha256:'
140
+ 'bb5bde0ecf24243865cdbc2b065358fe8c557696de18567dbb3f75adfb2ab51a'
141
+ ),
142
+ 'simfcs_1000.int.zip': (
143
+ 'sha256:'
144
+ 'f75e211dc344f194a871f0b3af3f6d8a9e4850e9718526f2bfad87ef16c1c377'
145
+ ),
146
+ 'simfcs_1000.mod': (
147
+ 'sha256:'
148
+ '84265df08d48ff56f6844d55392fccac9fa429c481d1ac81b07c23738075d336'
149
+ ),
150
+ 'simfcs_1000.phs': (
151
+ 'sha256:'
152
+ '8a39d2abd3999ab73c34db2476849cddf303ce389b35826850f9a700589b4a90'
153
+ ),
154
+ 'tcspc.sdt': (
155
+ 'sha256:'
156
+ '0ff0b25b36cb9a7657112a3b081ff479bcae487ce8100b8756e5780e0957708d'
157
+ ),
158
+ 'tcspc.sdt.zip': (
159
+ 'sha256:'
160
+ '57a772bc413e85e0f13eb996f8c2484dfb3d15df67ffa6c3b968d3a03c27fdc3'
161
+ ),
162
+ },
163
+ )
164
+
165
+ LFD_WORKSHOP = pooch.create(
166
+ path=pooch.os_cache('phasorpy'),
167
+ base_url=(
168
+ 'https://github.com/phasorpy/phasorpy-data/raw/main/lfd_workshop'
169
+ if DATA_ON_GITHUB
170
+ else 'doi:10.5281/zenodo.8411056'
171
+ ),
172
+ env=ENV,
173
+ registry={
174
+ '4-22-03-2-A5-CHO-CELL3B.tif': (
175
+ 'sha256:'
176
+ '015d4b5a4cbb6cc40ac0c39f7a0b57ff31173df5b3112627b551e4d8ce8c3b02'
177
+ ),
178
+ '1011rac1002.ref': (
179
+ 'sha256:'
180
+ 'b8eb374d21ba74519342187aa0b6f67727983c1e9d02a9b86bde7e323f5545ac'
181
+ ),
182
+ 'CFP and CFP-YFp.ref': (
183
+ 'sha256:'
184
+ 'f4f494d5e71836aeacfa8796dcf9b92bbc0f62b8176d6c10d5ab9ce202313257'
185
+ ),
186
+ 'CFP-YFP many cells with background.ref': (
187
+ 'sha256:'
188
+ '7cb88018be807144edbb2746d0ec6548eeb3ddc4aa176f3fba4223990aa21754'
189
+ ),
190
+ 'CFPpax8651866.ref': (
191
+ 'sha256:'
192
+ 'eda9177f2841229d120782862779e2db295ad773910b308bc2c360c22c75f391'
193
+ ),
194
+ 'Paxillins013.bin': (
195
+ 'sha256:'
196
+ 'b979e3112dda2fa1cc34a351dab7b0c82009ef07eaa34829503fb79f7a6bb7d2'
197
+ ),
198
+ 'capillaries1001.ref': (
199
+ 'sha256:'
200
+ '27f071ae31032ed4e79c365bb2076044876f7fc10ef622aff458945f33e60984'
201
+ ),
202
+ 'pax1023.bin': (
203
+ 'sha256:'
204
+ 'f467e8264bb10fc12a19506693837f384e32ca01c0cac0b25704c19ceb8d7d5a'
205
+ ),
206
+ },
207
+ )
208
+
209
+ FLUTE = pooch.create(
210
+ path=pooch.os_cache('phasorpy'),
211
+ base_url='doi:10.5281/zenodo.8046636',
212
+ env=ENV,
213
+ registry={
214
+ 'Embryo.tif': (
215
+ 'sha256:'
216
+ 'd1107de8d0f3da476e90bcb80ddf40231df343ed9f28340c873cf858ca869e20'
217
+ ),
218
+ 'Fluorescein_Embryo.tif': (
219
+ 'sha256:'
220
+ '53cb66439a6e921aef1aa7f57ef542260c51cdb8fe56a643f80ea88fe2230bc8'
221
+ ),
222
+ 'Fluorescein_hMSC.tif': (
223
+ 'sha256:'
224
+ 'a3f22076e8dc89b639f690146e46ff8a068388cbf381c2f3a9225cdcbbcec605'
225
+ ),
226
+ 'hMSC control.tif': (
227
+ 'sha256:'
228
+ '725570373ee51ee226560ec5ebb57708e2fac53effc94774c03b71c67a42c9f8'
229
+ ),
230
+ 'hMSC-ZOOM.tif': (
231
+ 'sha256:'
232
+ '6ff4be17e9d98a94b44ef13ec57af3c520f8deaeef72a7210ea371b84617ce92'
233
+ ),
234
+ 'hMSC_rotenone.tif': (
235
+ 'sha256:'
236
+ 'cd0d2bd3baddc0f82c84c9624692e51bbbc56a80ac20b5936be0898d619c2bf2'
237
+ ),
238
+ },
239
+ )
240
+
241
+ NAPARI_FLIM_PHASOR_PLOTTER = pooch.create(
242
+ path=pooch.os_cache('phasorpy'),
243
+ base_url='https://github.com/zoccoler/napari-flim-phasor-plotter/'
244
+ 'raw/0.0.6/src/napari_flim_phasor_plotter/data',
245
+ env=ENV,
246
+ registry={
247
+ 'hazelnut_FLIM_single_image.ptu': (
248
+ 'sha256:'
249
+ '262f60ebc0054ba985fdda3032b58419aac07720e5f157800616c864d15fc2d3'
250
+ ),
251
+ 'hazelnut_FLIM_z_stack.zip': (
252
+ 'sha256:'
253
+ '8d26ebc7c758a70ee256d95c06f7921baa3cecbcdde82c7bb54b66bcb8db156e'
254
+ ),
255
+ 'lifetime_cat.tif': (
256
+ 'sha256:'
257
+ '5f2a2d20284a6f32fa3d1d13cb0c535cea5c2ec99c23148d9ee2d1e22d121a34'
258
+ ),
259
+ 'lifetime_cat_labels.tif': (
260
+ 'sha256:'
261
+ '102d74c202171f0ce2821dfbf1c92ead578bafebf99830e0cfa766e7407aadf9'
262
+ ),
263
+ 'lifetime_cat_metadata.yml': (
264
+ 'sha256:'
265
+ '20c447c1251598f255309fa866e58fc0e4abc2b73e824d18727833a05467d8bc'
266
+ ),
267
+ 'seminal_receptacle_FLIM_single_image.sdt': (
268
+ 'sha256:'
269
+ '2ba169495e533235cffcad953e76c7969286aad9181b946f5167390b8ff1a44a'
270
+ ),
271
+ },
272
+ )
273
+
274
+ ZENODO_13625087 = pooch.create(
275
+ path=pooch.os_cache('phasorpy'),
276
+ base_url=(
277
+ 'https://github.com/phasorpy/phasorpy-data/raw/main/zenodo_13625087'
278
+ # if DATA_ON_GITHUB
279
+ # else 'doi:10.1088/2050-6120/ac9ae9' # TODO: not working with Pooch
280
+ ),
281
+ env=ENV,
282
+ registry={
283
+ # part of ZENODO_14860228
284
+ # '33_Hoechst_Golgi_Mito_Lyso_CellMAsk_404_488_561_633_SP.lsm': (
285
+ # 'sha256:'
286
+ # '68fcefcad4e750e9ec7068820e455258c986f6a9b724e66744a28bbbb689f986'
287
+ # ),
288
+ '34_Hoechst_Golgi_Mito_Lyso_CellMAsk_404_488_561_633_SP.lsm': (
289
+ 'sha256:'
290
+ '5c0b7d76c274fd64891fca2507013b7c8c9979d8131ce282fac55fd24fbb38bd'
291
+ ),
292
+ '35_Hoechst_Golgi_Mito_Lyso_CellMAsk_404_488_561_633_SP.lsm': (
293
+ 'sha256:'
294
+ 'df57c178c185f6e271a66e2664dcc09d6f5abf923ee7d9c33add41bafc15214c'
295
+ ),
296
+ '38_Hoechst_Golgi_Mito_Lyso_CellMAsk_404_488_561_633_SP.lsm': (
297
+ 'sha256:'
298
+ '092ac050edf55e26dcda8cba10122408c6f1b81d19accf07214385d6eebfcf3e'
299
+ ),
300
+ },
301
+ )
302
+
303
+ ZENODO_14860228 = pooch.create(
304
+ path=pooch.os_cache('phasorpy'),
305
+ base_url=(
306
+ 'https://github.com/phasorpy/phasorpy-data/raw/main/zenodo_14860228'
307
+ if DATA_ON_GITHUB
308
+ else 'doi:10.5281/zenodo.14860228'
309
+ ),
310
+ env=ENV,
311
+ registry={
312
+ '38_Hoechst_Golgi_Mito_Lyso_CellMAsk_404_488_561_633_SP.lsm': (
313
+ 'sha256:'
314
+ '092ac050edf55e26dcda8cba10122408c6f1b81d19accf07214385d6eebfcf3e'
315
+ ),
316
+ 'spectral cell mask.lsm': (
317
+ 'sha256:'
318
+ 'c4c2c567bd99ef4930d7278794d4e3daebaad0375c0852a5ab86a2ea056f4fe3'
319
+ ),
320
+ 'spectral golgi.lsm': (
321
+ 'sha256:'
322
+ 'd0a5079d9ed18b1248434f3f6d4b2b240fb034891121262cfe9dfec64d8429cd'
323
+ ),
324
+ 'spectral hoehst.lsm': (
325
+ 'sha256:'
326
+ '3ee44a7f9f125698bb5e34746d9723669f67c520ffbf21244757d7fc25dbbb88'
327
+ ),
328
+ 'spectral lyso tracker green.lsm': (
329
+ 'sha256:'
330
+ '0964448649e2c73a57f5ca0c705c86511fb4625c0a2af0d7850dfa39698fcbb9'
331
+ ),
332
+ 'spectral mito tracker.lsm': (
333
+ 'sha256:'
334
+ '99b9892b247256ebf8a9917c662bc7bb66a8daf3b5db950fbbb191de0cd35b37'
335
+ ),
336
+ },
337
+ )
338
+
339
+ ZENODO_14976703 = pooch.create(
340
+ path=pooch.os_cache('phasorpy'),
341
+ base_url=(
342
+ 'https://github.com/phasorpy/phasorpy-data/raw/main/zenodo_14976703'
343
+ if DATA_ON_GITHUB
344
+ else 'doi:10.5281/zenodo.14976703'
345
+ ),
346
+ env=ENV,
347
+ registry={
348
+ 'Convalaria_LambdaScan.lif': (
349
+ 'sha256:'
350
+ '27f1282cf02f87e11f8c7d3064066a4517ad4c9c769c796b32e459774f18c62a'
351
+ ),
352
+ },
353
+ )
354
+
355
+ CONVALLARIA_FBD = pooch.create(
356
+ path=pooch.os_cache('phasorpy'),
357
+ base_url=(
358
+ 'https://github.com/phasorpy/phasorpy-data/raw/main/zenodo_14026720'
359
+ if DATA_ON_GITHUB
360
+ else 'doi:10.5281/zenodo.14026719'
361
+ ),
362
+ env=ENV,
363
+ registry={
364
+ 'Convallaria_$EI0S.fbd': (
365
+ 'sha256:'
366
+ '3751891b02e3095fedd53a09688d8a22ff2a0083544dd5c0726b9267d11df1bc'
367
+ ),
368
+ 'Calibration_Rhodamine110_$EI0S.fbd': (
369
+ 'sha256:'
370
+ 'd745cbcdd4a10dbaed83ee9f1b150f0c7ddd313031e18233293582cdf10e4691'
371
+ ),
372
+ },
373
+ )
374
+
375
+ FLIMLABS = pooch.create(
376
+ path=pooch.os_cache('phasorpy'),
377
+ base_url=(
378
+ 'https://github.com/phasorpy/phasorpy-data/raw/main/flimlabs'
379
+ if DATA_ON_GITHUB
380
+ else 'doi:10.5281/zenodo.15007900'
381
+ ),
382
+ env=ENV,
383
+ registry={
384
+ 'Convallaria_m2_1740751781_phasor_ch1.json': (
385
+ 'sha256:'
386
+ 'a8bf0179f352ab2c6c78d0bd399545ab1fb6d5537f23dc06e5f12a7ef5af6615'
387
+ ),
388
+ 'Convallaria_m2_1740751781_phasor_ch1.json.zip': (
389
+ 'sha256:'
390
+ '9c5691f55e85778717ace13607d573bcd00c29e357e063c8db4f173340f72984'
391
+ ),
392
+ 'Fluorescein_Calibration_m2_1740751189_imaging.json': (
393
+ 'sha256:'
394
+ 'aeebb074dbea6bff7578f409c7622b2f7f173bb23e5475d1436adedca7fc2eed'
395
+ ),
396
+ 'Fluorescein_Calibration_m2_1740751189_imaging.json.zip': (
397
+ 'sha256:'
398
+ '32960bc1dec85fd16ffc7dd74a3cd63041fb3b69054ee6582f913129b0847086'
399
+ ),
400
+ 'Fluorescein_Calibration_m2_1740751189_imaging_calibration.json': (
401
+ 'sha256:'
402
+ '7fd1b9749789bd139c132602a771a127ea0c76f403d1750e9636cd657cce017a'
403
+ ),
404
+ },
405
+ )
406
+
407
+ FIGSHARE_28067108 = pooch.create(
408
+ path=pooch.os_cache('phasorpy'),
409
+ base_url=(
410
+ 'https://github.com/phasorpy/phasorpy-data/raw/main/figshare_28067108'
411
+ ),
412
+ env=ENV,
413
+ registry={
414
+ '38_Hoechst_Golgi_Mito_Lyso_CellMask_mixture.lsm': (
415
+ 'sha256:'
416
+ '092ac050edf55e26dcda8cba10122408c6f1b81d19accf07214385d6eebfcf3e'
417
+ ),
418
+ '38_Hoechst_Golgi_Mito_Lyso_CellMask_mixture.lsm.zip': (
419
+ 'sha256:'
420
+ '19298d12b16a58c1de3f532398c154d89df3f2286a1a6ee38a29f1fbefac78fc'
421
+ ),
422
+ '40x800fov19LP500p30_4dyes_a1_$CG0T_ch1_h1_h2.R64': (
423
+ 'sha256:'
424
+ 'ad1bae8c3624eecb8927283e333ab5ea3fb864d6c5bb0f155da83c7a8aa40df3'
425
+ ),
426
+ '40x800fov19LP500p30_AcO_a4_$CG0T_ch1_h1_h2.R64': (
427
+ 'sha256:'
428
+ 'd1de46652fbed0626ae6ad6334c41baafb0a5ae9e0e15e49221eb540a666d7e7'
429
+ ),
430
+ '40x800fov19LP500p30_EtBr_a5_$CG0T_ch1_h1_h2.R64': (
431
+ 'sha256:'
432
+ '9f4dd2d328877d2b18e064a3fb20d2a5318c833caa5a3cea15bafbf8df5d588a'
433
+ ),
434
+ '40x800fov19LP500p30_NucB_a6_$CG0T_ch1_h1_h2.R64': (
435
+ 'sha256:'
436
+ '74e378ddae84f6532d7ac05f8639feb42541eecb278c842e9a18565c201242f8'
437
+ ),
438
+ '40x800fov19LP500p30_RoseBx100_a1_$CG0T_ch1_h1_h2.R64': (
439
+ 'sha256:'
440
+ '898e0e7e96f8b6c2ee83940f94026dd9006e6fc46bb7e56c62dd22855079e279'
441
+ ),
442
+ 'Coumarin6.txt': (
443
+ 'sha256:'
444
+ '6a3ae0f886b512c26cea8bc4b4cd9027ee8d4b7dd437a1eeb9621947e19c3c88'
445
+ ),
446
+ 'Hoechst_Lyso_Golgi_MitoTracker_CellMask.csv': (
447
+ 'sha256:'
448
+ '1d000ae6268e6d290ab1cfdf2d31d840f27183cba75b380f116e1049696bb3a4'
449
+ ),
450
+ 'Mosaic04_10x3_FOV600_z95_32A1_t06_uncalibrated.ref': (
451
+ 'sha256:'
452
+ '3c23ca9a21a3ef762765fc81591dd0cf9bdaf3e77fa4faa3bf60da69e6ab1127'
453
+ ),
454
+ 'Mosaic04_10x3_FOV600_z95_32A1_t06_uncalibrated.ref.zip': (
455
+ 'sha256:'
456
+ '001a472d81b3d348ac4680c73de877ee809c2f229f882ef015225e208a7273fb'
457
+ ),
458
+ },
459
+ )
460
+
461
+ FIGSHARE_22336594 = pooch.create(
462
+ path=pooch.os_cache('phasorpy'),
463
+ base_url=(
464
+ 'https://github.com/phasorpy/phasorpy-data/raw/main/figshare_22336594'
465
+ if DATA_ON_GITHUB
466
+ else 'doi:10.6084/m9.figshare.22336594.v1'
467
+ ),
468
+ env=ENV,
469
+ registry={
470
+ 'FLIM_testdata.lif': (
471
+ 'sha256:'
472
+ '902d8fa6cd39da7cf062b32d43aab518fa2a851eab72b4bd8b8eca1bad591850'
473
+ ),
474
+ },
475
+ )
476
+
477
+ FIGSHARE_22336594_EXPORTED = pooch.create(
478
+ path=pooch.os_cache('phasorpy'),
479
+ base_url=(
480
+ 'https://github.com/phasorpy/phasorpy-data/raw/main/figshare_22336594'
481
+ ),
482
+ env=ENV,
483
+ registry={
484
+ 'FLIM_testdata.lif.ptu': (
485
+ 'sha256:'
486
+ 'c85792b25d0b274f1484e490c99aa19052ab8e48e4e5022aabb1f218cd1123b6'
487
+ ),
488
+ 'FLIM_testdata.lif.ptu.zip': (
489
+ 'sha256:'
490
+ 'c5134c470f6a3e5cb21eabd538cbd5061d9911dad96d58e3a4040cfddadaef33'
491
+ ),
492
+ 'FLIM_testdata.xlef': (
493
+ 'sha256:'
494
+ '7860ef0847dc9f5534895a9c11b979bb446f67382b577fe63fb166e281e5dc5e'
495
+ ),
496
+ 'FLIM_testdata.xlef.zip': (
497
+ 'sha256:'
498
+ 'ad0ad6389f38dcba6f9809b54934ef3f19da975d9dabeb4c3a248692b959b9cf'
499
+ ),
500
+ 'FLIM_testdata.lif.filtered.ptu': (
501
+ 'sha256:'
502
+ 'a00b84f626a39e79263322c60ae50b64163b36bb977ecc4dc54619097ba7f5b7'
503
+ ),
504
+ 'FLIM_testdata.lif.filtered.ptu.zip': (
505
+ 'sha256:'
506
+ '717366b231213bfd6e295c3efb7bf1bcd90e720eb28aab3223376087172e93e5'
507
+ ),
508
+ },
509
+ )
510
+
511
+ ZENODO_16894639 = pooch.create(
512
+ path=pooch.os_cache('phasorpy'),
513
+ base_url=(
514
+ 'https://github.com/phasorpy/phasorpy-data/raw/main/zenodo_16894639'
515
+ if DATA_ON_GITHUB
516
+ else 'doi:10.5281/zenodo.16894639'
517
+ ),
518
+ env=ENV,
519
+ registry={
520
+ '04 NIH3T3LAURDAN8meanspectra.lsm': (
521
+ 'sha256:'
522
+ '27173be5b57a1a0f40ad6e89df1fd1d6d20bdd1e0a80e469acb47cf0bc103a1c'
523
+ ),
524
+ '04NIH3T3_LAURDAN_000$CC0Z.fbd': (
525
+ 'sha256:'
526
+ '9c8e7d79ef6ce4cce7366c843d34f5b4544f4123fe88307b8df5954a1fe4a799'
527
+ ),
528
+ 'cumarinech1_780LAURDAN_000$CC0Z.fbd': (
529
+ 'sha256:'
530
+ '1b7b513680973c79df697b9cefdf2104f5d32346e24c9071336f76a7b82e9313'
531
+ ),
532
+ 'cumarinech2_780LAURDAN_000$CC0Z.fbd': (
533
+ 'sha256:'
534
+ '5c9cf9694652cc9c344e67b5650fd49683fa7fdcec39e56ccbf0bdd2f7dadf15'
535
+ ),
536
+ },
537
+ )
538
+
539
+ MISC = pooch.create(
540
+ path=pooch.os_cache('phasorpy'),
541
+ base_url='https://github.com/phasorpy/phasorpy-data/raw/main/misc',
542
+ env=ENV,
543
+ registry={
544
+ 'NADHandSHG.ifli': (
545
+ 'sha256:'
546
+ 'dfa65952850b8a222258776a8a14eb1ab7e70ff5f62b58aa2214797c5921b4a3'
547
+ ),
548
+ },
549
+ )
550
+
551
+ REPOSITORIES: dict[str, pooch.Pooch] = {
552
+ 'tests': TESTS,
553
+ 'lfd-workshop': LFD_WORKSHOP,
554
+ 'flute': FLUTE,
555
+ 'napari-flim-phasor-plotter': NAPARI_FLIM_PHASOR_PLOTTER,
556
+ 'zenodo-13625087': ZENODO_13625087,
557
+ 'zenodo-14860228': ZENODO_14860228,
558
+ 'zenodo-14976703': ZENODO_14976703,
559
+ 'convallaria-fbd': CONVALLARIA_FBD,
560
+ 'flimlabs': FLIMLABS,
561
+ 'figshare_28067108': FIGSHARE_28067108,
562
+ 'figshare_22336594': FIGSHARE_22336594,
563
+ 'figshare_22336594_exported': FIGSHARE_22336594_EXPORTED,
564
+ 'zenodo-16894639': ZENODO_16894639,
565
+ 'misc': MISC,
566
+ }
567
+ """Dictionary mapping repository names to Pooch repository objects.
568
+
569
+ Each repository provides access to a specific collection of sample data files
570
+ that can be fetched using the :py:func:`fetch` function.
571
+
572
+ """
573
+
574
+
575
+ def fetch(
576
+ *args: str | Iterable[str | pooch.Pooch] | pooch.Pooch,
577
+ extract_dir: str | None = '.',
578
+ return_scalar: bool = True,
579
+ **kwargs: Any,
580
+ ) -> Any: # str | tuple[str, ...]
581
+ """Return absolute path(s) to sample file(s) in local storage.
582
+
583
+ The files are downloaded from a remote repository if not present in local
584
+ storage.
585
+
586
+ Parameters
587
+ ----------
588
+ *args : str, iterable of str, or pooch.Pooch
589
+ Name(s) of file(s) or repositories to fetch from local storage.
590
+ Can be:
591
+
592
+ - File names (for example, 'simfcs.r64')
593
+ - Repository names (for example, 'tests', 'flute')
594
+ - Pooch repository objects
595
+ - Iterables of the above
596
+
597
+ If omitted, return files in all repositories.
598
+ extract_dir : str or None, optional
599
+ Path, relative to cache location, where ZIP files will be unpacked.
600
+ return_scalar : bool, optional
601
+ If true (default), return single path as string, else tuple of string.
602
+ **kwargs
603
+ Additional arguments passed to ``pooch.fetch()``.
604
+ For example, ``progressbar=True``.
605
+
606
+ Returns
607
+ -------
608
+ str or tuple of str
609
+ Absolute path(s) of file(s) in local storage.
610
+ Returns a single string if only one file and `return_scalar=True`,
611
+ otherwise returns a tuple of strings.
612
+
613
+ Raises
614
+ ------
615
+ ValueError
616
+ If specified file is not found in any repository.
617
+
618
+ Examples
619
+ --------
620
+ >>> fetch('simfcs.r64')
621
+ '...simfcs.r64'
622
+ >>> fetch('simfcs.r64', 'simfcs.ref')
623
+ ('...simfcs.r64', '...simfcs.ref')
624
+
625
+ """
626
+ filenames: list[str] = []
627
+ if not args:
628
+ args = tuple(REPOSITORIES.keys())
629
+ for arg in args:
630
+ if isinstance(arg, str):
631
+ if arg in REPOSITORIES:
632
+ # fetch all files in repository
633
+ filenames.extend(
634
+ fetch(
635
+ *REPOSITORIES[arg].registry.keys(),
636
+ extract_dir=extract_dir,
637
+ return_scalar=False,
638
+ **kwargs,
639
+ )
640
+ )
641
+ continue
642
+ for repo in REPOSITORIES.values():
643
+ if arg + '.zip' in repo.registry:
644
+ # fetch single file in ZIP
645
+ filenames.append(
646
+ repo.fetch(
647
+ arg + '.zip',
648
+ processor=_Unzip([arg], extract_dir),
649
+ **kwargs,
650
+ )
651
+ )
652
+ break
653
+ if arg in repo.registry:
654
+ if arg.endswith('.zip'):
655
+ # fetch and extract all files in ZIP
656
+ filenames.extend(
657
+ repo.fetch(
658
+ arg,
659
+ processor=pooch.processors.Unzip(
660
+ extract_dir=extract_dir
661
+ ),
662
+ **kwargs,
663
+ )
664
+ )
665
+ else:
666
+ # fetch single file
667
+ filenames.append(repo.fetch(arg, **kwargs))
668
+ break
669
+ else:
670
+ raise ValueError(f'file {arg!r} not found')
671
+ elif isinstance(arg, pooch.Pooch):
672
+ # fetch all files in repository
673
+ filenames.extend(
674
+ fetch(
675
+ *arg.registry.keys(),
676
+ extract_dir=extract_dir,
677
+ return_scalar=False,
678
+ **kwargs,
679
+ )
680
+ )
681
+ else:
682
+ # fetch all files in iterable
683
+ filenames.extend(
684
+ fetch(
685
+ *arg,
686
+ extract_dir=extract_dir,
687
+ return_scalar=False,
688
+ **kwargs,
689
+ )
690
+ )
691
+ if return_scalar and len(filenames) == 1:
692
+ return filenames[0]
693
+ return tuple(filenames)
694
+
695
+
696
+ class _Unzip(pooch.processors.ExtractorProcessor): # type: ignore[misc]
697
+ """Pooch processor that unpacks ZIP archive and returns single file."""
698
+
699
+ def __call__(self, fname: str, action: str, pooch_: pooch.Pooch) -> str:
700
+ pooch.processors.ExtractorProcessor.__call__(
701
+ self, fname, action, pooch_
702
+ )
703
+ return os.path.splitext(fname)[0]
704
+
705
+ @property
706
+ def suffix(self) -> str:
707
+ """String appended to unpacked archive folder name."""
708
+ return '.unzip'
709
+
710
+ def _all_members(self, fname: str) -> list[str]:
711
+ """Return all members from archive."""
712
+ from zipfile import ZipFile
713
+
714
+ with ZipFile(fname, 'r') as zip_file:
715
+ return zip_file.namelist()
716
+
717
+ def _extract_file(self, fname: str, extract_dir: str) -> None:
718
+ """Extract all files from ZIP archive."""
719
+ from zipfile import ZipFile
720
+
721
+ with ZipFile(fname, 'r') as zip_file:
722
+ zip_file.extractall(path=extract_dir)