Stimulus Mapping


class mesmerize.viewer.modules.stimulus_mapping.ModuleGUI(parent, viewer)[source]

Returns a dictionary of the stimulus maps


Each Page instance contains the mapping data for one stimulus type

class, stim_type: str)[source]
set_data(dataframe: pandas.core.frame.DataFrame)[source]

Set the stimulus map

Parameters:dataframe – DataFrame with the appropriate rows (see add_row())
get_dataframe() → pandas.core.frame.DataFrame[source]

Get the stimulus map as a DataFrame

set_units(units: str)[source]

Set the time units

Parameters:units – One of ‘frames’ or ‘seconds’
get_units() → str[source]

Get the time units

add_row(pd_series: pandas.core.series.Series = None)[source]

Add a row to the stimulus map

Parameters:pd_series – pandas series containing the following: stimulus name, start, end, and color
delete_row(row: Union[mesmerize.viewer.modules.stimmap_modules.row.Row, int])[source]

Delete a row from the stimulus map

Parameters:row – The Row object to remove or the numerical index of the row

Clear the stimulus map

DataFrame Format

Page.set_data() expects a DataFrame in the following format


Column Description
name Stimulus name
start Start time of stimulus period
end End time of stimulus period
color Color to display in the viewer curve plot.

Data types:

Column Data type
name str
start numpy.float64
end numpy.float64

Tuple in RGBA format

(int, int, int, int)
Each int must be within the 0 - 255 range


name start end color
control 0.0 328.0 (0, 75, 0, 255)
stim_A 328.0 1156.0 (0, 0, 125, 255)
stim_C 1156.0 2987.0 (125, 0, 0, 255)