Skip to content

Commit c0ba413

Browse files
committed
Initial commit.
0 parents  commit c0ba413

8 files changed

+588
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*~
2+
*.asv

Example.mlx

67.4 KB
Binary file not shown.

README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Spike Raster Plot
2+
3+
Version: 1.0
4+
5+
This chart creates a spike raster plot from spike time stamps with optional trial and group data.
6+
7+
## Syntax
8+
* `spikeRasterPlot(spikeTimes)` create a spike raster plot with the specified spike timestamps. spikeTimes must be a vector of duration values.
9+
* `spikeRasterPlot(spikeTimes, trials)` create a spike raster plot with the specified trial assignment for each spike time. trials must be a vector of equal length to the spike times and of type categorical or be convertible to categorical.
10+
* `spikeRasterPlot()` create a spike raster plot using only name-value pairs.
11+
* `spikeRasterPlot(___,Name,Value)` specifies additional options for the spike raster plot using one or more name-value pair arguments. Specify the options after all other input arguments.
12+
* `spikeRasterPlot(parent,___)` creates the spike raster plot in the specified parent.
13+
* `h = spikeRasterPlot(___)` returns the spikeRasterPlot object. Use h to modify properties of the plot after creating it.
14+
15+
## Name-Value Pair Arguments/Properties
16+
* `SpikeTimeData` (n x 1 duration vector) spike time data.
17+
* `TrialData` (n x 1 categorical vector) trial assignment of each spike in the SpikeTimeData.
18+
* `GroupData` (n x 1 categorical vector) group assignment of each spike in the SpikeTimeData.
19+
* `AlignmentTimes` (n x 1 duration vector) time to use as alignment time for each trial.
20+
* `ColorOrder` (m x 3 matrix of RGB triplets) list of colors to use for each group.
21+
* `XLimits` (1 x 2 duration vector) x-limits of the plot.
22+
* `XLimitsMode` (`'auto'` or '`manual'`) mode for the x-limits.
23+
* `TitleText` (n x 1 string vector) title of the plot.
24+
* `SubtitleText` (n x 1 string vector) subtitle of the plot.
25+
* `XLabelText` (n x 1 string vector) x-label of the plot.
26+
* `YLabelText` (n x 1 string vector) y-label of the plot.
27+
* `LegendVisible` (scalar `matlab.lang.OnOffSwitchState`) display the legend or not.
28+
* `LegendTitle` (n x 1 string vector) title on the legend.
29+
30+
## Example
31+
Create a spike raster plot using generated by the helper script `createExampleData`.
32+
```
33+
[spiketimes, trials, groups, trialStarts] = createExampleData;
34+
s = spikeRasterPlot(spiketimes, trials, 'GroupData', groups);
35+
s.AlignmentTimes = trialStarts;
36+
s.LegendTitle = 'neuron';
37+
ylabel('Lap')
38+
```

SECURITY.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Reporting Security Vulnerabilities
2+
3+
If you believe you have discovered a security vulnerability, please report it to
4+
[security@mathworks.com](mailto:security@mathworks.com). Please see
5+
[MathWorks Vulnerability Disclosure Policy for Security Researchers](https://www.mathworks.com/company/aboutus/policies_statements/vulnerability-disclosure-policy.html)
6+
for additional information.

createExampleData.m

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
function [spiketimes, trials, groups, trialStarts] = createExampleData
2+
% createExampleData Generate random spike times for testing spikeRasterPlot
3+
% [times, trials, groups, starts] = createExampleData() Generate a random
4+
% spike times for two neurons across 20 trials.
5+
6+
% Copyright 2020-2021 The MathWorks, Inc.
7+
8+
% Create 20 trials, one minute apart.
9+
trialStarts = minutes(1:20);
10+
11+
% Create one neuron that fires 2 seconds into the trial.
12+
times1 = [(randn(100,20)*2.5)+2; rand(20,20)*60];
13+
trials = zeros(size(times1)) + (1:20);
14+
keep = (times1>=0 & times1<60)';
15+
times1 = seconds(times1) + trialStarts;
16+
times1 = times1(keep);
17+
t1 = trials(keep);
18+
g1 = ones(size(times1));
19+
20+
% Create another neuron that fires 20 seconds into the trial.
21+
times2 = [(randn(100,20)*5)+20; rand(10,20)*60];
22+
trials = zeros(size(times2)) + (1:20);
23+
keep = (times2>=0 & times2<60)';
24+
times2 = seconds(times2) + trialStarts;
25+
times2 = times2(keep);
26+
t2 = trials(keep);
27+
g2 = 2*ones(size(times2));
28+
29+
% Merge two together.
30+
[spiketimes, o] = sort([times1;times2]);
31+
trials = [t1; t2];
32+
trials = trials(o);
33+
groups = [g1; g2];
34+
groups = groups(o);

functionSignatures.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"spikeRasterPlot":
3+
{
4+
"inputs":
5+
[
6+
{"name":"parent", "kind":"ordered", "type":[["matlab.ui.Figure"], ["matlab.ui.container.Panel"], ["matlab.ui.container.Tab"], ["matlab.ui.container.GridLayout"], ["matlab.graphics.layout.TiledChartLayout"]]},
7+
{"name":"spikeTimes", "kind":"positional", "type":["duration", "vector"]},
8+
{"name":"trials", "kind":"positional", "type":[["numeric", "vector"],["categorical", "vector"],["string", "vector"],["cellstr", "vector"]]},
9+
{"name":"namevalue", "kind":"properties", "type":"spikeRasterPlot"}
10+
],
11+
"outputs":
12+
[
13+
{"name":"h", "type":"spikeRasterPlot"}
14+
]
15+
}
16+
}

license.txt

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Copyright (c) 2020-2021, The MathWorks, Inc.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5+
6+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8+
3. In all cases, the software is, and all modifications and derivatives of the software shall be, licensed to you solely for use in conjunction with MathWorks products and service offerings.
9+
10+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)