CuratedSpikeAnalysis

The CuratedSpikeAnalysis class is to be used to only assess a subset of responsive neurons as defined in the SpikeAnalysis class. This requires the entry of a curation dictionary which contains the following structure:

curation = {'stim' : {'activated': np.array([True, True, False, True])}}

To make generation of this easier there is a bit in get_responsive_neurons() function in the SpikeAnalysis class. This can then be read with the read_responsive_neurons() function.

import spikeanalysis as sa

# st is a SpikeAnalysis
st.get_responsive_neurons(z_parameters=my_parameters) # created a parameters dict
st.save_responsive_neurons()

curation = sa.read_responsive_neurons(file_path)

curated_st = sa.CuratedSpikeAnalysis(curation=curation)

Loading the Data

Because CuratedSpikeAnalysis is a SpikeAnalysis object it requires StimulusData and a SpikeData. These can be loaded with the normal methods set_stimulus_data() and set_spike_data(), but there is also a convenience function to load all necessary data from the SpikeAnalysis: set_spike_analysis().

# This will collect stim and spike data all at once.
curated_st.set_spike_analysis(st)

Curating the Data

There is one additional function to run curate(), which will use the curation dictionary to curate based on the subset of data the user wishes to analyze. For example:

curated_st.curate(criteria = 'stim', by_stim=True, by_response=False, by_trial='all')

This will then select only neurons deemed responsive during 'stim' without regard to response type (e.g. an activated neuron vs an inhited) and the neurons must be response during all trial groups (by_trial='all'). If one wishes to look at any trial group then one can set by_trial=False

There are a lot of customization options. For example, by_stim and by_trial:

curated_st.curate(criteria = {'stim':'inhibited'}, by_stim=True, by_response=True, by_trial=False)

In this case the analysis would be neurons which are inhibited by the the stimulus stim as long as they were inhibited in at least one trial grouping.

To look at a single trial within a stim and response type set by_trial=True and give a trial_index.

Reverting the Data

To revert back to the original full set of neurons use revert_curation() function.

curated_st.revert_curation()

Plotting the Data

Since CuratedSpikeAnalysis inherits from SpikeAnalysis it can be used with the SpikePlotter class with no additional work.

plotter = sa.SpikePlotter()

plotter.set_analysis(curated_st)
plotter.plot_zscores()