mplview.core module

class mplview.core.MatplotlibViewer(*args, **kwargs)[source]

Bases: matplotlib.figure.Figure

Provides a way to interact with numpy arrays pulled from neuron images.

Wraps a Matplotlib figure instance.

color_range_update(vmin, vmax)[source]

Handles an update to the vmin and vmax range based on the selection provided.

Parameters:
  • the min value selected (vmin) –
  • the max value selected (vmax) –
format_coord(x, y)[source]

Include intensity when showing coordinates during mouseover.

Parameters:
  • x (float) – cursor’s x position within the image.
  • y (float) – cursor’s y position within the image.
Returns:

coordinates and intensity if it can be gotten.

Return type:

str

get_image(i=None)[source]

Gets the current image or the image if it is a projection.

Parameters:i (int) – image to retrieve (defaults to selection).
Returns:the current image.
Return type:numpy.ndarray
set_images(new_neuron_images, cmap=<matplotlib.colors.LinearSegmentedColormap object>, use_matshow=False, vmin=None, vmax=None)[source]

Sets the images to be viewed.

Parameters:new_neuron_images (numpy.ndarray) – array of images (first index is which image)
time_update()[source]

Method to be called by the SequenceNavigator when the time changes. Updates image displayed.

class mplview.core.SequenceNavigator(fig, max_time, min_time=0, time_step=1, axcolor='lightgoldenrodyellow', hovercolor='0.975')[source]

Bases: object

begin_time(event)[source]

Sets time to min_time.

Parameters:Matplotlib event that caused the call to this callback. (event) –
disconnect(cid)[source]

Disconnects the given cid from being notified of time updates.

Parameters:ID of callback to pull (cid) –
end_time(event)[source]

Sets time to max_time.

Parameters:Matplotlib event that caused the call to this callback. (event) –
next_time(event)[source]

Sets time to one time_step after.

Parameters:Matplotlib event that caused the call to this callback. (event) –
normalize_val(val)[source]

Takes the time value and normalizes it to fit within the range. Then, makes sure it is a discrete number of steps from the min_time.

Parameters:float position from the slider bar to correct (val) –
Returns:the normalized value.
Return type:int
on_time_update(func)[source]

Registers a callback function for notification when the time is updated.

Parameters:func (callable) – function call when the time is updated
Returns:
a callback ID or cid to allow pulling the
callback when no longer necessary.
Return type:int
prev_time(event)[source]

Sets time to one time_step prior.

Parameters:Matplotlib event that caused the call to this callback. (event) –
time_update(val)[source]

Takes the time value and normalizes it within the range if it does not fit.

Parameters:float position from slider bar to move to (val) –