Visualization
Tools for visualizing experimental data.
- pyneurotrace.viz.plotIntensity(data, hz, branches=None, colors=None, stim=None, title=None, overlayStim=False, savePath=None, hybridStimColours=False, forceStimWidth=None, **kwargs)
Plots intensity data with optional branches and stimulus.
- Parameters:
data (array) – Data to be plotted.
hz (int) – Sampling rate in Hz.
branches (array, optional) – Array of branch data. Default is None.
colors (array, optional) – Colors for the branches. Default is None.
stim (array, optional) – Array of stimulus data. Default is None.
title (str, optional) – Title for the plot. Default is None.
overlayStim (bool, optional) – Flag to overlay stimulus data. Default is False.
savePath (str, optional) – Path to save the plot. Default is None.
hybridStimColours (bool, optional) – Flag for hybrid stimulus colors. Default is False.
forceStimWidth (int, optional) – Force width for the stimulus. Default is None.
**kwargs (Additional keyword arguments for customization.)
- Returns:
xAx (object) – x-axis object.
yAx (object) – y-axis object.
- pyneurotrace.viz.plotLine(data, hz, branches=None, stim=None, labels=None, colors=None, title=None, yTitle='DF/F0', split=True, limitSec=None, overlayStim=True, savePath=None, hybridStimColours=True, yTickScale=1, yTickPct=True, yPad=0.05)
Plots line data with optional branches and stimulus.
- Parameters:
data (array) – Data to be plotted.
hz (int) – Sampling rate in Hz.
branches (array, optional) – Array of branch data. Default is None.
stim (array, optional) – Array of stimulus data. Default is None.
labels (list, optional) – Labels for the lines. Default is None.
colors (array, optional) – Colors for the lines. Default is None.
title (str, optional) – Title for the plot. Default is None.
yTitle (str, optional) – Title for the y-axis. Default is ‘DF/F0’.
split (bool, optional) – Flag to split the lines. Default is True.
limitSec (tuple, optional) – Time limits for the plot in seconds. Default is None.
overlayStim (bool, optional) – Flag to overlay stimulus data. Default is True.
savePath (str, optional) – Path to save the plot. Default is None.
hybridStimColours (bool, optional) – Flag for hybrid stimulus colors. Default is True.
yTickScale (int, optional) – Scale for the y-axis ticks. Default is 1.
yTickPct (bool, optional) – Flag to format y-axis ticks as percentages. Default is True.
yPad (float, optional) – Padding for the y-axis. Default is .05.
- Returns:
xAx (object) – x-axis object.
yAx (object) – y-axis object.
- pyneurotrace.viz.plotAveragePostStimIntensity(data, hz, stimOffIdx, stimOnIdx, branches=None, title=None, secBefore=0, secAfter=3, savePath=None, **kwargs)
Plots average post-stimulus intensity.
- Parameters:
data (array) – Data to be plotted.
hz (int) – Sampling rate in Hz.
stimOffIdx (int) – Index of stimulus off.
stimOnIdx (int, optional) – Index of stimulus on. Default is None.
branches (array, optional) – Array of branch data. Default is None.
title (str, optional) – Title for the plot. Default is None.
secBefore (int, optional) – Seconds before the stimulus. Default is 0.
secAfter (int, optional) – Seconds after the stimulus. Default is 3.
savePath (str, optional) – Path to save the plot. Default is None.
**kwargs (Additional keyword arguments for customization.)
- Return type:
None
- pyneurotrace.viz.plotAveragePostStimTransientParams(dfof, hz, stimOffsets, secAfter, vizTrace=None, savePath=None)
Plots average post-stimulus transient parameters.
- Parameters:
dfof (array) – Data to be plotted.
hz (int) – Sampling rate in Hz.
stimOffsets (array) – Array of stimulus offsets.
secAfter (int) – Seconds after the stimulus.
vizTrace (int, optional) – Index of trace to visualize. Default is None.
savePath (str, optional) – Path to save the plot. Default is None.
- Returns:
ax – Axis object.
- Return type:
object
- pyneurotrace.viz.plotPlanarStructure(tree, rootID, nodeXYZ, branchIDs=None, colors=None, title=None, flipY=False, scale=1, savePath=None, lineAlpha=0.8, flatten='Z', pixelMeters=None, palette='seaborn-v0_8-dark-palette', bgColor='black')
Plots a planar structure of the tree.
- Parameters:
tree (dict) – Dictionary representing the tree structure.
rootID (int) – ID of the root node.
nodeXYZ (array) – Array of node locations (XYZ coordinates).
branchIDs (array, optional) – Array of branch IDs. Default is None.
colors (array, optional) – Colors for the branches. Default is None.
title (str, optional) – Title for the plot. Default is None.
flipY (bool, optional) – Flag to flip the y-axis. Default is False.
scale (float, optional) – Scale factor for the plot. Default is 1.
savePath (str, optional) – Path to save the plot. Default is None.
lineAlpha (float, optional) – Alpha value for the lines. Default is 0.8.
flatten (str, optional) – Axis to flatten. Default is ‘Z’.
pixelMeters (float, optional) – Pixel to meter conversion factor. Default is None.
palette (str, optional) – Color palette for the plot. Default is ‘seaborn-v0_8-dark-palette’.
bgColor (str, optional) – Background color for the plot. Default is ‘black’.
- Returns:
ax – Axis object.
- Return type:
object
- pyneurotrace.viz.plotBaseTipScatter(baseTrace, tipTrace, title=None, **kwargs)
Scatter plot of all samples from traces from a filopodia tip vs. filopodia base.
- Parameters:
baseTrace (array) – Base trace data.
tipTrace (array) – Tip trace data.
title (str, optional) – Title for the plot. Default is None.
**kwargs (Additional keyword arguments for customization.)
- Returns:
ax – Axis object.
- Return type:
object
- pyneurotrace.viz.planarAnimation(tree, rootID, nodeXYZ, traceData, hz, flipY=False, stim=None, stimXY=(0, 0), radius=0.005, savePath=None, scale=1, flatten='Z')
Creates an animation of the planar structure with trace data.
- Parameters:
tree (dict) – Dictionary representing the tree structure.
rootID (int) – ID of the root node.
nodeXYZ (array) – Array of node locations (XYZ coordinates).
traceData (array) – Array of trace data.
hz (int) – Sampling rate in Hz.
flipY (bool, optional) – Flag to flip the y-axis. Default is False.
stim (array, optional) – Array of stimulus data. Default is None.
stimXY (tuple, optional) – Stimulus position in the plot. Default is (0,0).
radius (float, optional) – Radius of the nodes. Default is 0.005.
savePath (str, optional) – Path to save the animation. Default is None.
scale (float, optional) – Scale factor for the plot. Default is 1.
flatten (str, optional) – Axis to flatten. Default is ‘Z’.
- Returns:
anim – Animation object.
- Return type:
object
- pyneurotrace.viz.kymograph(kymoData, hz, smooth=False, title=None, widthInches=10, heightInches=60)
Shows raw intensity across the pixel line scanned around the POI to check for drift.
- Parameters:
kymoData (array) – Kymograph data.
hz (int) – Sampling rate in Hz.
smooth (bool, optional) – Flag to smooth the data. Default is False.
title (str, optional) – Title for the plot. Default is None.
widthInches (int, optional) – Width of the plot in inches. Default is 10.
heightInches (int, optional) – Height of the plot in inches. Default is 60.
- Returns:
ax – Axis object.
- Return type:
object
- pyneurotrace.viz.scrollingAnimation(data, hz, branches, stim, title, savePath)
Creates a scrolling animation of the data.
- Parameters:
data (array) – Data to be animated.
hz (int) – Sampling rate in Hz.
branches (array) – Array of branch data.
stim (array) – Array of stimulus data.
title (str) – Title for the animation.
savePath (str) – Path to save the animation.
- Returns:
anim – Animation object.
- Return type:
object