Skip to content

Commit 27b4af5

Browse files
committed
1 parent 4436239 commit 27b4af5

73 files changed

Lines changed: 335 additions & 309 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Binary file not shown.

docs/main/_downloads/1b3c132ff7b40bb13bb60712fdfbc4bc/phasorpy_io.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"cell_type": "markdown",
109109
"metadata": {},
110110
"source": [
111-
"Apparent single lifetimes are calculated from the calibrated phasor\ncoordinates and compared to the \"Fast FLIM\" lifetimes (average photon\narrival times) calculated by LAS X software:\n\n"
111+
"Apparent single lifetimes are calculated from the calibrated phasor\ncoordinates and compared to the \"Fast FLIM\" lifetimes (average photon\narrival times) calculated by LAS X software. The Fast FLIM lifetimes are\ncorrected for the IRF position, which is extracted from metadata:\n\n"
112112
]
113113
},
114114
{
@@ -119,14 +119,14 @@
119119
},
120120
"outputs": [],
121121
"source": [
122-
"phase_lifetime, modulation_lifetime = phasor_to_apparent_lifetime(\n real, imag, frequency\n)\n\nfastflim_lifetime = lifetime_from_lif(fetch(filename))[0]\nfastflim_lifetime[numpy.isnan(mean)] = numpy.nan\n\nplot_histograms(\n phase_lifetime,\n modulation_lifetime,\n fastflim_lifetime,\n range=(0, 10),\n bins=100,\n alpha=0.66,\n xlabel='Lifetime (ns)',\n ylabel='Count',\n labels=[\n 'Phase lifetime',\n 'Modulation lifetime',\n 'Fast FLIM lifetime from LIF',\n ],\n title='Lifetime histograms',\n)"
122+
"phase_lifetime, modulation_lifetime = phasor_to_apparent_lifetime(\n real, imag, frequency\n)\n\nfastflim_lifetime, _, _, attrs = lifetime_from_lif(fetch(filename))\nfastflim_lifetime[numpy.isnan(mean)] = numpy.nan\n\nfrequency = attrs['frequency']\nreference = attrs['flim_phasor_channels'][0]['AutomaticReferencePhase']\nfastflim_lifetime -= math.radians(reference) / (2 * math.pi) / frequency * 1000\n\nplot_histograms(\n phase_lifetime,\n modulation_lifetime,\n fastflim_lifetime,\n range=(0, 10),\n bins=100,\n alpha=0.6,\n xlabel='Lifetime (ns)',\n ylabel='Count',\n labels=[\n 'Phase lifetime',\n 'Modulation lifetime',\n 'Fast FLIM lifetime',\n ],\n title='Lifetime histograms',\n)"
123123
]
124124
},
125125
{
126126
"cell_type": "markdown",
127127
"metadata": {},
128128
"source": [
129-
"The apparent single lifetimes from phase and modulation do not exactly match.\nMost likely there is more than one lifetime component in the sample.\n\n"
129+
"The apparent single lifetimes from phase and modulation do not exactly match\nand the Fast FLIM lifetimes are in between them.\nMost likely there is more than one lifetime component in the sample.\n\n"
130130
]
131131
},
132132
{
@@ -241,7 +241,7 @@
241241
},
242242
"outputs": [],
243243
"source": [
244-
"plot_histograms(\n phasor_to_apparent_lifetime(real, imag, frequency)[0],\n phase_lifetime,\n range=(0, 10),\n bins=100,\n alpha=0.66,\n xlabel='Lifetime (ns)',\n ylabel='Count',\n labels=['Phase lifetime from PTU', 'Phase lifetime from LIF'],\n title='Lifetime histograms',\n)"
244+
"plot_histograms(\n phasor_to_apparent_lifetime(real, imag, frequency)[0],\n phase_lifetime,\n range=(0, 10),\n bins=100,\n alpha=0.6,\n xlabel='Lifetime (ns)',\n ylabel='Count',\n labels=['Phase lifetime from PTU', 'Phase lifetime from LIF'],\n title='Lifetime histograms',\n)"
245245
]
246246
},
247247
{
@@ -701,7 +701,7 @@
701701
"cell_type": "markdown",
702702
"metadata": {},
703703
"source": [
704-
"sphinx_gallery_thumbnail_number = 3\nmypy: allow-untyped-defs, allow-untyped-calls\nmypy: disable-error-code=\"arg-type\"\n\n"
704+
"sphinx_gallery_thumbnail_number = 11\nmypy: allow-untyped-defs, allow-untyped-calls\nmypy: disable-error-code=\"arg-type\"\n\n"
705705
]
706706
}
707707
],
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

docs/main/_downloads/7a852d16dd787759c626e759efa1dd52/phasorpy_io.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,34 +114,40 @@
114114
# %%
115115
# Apparent single lifetimes are calculated from the calibrated phasor
116116
# coordinates and compared to the "Fast FLIM" lifetimes (average photon
117-
# arrival times) calculated by LAS X software:
117+
# arrival times) calculated by LAS X software. The Fast FLIM lifetimes are
118+
# corrected for the IRF position, which is extracted from metadata:
118119

119120
phase_lifetime, modulation_lifetime = phasor_to_apparent_lifetime(
120121
real, imag, frequency
121122
)
122123

123-
fastflim_lifetime = lifetime_from_lif(fetch(filename))[0]
124+
fastflim_lifetime, _, _, attrs = lifetime_from_lif(fetch(filename))
124125
fastflim_lifetime[numpy.isnan(mean)] = numpy.nan
125126

127+
frequency = attrs['frequency']
128+
reference = attrs['flim_phasor_channels'][0]['AutomaticReferencePhase']
129+
fastflim_lifetime -= math.radians(reference) / (2 * math.pi) / frequency * 1000
130+
126131
plot_histograms(
127132
phase_lifetime,
128133
modulation_lifetime,
129134
fastflim_lifetime,
130135
range=(0, 10),
131136
bins=100,
132-
alpha=0.66,
137+
alpha=0.6,
133138
xlabel='Lifetime (ns)',
134139
ylabel='Count',
135140
labels=[
136141
'Phase lifetime',
137142
'Modulation lifetime',
138-
'Fast FLIM lifetime from LIF',
143+
'Fast FLIM lifetime',
139144
],
140145
title='Lifetime histograms',
141146
)
142147

143148
# %%
144-
# The apparent single lifetimes from phase and modulation do not exactly match.
149+
# The apparent single lifetimes from phase and modulation do not exactly match
150+
# and the Fast FLIM lifetimes are in between them.
145151
# Most likely there is more than one lifetime component in the sample.
146152

147153
# %%
@@ -251,7 +257,7 @@
251257
phase_lifetime,
252258
range=(0, 10),
253259
bins=100,
254-
alpha=0.66,
260+
alpha=0.6,
255261
xlabel='Lifetime (ns)',
256262
ylabel='Count',
257263
labels=['Phase lifetime from PTU', 'Phase lifetime from LIF'],
@@ -742,6 +748,6 @@
742748
plot_phasor(real, imag, frequency=80.0, allquadrants=True, title=filename)
743749

744750
# %%
745-
# sphinx_gallery_thumbnail_number = 3
751+
# sphinx_gallery_thumbnail_number = 11
746752
# mypy: allow-untyped-defs, allow-untyped-calls
747753
# mypy: disable-error-code="arg-type"

0 commit comments

Comments
 (0)