neurochat.nc_data module¶
This module implements NData Class for NeuroChaT software.
@author: Md Nurul Islam; islammn at tcd dot ie
-
class
neurochat.nc_data.NData[source]¶ Bases:
objectThe NData class composes (NSpike(), NSpatial(), NLfp(), and Nhdf()).
The NData class is built upon the composite structural object pattern. This data class is the main data element in NeuroChaT which delegates the analysis and other operations to respective objects.
-
lfp¶ LFP data object
Type: Nlfp
-
hdf¶ Object for manipulating HDF5 file
Type: NHdf
-
data_format¶ Recording system or format of the data file
Type: str
-
_results¶ The results of the analysis are written to this.
Type: OrderedDict
-
__getattr__(arg)[source]¶ Set precedence for delegation with NSpike() > NLfp() > NSpatial().
Parameters: arg (str) – Name of the function attributes to look for
-
angular_velocity(**kwargs)[source]¶ Analyse unit correlation to angular head velocity (AHV) of the animal.
Delegates to NSpatial().angular_velocity()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
bandpower_ratio(first_band, second_band, win_sec, **kwargs)[source]¶ Calculate the ratio in power between two bandpass filtered signals.
Delegates to NLfp.bandpower_ratio() For example [5, 11] and [1.5, 4 bands] for theta delta ratio.
Parameters: - first_band (list | tuple) – The frequency band of the ratio numerator [lower, upper].
- second_band (list | tuple) – The frequency band of the ratio denominator [lower, upper].
- win_sec (float) – The length of the window in seconds for power computation.
- **kwargs (keyword arguments) – Passed to nc_lfp.NLfp.bandpower_ratio()
Returns: float – The ratio between the band powers first_band / second_band.
See also
nc_lfp.NLfp.bandpower_ratio()
-
border(**kwargs)[source]¶ Analysis of the firing of a unit related to the environmental border.
Delegates to NSpatial().border()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
burst(burst_thresh=5, ibi_thresh=50)[source]¶ Burst analysis of spike-train.
Delegates to NSpike().burst()
Parameters: - burst_thresh (int) – Minimum ISI between consecutive spikes in a burst
- ibi_thresh (int) – Minimum inter-burst interval between two bursting groups of spikes
Returns: None
See also
nc_spike.NSpike()
-
event_trig_average(**kwargs)[source]¶ Averaging event-triggered LFP signals based on spike times.
Delegates to NLfp().event_trig_average()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_lfp.NLfp()
-
get_data_format()[source]¶ Return the recording system or data format.
Parameters: None – Returns: str
-
get_lfp_file()[source]¶ Get the filename of the LFP dataset.
Parameters: None – Returns: str – Filename of the LFP dataset
-
get_results(spaces_to_underscores=False)[source]¶ Return the parametric results of the analyses.
Parameters: spaces_to_underscores (bool) – If True, any keys in the results dicts with spaces will be converted to keys with underscores this is useful for compatibility with R, as an example. Returns: OrderedDict
-
get_spatial_file()[source]¶ Get the filename of the spatial dataset.
Parameters: None – Returns: str – Filename of the spatial dataset
-
get_spike_file()[source]¶ Get the filename of the spike dataset.
Parameters: None – Returns: str – Filename of the spike dataset
-
get_type()[source]¶ Return the type of object. For NData, this is always data type.
Parameters: None – Returns: str
-
gradient(**kwargs)[source]¶ Analysis of gradient cell.
A gradient cell is a unit whose firing rate gradually increases as the animal traverses from the border to the center of the environment.
Delegates to NSpatial().gradient()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
grid(**kwargs)[source]¶ Analysis of Grid cells.
Grid cells are characterised by formation of grid-like pattern of high activity in the firing-rate map.
Delegates to NSpatial().grid()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
hd_rate(**kwargs)[source]¶ Analysis the firing of a unit with respect to animal’s head-direction.
Delegates to NSpatial().hd_rate()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
hd_rate_ccw(**kwargs)[source]¶ Analysis of head directional tuning split into CW and CCW.
Analysis of the firing characteristics of a unit with respect to animal’s head-direction split into clockwise and counterclockwise directions.
Delegates to NSpatial().hd_rate_ccw()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
hd_shift(shift_ind=array([-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), **kwargs)[source]¶ Time shift analysis performed on head-directional firing.
Analysis of firing specificity of the unit with respect to animal’s head direction to observe whether it represents past direction or anticipates a future direction.
Delegates to NSpatial().hd_shift()
Parameters: - shift_ind (ndarray) – Index of spatial resolution shift for the spike event time. Shift -1 implies shift to the past by 1 spatial time resolution and +2 implies shift to the future by 2 spatial time resolution.
- **kwargs – Keyword arguments
Returns: dict – Graphical data of the analysis
See also
nc_spatial.NSpatial()
-
hd_shuffle(**kwargs)[source]¶ Shuffling analysis of the unit for head-directional firing.
This should be performed to see if the head-directional firing specificity is by chance or actually correlated to the head-direction of the animal.
Delegates to NSpatial().hd_shuffle()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
hd_time_lapse()[source]¶ Time-lapse firing properties of the unit with respect to HD.
HD stands for Head-Direction.
Delegates to NSpatial().hd_time_lapse()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
interdependence(**kwargs)[source]¶ Interdependence analysis between variables.
The firing rate of each variable is predicted from another variable and the distributive ratio is measured between the predicted firing rate and the calculated firing rate.
Delegates to NSpatial().interdependence()
Parameters: **kwargs – Keyword arguments Returns: None See also
nc_spatial.NSpatial()
-
isi(bins='auto', bound=None, density=False, refractory_threshold=2)[source]¶ Analysis of ISI histogram.
Delegates to NSpike().isi()
Parameters: - bins (str or int) – Number of ISI histogram bins. If ‘auto’, NumPy default is used
- bound (int) – Length of the ISI histogram in msec
- density (bool) – If true, normalized historagm is calcultaed
- refractory_threshold (int) – Length of the refractory period in msec
Returns: dict – Graphical data of the analysis
See also
nc_spike.NSpike()
-
isi_auto_corr(spike=None, **kwargs)[source]¶ Analysis of ISI autocrrelation histogram.
Delegates to NSpike().isi_corr()
Parameters: - spike (NSpike()) – If specified, it calulates cross-correlation.
- **kwargs – Keyword arguments
Returns: dict – Graphical data of the analysis
See also
nc_spike.NSpike(),nc_spike.NSpike()
-
load()[source]¶ Load the data from the filenames in each constituting object.
This loads the spatial, spike and LFP objects.
Parameters: None – Returns: None
-
load_spatial()[source]¶ Load spatial dataset from the file to NSpatial() object.
Parameters: filename (str) – Full file directory of the spike dataset Returns: None
-
load_spike()[source]¶ Load spike dataset from the file to NSpike() object.
Parameters: None – Returns: None
-
loc_auto_corr(**kwargs)[source]¶ Calculate the two-dimensional correlation of the firing map.
The firing map is the map of the firing rate of the animal with respect to its location.
Delegates to NSpatial().loc_auto_corr()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
loc_rot_corr(**kwargs)[source]¶ Calculate the rotational correlation of the firing map.
The locational firing rate of the animal with respect to location, is what is meant by the firing map.
Delegates to NSpatial().loc_rot_corr()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
loc_shift(shift_ind=array([-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), **kwargs)[source]¶ Linear time shifting analysis of the unit for spatial properties.
Analysis of firing specificity of the unit with respect to animal’s location to observe whether it represents past location of the animal or anticipates a future location.
Delegates to NSpatial().loc_shift()
Parameters: - shift_ind (ndarray) – Index of spatial resolution shift for the spike event time. For example if shift_ind = np.array([-1, +2]) Shift -1 implies shift to the past by 1 spatial time resolution, and +2 implies shift to the future by 2 spatial time resolution.
- **kwargs – Keyword arguments
Returns: dict – Graphical data of the analysis
See also
nc_spatial.NSpatial()
-
loc_shuffle(**kwargs)[source]¶ Shuffling analysis of the unit for spatial properties.
This should be performed to see if the locational firing specificity is by chance or actually correlated to the location of the animal.
Delegates to NSpatial().loc_shuffle()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
loc_time_lapse(**kwargs)[source]¶ Time-lapse firing properties of the unit with respect to location.
This means that the recording is split into multiple continuous samples. Delegates to NSpatial().loc_time_lapse()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
multiple_regression(**kwargs)[source]¶ Multiple-regression analysis to predict firing rate of the unit.
Specifically, the firing rate for each variable, namely location, head-direction, speed, AHV, and distance from border, are used to regress the instantaneous firing rate of the unit.
Delegates to NSpatial().multiple_regression()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
phase_at_spikes(**kwargs)[source]¶ Analysis of spike to LFP phase distribution.
Can use the spatial data to only consider the phase information within the place field.
Parameters: **kwargs – Keyword arguments Returns: phases, times, positions See also
nc_lfp.NLfp()
-
phase_dist(**kwargs)[source]¶ Analysis of spike to LFP phase distribution.
Delegates to NLfp().phase_dist()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_lfp.NLfp()
-
place(**kwargs)[source]¶ Analysis of place cell firing characteristics.
Delegates to NSpatial().place()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
plv(**kwargs)[source]¶ Phase-locking value of the spike train to underlying LFP signal.
Delegates to NLfp().plv()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_lfp.NLfp()
-
reset_results()[source]¶ Reset the NData results to an empty OrderedDict.
Parameters: None – Returns: None
-
save_to_hdf5()[source]¶ Store the spatial, spike and LFP datasets to HDF5 file.
Parameters: None – Returns: None
-
set_data_format(data_format=None)[source]¶ Return the parametric results of the analyses.
Parameters: data_format (str) – Recording system or format of the data Returns: None
-
set_lfp_file(filename)[source]¶ Set the filename of the LFP dataset.
Parameters: filename (str) – Full file directory of the spike dataset Returns: None
-
set_lfp_name(name)[source]¶ Set the name of the NLfp() object.
Parameters: name (str) – Name of the LFP dataset Returns: None
-
set_spatial_file(filename)[source]¶ Set the filename of the spatial dataset.
Parameters: filename (str) – Full file directory of the spike dataset Returns: None
-
set_spatial_name(name)[source]¶ Set the name of the spatial dataset.
Parameters: name (str) – Name of the spatial dataset Returns: None
-
set_spike_file(filename)[source]¶ Set the filename of the spike dataset.
Parameters: filename (str) – Full file directory of the spike dataset Returns: None
-
set_spike_name(name='C0')[source]¶ Set the name of the spike dataset.
Parameters: name (str) – Name of the spike dataset Returns: None
-
set_unit_no(unit_no)[source]¶ Set the unit number of the spike dataset to analyse.
Parameters: unit_no (int) – Unit or cell number to analyse Returns: None
-
spectrum(**kwargs)[source]¶ Analyses frequency spectrum of the LFP signal.
Delegates to NLfp().spectrum()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_lfp.NLfp()
-
speed(**kwargs)[source]¶ Analysis of unit correlation with running speed.
Delegates to NSpatial().speed()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spatial.NSpatial()
-
spike_lfp_causality(**kwargs)[source]¶ Analyses spike to underlying LFP causality.
Delegates to NLfp().spike_lfp_causality()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_lfp.NLfp()
-
subsample(sample_range)[source]¶ Sample a time range in seconds from the overall data.
Parameters: sample_range (tuple) – times in seconds to extract Returns: NData – subsampled version of initial ndata object
-
theta_index(**kwargs)[source]¶ Theta-modulation of spike-train ISI autocorrelation histogram.
Delegates to NSpike().theta_index()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spike.NSpike()
-
theta_skip_index(**kwargs)[source]¶ Calculate theta-skipping of spike-train ISI autocorrelation histogram.
Delegates to NSpike().theta_skip_index()
Parameters: **kwargs – Keyword arguments Returns: dict – Graphical data of the analysis See also
nc_spike.NSpike()
-