cgid.spikes module

spiking analysis tools for the CGID datasets

cgid.spikes.amap(f, x)[source]
cgid.spikes.get_MUA_all_spikes(session, area, tr, ch=None, fsmooth=5, epoch=None)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • tr (int) – Which trial to example. Trial indexing start at 1 for Matlab
  • ch (int) – Which channel to examine. Channel indexing starts at 1 for Matlab compatibility
cgid.spikes.get_MUA_good_spikes(session, area, tr, epoch, ch=None, fsmooth=None, Fs=1000)
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • tr (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
  • ch (int) – Which channel to examine. Channel indexing starts at 1 for Matlab compatibility
cgid.spikes.get_MUA_spikes(session, area, tr, epoch, ch=None, fsmooth=None, Fs=1000)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • tr (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
  • ch (int) – Which channel to examine. Channel indexing starts at 1 for Matlab compatibility
cgid.spikes.get_all_MUA_all_spikes(s, a, tr, fsmooth=5, epoch=None)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • tr (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
cgid.spikes.get_all_MUA_spikes(s, a, tr, epoch, fsmooth=5)[source]
Parameters:
  • s (string) – Which experimental session to use, for example “SPK120924”
  • a (string) – Which motor area to use, for example ‘PMv’
  • tr (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_all_MUA_spikes_all_areas(session, trial, epoch, fsmooth=5)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_all_MUA_spikes_all_areas_average(session, trial, epoch, fsmooth=5, Fs=1000)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_all_good_spike_rasters(session, area, tr, epoch)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_all_good_spike_rasters_all_areas(session, trial, epoch)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_all_good_spike_times(session, area, tr, epoch)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • tr (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_all_good_spike_times_all_areas(session, trial, epoch)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_all_good_trial_spike_times(session, area, unit, epoch)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_all_other_spikes_on_channel(session, area, unit, trial, epoch)[source]

Returns ALL threshold crossing, including noise and multi-unit has as well as potentially well isolated units, on a given channel. EXCLUDING the unit passed as argument. Returns a 1ms binned count

Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_all_spikes_on_channel(session, area, trial, channel, epoch)[source]

Returns ALL threshold crossing, including noise and multi-unit has as well as potentially well isolated units, on a given channel. Returns a 1ms binned count

Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • channel (int) – Which channel to examine. Channel indexing starts at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_all_units(session, area)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
cgid.spikes.get_all_units_on_channel(session, area, ch)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • ch (int) – Which channel to examine. Channel indexing starts at 1 for Matlab compatibility
cgid.spikes.get_boxfiltered_mua(units, epoch, box=25)[source]
cgid.spikes.get_cgid_units_class(session, area, unitclass=u'Periodic')[source]

Classes are Rhythmic Burst Poisson Other Created November 2015 See the file Figure_1_ISIs_and_classifications.py All Units have at least 200 ISI events between the first second and 1s pre-go periods.

Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
cgid.spikes.get_channel(session, area, unit)
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
cgid.spikes.get_channel_id(session, area, unit)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
cgid.spikes.get_channel_ids(session, area)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
cgid.spikes.get_epoch_firing_rate(session, area, unit, epoch)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_good_MUA_spikes(session, area, tr, epoch, ch=None, fsmooth=None, Fs=1000)
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • tr (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
  • ch (int) – Which channel to examine. Channel indexing starts at 1 for Matlab compatibility
cgid.spikes.get_good_high_rate_units(session, area)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
cgid.spikes.get_good_units(session, area)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
cgid.spikes.get_good_units_on_channel(session, area, ch)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • ch (int) – Which channel to examine. Channel indexing starts at 1 for Matlab compatibility
cgid.spikes.get_hash_on_channel(session, area, trial, channel, epoch)[source]

Returns the multi-unit hash (if available) on the specified channel Returns a 1ms binned count

Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • channel (int) – Which channel to examine. Channel indexing starts at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_isi_stats(spikes, epoch, FS=1000, BURST_CUTOFF_MS=10, MIN_NISI=100)[source]

Computes a statistical summary of an ISI distribution. Accepts a list of lists of spike times return burstiness, ISI_cv, mean_rate, KS, mode, burst_free_ISI_cv, burst_free_mean_rate, burst_free_mode

cgid.spikes.get_isi_stats_unit_epoch(session, area, unit, epoch, MIN_NISI)[source]

Computes a statistical summary of an ISI distribution for given unit for all good trials for given epoch

Returns:

Return type:

burstiness, ISI_cv, mean_rate, KS, mode, burst_free_ISI_cv, burst_free_mean_rate, burst_free_mode

Parameters:
  • ----------
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_mean_waveform(s, a, u)[source]
Parameters:
  • ----------
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
cgid.spikes.get_multiunit_on_channel(session, area, trial, channel, epoch)[source]

Returns the multi-unit hash (if available) on the specified channel Returns a 1ms binned count

Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • channel (int) – Which channel to examine. Channel indexing starts at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_neighbor_MUA(session, area, unit, trial, epoch)[source]

Version 0.2

Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_spike_times_all_trials(session, area, unit, epoch, good=True)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_spikes(session, area, unit, trial)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
cgid.spikes.get_spikes_and_lfp_all_trials(session, area, unit, epoch)[source]
Parameters:
  • ----------
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_spikes_epoch(session, area, unit, trial, epoch)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_spikes_epoch_all_trials(session, area, unit, epoch)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_spikes_event(session, area, unit, trial, event, start, stop)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • event (int) – Which trial epoch to examine
  • start (float) – Start time
  • stop (float) – Stop time
cgid.spikes.get_spikes_for_all_units_all_areas(s, epoch, B=None, use=None, decimate=1)[source]
cgid.spikes.get_spikes_raster(session, area, unit, trial, epoch=None)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • trial (int) – Which trial to example. Trial indexing start at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_spikes_raster_all_trials(session, area, unit, epoch)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_spikes_session(session, area, unit, Fs=1000)[source]
spikeTimes:
1xNUNITS cell array of spike times in seconds. These are raw spike times for the whole session and have not been segmented into individual trials.
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
cgid.spikes.get_spikes_session_filtered_by_epoch(session, area, unit, epoch)[source]

spike times from session. spike times outside of trials, from bad trials, and outside of epoch on good trials, are removed

Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • epoch (int) – Which trial epoch to examine
cgid.spikes.get_spikes_session_raster(session, area, unit, start, stop, decimate=1)[source]

Get spikes as raster for a fixed time window relative to session time sample rate is 1KHz and sample times are in ms (equiv. samples)

Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • start (float) – Start time
  • stop (float) – Stop time
  • decimate (int, default 1) – If decimate is > 1, spike raster will be down-sampled by decimate
cgid.spikes.get_spikes_session_time(session, area, unit, start, stop)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
  • start (float) – Start time
  • stop (float) – Stop time
cgid.spikes.get_unfiltered_mua(units, epoch)[source]
cgid.spikes.get_unit_SNR(session, area, unit)[source]

Defined as in Vargas-Irwin and Donoghue 2007 SNR = 0.5 * (peak-trough) / np.std( first time-bin )

Parameters:
  • ----------
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
cgid.spikes.get_unit_channel(session, area, unit)
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • unit (int) – Which unit to examine. Unit indexing starts at 1 for Matlab compatibility
cgid.spikes.get_unit_ids(session, area)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
cgid.spikes.get_unit_quality(session, area, unit=None)[source]
Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
cgid.spikes.locate_multiunit_hash_on_channel(session, area, channel)[source]

For a given session, area, and channel, determines which unit ID (1-indexed) corresponds to the multi-unit hash on that channel. Note that this may not always be available. Note that some “sorted” units may also be multi-unit

Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • ch (int) – Which channel to examine. Channel indexing starts at 1 for Matlab compatibility
cgid.spikes.locate_multiunits_on_channel(session, area, channel)[source]

Any channel may have one or more units marked as multi-unit. This code locates them.

Parameters:
  • session (string) – Which experimental session to use, for example “SPK120924”
  • area (string) – Which motor area to use, for example ‘PMv’
  • ch (int) – Which channel to examine. Channel indexing starts at 1 for Matlab compatibility
cgid.spikes.poisson_KS(allisi)[source]

KS statistics for an ISI distribution against the Poisson (Exponential) input: isi events

cgid.spikes.remove_bursts(spikes, duration=5)[source]

remove spikes too close together input: list of lists of spike times

cgid.spikes.spikejitter(x, jitter=50)[source]

accepts and returns raster. spikes might be jittered outside of range of x, in which case they are removed.

cgid.spikes.unit_class_summary(group, verbose=True)[source]

Extracts summary statistics for a tagged group of neurons. This is hard coded to use unit categories defined at /home/mrule/Desktop/Workspace2/CGID_unit_classification/20141106 manually sort isi wf acorr isolated units/ >>>> useable,thin,thick,missing = unit_class_summary(group,verbose=True)