neurochat.nc_event module

This module implements the NEvent Class for NeuroChaT software.

@author: Md Nurul Islam; islammn at tcd dot ie

class neurochat.nc_event.NEvent(event_names=[], timestamps=[], event_train=[], **kwargs)[source]

Bases: neurochat.nc_base.NBase

Store external events or stimuli and relate them to neural data.

This data class is the placeholder for the dataset that contains information about external events or stimuli. Events are stored as a name (str), tag (int) and a timestamp (float). Each tag is a unique integer number representing a particular event.

Parameters:
  • event_names (list of str, or np.ndarray) – The name of each timestamped event.
  • timestamps (list of float, or np.ndarray) – The time of each event.
  • event_train (list of int, or np.ndarry) – The unique integer tag of each timestamped event.
  • **kwargs – Keyword arguments passed to NBase init.
__repr__()[source]

Return a REPL string, eval(repr(self)) = self.

__str__()[source]

Return a user friendly (time, name, tag) string.

Only returns the first and last 10 events if more than 20 events.

add_lfp(lfp=None, **kwargs)[source]

Add a new LFP node to current NEvent() object.

Parameters:lfp (NLfp) – NLfp object. If None, new object is created
Returns:` (obj:Nlfp`) – A new NLfp() object
add_spike(spike=None, **kwargs)[source]

Add new spike node to current NEvent() object.

Parameters:spike (NSpike) – NSPike object. If None, new object is created
Returns:` (obj:NSpike`) – A new NSpike() object
get_bytes_per_timestamp()[source]

Return the number of bytes per timestamp.

Parameters:None
Returns:int – The number of bytes per timestamp.
get_event_name(event_tag=None)[source]

Return name of the event from its tag.

Parameters:event_tag (int) –
Returns:event_name (str) – Name of the event
get_event_stamp(event=None)[source]

Return timestamps for a particular event.

Parameters:event (str or int) – If str, represent the name of the event. If int, represents event tag.
Returns:timestamp (ndarray) – Timestamps of the event
get_event_train()[source]

Return tags for all events in temporal order.

Parameters:None
Returns:ndarray – Train of events as train of tags
get_tag(event_name=None)[source]

Return tag of the event from its name.

Parameters:event_name (str) –
Returns:event_tag (int) – Tag of the event
get_timebase()[source]

Get timebase.

Returns:float
get_timestamp()[source]

Return timestamps for all events.

Parameters:None
Returns:timestamp (ndarray) – Timestamps of all the events
get_total_samples()[source]

Return the total number of samples.

Parameters:None
Returns:int – The number of samples.
load(filename=None, system=None)[source]

Read event file from the recording formats.

This is currently only implemented for the Axona .stm format.

Parameters:
  • filename (str) – Full filepath of the event data.
  • system (str) – Data format or the recording system. Currently, only “Axona” is supported.
Returns:

None

load_lfp(names=None)[source]

Load datasets of the LFP nodes.

The name of each node is used for obtaining the filenames.

Parameters:names (list of str) – Names of the nodes to load. If all, all LFP nodes are loaded
Returns:None
load_spike(names='all')[source]

Load datasets of the spike nodes.

The name of each node is used for obtaining the filenames.

Parameters:names (list of str) – Names of the nodes to load. If ‘all’, all the spike nodes are loaded.
Returns:None
phase_dist(lfp=None, **kwargs)[source]

Analysis of event to LFP phase distribution.

Delegates to NLfp().phase_dist()

Parameters:
  • lfp (NLfp) – LFP object which contains the LFP data.
  • **kwargs – Keyword arguments
Returns:

dict – Graphical data of the analysis

See also

nc_lfp.NLfp()

plv(lfp=None, **kwargs)[source]

Calculate phase-locking value of event train to underlying LFP signal.

Delegates to NLfp().plv()

Parameters:
  • lfp (NLfp) – LFP object which contains the LFP data
  • **kwargs – Keyword arguments
Returns:

dict – Graphical data of the analysis

See also

nc_lfp.NLfp()

psth(event=None, spike=None, **kwargs)[source]

Calculate peri-stimulus time histogram (PSTH).

Parameters:
  • event – Event name or tag
  • spike (NSpike) – NSpike object to characterize
  • **kwargs – Keyword arguments
Returns:

dict – Graphical data of the analysis

set_curr_name(name)[source]

Set current event using event name.

Parameters:name (str) – Name of the event
Returns:None
set_curr_tag(event)[source]

Set current tag of to consider for analysis.

Parameters:event (str or int) – If str, represent the name of the event. If int, represents event tag.
Returns:None
set_timebase(timebase)[source]

Set timebase.

Parameters:timebase (int) – Timebase
Returns:None