Perform custom analysis directly from NeuroScope2
You can add your own custom functions that can be run from NeuroScope2 from the menu called Analysis. You must create a wrapper function for what you want to call outside NeuroScope2. There are a lot of examples included, that you can take inspiration from. The analysis tools are located in the +analysis_tools
folder. Please see the wrapper example at the bottom of this page.
Organization of analysis tools and included functions
The analysis menu and underlying +analysis_tools
folder are organized according to the underlying data types of CellExplorer. Various functions are already included:
behavior:
- 2D and
- 3D plot of behavior
cell_metrics
- run ProcessCellMetrics
- open CellExplorer
- Plot metrics for a subset of cells, including CCGs and other built-in plots from CellExplorer
events
- detect ripples. Shows a dialog first, allowing for defining input parameters
lfp
- generate the .lfp file from the raw data
session
- Plot channel coordinates
spikes
- Detect monosynaptic connections
- plot CCGs
- plot spike-rasters
states
- Detect brain states using
SleepScoreMaster
- requires the Buzcode toolbox. - Edit brain states in
TheStateEditor
- requires the Buzcode toolbox.
timeseries
- open StateExplorer
traces
- Plot correlation between channels
- Plot RMS noise across channels
- Show power spectral density across channels on a linear scale
- Show power spectral density across channels on a log scale
- Show temporal offsets between channels
The folder structure is purely for organization but the names are hard-coded in NeuroScope2, so they should not be altered.
Wrapper example provided
The wrapper example is located in the +traces folder (wrapper_example.m
), use it to built your own analysis functions.
function out = wrapper_example(varargin)
% This is a wrapper example file for NeuroScope2.
% Use this wrapper example to make calls from NeuroScope to any other analysis that can be applied to the traces, raw data or any derived data types.
% This function can be called from NeuroScope2 via the menu Analysis
p = inputParser;
% The inputs are NeuroScope2 variables:
addParameter(p,'UI',[],@isstruct); % UI: struct with UI elements and settings of NeuroScope2
addParameter(p,'ephys',[],@isstruct); % ephys: Struct with ephys data for current shown time interval, e.g. ephys.raw (raw unprocessed data), ephys.traces (processed data)
addParameter(p,'data',[],@isstruct); % data: contains all external data loaded like data.session, data.spikes, data.events, data.states, data.behavior
parse(p,varargin{:})
ephys = p.Results.ephys;
UI = p.Results.UI;
data = p.Results.data;
out = [];
% % % % % % % % % % % % % % % %
% Function content below
% % % % % % % % % % % % % % % %
% Your function content should go here