Spike Plotting API
bmtool.bmplot.spikes.raster(spikes_df=None, config=None, network_name=None, groupby='pop_name', ax=None, tstart=None, tstop=None, color_map=None, dot_size=0.3)
Plots a raster plot of neural spikes, with different colors for each population.
Parameters:
spikes_df : pd.DataFrame, optional
DataFrame containing spike data with columns 'timestamps', 'node_ids', and optional 'pop_name'.
config : str, optional
Path to the configuration file used to load node data.
network_name : str, optional
Specific network name to select from the configuration; if not provided, uses the first network.
ax : matplotlib.axes.Axes, optional
Axes on which to plot the raster; if None, a new figure and axes are created.
tstart : float, optional
Start time for filtering spikes; only spikes with timestamps greater than tstart
will be plotted.
tstop : float, optional
Stop time for filtering spikes; only spikes with timestamps less than tstop
will be plotted.
color_map : dict, optional
Dictionary specifying colors for each population. Keys should be population names, and values should be color values.
dot_size: float, optional
Size of the dot to display on the scatterplot
Returns:
matplotlib.axes.Axes Axes with the raster plot.
Notes:
- If
config
is provided, the function merges population names from the node data withspikes_df
. - Each unique population from groupby in
spikes_df
will be represented by a different color ifcolor_map
is not specified. - If
color_map
is provided, it should contain colors for all uniquepop_name
values inspikes_df
.
Source code in bmtool/bmplot/spikes.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|