Skip to content

Commit

Permalink
kymograph tutorial: add section on photon counts
Browse files Browse the repository at this point in the history
  • Loading branch information
aafkevandenberg committed Jan 2, 2025
1 parent cd12f63 commit 88906c3
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/tutorial/figures/kymographs/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/tutorial/figures/kymographs/kymograph_selection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/tutorial/figures/kymographs/photon_counts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions docs/tutorial/kymographs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,45 @@ This returns a new (but flipped) :class:`~lumicks.pylake.kymo.Kymo`::

.. image:: figures/kymographs/kymo_flipped.png

Extracting photon counts
------------------------
Photon counts can be extracted from the raw image, for example for stoichiometry analysis.
First, select a region for which the photon counts have to be determined::

kymo_selection = kymo["88.5s":"93s"].crop_by_distance(21.4,22.3)

plt.figure()
kymo_selection.plot("rgb", adjustment=lk.ColorAdjustment(0, 98, mode="percentile"))

Get the raw data (photon counts for each pixel) for the selected region::

selection_green = kymo_selection.get_image(channel = 'green')

.. image:: figures/kymographs/kymograph_selection.png

If the background has to be subtracted, choose a region without binding events as background::

background = kymo["92.1s":"100s"].crop_by_distance(21.4,22.3)
plt.figure()
background.plot("rgb", adjustment=lk.ColorAdjustment(0, 98, mode="percentile"))

.. image:: figures/kymographs/background.png

Subtract the background and sum over the vertical axis (along the width of the binding event) to obtain the photon counts over time::

background_mean = np.mean(background.get_image(channel = "green"))
photon_counts = np.sum(selection_green-background_mean, axis = 0)
time = np.arange(len(photon_counts))*kymo.line_time_seconds

plt.figure()
plt.plot(time, photon_counts)
plt.xlabel("time (s)")
plt.ylabel("Photon counts")
plt.title("Photon counts along binding event")

.. image:: figures/kymographs/photon_counts.png

Calibrating to base pairs
-------------------------

Expand Down

0 comments on commit 88906c3

Please sign in to comment.