nstat.Events
- class nstat.Events(eventTimes, eventLabels=None, eventColor='r')[source]
Bases:
objectExperimental event markers for highlighting epochs in figures.
Events represent times of importance during an experiment (e.g. stimulus onset, trial boundaries) that are overlaid on raster or signal plots.
- Parameters:
eventTimes (array_like) – Vector of event times (seconds).
eventLabels (sequence of str or None) – Labels for each event. Must match the length of eventTimes when provided.
eventColor (str, default
'r') – Colour string for the event lines (Matlab-style colour codes).
- plot(*_, handle=None, colorString=None, **__)[source]
Plot event markers on one or more axes.
- Parameters:
handle (Axes or list[Axes], optional) – Axes to plot into (default: current axes).
colorString (str, optional) – Override line colour for event lines. When
None(the default), falls back toself.eventColorset at construction. Matches MATLABEvents.m:87after the upstream fix from hardcoded'r'toEObj.eventColor(see AUDIT_REPORT M17). Gold fixtureevents_exactness.matwas regenerated 2026-06-11 against this corrected MATLAB behavior.
Notes
MATLAB single-letter colour codes (
'g','b', …) differ from matplotlib’s defaults: MATLAB’s'g'is RGB[0,1,0]while matplotlib’s'g'is the darker[0,0.5,0]. Single- letter codes are translated to the MATLAB convention so the rendered colour matches MATLAB exactly.
- static fromStructure(structure)[source]
Reconstruct Events from a dictionary (inverse of
toStructure()).