Tutorial 3 - Making Useful Plots

none
[1]:
ipython3
import imagingplus as ip
import imagingplus.plotting as plotting

imported imagingplus successfully
        version: 0.2-beta

import data

none
[2]:
ipython3
# import data as a `trialobj` (here we are importing a TwoPhotonImaging Trial object)

expobj = ip.import_obj(pkl_path='/mnt/qnap_share/Data/imagingplus-example/RL109_analysis.pkl')
print(expobj)
trialobj = expobj.load_trial(trialID='t-013')

|- Loaded imagingplus.Experiment object (expID: RL109)109_analysis.pkl ...

imagingplus Experiment object (last saved: Sun Oct 23 13:04:11 2022), expID: RL109
file path: /mnt/qnap_share/Data/imagingplus-example/RL109_analysis.pkl

trials in Experiment object:
        t-005: awake spont. 2p imaging + LFP
        t-006: awake spont. 2p imaging + LFP
        t-013: all optical trial with LFP


|- Loaded TwoPhotonImagingTrial.alloptical experimental trial object ...

plot Suite2p ROIs location

none
[3]:
ipython3
# simple plot of the location of the given cell(s) against a black FOV (optionally provide background image as np.array to use)
plotting.plotRoiLocations(trialobj=trialobj, scalebar=True)
\- executing plotting function: plotRoiLocations
\- adding scalebar of length 100 microns.
../_images/Tutorials_Tutorial-3-plotting-module_5_1.png

plot default output images from Suite2p

none
[4]:
ipython3
plotting.makeSuite2pPlots(obj=trialobj, scalebar=True)
\- executing plotting function: makeSuite2pPlots
\- adding scalebar of length 100 microns.
../_images/Tutorials_Tutorial-3-plotting-module_7_1.png

plot individual cell’s flu or dFF trace

none
[5]:
ipython3
cell = 0  # pick any cell ID from Suite2p

# use the `to_plot` parameter to select data to plot. Available options == `.layers` keys in anndata object
# (choose 'raw' to plot main raw data layer, otherwise choose name of the desired layer)

plotting.plot_flu_trace(trialobj=trialobj, cell=cell, to_plot = 'raw', linewidth = 0.10,
                        x_lims=None, y_lims= None, x_axis='Frames', title=f'Cell # {cell}', y_axis='dFF Flu')
\- executing plotting function: plot_flu_trace
../_images/Tutorials_Tutorial-3-plotting-module_9_1.png

Raw trace of mean FOV

none
[6]:
ipython3
# plots the raw trace for the Flu mean of the FOV (similar to the ZProject in Fiji)
plotting.plotMeanFovFluTrace(trialobj=trialobj)
\- executing plotting function: plotMeanFovFluTrace
         \- PLOTTING mean raw flu trace ...
../_images/Tutorials_Tutorial-3-plotting-module_11_1.png