repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
wonambi-python/wonambi
wonambi/widgets/overview.py
Overview.display_markers
def display_markers(self): """Mark all the markers, from the dataset. This function should be called only when we load the dataset or when we change the settings. """ for rect in self.idx_markers: self.scene.removeItem(rect) self.idx_markers = [] mar...
python
def display_markers(self): """Mark all the markers, from the dataset. This function should be called only when we load the dataset or when we change the settings. """ for rect in self.idx_markers: self.scene.removeItem(rect) self.idx_markers = [] mar...
[ "def", "display_markers", "(", "self", ")", ":", "for", "rect", "in", "self", ".", "idx_markers", ":", "self", ".", "scene", ".", "removeItem", "(", "rect", ")", "self", ".", "idx_markers", "=", "[", "]", "markers", "=", "[", "]", "if", "self", ".", ...
Mark all the markers, from the dataset. This function should be called only when we load the dataset or when we change the settings.
[ "Mark", "all", "the", "markers", "from", "the", "dataset", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/overview.py#L267-L293
train
wonambi-python/wonambi
wonambi/widgets/overview.py
Overview.mark_stages
def mark_stages(self, start_time, length, stage_name): """Mark stages, only add the new ones. Parameters ---------- start_time : int start time in s of the epoch being scored. length : int duration in s of the epoch being scored. stage_name : str ...
python
def mark_stages(self, start_time, length, stage_name): """Mark stages, only add the new ones. Parameters ---------- start_time : int start time in s of the epoch being scored. length : int duration in s of the epoch being scored. stage_name : str ...
[ "def", "mark_stages", "(", "self", ",", "start_time", ",", "length", ",", "stage_name", ")", ":", "y_pos", "=", "BARS", "[", "'stage'", "]", "[", "'pos0'", "]", "current_stage", "=", "STAGES", ".", "get", "(", "stage_name", ",", "STAGES", "[", "'Unknown'...
Mark stages, only add the new ones. Parameters ---------- start_time : int start time in s of the epoch being scored. length : int duration in s of the epoch being scored. stage_name : str one of the stages defined in global stages.
[ "Mark", "stages", "only", "add", "the", "new", "ones", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/overview.py#L351-L386
train
wonambi-python/wonambi
wonambi/widgets/overview.py
Overview.mark_quality
def mark_quality(self, start_time, length, qual_name): """Mark signal quality, only add the new ones. Parameters ---------- start_time : int start time in s of the epoch being scored. length : int duration in s of the epoch being scored. qual_name ...
python
def mark_quality(self, start_time, length, qual_name): """Mark signal quality, only add the new ones. Parameters ---------- start_time : int start time in s of the epoch being scored. length : int duration in s of the epoch being scored. qual_name ...
[ "def", "mark_quality", "(", "self", ",", "start_time", ",", "length", ",", "qual_name", ")", ":", "y_pos", "=", "BARS", "[", "'quality'", "]", "[", "'pos0'", "]", "height", "=", "10", "old_score", "=", "self", ".", "scene", ".", "itemAt", "(", "start_t...
Mark signal quality, only add the new ones. Parameters ---------- start_time : int start time in s of the epoch being scored. length : int duration in s of the epoch being scored. qual_name : str one of the stages defined in global stages.
[ "Mark", "signal", "quality", "only", "add", "the", "new", "ones", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/overview.py#L388-L419
train
wonambi-python/wonambi
wonambi/widgets/overview.py
Overview.mark_cycles
def mark_cycles(self, start_time, length, end=False): """Mark cycle bound, only add the new one. Parameters ---------- start_time: int start time in s of the bounding epoch length : int duration in s of the epoch being scored. end: bool ...
python
def mark_cycles(self, start_time, length, end=False): """Mark cycle bound, only add the new one. Parameters ---------- start_time: int start time in s of the bounding epoch length : int duration in s of the epoch being scored. end: bool ...
[ "def", "mark_cycles", "(", "self", ",", "start_time", ",", "length", ",", "end", "=", "False", ")", ":", "y_pos", "=", "STAGES", "[", "'cycle'", "]", "[", "'pos0'", "]", "height", "=", "STAGES", "[", "'cycle'", "]", "[", "'pos1'", "]", "color", "=", ...
Mark cycle bound, only add the new one. Parameters ---------- start_time: int start time in s of the bounding epoch length : int duration in s of the epoch being scored. end: bool If True, marker will be a cycle end marker; otherwise, it's star...
[ "Mark", "cycle", "bound", "only", "add", "the", "new", "one", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/overview.py#L421-L467
train
wonambi-python/wonambi
wonambi/widgets/overview.py
Overview.mousePressEvent
def mousePressEvent(self, event): """Jump to window when user clicks on overview. Parameters ---------- event : instance of QtCore.QEvent it contains the position that was clicked. """ if self.scene is not None: x_in_scene = self.mapToScene(event....
python
def mousePressEvent(self, event): """Jump to window when user clicks on overview. Parameters ---------- event : instance of QtCore.QEvent it contains the position that was clicked. """ if self.scene is not None: x_in_scene = self.mapToScene(event....
[ "def", "mousePressEvent", "(", "self", ",", "event", ")", ":", "if", "self", ".", "scene", "is", "not", "None", ":", "x_in_scene", "=", "self", ".", "mapToScene", "(", "event", ".", "pos", "(", ")", ")", ".", "x", "(", ")", "window_length", "=", "s...
Jump to window when user clicks on overview. Parameters ---------- event : instance of QtCore.QEvent it contains the position that was clicked.
[ "Jump", "to", "window", "when", "user", "clicks", "on", "overview", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/overview.py#L494-L510
train
wonambi-python/wonambi
wonambi/widgets/overview.py
Overview.reset
def reset(self): """Reset the widget, and clear the scene.""" self.minimum = None self.maximum = None self.start_time = None # datetime, absolute start time self.idx_current = None self.idx_markers = [] self.idx_annot = [] if self.scene is not None: ...
python
def reset(self): """Reset the widget, and clear the scene.""" self.minimum = None self.maximum = None self.start_time = None # datetime, absolute start time self.idx_current = None self.idx_markers = [] self.idx_annot = [] if self.scene is not None: ...
[ "def", "reset", "(", "self", ")", ":", "self", ".", "minimum", "=", "None", "self", ".", "maximum", "=", "None", "self", ".", "start_time", "=", "None", "self", ".", "idx_current", "=", "None", "self", ".", "idx_markers", "=", "[", "]", "self", ".", ...
Reset the widget, and clear the scene.
[ "Reset", "the", "widget", "and", "clear", "the", "scene", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/overview.py#L512-L524
train
wonambi-python/wonambi
wonambi/viz/plot_3d.py
_prepare_colors
def _prepare_colors(color, values, limits_c, colormap, alpha, chan=None): """Return colors for all the channels based on various inputs. Parameters ---------- color : tuple 3-, 4-element tuple, representing RGB and alpha, between 0 and 1 values : ndarray array with values for each c...
python
def _prepare_colors(color, values, limits_c, colormap, alpha, chan=None): """Return colors for all the channels based on various inputs. Parameters ---------- color : tuple 3-, 4-element tuple, representing RGB and alpha, between 0 and 1 values : ndarray array with values for each c...
[ "def", "_prepare_colors", "(", "color", ",", "values", ",", "limits_c", ",", "colormap", ",", "alpha", ",", "chan", "=", "None", ")", ":", "if", "values", "is", "not", "None", ":", "if", "limits_c", "is", "None", ":", "limits_c", "=", "array", "(", "...
Return colors for all the channels based on various inputs. Parameters ---------- color : tuple 3-, 4-element tuple, representing RGB and alpha, between 0 and 1 values : ndarray array with values for each channel limits_c : tuple of 2 floats, optional min and max values to n...
[ "Return", "colors", "for", "all", "the", "channels", "based", "on", "various", "inputs", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/viz/plot_3d.py#L146-L191
train
wonambi-python/wonambi
wonambi/viz/plot_3d.py
Viz3.add_surf
def add_surf(self, surf, color=SKIN_COLOR, vertex_colors=None, values=None, limits_c=None, colormap=COLORMAP, alpha=1, colorbar=False): """Add surfaces to the visualization. Parameters ---------- surf : instance of wonambi.attr.anat.Surf sur...
python
def add_surf(self, surf, color=SKIN_COLOR, vertex_colors=None, values=None, limits_c=None, colormap=COLORMAP, alpha=1, colorbar=False): """Add surfaces to the visualization. Parameters ---------- surf : instance of wonambi.attr.anat.Surf sur...
[ "def", "add_surf", "(", "self", ",", "surf", ",", "color", "=", "SKIN_COLOR", ",", "vertex_colors", "=", "None", ",", "values", "=", "None", ",", "limits_c", "=", "None", ",", "colormap", "=", "COLORMAP", ",", "alpha", "=", "1", ",", "colorbar", "=", ...
Add surfaces to the visualization. Parameters ---------- surf : instance of wonambi.attr.anat.Surf surface to be plotted color : tuple or ndarray, optional 4-element tuple, representing RGB and alpha, between 0 and 1 vertex_colors : ndarray nd...
[ "Add", "surfaces", "to", "the", "visualization", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/viz/plot_3d.py#L42-L93
train
wonambi-python/wonambi
wonambi/viz/plot_3d.py
Viz3.add_chan
def add_chan(self, chan, color=None, values=None, limits_c=None, colormap=CHAN_COLORMAP, alpha=None, colorbar=False): """Add channels to visualization Parameters ---------- chan : instance of Channels channels to plot color : tuple 3-, 4-...
python
def add_chan(self, chan, color=None, values=None, limits_c=None, colormap=CHAN_COLORMAP, alpha=None, colorbar=False): """Add channels to visualization Parameters ---------- chan : instance of Channels channels to plot color : tuple 3-, 4-...
[ "def", "add_chan", "(", "self", ",", "chan", ",", "color", "=", "None", ",", "values", "=", "None", ",", "limits_c", "=", "None", ",", "colormap", "=", "CHAN_COLORMAP", ",", "alpha", "=", "None", ",", "colorbar", "=", "False", ")", ":", "if", "limits...
Add channels to visualization Parameters ---------- chan : instance of Channels channels to plot color : tuple 3-, 4-element tuple, representing RGB and alpha, between 0 and 1 values : ndarray array with values for each channel limits_...
[ "Add", "channels", "to", "visualization" ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/viz/plot_3d.py#L95-L133
train
wonambi-python/wonambi
wonambi/trans/select.py
select
def select(data, trial=None, invert=False, **axes_to_select): """Define the selection of trials, using ranges or actual values. Parameters ---------- data : instance of Data data to select from. trial : list of int or ndarray (dtype='i'), optional index of trials of interest **a...
python
def select(data, trial=None, invert=False, **axes_to_select): """Define the selection of trials, using ranges or actual values. Parameters ---------- data : instance of Data data to select from. trial : list of int or ndarray (dtype='i'), optional index of trials of interest **a...
[ "def", "select", "(", "data", ",", "trial", "=", "None", ",", "invert", "=", "False", ",", "**", "axes_to_select", ")", ":", "if", "trial", "is", "not", "None", "and", "not", "isinstance", "(", "trial", ",", "Iterable", ")", ":", "raise", "TypeError", ...
Define the selection of trials, using ranges or actual values. Parameters ---------- data : instance of Data data to select from. trial : list of int or ndarray (dtype='i'), optional index of trials of interest **axes_to_select, optional Values need to be tuple or list. If t...
[ "Define", "the", "selection", "of", "trials", "using", "ranges", "or", "actual", "values", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/select.py#L179-L267
train
wonambi-python/wonambi
wonambi/trans/select.py
resample
def resample(data, s_freq=None, axis='time', ftype='fir', n=None): """Downsample the data after applying a filter. Parameters ---------- data : instance of Data data to downsample s_freq : int or float desired sampling frequency axis : str axis you want to apply downsamp...
python
def resample(data, s_freq=None, axis='time', ftype='fir', n=None): """Downsample the data after applying a filter. Parameters ---------- data : instance of Data data to downsample s_freq : int or float desired sampling frequency axis : str axis you want to apply downsamp...
[ "def", "resample", "(", "data", ",", "s_freq", "=", "None", ",", "axis", "=", "'time'", ",", "ftype", "=", "'fir'", ",", "n", "=", "None", ")", ":", "output", "=", "data", ".", "_copy", "(", ")", "ratio", "=", "int", "(", "data", ".", "s_freq", ...
Downsample the data after applying a filter. Parameters ---------- data : instance of Data data to downsample s_freq : int or float desired sampling frequency axis : str axis you want to apply downsample on (most likely 'time') ftype : str filter type to apply. T...
[ "Downsample", "the", "data", "after", "applying", "a", "filter", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/select.py#L270-L308
train
wonambi-python/wonambi
wonambi/trans/select.py
fetch
def fetch(dataset, annot, cat=(0, 0, 0, 0), evt_type=None, stage=None, cycle=None, chan_full=None, epoch=None, epoch_dur=30, epoch_overlap=0, epoch_step=None, reject_epoch=False, reject_artf=False, min_dur=0, buffer=0): """Create instance of Segments for analysis, complete with info ab...
python
def fetch(dataset, annot, cat=(0, 0, 0, 0), evt_type=None, stage=None, cycle=None, chan_full=None, epoch=None, epoch_dur=30, epoch_overlap=0, epoch_step=None, reject_epoch=False, reject_artf=False, min_dur=0, buffer=0): """Create instance of Segments for analysis, complete with info ab...
[ "def", "fetch", "(", "dataset", ",", "annot", ",", "cat", "=", "(", "0", ",", "0", ",", "0", ",", "0", ")", ",", "evt_type", "=", "None", ",", "stage", "=", "None", ",", "cycle", "=", "None", ",", "chan_full", "=", "None", ",", "epoch", "=", ...
Create instance of Segments for analysis, complete with info about stage, cycle, channel, event type. Segments contains only metadata until .read_data is called. Parameters ---------- dataset : instance of Dataset info about record annot : instance of Annotations scoring info ...
[ "Create", "instance", "of", "Segments", "for", "analysis", "complete", "with", "info", "about", "stage", "cycle", "channel", "event", "type", ".", "Segments", "contains", "only", "metadata", "until", ".", "read_data", "is", "called", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/select.py#L311-L413
train
wonambi-python/wonambi
wonambi/trans/select.py
get_times
def get_times(annot, evt_type=None, stage=None, cycle=None, chan=None, exclude=False, buffer=0): """Get start and end times for selected segments of data, bundled together with info. Parameters ---------- annot: instance of Annotations The annotation file containing events and...
python
def get_times(annot, evt_type=None, stage=None, cycle=None, chan=None, exclude=False, buffer=0): """Get start and end times for selected segments of data, bundled together with info. Parameters ---------- annot: instance of Annotations The annotation file containing events and...
[ "def", "get_times", "(", "annot", ",", "evt_type", "=", "None", ",", "stage", "=", "None", ",", "cycle", "=", "None", ",", "chan", "=", "None", ",", "exclude", "=", "False", ",", "buffer", "=", "0", ")", ":", "getter", "=", "annot", ".", "get_epoch...
Get start and end times for selected segments of data, bundled together with info. Parameters ---------- annot: instance of Annotations The annotation file containing events and epochs evt_type: list of str, optional Enter a list of event types to get events; otherwise, epochs will ...
[ "Get", "start", "and", "end", "times", "for", "selected", "segments", "of", "data", "bundled", "together", "with", "info", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/select.py#L416-L512
train
wonambi-python/wonambi
wonambi/trans/select.py
_longer_than
def _longer_than(segments, min_dur): """Remove segments longer than min_dur.""" if min_dur <= 0.: return segments long_enough = [] for seg in segments: if sum([t[1] - t[0] for t in seg['times']]) >= min_dur: long_enough.append(seg) return long_enough
python
def _longer_than(segments, min_dur): """Remove segments longer than min_dur.""" if min_dur <= 0.: return segments long_enough = [] for seg in segments: if sum([t[1] - t[0] for t in seg['times']]) >= min_dur: long_enough.append(seg) return long_enough
[ "def", "_longer_than", "(", "segments", ",", "min_dur", ")", ":", "if", "min_dur", "<=", "0.", ":", "return", "segments", "long_enough", "=", "[", "]", "for", "seg", "in", "segments", ":", "if", "sum", "(", "[", "t", "[", "1", "]", "-", "t", "[", ...
Remove segments longer than min_dur.
[ "Remove", "segments", "longer", "than", "min_dur", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/select.py#L515-L526
train
wonambi-python/wonambi
wonambi/trans/select.py
_concat
def _concat(bundles, cat=(0, 0, 0, 0)): """Prepare event or epoch start and end times for concatenation.""" chan = sorted(set([x['chan'] for x in bundles])) cycle = sorted(set([x['cycle'] for x in bundles])) stage = sorted(set([x['stage'] for x in bundles])) evt_type = sorted(set([x['name'] for x in...
python
def _concat(bundles, cat=(0, 0, 0, 0)): """Prepare event or epoch start and end times for concatenation.""" chan = sorted(set([x['chan'] for x in bundles])) cycle = sorted(set([x['cycle'] for x in bundles])) stage = sorted(set([x['stage'] for x in bundles])) evt_type = sorted(set([x['name'] for x in...
[ "def", "_concat", "(", "bundles", ",", "cat", "=", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ":", "chan", "=", "sorted", "(", "set", "(", "[", "x", "[", "'chan'", "]", "for", "x", "in", "bundles", "]", ")", ")", "cycle", "=", "sorte...
Prepare event or epoch start and end times for concatenation.
[ "Prepare", "event", "or", "epoch", "start", "and", "end", "times", "for", "concatenation", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/select.py#L529-L607
train
wonambi-python/wonambi
wonambi/trans/select.py
_divide_bundles
def _divide_bundles(bundles): """Take each subsegment inside a bundle and put it in its own bundle, copying the bundle metadata.""" divided = [] for bund in bundles: for t in bund['times']: new_bund = bund.copy() new_bund['times'] = [t] divided.append(new_bun...
python
def _divide_bundles(bundles): """Take each subsegment inside a bundle and put it in its own bundle, copying the bundle metadata.""" divided = [] for bund in bundles: for t in bund['times']: new_bund = bund.copy() new_bund['times'] = [t] divided.append(new_bun...
[ "def", "_divide_bundles", "(", "bundles", ")", ":", "divided", "=", "[", "]", "for", "bund", "in", "bundles", ":", "for", "t", "in", "bund", "[", "'times'", "]", ":", "new_bund", "=", "bund", ".", "copy", "(", ")", "new_bund", "[", "'times'", "]", ...
Take each subsegment inside a bundle and put it in its own bundle, copying the bundle metadata.
[ "Take", "each", "subsegment", "inside", "a", "bundle", "and", "put", "it", "in", "its", "own", "bundle", "copying", "the", "bundle", "metadata", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/select.py#L610-L621
train
wonambi-python/wonambi
wonambi/trans/select.py
_find_intervals
def _find_intervals(bundles, duration, step): """Divide bundles into segments of a certain duration and a certain step, discarding any remainder.""" segments = [] for bund in bundles: beg, end = bund['times'][0][0], bund['times'][-1][1] if end - beg >= duration: new_begs = a...
python
def _find_intervals(bundles, duration, step): """Divide bundles into segments of a certain duration and a certain step, discarding any remainder.""" segments = [] for bund in bundles: beg, end = bund['times'][0][0], bund['times'][-1][1] if end - beg >= duration: new_begs = a...
[ "def", "_find_intervals", "(", "bundles", ",", "duration", ",", "step", ")", ":", "segments", "=", "[", "]", "for", "bund", "in", "bundles", ":", "beg", ",", "end", "=", "bund", "[", "'times'", "]", "[", "0", "]", "[", "0", "]", ",", "bund", "[",...
Divide bundles into segments of a certain duration and a certain step, discarding any remainder.
[ "Divide", "bundles", "into", "segments", "of", "a", "certain", "duration", "and", "a", "certain", "step", "discarding", "any", "remainder", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/select.py#L624-L639
train
wonambi-python/wonambi
wonambi/trans/select.py
_create_data
def _create_data(data, active_chan, ref_chan=[], grp_name=None): """Create data after montage. Parameters ---------- data : instance of ChanTime the raw data active_chan : list of str the channel(s) of interest, without reference or group ref_chan : list of str reference...
python
def _create_data(data, active_chan, ref_chan=[], grp_name=None): """Create data after montage. Parameters ---------- data : instance of ChanTime the raw data active_chan : list of str the channel(s) of interest, without reference or group ref_chan : list of str reference...
[ "def", "_create_data", "(", "data", ",", "active_chan", ",", "ref_chan", "=", "[", "]", ",", "grp_name", "=", "None", ")", ":", "output", "=", "ChanTime", "(", ")", "output", ".", "s_freq", "=", "data", ".", "s_freq", "output", ".", "start_time", "=", ...
Create data after montage. Parameters ---------- data : instance of ChanTime the raw data active_chan : list of str the channel(s) of interest, without reference or group ref_chan : list of str reference channel(s), without group grp_name : str name of channel gr...
[ "Create", "data", "after", "montage", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/select.py#L642-L687
train
wonambi-python/wonambi
wonambi/trans/select.py
_select_channels
def _select_channels(data, channels): """Select channels. Parameters ---------- data : instance of ChanTime data with all the channels channels : list channels of interest Returns ------- instance of ChanTime data with only channels of interest Notes --...
python
def _select_channels(data, channels): """Select channels. Parameters ---------- data : instance of ChanTime data with all the channels channels : list channels of interest Returns ------- instance of ChanTime data with only channels of interest Notes --...
[ "def", "_select_channels", "(", "data", ",", "channels", ")", ":", "output", "=", "data", ".", "_copy", "(", ")", "chan_list", "=", "list", "(", "data", ".", "axis", "[", "'chan'", "]", "[", "0", "]", ")", "idx_chan", "=", "[", "chan_list", ".", "i...
Select channels. Parameters ---------- data : instance of ChanTime data with all the channels channels : list channels of interest Returns ------- instance of ChanTime data with only channels of interest Notes ----- This function does the same as wonamb...
[ "Select", "channels", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/select.py#L718-L746
train
wonambi-python/wonambi
wonambi/widgets/creation.py
create_widgets
def create_widgets(MAIN): """Create all the widgets and dockwidgets. It also creates actions to toggle views of dockwidgets in dockwidgets. """ """ ------ CREATE WIDGETS ------ """ MAIN.labels = Labels(MAIN) MAIN.channels = Channels(MAIN) MAIN.notes = Notes(MAIN) MAIN.merge_dialog = Mer...
python
def create_widgets(MAIN): """Create all the widgets and dockwidgets. It also creates actions to toggle views of dockwidgets in dockwidgets. """ """ ------ CREATE WIDGETS ------ """ MAIN.labels = Labels(MAIN) MAIN.channels = Channels(MAIN) MAIN.notes = Notes(MAIN) MAIN.merge_dialog = Mer...
[ "def", "create_widgets", "(", "MAIN", ")", ":", "MAIN", ".", "labels", "=", "Labels", "(", "MAIN", ")", "MAIN", ".", "channels", "=", "Channels", "(", "MAIN", ")", "MAIN", ".", "notes", "=", "Notes", "(", "MAIN", ")", "MAIN", ".", "merge_dialog", "="...
Create all the widgets and dockwidgets. It also creates actions to toggle views of dockwidgets in dockwidgets.
[ "Create", "all", "the", "widgets", "and", "dockwidgets", ".", "It", "also", "creates", "actions", "to", "toggle", "views", "of", "dockwidgets", "in", "dockwidgets", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/creation.py#L31-L118
train
wonambi-python/wonambi
wonambi/widgets/creation.py
create_actions
def create_actions(MAIN): """Create all the possible actions.""" actions = MAIN.action # actions was already taken """ ------ OPEN SETTINGS ------ """ actions['open_settings'] = QAction(QIcon(ICON['settings']), 'Settings', MAIN) actions['open_settings'].trigg...
python
def create_actions(MAIN): """Create all the possible actions.""" actions = MAIN.action # actions was already taken """ ------ OPEN SETTINGS ------ """ actions['open_settings'] = QAction(QIcon(ICON['settings']), 'Settings', MAIN) actions['open_settings'].trigg...
[ "def", "create_actions", "(", "MAIN", ")", ":", "actions", "=", "MAIN", ".", "action", "actions", "[", "'open_settings'", "]", "=", "QAction", "(", "QIcon", "(", "ICON", "[", "'settings'", "]", ")", ",", "'Settings'", ",", "MAIN", ")", "actions", "[", ...
Create all the possible actions.
[ "Create", "all", "the", "possible", "actions", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/creation.py#L121-L139
train
wonambi-python/wonambi
wonambi/widgets/creation.py
create_toolbar
def create_toolbar(MAIN): """Create the various toolbars.""" actions = MAIN.action toolbar = MAIN.addToolBar('File Management') toolbar.setObjectName('File Management') # for savestate toolbar.addAction(MAIN.info.action['open_dataset']) toolbar.addSeparator() toolbar.addAction(MAIN.channel...
python
def create_toolbar(MAIN): """Create the various toolbars.""" actions = MAIN.action toolbar = MAIN.addToolBar('File Management') toolbar.setObjectName('File Management') # for savestate toolbar.addAction(MAIN.info.action['open_dataset']) toolbar.addSeparator() toolbar.addAction(MAIN.channel...
[ "def", "create_toolbar", "(", "MAIN", ")", ":", "actions", "=", "MAIN", ".", "action", "toolbar", "=", "MAIN", ".", "addToolBar", "(", "'File Management'", ")", "toolbar", ".", "setObjectName", "(", "'File Management'", ")", "toolbar", ".", "addAction", "(", ...
Create the various toolbars.
[ "Create", "the", "various", "toolbars", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/creation.py#L327-L371
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.update_evt_types
def update_evt_types(self): """Update the event types list when dialog is opened.""" self.event_types = self.parent.notes.annot.event_types self.idx_evt_type.clear() self.frequency['norm_evt_type'].clear() for ev in self.event_types: self.idx_evt_type.addItem(ev) ...
python
def update_evt_types(self): """Update the event types list when dialog is opened.""" self.event_types = self.parent.notes.annot.event_types self.idx_evt_type.clear() self.frequency['norm_evt_type'].clear() for ev in self.event_types: self.idx_evt_type.addItem(ev) ...
[ "def", "update_evt_types", "(", "self", ")", ":", "self", ".", "event_types", "=", "self", ".", "parent", ".", "notes", ".", "annot", ".", "event_types", "self", ".", "idx_evt_type", ".", "clear", "(", ")", "self", ".", "frequency", "[", "'norm_evt_type'",...
Update the event types list when dialog is opened.
[ "Update", "the", "event", "types", "list", "when", "dialog", "is", "opened", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L843-L850
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.toggle_concatenate
def toggle_concatenate(self): """Enable and disable concatenation options.""" if not (self.chunk['epoch'].isChecked() and self.lock_to_staging.get_value()): for i,j in zip([self.idx_chan, self.idx_cycle, self.idx_stage, self.idx_evt_type], ...
python
def toggle_concatenate(self): """Enable and disable concatenation options.""" if not (self.chunk['epoch'].isChecked() and self.lock_to_staging.get_value()): for i,j in zip([self.idx_chan, self.idx_cycle, self.idx_stage, self.idx_evt_type], ...
[ "def", "toggle_concatenate", "(", "self", ")", ":", "if", "not", "(", "self", ".", "chunk", "[", "'epoch'", "]", ".", "isChecked", "(", ")", "and", "self", ".", "lock_to_staging", ".", "get_value", "(", ")", ")", ":", "for", "i", ",", "j", "in", "z...
Enable and disable concatenation options.
[ "Enable", "and", "disable", "concatenation", "options", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L934-L955
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.toggle_pac
def toggle_pac(self): """Enable and disable PAC options.""" if Pac is not None: pac_on = self.pac['pac_on'].get_value() self.pac['prep'].setEnabled(pac_on) self.pac['box_metric'].setEnabled(pac_on) self.pac['box_complex'].setEnabled(pac_on) sel...
python
def toggle_pac(self): """Enable and disable PAC options.""" if Pac is not None: pac_on = self.pac['pac_on'].get_value() self.pac['prep'].setEnabled(pac_on) self.pac['box_metric'].setEnabled(pac_on) self.pac['box_complex'].setEnabled(pac_on) sel...
[ "def", "toggle_pac", "(", "self", ")", ":", "if", "Pac", "is", "not", "None", ":", "pac_on", "=", "self", ".", "pac", "[", "'pac_on'", "]", ".", "get_value", "(", ")", "self", ".", "pac", "[", "'prep'", "]", ".", "setEnabled", "(", "pac_on", ")", ...
Enable and disable PAC options.
[ "Enable", "and", "disable", "PAC", "options", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L1043-L1098
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.update_nseg
def update_nseg(self): """Update the number of segments, displayed in the dialog.""" self.nseg = 0 if self.one_grp: segments = self.get_segments() if segments is not None: self.nseg = len(segments) self.show_nseg.setText('Number of segment...
python
def update_nseg(self): """Update the number of segments, displayed in the dialog.""" self.nseg = 0 if self.one_grp: segments = self.get_segments() if segments is not None: self.nseg = len(segments) self.show_nseg.setText('Number of segment...
[ "def", "update_nseg", "(", "self", ")", ":", "self", ".", "nseg", "=", "0", "if", "self", ".", "one_grp", ":", "segments", "=", "self", ".", "get_segments", "(", ")", "if", "segments", "is", "not", "None", ":", "self", ".", "nseg", "=", "len", "(",...
Update the number of segments, displayed in the dialog.
[ "Update", "the", "number", "of", "segments", "displayed", "in", "the", "dialog", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L1123-L1138
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.check_all_local
def check_all_local(self): """Check or uncheck all local event parameters.""" all_local_chk = self.event['global']['all_local'].isChecked() for buttons in self.event['local'].values(): buttons[0].setChecked(all_local_chk) buttons[1].setEnabled(buttons[0].isChecked())
python
def check_all_local(self): """Check or uncheck all local event parameters.""" all_local_chk = self.event['global']['all_local'].isChecked() for buttons in self.event['local'].values(): buttons[0].setChecked(all_local_chk) buttons[1].setEnabled(buttons[0].isChecked())
[ "def", "check_all_local", "(", "self", ")", ":", "all_local_chk", "=", "self", ".", "event", "[", "'global'", "]", "[", "'all_local'", "]", ".", "isChecked", "(", ")", "for", "buttons", "in", "self", ".", "event", "[", "'local'", "]", ".", "values", "(...
Check or uncheck all local event parameters.
[ "Check", "or", "uncheck", "all", "local", "event", "parameters", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L1140-L1145
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.check_all_local_prep
def check_all_local_prep(self): """Check or uncheck all enabled event pre-processing.""" all_local_pp_chk = self.event['global']['all_local_prep'].isChecked() for buttons in self.event['local'].values(): if buttons[1].isEnabled(): buttons[1].setChecked(all_local_pp_ch...
python
def check_all_local_prep(self): """Check or uncheck all enabled event pre-processing.""" all_local_pp_chk = self.event['global']['all_local_prep'].isChecked() for buttons in self.event['local'].values(): if buttons[1].isEnabled(): buttons[1].setChecked(all_local_pp_ch...
[ "def", "check_all_local_prep", "(", "self", ")", ":", "all_local_pp_chk", "=", "self", ".", "event", "[", "'global'", "]", "[", "'all_local_prep'", "]", ".", "isChecked", "(", ")", "for", "buttons", "in", "self", ".", "event", "[", "'local'", "]", ".", "...
Check or uncheck all enabled event pre-processing.
[ "Check", "or", "uncheck", "all", "enabled", "event", "pre", "-", "processing", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L1147-L1152
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.uncheck_all_local
def uncheck_all_local(self): """Uncheck 'all local' box when a local event is unchecked.""" for buttons in self.event['local'].values(): if not buttons[0].get_value(): self.event['global']['all_local'].setChecked(False) if buttons[1].isEnabled() and not buttons[1]...
python
def uncheck_all_local(self): """Uncheck 'all local' box when a local event is unchecked.""" for buttons in self.event['local'].values(): if not buttons[0].get_value(): self.event['global']['all_local'].setChecked(False) if buttons[1].isEnabled() and not buttons[1]...
[ "def", "uncheck_all_local", "(", "self", ")", ":", "for", "buttons", "in", "self", ".", "event", "[", "'local'", "]", ".", "values", "(", ")", ":", "if", "not", "buttons", "[", "0", "]", ".", "get_value", "(", ")", ":", "self", ".", "event", "[", ...
Uncheck 'all local' box when a local event is unchecked.
[ "Uncheck", "all", "local", "box", "when", "a", "local", "event", "is", "unchecked", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L1154-L1160
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.get_segments
def get_segments(self): """Get segments for analysis. Creates instance of trans.Segments.""" # Chunking chunk = {k: v.isChecked() for k, v in self.chunk.items()} lock_to_staging = self.lock_to_staging.get_value() epoch_dur = self.epoch_param['dur'].get_value() epoch_overl...
python
def get_segments(self): """Get segments for analysis. Creates instance of trans.Segments.""" # Chunking chunk = {k: v.isChecked() for k, v in self.chunk.items()} lock_to_staging = self.lock_to_staging.get_value() epoch_dur = self.epoch_param['dur'].get_value() epoch_overl...
[ "def", "get_segments", "(", "self", ")", ":", "chunk", "=", "{", "k", ":", "v", ".", "isChecked", "(", ")", "for", "k", ",", "v", "in", "self", ".", "chunk", ".", "items", "(", ")", "}", "lock_to_staging", "=", "self", ".", "lock_to_staging", ".", ...
Get segments for analysis. Creates instance of trans.Segments.
[ "Get", "segments", "for", "analysis", ".", "Creates", "instance", "of", "trans", ".", "Segments", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L1391-L1476
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.transform_data
def transform_data(self, data): """Apply pre-processing transformation to data, and add it to data dict. Parameters --------- data : instance of Segments segments including 'data' (ChanTime) Returns ------- instance of Segments sa...
python
def transform_data(self, data): """Apply pre-processing transformation to data, and add it to data dict. Parameters --------- data : instance of Segments segments including 'data' (ChanTime) Returns ------- instance of Segments sa...
[ "def", "transform_data", "(", "self", ",", "data", ")", ":", "trans", "=", "self", ".", "trans", "differ", "=", "trans", "[", "'diff'", "]", ".", "get_value", "(", ")", "bandpass", "=", "trans", "[", "'bandpass'", "]", ".", "get_value", "(", ")", "no...
Apply pre-processing transformation to data, and add it to data dict. Parameters --------- data : instance of Segments segments including 'data' (ChanTime) Returns ------- instance of Segments same object with transformed data as 'trans_d...
[ "Apply", "pre", "-", "processing", "transformation", "to", "data", "and", "add", "it", "to", "data", "dict", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L1478-L1537
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.save_as
def save_as(self): """Dialog for getting name, location of data export file.""" filename = splitext( self.parent.notes.annot.xml_file)[0] + '_data' filename, _ = QFileDialog.getSaveFileName(self, 'Export analysis data', filename, ...
python
def save_as(self): """Dialog for getting name, location of data export file.""" filename = splitext( self.parent.notes.annot.xml_file)[0] + '_data' filename, _ = QFileDialog.getSaveFileName(self, 'Export analysis data', filename, ...
[ "def", "save_as", "(", "self", ")", ":", "filename", "=", "splitext", "(", "self", ".", "parent", ".", "notes", ".", "annot", ".", "xml_file", ")", "[", "0", "]", "+", "'_data'", "filename", ",", "_", "=", "QFileDialog", ".", "getSaveFileName", "(", ...
Dialog for getting name, location of data export file.
[ "Dialog", "for", "getting", "name", "location", "of", "data", "export", "file", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L1539-L1551
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.plot_freq
def plot_freq(self, x, y, title='', ylabel=None, scale='semilogy'): """Plot mean frequency spectrum and display in dialog. Parameters ---------- x : list vector with frequencies y : ndarray vector with amplitudes title : str plot title...
python
def plot_freq(self, x, y, title='', ylabel=None, scale='semilogy'): """Plot mean frequency spectrum and display in dialog. Parameters ---------- x : list vector with frequencies y : ndarray vector with amplitudes title : str plot title...
[ "def", "plot_freq", "(", "self", ",", "x", ",", "y", ",", "title", "=", "''", ",", "ylabel", "=", "None", ",", "scale", "=", "'semilogy'", ")", ":", "freq", "=", "self", ".", "frequency", "scaling", "=", "freq", "[", "'scaling'", "]", ".", "get_val...
Plot mean frequency spectrum and display in dialog. Parameters ---------- x : list vector with frequencies y : ndarray vector with amplitudes title : str plot title ylabel : str plot y label scale : str ...
[ "Plot", "mean", "frequency", "spectrum", "and", "display", "in", "dialog", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L1880-L1909
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.export_pac
def export_pac(self, xpac, fpha, famp, desc): """Write PAC analysis data to CSV.""" filename = splitext(self.filename)[0] + '_pac.csv' heading_row_1 = ['Segment index', 'Start time', 'End time', 'Duration', ...
python
def export_pac(self, xpac, fpha, famp, desc): """Write PAC analysis data to CSV.""" filename = splitext(self.filename)[0] + '_pac.csv' heading_row_1 = ['Segment index', 'Start time', 'End time', 'Duration', ...
[ "def", "export_pac", "(", "self", ",", "xpac", ",", "fpha", ",", "famp", ",", "desc", ")", ":", "filename", "=", "splitext", "(", "self", ".", "filename", ")", "[", "0", "]", "+", "'_pac.csv'", "heading_row_1", "=", "[", "'Segment index'", ",", "'Start...
Write PAC analysis data to CSV.
[ "Write", "PAC", "analysis", "data", "to", "CSV", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L2135-L2198
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.compute_evt_params
def compute_evt_params(self): """Compute event parameters.""" ev = self.event glob = {k: v.get_value() for k, v in ev['global'].items()} params = {k: v[0].get_value() for k, v in ev['local'].items()} prep = {k: v[1].get_value() for k, v in ev['local'].items()} slopes = {k...
python
def compute_evt_params(self): """Compute event parameters.""" ev = self.event glob = {k: v.get_value() for k, v in ev['global'].items()} params = {k: v[0].get_value() for k, v in ev['local'].items()} prep = {k: v[1].get_value() for k, v in ev['local'].items()} slopes = {k...
[ "def", "compute_evt_params", "(", "self", ")", ":", "ev", "=", "self", ".", "event", "glob", "=", "{", "k", ":", "v", ".", "get_value", "(", ")", "for", "k", ",", "v", "in", "ev", "[", "'global'", "]", ".", "items", "(", ")", "}", "params", "="...
Compute event parameters.
[ "Compute", "event", "parameters", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L2200-L2231
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
AnalysisDialog.make_title
def make_title(self, chan, cycle, stage, evt_type): """Make a title for plots, etc.""" cyc_str = None if cycle is not None: cyc_str = [str(c[2]) for c in cycle] cyc_str[0] = 'cycle ' + cyc_str[0] title = [' + '.join([str(x) for x in y]) for y in [chan, cyc_str, ...
python
def make_title(self, chan, cycle, stage, evt_type): """Make a title for plots, etc.""" cyc_str = None if cycle is not None: cyc_str = [str(c[2]) for c in cycle] cyc_str[0] = 'cycle ' + cyc_str[0] title = [' + '.join([str(x) for x in y]) for y in [chan, cyc_str, ...
[ "def", "make_title", "(", "self", ",", "chan", ",", "cycle", ",", "stage", ",", "evt_type", ")", ":", "cyc_str", "=", "None", "if", "cycle", "is", "not", "None", ":", "cyc_str", "=", "[", "str", "(", "c", "[", "2", "]", ")", "for", "c", "in", "...
Make a title for plots, etc.
[ "Make", "a", "title", "for", "plots", "etc", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L2233-L2243
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
PlotCanvas.plot
def plot(self, x, y, title, ylabel, scale='semilogy', idx_lim=(1, -1)): """Plot the data. Parameters ---------- x : ndarray vector with frequencies y : ndarray vector with amplitudes title : str title of the plot, to appear above it ...
python
def plot(self, x, y, title, ylabel, scale='semilogy', idx_lim=(1, -1)): """Plot the data. Parameters ---------- x : ndarray vector with frequencies y : ndarray vector with amplitudes title : str title of the plot, to appear above it ...
[ "def", "plot", "(", "self", ",", "x", ",", "y", ",", "title", ",", "ylabel", ",", "scale", "=", "'semilogy'", ",", "idx_lim", "=", "(", "1", ",", "-", "1", ")", ")", ":", "x", "=", "x", "[", "slice", "(", "*", "idx_lim", ")", "]", "y", "=",...
Plot the data. Parameters ---------- x : ndarray vector with frequencies y : ndarray vector with amplitudes title : str title of the plot, to appear above it ylabel : str label for the y-axis scale : str ...
[ "Plot", "the", "data", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L2262-L2293
train
wonambi-python/wonambi
wonambi/widgets/analysis.py
PlotDialog.create_dialog
def create_dialog(self): """Create the basic dialog.""" self.bbox = QDialogButtonBox(QDialogButtonBox.Close) self.idx_close = self.bbox.button(QDialogButtonBox.Close) self.idx_close.pressed.connect(self.reject) btnlayout = QHBoxLayout() btnlayout.addStretch(1) bt...
python
def create_dialog(self): """Create the basic dialog.""" self.bbox = QDialogButtonBox(QDialogButtonBox.Close) self.idx_close = self.bbox.button(QDialogButtonBox.Close) self.idx_close.pressed.connect(self.reject) btnlayout = QHBoxLayout() btnlayout.addStretch(1) bt...
[ "def", "create_dialog", "(", "self", ")", ":", "self", ".", "bbox", "=", "QDialogButtonBox", "(", "QDialogButtonBox", ".", "Close", ")", "self", ".", "idx_close", "=", "self", ".", "bbox", ".", "button", "(", "QDialogButtonBox", ".", "Close", ")", "self", ...
Create the basic dialog.
[ "Create", "the", "basic", "dialog", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/analysis.py#L2310-L2325
train
wonambi-python/wonambi
wonambi/detect/arousal.py
make_arousals
def make_arousals(events, time, s_freq): """Create dict for each arousal, based on events of time points. Parameters ---------- events : ndarray (dtype='int') N x 5 matrix with start, end samples data : ndarray (dtype='float') vector with the data time : ndarray (dtype='float') ...
python
def make_arousals(events, time, s_freq): """Create dict for each arousal, based on events of time points. Parameters ---------- events : ndarray (dtype='int') N x 5 matrix with start, end samples data : ndarray (dtype='float') vector with the data time : ndarray (dtype='float') ...
[ "def", "make_arousals", "(", "events", ",", "time", ",", "s_freq", ")", ":", "arousals", "=", "[", "]", "for", "ev", "in", "events", ":", "one_ar", "=", "{", "'start'", ":", "time", "[", "ev", "[", "0", "]", "]", ",", "'end'", ":", "time", "[", ...
Create dict for each arousal, based on events of time points. Parameters ---------- events : ndarray (dtype='int') N x 5 matrix with start, end samples data : ndarray (dtype='float') vector with the data time : ndarray (dtype='float') vector with time points s_freq : flo...
[ "Create", "dict", "for", "each", "arousal", "based", "on", "events", "of", "time", "points", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/arousal.py#L233-L261
train
wonambi-python/wonambi
wonambi/dataset.py
_convert_time_to_sample
def _convert_time_to_sample(abs_time, dataset): """Convert absolute time into samples. Parameters ---------- abs_time : dat if it's int or float, it's assumed it's s; if it's timedelta, it's assumed from the start of the recording; if it's datetime, it's assumed it's absolute ti...
python
def _convert_time_to_sample(abs_time, dataset): """Convert absolute time into samples. Parameters ---------- abs_time : dat if it's int or float, it's assumed it's s; if it's timedelta, it's assumed from the start of the recording; if it's datetime, it's assumed it's absolute ti...
[ "def", "_convert_time_to_sample", "(", "abs_time", ",", "dataset", ")", ":", "if", "isinstance", "(", "abs_time", ",", "datetime", ")", ":", "abs_time", "=", "abs_time", "-", "dataset", ".", "header", "[", "'start_time'", "]", "if", "not", "isinstance", "(",...
Convert absolute time into samples. Parameters ---------- abs_time : dat if it's int or float, it's assumed it's s; if it's timedelta, it's assumed from the start of the recording; if it's datetime, it's assumed it's absolute time. dataset : instance of wonambi.Dataset d...
[ "Convert", "absolute", "time", "into", "samples", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/dataset.py#L36-L67
train
wonambi-python/wonambi
wonambi/dataset.py
detect_format
def detect_format(filename): """Detect file format. Parameters ---------- filename : str or Path name of the filename or directory. Returns ------- class used to read the data. """ filename = Path(filename) if filename.is_dir(): if list(filename.glob('*.stc')) ...
python
def detect_format(filename): """Detect file format. Parameters ---------- filename : str or Path name of the filename or directory. Returns ------- class used to read the data. """ filename = Path(filename) if filename.is_dir(): if list(filename.glob('*.stc')) ...
[ "def", "detect_format", "(", "filename", ")", ":", "filename", "=", "Path", "(", "filename", ")", "if", "filename", ".", "is_dir", "(", ")", ":", "if", "list", "(", "filename", ".", "glob", "(", "'*.stc'", ")", ")", "and", "list", "(", "filename", "....
Detect file format. Parameters ---------- filename : str or Path name of the filename or directory. Returns ------- class used to read the data.
[ "Detect", "file", "format", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/dataset.py#L70-L142
train
wonambi-python/wonambi
wonambi/dataset.py
Dataset.read_videos
def read_videos(self, begtime=None, endtime=None): """Return list of videos with start and end times for a period. Parameters ---------- begtime : int or datedelta or datetime or list start of the data to read; if it's int, it's assumed it's s; if it'...
python
def read_videos(self, begtime=None, endtime=None): """Return list of videos with start and end times for a period. Parameters ---------- begtime : int or datedelta or datetime or list start of the data to read; if it's int, it's assumed it's s; if it'...
[ "def", "read_videos", "(", "self", ",", "begtime", "=", "None", ",", "endtime", "=", "None", ")", ":", "if", "isinstance", "(", "begtime", ",", "datetime", ")", ":", "begtime", "=", "begtime", "-", "self", ".", "header", "[", "'start_time'", "]", "if",...
Return list of videos with start and end times for a period. Parameters ---------- begtime : int or datedelta or datetime or list start of the data to read; if it's int, it's assumed it's s; if it's datedelta, it's assumed from the start of the recording; ...
[ "Return", "list", "of", "videos", "with", "start", "and", "end", "times", "for", "a", "period", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/dataset.py#L219-L272
train
wonambi-python/wonambi
wonambi/dataset.py
Dataset.read_data
def read_data(self, chan=None, begtime=None, endtime=None, begsam=None, endsam=None, s_freq=None): """Read the data and creates a ChanTime instance Parameters ---------- chan : list of strings names of the channels to read begtime : int or datedelta...
python
def read_data(self, chan=None, begtime=None, endtime=None, begsam=None, endsam=None, s_freq=None): """Read the data and creates a ChanTime instance Parameters ---------- chan : list of strings names of the channels to read begtime : int or datedelta...
[ "def", "read_data", "(", "self", ",", "chan", "=", "None", ",", "begtime", "=", "None", ",", "endtime", "=", "None", ",", "begsam", "=", "None", ",", "endsam", "=", "None", ",", "s_freq", "=", "None", ")", ":", "data", "=", "ChanTime", "(", ")", ...
Read the data and creates a ChanTime instance Parameters ---------- chan : list of strings names of the channels to read begtime : int or datedelta or datetime or list start of the data to read; if it's int or float, it's assumed it's s; i...
[ "Read", "the", "data", "and", "creates", "a", "ChanTime", "instance" ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/dataset.py#L274-L379
train
wonambi-python/wonambi
wonambi/ioeeg/moberg.py
_read_dat
def _read_dat(x): """read 24bit binary data and convert them to numpy. Parameters ---------- x : bytes bytes (length should be divisible by 3) Returns ------- numpy vector vector with the signed 24bit values Notes ----- It's pretty slow but it's pretty a PITA t...
python
def _read_dat(x): """read 24bit binary data and convert them to numpy. Parameters ---------- x : bytes bytes (length should be divisible by 3) Returns ------- numpy vector vector with the signed 24bit values Notes ----- It's pretty slow but it's pretty a PITA t...
[ "def", "_read_dat", "(", "x", ")", ":", "n_smp", "=", "int", "(", "len", "(", "x", ")", "/", "DATA_PRECISION", ")", "dat", "=", "zeros", "(", "n_smp", ")", "for", "i", "in", "range", "(", "n_smp", ")", ":", "i0", "=", "i", "*", "DATA_PRECISION", ...
read 24bit binary data and convert them to numpy. Parameters ---------- x : bytes bytes (length should be divisible by 3) Returns ------- numpy vector vector with the signed 24bit values Notes ----- It's pretty slow but it's pretty a PITA to read 24bit as far as I ...
[ "read", "24bit", "binary", "data", "and", "convert", "them", "to", "numpy", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/moberg.py#L163-L188
train
wonambi-python/wonambi
wonambi/ioeeg/egimff.py
_read_chan_name
def _read_chan_name(orig): """Read channel labels, which can be across xml files. Parameters ---------- orig : dict contains the converted xml information Returns ------- list of str list of channel names ndarray vector to indicate to which signal a channel belo...
python
def _read_chan_name(orig): """Read channel labels, which can be across xml files. Parameters ---------- orig : dict contains the converted xml information Returns ------- list of str list of channel names ndarray vector to indicate to which signal a channel belo...
[ "def", "_read_chan_name", "(", "orig", ")", ":", "sensors", "=", "orig", "[", "'sensorLayout'", "]", "[", "1", "]", "eeg_chan", "=", "[", "]", "for", "one_sensor", "in", "sensors", ":", "if", "one_sensor", "[", "'type'", "]", "in", "(", "'0'", ",", "...
Read channel labels, which can be across xml files. Parameters ---------- orig : dict contains the converted xml information Returns ------- list of str list of channel names ndarray vector to indicate to which signal a channel belongs to Notes ----- Th...
[ "Read", "channel", "labels", "which", "can", "be", "across", "xml", "files", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/egimff.py#L427-L462
train
wonambi-python/wonambi
wonambi/ioeeg/wonambi.py
write_wonambi
def write_wonambi(data, filename, subj_id='', dtype='float64'): """Write file in simple Wonambi format. Parameters ---------- data : instance of ChanTime data with only one trial filename : path to file file to export to (the extensions .won and .dat will be added) subj_id : str...
python
def write_wonambi(data, filename, subj_id='', dtype='float64'): """Write file in simple Wonambi format. Parameters ---------- data : instance of ChanTime data with only one trial filename : path to file file to export to (the extensions .won and .dat will be added) subj_id : str...
[ "def", "write_wonambi", "(", "data", ",", "filename", ",", "subj_id", "=", "''", ",", "dtype", "=", "'float64'", ")", ":", "filename", "=", "Path", "(", "filename", ")", "json_file", "=", "filename", ".", "with_suffix", "(", "'.won'", ")", "memmap_file", ...
Write file in simple Wonambi format. Parameters ---------- data : instance of ChanTime data with only one trial filename : path to file file to export to (the extensions .won and .dat will be added) subj_id : str subject id dtype : str numpy dtype in which you wa...
[ "Write", "file", "in", "simple", "Wonambi", "format", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/wonambi.py#L120-L168
train
wonambi-python/wonambi
wonambi/attr/anat.py
_read_geometry
def _read_geometry(surf_file): """Read a triangular format Freesurfer surface mesh. Parameters ---------- surf_file : str path to surface file Returns ------- coords : numpy.ndarray nvtx x 3 array of vertex (x, y, z) coordinates faces : numpy.ndarray nfaces x 3 ...
python
def _read_geometry(surf_file): """Read a triangular format Freesurfer surface mesh. Parameters ---------- surf_file : str path to surface file Returns ------- coords : numpy.ndarray nvtx x 3 array of vertex (x, y, z) coordinates faces : numpy.ndarray nfaces x 3 ...
[ "def", "_read_geometry", "(", "surf_file", ")", ":", "with", "open", "(", "surf_file", ",", "'rb'", ")", "as", "f", ":", "filebytes", "=", "f", ".", "read", "(", ")", "assert", "filebytes", "[", ":", "3", "]", "==", "b'\\xff\\xff\\xfe'", "i0", "=", "...
Read a triangular format Freesurfer surface mesh. Parameters ---------- surf_file : str path to surface file Returns ------- coords : numpy.ndarray nvtx x 3 array of vertex (x, y, z) coordinates faces : numpy.ndarray nfaces x 3 array of defining mesh triangles ...
[ "Read", "a", "triangular", "format", "Freesurfer", "surface", "mesh", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/anat.py#L33-L72
train
wonambi-python/wonambi
wonambi/attr/anat.py
import_freesurfer_LUT
def import_freesurfer_LUT(fs_lut=None): """Import Look-up Table with colors and labels for anatomical regions. It's necessary that Freesurfer is installed and that the environmental variable 'FREESURFER_HOME' is present. Parameters ---------- fs_lut : str or Path path to file called Fr...
python
def import_freesurfer_LUT(fs_lut=None): """Import Look-up Table with colors and labels for anatomical regions. It's necessary that Freesurfer is installed and that the environmental variable 'FREESURFER_HOME' is present. Parameters ---------- fs_lut : str or Path path to file called Fr...
[ "def", "import_freesurfer_LUT", "(", "fs_lut", "=", "None", ")", ":", "if", "fs_lut", "is", "not", "None", ":", "lg", ".", "info", "(", "'Reading user-specified lookuptable {}'", ".", "format", "(", "fs_lut", ")", ")", "fs_lut", "=", "Path", "(", "fs_lut", ...
Import Look-up Table with colors and labels for anatomical regions. It's necessary that Freesurfer is installed and that the environmental variable 'FREESURFER_HOME' is present. Parameters ---------- fs_lut : str or Path path to file called FreeSurferColorLUT.txt Returns ------- ...
[ "Import", "Look", "-", "up", "Table", "with", "colors", "and", "labels", "for", "anatomical", "regions", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/anat.py#L97-L144
train
wonambi-python/wonambi
wonambi/attr/anat.py
Freesurfer.find_brain_region
def find_brain_region(self, abs_pos, parc_type='aparc', max_approx=None, exclude_regions=None): """Find the name of the brain region in which an electrode is located. Parameters ---------- abs_pos : numpy.ndarray 3x0 vector with the position of inte...
python
def find_brain_region(self, abs_pos, parc_type='aparc', max_approx=None, exclude_regions=None): """Find the name of the brain region in which an electrode is located. Parameters ---------- abs_pos : numpy.ndarray 3x0 vector with the position of inte...
[ "def", "find_brain_region", "(", "self", ",", "abs_pos", ",", "parc_type", "=", "'aparc'", ",", "max_approx", "=", "None", ",", "exclude_regions", "=", "None", ")", ":", "pos", "=", "around", "(", "dot", "(", "FS_AFFINE", ",", "append", "(", "abs_pos", "...
Find the name of the brain region in which an electrode is located. Parameters ---------- abs_pos : numpy.ndarray 3x0 vector with the position of interest. parc_type : str 'aparc', 'aparc.a2009s', 'BA', 'BA.thresh', or 'aparc.DKTatlas40' 'aparc.DKTatl...
[ "Find", "the", "name", "of", "the", "brain", "region", "in", "which", "an", "electrode", "is", "located", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/anat.py#L237-L293
train
wonambi-python/wonambi
wonambi/attr/anat.py
Freesurfer.read_seg
def read_seg(self, parc_type='aparc'): """Read the MRI segmentation. Parameters ---------- parc_type : str 'aparc' or 'aparc.a2009s' Returns ------- numpy.ndarray 3d matrix with values numpy.ndarray 4x4 affine matrix ...
python
def read_seg(self, parc_type='aparc'): """Read the MRI segmentation. Parameters ---------- parc_type : str 'aparc' or 'aparc.a2009s' Returns ------- numpy.ndarray 3d matrix with values numpy.ndarray 4x4 affine matrix ...
[ "def", "read_seg", "(", "self", ",", "parc_type", "=", "'aparc'", ")", ":", "seg_file", "=", "self", ".", "dir", "/", "'mri'", "/", "(", "parc_type", "+", "'+aseg.mgz'", ")", "seg_mri", "=", "load", "(", "seg_file", ")", "seg_aff", "=", "seg_mri", ".",...
Read the MRI segmentation. Parameters ---------- parc_type : str 'aparc' or 'aparc.a2009s' Returns ------- numpy.ndarray 3d matrix with values numpy.ndarray 4x4 affine matrix
[ "Read", "the", "MRI", "segmentation", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/anat.py#L320-L339
train
wonambi-python/wonambi
wonambi/trans/merge.py
concatenate
def concatenate(data, axis): """Concatenate multiple trials into one trials, according to any dimension. Parameters ---------- data : instance of DataTime, DataFreq, or DataTimeFreq axis : str axis that you want to concatenate (it can be 'trial') Returns ------- instace of sam...
python
def concatenate(data, axis): """Concatenate multiple trials into one trials, according to any dimension. Parameters ---------- data : instance of DataTime, DataFreq, or DataTimeFreq axis : str axis that you want to concatenate (it can be 'trial') Returns ------- instace of sam...
[ "def", "concatenate", "(", "data", ",", "axis", ")", ":", "output", "=", "data", ".", "_copy", "(", "axis", "=", "False", ")", "for", "dataaxis", "in", "data", ".", "axis", ":", "output", ".", "axis", "[", "dataaxis", "]", "=", "empty", "(", "1", ...
Concatenate multiple trials into one trials, according to any dimension. Parameters ---------- data : instance of DataTime, DataFreq, or DataTimeFreq axis : str axis that you want to concatenate (it can be 'trial') Returns ------- instace of same class as input the data wi...
[ "Concatenate", "multiple", "trials", "into", "one", "trials", "according", "to", "any", "dimension", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/merge.py#L15-L72
train
wonambi-python/wonambi
wonambi/ioeeg/lyonrri.py
LyonRRI.return_rri
def return_rri(self, begsam, endsam): """Return raw, irregularly-timed RRI.""" interval = endsam - begsam dat = empty(interval) k = 0 with open(self.filename, 'rt') as f: [next(f) for x in range(12)] for j, datum in enumerate(f): ...
python
def return_rri(self, begsam, endsam): """Return raw, irregularly-timed RRI.""" interval = endsam - begsam dat = empty(interval) k = 0 with open(self.filename, 'rt') as f: [next(f) for x in range(12)] for j, datum in enumerate(f): ...
[ "def", "return_rri", "(", "self", ",", "begsam", ",", "endsam", ")", ":", "interval", "=", "endsam", "-", "begsam", "dat", "=", "empty", "(", "interval", ")", "k", "=", "0", "with", "open", "(", "self", ".", "filename", ",", "'rt'", ")", "as", "f",...
Return raw, irregularly-timed RRI.
[ "Return", "raw", "irregularly", "-", "timed", "RRI", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/lyonrri.py#L100-L117
train
wonambi-python/wonambi
wonambi/widgets/labels.py
Labels.update
def update(self, checked=False, labels=None, custom_labels=None): """Use this function when we make changes to the list of labels or when we load a new dataset. Parameters ---------- checked : bool argument from clicked.connect labels : list of str ...
python
def update(self, checked=False, labels=None, custom_labels=None): """Use this function when we make changes to the list of labels or when we load a new dataset. Parameters ---------- checked : bool argument from clicked.connect labels : list of str ...
[ "def", "update", "(", "self", ",", "checked", "=", "False", ",", "labels", "=", "None", ",", "custom_labels", "=", "None", ")", ":", "if", "labels", "is", "not", "None", ":", "self", ".", "setEnabled", "(", "True", ")", "self", ".", "chan_name", "=",...
Use this function when we make changes to the list of labels or when we load a new dataset. Parameters ---------- checked : bool argument from clicked.connect labels : list of str list of labels in the dataset (default) custom_labels : list of str...
[ "Use", "this", "function", "when", "we", "make", "changes", "to", "the", "list", "of", "labels", "or", "when", "we", "load", "a", "new", "dataset", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/labels.py#L81-L115
train
wonambi-python/wonambi
wonambi/trans/peaks.py
peaks
def peaks(data, method='max', axis='time', limits=None): """Return the values of an index where the data is at max or min Parameters ---------- method : str, optional 'max' or 'min' axis : str, optional the axis where you want to detect the peaks limits : tuple of two values, op...
python
def peaks(data, method='max', axis='time', limits=None): """Return the values of an index where the data is at max or min Parameters ---------- method : str, optional 'max' or 'min' axis : str, optional the axis where you want to detect the peaks limits : tuple of two values, op...
[ "def", "peaks", "(", "data", ",", "method", "=", "'max'", ",", "axis", "=", "'time'", ",", "limits", "=", "None", ")", ":", "idx_axis", "=", "data", ".", "index_of", "(", "axis", ")", "output", "=", "data", ".", "_copy", "(", ")", "output", ".", ...
Return the values of an index where the data is at max or min Parameters ---------- method : str, optional 'max' or 'min' axis : str, optional the axis where you want to detect the peaks limits : tuple of two values, optional the lowest and highest limits where to search for...
[ "Return", "the", "values", "of", "an", "index", "where", "the", "data", "is", "at", "max", "or", "min" ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/peaks.py#L9-L58
train
wonambi-python/wonambi
wonambi/trans/analyze.py
export_freq
def export_freq(xfreq, filename, desc=None): """Write frequency analysis data to CSV. Parameters ---------- xfreq : list of dict spectral data, one dict per segment, where 'data' is ChanFreq filename : str output filename desc : dict of ndarray descriptives '""" ...
python
def export_freq(xfreq, filename, desc=None): """Write frequency analysis data to CSV. Parameters ---------- xfreq : list of dict spectral data, one dict per segment, where 'data' is ChanFreq filename : str output filename desc : dict of ndarray descriptives '""" ...
[ "def", "export_freq", "(", "xfreq", ",", "filename", ",", "desc", "=", "None", ")", ":", "heading_row_1", "=", "[", "'Segment index'", ",", "'Start time'", ",", "'End time'", ",", "'Duration'", ",", "'Stitches'", ",", "'Stage'", ",", "'Cycle'", ",", "'Event ...
Write frequency analysis data to CSV. Parameters ---------- xfreq : list of dict spectral data, one dict per segment, where 'data' is ChanFreq filename : str output filename desc : dict of ndarray descriptives
[ "Write", "frequency", "analysis", "data", "to", "CSV", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/analyze.py#L294-L352
train
wonambi-python/wonambi
wonambi/trans/analyze.py
export_freq_band
def export_freq_band(xfreq, bands, filename): """Write frequency analysis data to CSV by pre-defined band.""" heading_row_1 = ['Segment index', 'Start time', 'End time', 'Duration', 'Stitches', 'Stage', ...
python
def export_freq_band(xfreq, bands, filename): """Write frequency analysis data to CSV by pre-defined band.""" heading_row_1 = ['Segment index', 'Start time', 'End time', 'Duration', 'Stitches', 'Stage', ...
[ "def", "export_freq_band", "(", "xfreq", ",", "bands", ",", "filename", ")", ":", "heading_row_1", "=", "[", "'Segment index'", ",", "'Start time'", ",", "'End time'", ",", "'Duration'", ",", "'Stitches'", ",", "'Stage'", ",", "'Cycle'", ",", "'Event type'", "...
Write frequency analysis data to CSV by pre-defined band.
[ "Write", "frequency", "analysis", "data", "to", "CSV", "by", "pre", "-", "defined", "band", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/analyze.py#L355-L417
train
wonambi-python/wonambi
wonambi/attr/annotations.py
create_empty_annotations
def create_empty_annotations(xml_file, dataset): """Create an empty annotation file. Notes ----- Dates are made time-zone unaware. """ xml_file = Path(xml_file) root = Element('annotations') root.set('version', VERSION) info = SubElement(root, 'dataset') x = SubElement(info, 'f...
python
def create_empty_annotations(xml_file, dataset): """Create an empty annotation file. Notes ----- Dates are made time-zone unaware. """ xml_file = Path(xml_file) root = Element('annotations') root.set('version', VERSION) info = SubElement(root, 'dataset') x = SubElement(info, 'f...
[ "def", "create_empty_annotations", "(", "xml_file", ",", "dataset", ")", ":", "xml_file", "=", "Path", "(", "xml_file", ")", "root", "=", "Element", "(", "'annotations'", ")", "root", ".", "set", "(", "'version'", ",", "VERSION", ")", "info", "=", "SubElem...
Create an empty annotation file. Notes ----- Dates are made time-zone unaware.
[ "Create", "an", "empty", "annotation", "file", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L115-L146
train
wonambi-python/wonambi
wonambi/attr/annotations.py
create_annotation
def create_annotation(xml_file, from_fasst): """Create annotations by importing from FASST sleep scoring file. Parameters ---------- xml_file : path to xml file annotation file that will be created from_fasst : path to FASST file .mat file containing the scores Returns ----...
python
def create_annotation(xml_file, from_fasst): """Create annotations by importing from FASST sleep scoring file. Parameters ---------- xml_file : path to xml file annotation file that will be created from_fasst : path to FASST file .mat file containing the scores Returns ----...
[ "def", "create_annotation", "(", "xml_file", ",", "from_fasst", ")", ":", "xml_file", "=", "Path", "(", "xml_file", ")", "try", ":", "mat", "=", "loadmat", "(", "str", "(", "from_fasst", ")", ",", "variable_names", "=", "'D'", ",", "struct_as_record", "=",...
Create annotations by importing from FASST sleep scoring file. Parameters ---------- xml_file : path to xml file annotation file that will be created from_fasst : path to FASST file .mat file containing the scores Returns ------- instance of Annotations TODO ---- ...
[ "Create", "annotations", "by", "importing", "from", "FASST", "sleep", "scoring", "file", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L149-L220
train
wonambi-python/wonambi
wonambi/attr/annotations.py
update_annotation_version
def update_annotation_version(xml_file): """Update the fields that have changed over different versions. Parameters ---------- xml_file : path to file xml file with the sleep scoring Notes ----- new in version 4: use 'marker_name' instead of simply 'name' etc new in version 5:...
python
def update_annotation_version(xml_file): """Update the fields that have changed over different versions. Parameters ---------- xml_file : path to file xml file with the sleep scoring Notes ----- new in version 4: use 'marker_name' instead of simply 'name' etc new in version 5:...
[ "def", "update_annotation_version", "(", "xml_file", ")", ":", "with", "open", "(", "xml_file", ",", "'r'", ")", "as", "f", ":", "s", "=", "f", ".", "read", "(", ")", "m", "=", "search", "(", "'<annotations version=\"([0-9]*)\">'", ",", "s", ")", "curren...
Update the fields that have changed over different versions. Parameters ---------- xml_file : path to file xml file with the sleep scoring Notes ----- new in version 4: use 'marker_name' instead of simply 'name' etc new in version 5: use 'bookmark' instead of 'marker'
[ "Update", "the", "fields", "that", "have", "changed", "over", "different", "versions", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L2050-L2082
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.load
def load(self): """Load xml from file.""" lg.info('Loading ' + str(self.xml_file)) update_annotation_version(self.xml_file) xml = parse(self.xml_file) return xml.getroot()
python
def load(self): """Load xml from file.""" lg.info('Loading ' + str(self.xml_file)) update_annotation_version(self.xml_file) xml = parse(self.xml_file) return xml.getroot()
[ "def", "load", "(", "self", ")", ":", "lg", ".", "info", "(", "'Loading '", "+", "str", "(", "self", ".", "xml_file", ")", ")", "update_annotation_version", "(", "self", ".", "xml_file", ")", "xml", "=", "parse", "(", "self", ".", "xml_file", ")", "r...
Load xml from file.
[ "Load", "xml", "from", "file", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L240-L246
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.save
def save(self): """Save xml to file.""" if self.rater is not None: self.rater.set('modified', datetime.now().isoformat()) xml = parseString(tostring(self.root)) with open(self.xml_file, 'w') as f: f.write(xml.toxml())
python
def save(self): """Save xml to file.""" if self.rater is not None: self.rater.set('modified', datetime.now().isoformat()) xml = parseString(tostring(self.root)) with open(self.xml_file, 'w') as f: f.write(xml.toxml())
[ "def", "save", "(", "self", ")", ":", "if", "self", ".", "rater", "is", "not", "None", ":", "self", ".", "rater", ".", "set", "(", "'modified'", ",", "datetime", ".", "now", "(", ")", ".", "isoformat", "(", ")", ")", "xml", "=", "parseString", "(...
Save xml to file.
[ "Save", "xml", "to", "file", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L248-L255
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.add_bookmark
def add_bookmark(self, name, time, chan=''): """Add a new bookmark Parameters ---------- name : str name of the bookmark time : (float, float) float with start and end time in s Raises ------ IndexError When there is n...
python
def add_bookmark(self, name, time, chan=''): """Add a new bookmark Parameters ---------- name : str name of the bookmark time : (float, float) float with start and end time in s Raises ------ IndexError When there is n...
[ "def", "add_bookmark", "(", "self", ",", "name", ",", "time", ",", "chan", "=", "''", ")", ":", "try", ":", "bookmarks", "=", "self", ".", "rater", ".", "find", "(", "'bookmarks'", ")", "except", "AttributeError", ":", "raise", "IndexError", "(", "'You...
Add a new bookmark Parameters ---------- name : str name of the bookmark time : (float, float) float with start and end time in s Raises ------ IndexError When there is no selected rater
[ "Add", "a", "new", "bookmark" ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L645-L677
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.remove_bookmark
def remove_bookmark(self, name=None, time=None, chan=None): """if you call it without arguments, it removes ALL the bookmarks.""" bookmarks = self.rater.find('bookmarks') for m in bookmarks: bookmark_name = m.find('bookmark_name').text bookmark_start = float(m.find('boo...
python
def remove_bookmark(self, name=None, time=None, chan=None): """if you call it without arguments, it removes ALL the bookmarks.""" bookmarks = self.rater.find('bookmarks') for m in bookmarks: bookmark_name = m.find('bookmark_name').text bookmark_start = float(m.find('boo...
[ "def", "remove_bookmark", "(", "self", ",", "name", "=", "None", ",", "time", "=", "None", ",", "chan", "=", "None", ")", ":", "bookmarks", "=", "self", ".", "rater", ".", "find", "(", "'bookmarks'", ")", "for", "m", "in", "bookmarks", ":", "bookmark...
if you call it without arguments, it removes ALL the bookmarks.
[ "if", "you", "call", "it", "without", "arguments", "it", "removes", "ALL", "the", "bookmarks", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L679-L711
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.remove_event_type
def remove_event_type(self, name): """Remove event type based on name.""" if name not in self.event_types: lg.info('Event type ' + name + ' was not found.') events = self.rater.find('events') # list is necessary so that it does not remove in place for e in list(eve...
python
def remove_event_type(self, name): """Remove event type based on name.""" if name not in self.event_types: lg.info('Event type ' + name + ' was not found.') events = self.rater.find('events') # list is necessary so that it does not remove in place for e in list(eve...
[ "def", "remove_event_type", "(", "self", ",", "name", ")", ":", "if", "name", "not", "in", "self", ".", "event_types", ":", "lg", ".", "info", "(", "'Event type '", "+", "name", "+", "' was not found.'", ")", "events", "=", "self", ".", "rater", ".", "...
Remove event type based on name.
[ "Remove", "event", "type", "based", "on", "name", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L787-L800
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.remove_event
def remove_event(self, name=None, time=None, chan=None): """get events inside window.""" events = self.rater.find('events') if name is not None: pattern = "event_type[@type='" + name + "']" else: pattern = "event_type" if chan is not None: if ...
python
def remove_event(self, name=None, time=None, chan=None): """get events inside window.""" events = self.rater.find('events') if name is not None: pattern = "event_type[@type='" + name + "']" else: pattern = "event_type" if chan is not None: if ...
[ "def", "remove_event", "(", "self", ",", "name", "=", "None", ",", "time", "=", "None", ",", "chan", "=", "None", ")", ":", "events", "=", "self", ".", "rater", ".", "find", "(", "'events'", ")", "if", "name", "is", "not", "None", ":", "pattern", ...
get events inside window.
[ "get", "events", "inside", "window", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L907-L941
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.epochs
def epochs(self): """Get epochs as generator Returns ------- list of dict each epoch is defined by start_time and end_time (in s in reference to the start of the recordings) and a string of the sleep stage, and a string of the signal quality. ...
python
def epochs(self): """Get epochs as generator Returns ------- list of dict each epoch is defined by start_time and end_time (in s in reference to the start of the recordings) and a string of the sleep stage, and a string of the signal quality. ...
[ "def", "epochs", "(", "self", ")", ":", "if", "self", ".", "rater", "is", "None", ":", "raise", "IndexError", "(", "'You need to have at least one rater'", ")", "for", "one_epoch", "in", "self", ".", "rater", ".", "iterfind", "(", "'stages/epoch'", ")", ":",...
Get epochs as generator Returns ------- list of dict each epoch is defined by start_time and end_time (in s in reference to the start of the recordings) and a string of the sleep stage, and a string of the signal quality. If you specify stages_of_...
[ "Get", "epochs", "as", "generator" ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L1081-L1107
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.get_stage_for_epoch
def get_stage_for_epoch(self, epoch_start, window_length=None, attr='stage'): """Return stage for one specific epoch. Parameters ---------- id_epoch : str index of the epoch attr : str, optional 'stage' or 'quality' Re...
python
def get_stage_for_epoch(self, epoch_start, window_length=None, attr='stage'): """Return stage for one specific epoch. Parameters ---------- id_epoch : str index of the epoch attr : str, optional 'stage' or 'quality' Re...
[ "def", "get_stage_for_epoch", "(", "self", ",", "epoch_start", ",", "window_length", "=", "None", ",", "attr", "=", "'stage'", ")", ":", "for", "epoch", "in", "self", ".", "epochs", ":", "if", "epoch", "[", "'start'", "]", "==", "epoch_start", ":", "retu...
Return stage for one specific epoch. Parameters ---------- id_epoch : str index of the epoch attr : str, optional 'stage' or 'quality' Returns ------- stage : str description of the stage.
[ "Return", "stage", "for", "one", "specific", "epoch", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L1166-L1191
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.set_stage_for_epoch
def set_stage_for_epoch(self, epoch_start, name, attr='stage', save=True): """Change the stage for one specific epoch. Parameters ---------- epoch_start : int start time of the epoch, in seconds name : str description of the stage or qualifier. at...
python
def set_stage_for_epoch(self, epoch_start, name, attr='stage', save=True): """Change the stage for one specific epoch. Parameters ---------- epoch_start : int start time of the epoch, in seconds name : str description of the stage or qualifier. at...
[ "def", "set_stage_for_epoch", "(", "self", ",", "epoch_start", ",", "name", ",", "attr", "=", "'stage'", ",", "save", "=", "True", ")", ":", "if", "self", ".", "rater", "is", "None", ":", "raise", "IndexError", "(", "'You need to have at least one rater'", "...
Change the stage for one specific epoch. Parameters ---------- epoch_start : int start time of the epoch, in seconds name : str description of the stage or qualifier. attr : str, optional either 'stage' or 'quality' save : bool ...
[ "Change", "the", "stage", "for", "one", "specific", "epoch", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L1212-L1249
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.set_cycle_mrkr
def set_cycle_mrkr(self, epoch_start, end=False): """Mark epoch start as cycle start or end. Parameters ---------- epoch_start: int start time of the epoch, in seconds end : bool If True, marked as cycle end; otherwise, marks cycle start """ ...
python
def set_cycle_mrkr(self, epoch_start, end=False): """Mark epoch start as cycle start or end. Parameters ---------- epoch_start: int start time of the epoch, in seconds end : bool If True, marked as cycle end; otherwise, marks cycle start """ ...
[ "def", "set_cycle_mrkr", "(", "self", ",", "epoch_start", ",", "end", "=", "False", ")", ":", "if", "self", ".", "rater", "is", "None", ":", "raise", "IndexError", "(", "'You need to have at least one rater'", ")", "bound", "=", "'start'", "if", "end", ":", ...
Mark epoch start as cycle start or end. Parameters ---------- epoch_start: int start time of the epoch, in seconds end : bool If True, marked as cycle end; otherwise, marks cycle start
[ "Mark", "epoch", "start", "as", "cycle", "start", "or", "end", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L1251-L1277
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.remove_cycle_mrkr
def remove_cycle_mrkr(self, epoch_start): """Remove cycle marker at epoch_start. Parameters ---------- epoch_start: int start time of epoch, in seconds """ if self.rater is None: raise IndexError('You need to have at least one rater') cycl...
python
def remove_cycle_mrkr(self, epoch_start): """Remove cycle marker at epoch_start. Parameters ---------- epoch_start: int start time of epoch, in seconds """ if self.rater is None: raise IndexError('You need to have at least one rater') cycl...
[ "def", "remove_cycle_mrkr", "(", "self", ",", "epoch_start", ")", ":", "if", "self", ".", "rater", "is", "None", ":", "raise", "IndexError", "(", "'You need to have at least one rater'", ")", "cycles", "=", "self", ".", "rater", ".", "find", "(", "'cycles'", ...
Remove cycle marker at epoch_start. Parameters ---------- epoch_start: int start time of epoch, in seconds
[ "Remove", "cycle", "marker", "at", "epoch_start", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L1279-L1302
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.clear_cycles
def clear_cycles(self): """Remove all cycle markers in current rater.""" if self.rater is None: raise IndexError('You need to have at least one rater') cycles = self.rater.find('cycles') for cyc in list(cycles): cycles.remove(cyc) self.save()
python
def clear_cycles(self): """Remove all cycle markers in current rater.""" if self.rater is None: raise IndexError('You need to have at least one rater') cycles = self.rater.find('cycles') for cyc in list(cycles): cycles.remove(cyc) self.save()
[ "def", "clear_cycles", "(", "self", ")", ":", "if", "self", ".", "rater", "is", "None", ":", "raise", "IndexError", "(", "'You need to have at least one rater'", ")", "cycles", "=", "self", ".", "rater", ".", "find", "(", "'cycles'", ")", "for", "cyc", "in...
Remove all cycle markers in current rater.
[ "Remove", "all", "cycle", "markers", "in", "current", "rater", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L1304-L1313
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.get_cycles
def get_cycles(self): """Return the cycle start and end times. Returns ------- list of tuple of float start and end times for each cycle, in seconds from recording start and the cycle index starting at 1 """ cycles = self.rater.find('cycles') ...
python
def get_cycles(self): """Return the cycle start and end times. Returns ------- list of tuple of float start and end times for each cycle, in seconds from recording start and the cycle index starting at 1 """ cycles = self.rater.find('cycles') ...
[ "def", "get_cycles", "(", "self", ")", ":", "cycles", "=", "self", ".", "rater", ".", "find", "(", "'cycles'", ")", "if", "not", "cycles", ":", "return", "None", "starts", "=", "sorted", "(", "[", "float", "(", "mrkr", ".", "text", ")", "for", "mrk...
Return the cycle start and end times. Returns ------- list of tuple of float start and end times for each cycle, in seconds from recording start and the cycle index starting at 1
[ "Return", "the", "cycle", "start", "and", "end", "times", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L1315-L1366
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.switch
def switch(self, time=None): """Obtain switch parameter, ie number of times the stage shifts.""" stag_to_int = {'NREM1': 1, 'NREM2': 2, 'NREM3': 3, 'REM': 5, 'Wake': 0} hypno = [stag_to_int[x['stage']] for x in self.get_epochs(time=time) \ if x['stage'] in stag_to_int.keys()] ...
python
def switch(self, time=None): """Obtain switch parameter, ie number of times the stage shifts.""" stag_to_int = {'NREM1': 1, 'NREM2': 2, 'NREM3': 3, 'REM': 5, 'Wake': 0} hypno = [stag_to_int[x['stage']] for x in self.get_epochs(time=time) \ if x['stage'] in stag_to_int.keys()] ...
[ "def", "switch", "(", "self", ",", "time", "=", "None", ")", ":", "stag_to_int", "=", "{", "'NREM1'", ":", "1", ",", "'NREM2'", ":", "2", ",", "'NREM3'", ":", "3", ",", "'REM'", ":", "5", ",", "'Wake'", ":", "0", "}", "hypno", "=", "[", "stag_t...
Obtain switch parameter, ie number of times the stage shifts.
[ "Obtain", "switch", "parameter", "ie", "number", "of", "times", "the", "stage", "shifts", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L1368-L1374
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.slp_frag
def slp_frag(self, time=None): """Obtain sleep fragmentation parameter, ie number of stage shifts to a lighter stage.""" epochs = self.get_epochs(time=time) stage_int = {'Wake': 0, 'NREM1': 1, 'NREM2': 2, 'NREM3': 3, 'REM': 2} hypno_str = [x['stage'] for x in epochs \ ...
python
def slp_frag(self, time=None): """Obtain sleep fragmentation parameter, ie number of stage shifts to a lighter stage.""" epochs = self.get_epochs(time=time) stage_int = {'Wake': 0, 'NREM1': 1, 'NREM2': 2, 'NREM3': 3, 'REM': 2} hypno_str = [x['stage'] for x in epochs \ ...
[ "def", "slp_frag", "(", "self", ",", "time", "=", "None", ")", ":", "epochs", "=", "self", ".", "get_epochs", "(", "time", "=", "time", ")", "stage_int", "=", "{", "'Wake'", ":", "0", ",", "'NREM1'", ":", "1", ",", "'NREM2'", ":", "2", ",", "'NRE...
Obtain sleep fragmentation parameter, ie number of stage shifts to a lighter stage.
[ "Obtain", "sleep", "fragmentation", "parameter", "ie", "number", "of", "stage", "shifts", "to", "a", "lighter", "stage", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L1376-L1395
train
wonambi-python/wonambi
wonambi/attr/annotations.py
Annotations.export
def export(self, file_to_export, xformat='csv'): """Export epochwise annotations to csv file. Parameters ---------- file_to_export : path to file file to write to """ if 'csv' == xformat: with open(file_to_export, 'w', newline='') as f: ...
python
def export(self, file_to_export, xformat='csv'): """Export epochwise annotations to csv file. Parameters ---------- file_to_export : path to file file to write to """ if 'csv' == xformat: with open(file_to_export, 'w', newline='') as f: ...
[ "def", "export", "(", "self", ",", "file_to_export", ",", "xformat", "=", "'csv'", ")", ":", "if", "'csv'", "==", "xformat", ":", "with", "open", "(", "file_to_export", ",", "'w'", ",", "newline", "=", "''", ")", "as", "f", ":", "csv_file", "=", "wri...
Export epochwise annotations to csv file. Parameters ---------- file_to_export : path to file file to write to
[ "Export", "epochwise", "annotations", "to", "csv", "file", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L1440-L1499
train
wonambi-python/wonambi
wonambi/widgets/info.py
Info.create
def create(self): """Create the widget layout with all the information.""" b0 = QGroupBox('Dataset') form = QFormLayout() b0.setLayout(form) open_rec = QPushButton('Open Dataset...') open_rec.clicked.connect(self.open_dataset) open_rec.setToolTip('Click here to o...
python
def create(self): """Create the widget layout with all the information.""" b0 = QGroupBox('Dataset') form = QFormLayout() b0.setLayout(form) open_rec = QPushButton('Open Dataset...') open_rec.clicked.connect(self.open_dataset) open_rec.setToolTip('Click here to o...
[ "def", "create", "(", "self", ")", ":", "b0", "=", "QGroupBox", "(", "'Dataset'", ")", "form", "=", "QFormLayout", "(", ")", "b0", ".", "setLayout", "(", "form", ")", "open_rec", "=", "QPushButton", "(", "'Open Dataset...'", ")", "open_rec", ".", "clicke...
Create the widget layout with all the information.
[ "Create", "the", "widget", "layout", "with", "all", "the", "information", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/info.py#L90-L135
train
wonambi-python/wonambi
wonambi/widgets/info.py
Info.open_dataset
def open_dataset(self, recent=None, debug_filename=None, bids=False): """Open a new dataset. Parameters ---------- recent : path to file one of the recent datasets to read """ if recent: filename = recent elif debug_filename is not None: ...
python
def open_dataset(self, recent=None, debug_filename=None, bids=False): """Open a new dataset. Parameters ---------- recent : path to file one of the recent datasets to read """ if recent: filename = recent elif debug_filename is not None: ...
[ "def", "open_dataset", "(", "self", ",", "recent", "=", "None", ",", "debug_filename", "=", "None", ",", "bids", "=", "False", ")", ":", "if", "recent", ":", "filename", "=", "recent", "elif", "debug_filename", "is", "not", "None", ":", "filename", "=", ...
Open a new dataset. Parameters ---------- recent : path to file one of the recent datasets to read
[ "Open", "a", "new", "dataset", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/info.py#L174-L248
train
wonambi-python/wonambi
wonambi/widgets/info.py
Info.display_dataset
def display_dataset(self): """Update the widget with information about the dataset.""" header = self.dataset.header self.parent.setWindowTitle(basename(self.filename)) short_filename = short_strings(basename(self.filename)) self.idx_filename.setText(short_filename) self....
python
def display_dataset(self): """Update the widget with information about the dataset.""" header = self.dataset.header self.parent.setWindowTitle(basename(self.filename)) short_filename = short_strings(basename(self.filename)) self.idx_filename.setText(short_filename) self....
[ "def", "display_dataset", "(", "self", ")", ":", "header", "=", "self", ".", "dataset", ".", "header", "self", ".", "parent", ".", "setWindowTitle", "(", "basename", "(", "self", ".", "filename", ")", ")", "short_filename", "=", "short_strings", "(", "base...
Update the widget with information about the dataset.
[ "Update", "the", "widget", "with", "information", "about", "the", "dataset", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/info.py#L250-L263
train
wonambi-python/wonambi
wonambi/widgets/info.py
Info.display_view
def display_view(self): """Update information about the size of the traces.""" self.idx_start.setText(str(self.parent.value('window_start'))) self.idx_length.setText(str(self.parent.value('window_length'))) self.idx_scaling.setText(str(self.parent.value('y_scale'))) self.idx_dist...
python
def display_view(self): """Update information about the size of the traces.""" self.idx_start.setText(str(self.parent.value('window_start'))) self.idx_length.setText(str(self.parent.value('window_length'))) self.idx_scaling.setText(str(self.parent.value('y_scale'))) self.idx_dist...
[ "def", "display_view", "(", "self", ")", ":", "self", ".", "idx_start", ".", "setText", "(", "str", "(", "self", ".", "parent", ".", "value", "(", "'window_start'", ")", ")", ")", "self", ".", "idx_length", ".", "setText", "(", "str", "(", "self", "....
Update information about the size of the traces.
[ "Update", "information", "about", "the", "size", "of", "the", "traces", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/info.py#L265-L270
train
wonambi-python/wonambi
wonambi/widgets/info.py
Info.reset
def reset(self): """Reset widget to original state.""" self.filename = None self.dataset = None # about the recordings self.idx_filename.setText('Open Recordings...') self.idx_s_freq.setText('') self.idx_n_chan.setText('') self.idx_start_time.setText('') ...
python
def reset(self): """Reset widget to original state.""" self.filename = None self.dataset = None # about the recordings self.idx_filename.setText('Open Recordings...') self.idx_s_freq.setText('') self.idx_n_chan.setText('') self.idx_start_time.setText('') ...
[ "def", "reset", "(", "self", ")", ":", "self", ".", "filename", "=", "None", "self", ".", "dataset", "=", "None", "self", ".", "idx_filename", ".", "setText", "(", "'Open Recordings...'", ")", "self", ".", "idx_s_freq", ".", "setText", "(", "''", ")", ...
Reset widget to original state.
[ "Reset", "widget", "to", "original", "state", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/info.py#L272-L288
train
wonambi-python/wonambi
wonambi/widgets/info.py
ExportDatasetDialog.update
def update(self): """Get info from dataset before opening dialog.""" self.filename = self.parent.info.dataset.filename self.chan = self.parent.info.dataset.header['chan_name'] for chan in self.chan: self.idx_chan.addItem(chan)
python
def update(self): """Get info from dataset before opening dialog.""" self.filename = self.parent.info.dataset.filename self.chan = self.parent.info.dataset.header['chan_name'] for chan in self.chan: self.idx_chan.addItem(chan)
[ "def", "update", "(", "self", ")", ":", "self", ".", "filename", "=", "self", ".", "parent", ".", "info", ".", "dataset", ".", "filename", "self", ".", "chan", "=", "self", ".", "parent", ".", "info", ".", "dataset", ".", "header", "[", "'chan_name'"...
Get info from dataset before opening dialog.
[ "Get", "info", "from", "dataset", "before", "opening", "dialog", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/info.py#L460-L466
train
wonambi-python/wonambi
wonambi/utils/simulate.py
create_channels
def create_channels(chan_name=None, n_chan=None): """Create instance of Channels with random xyz coordinates Parameters ---------- chan_name : list of str names of the channels n_chan : int if chan_name is not specified, this defines the number of channels Returns ------- ...
python
def create_channels(chan_name=None, n_chan=None): """Create instance of Channels with random xyz coordinates Parameters ---------- chan_name : list of str names of the channels n_chan : int if chan_name is not specified, this defines the number of channels Returns ------- ...
[ "def", "create_channels", "(", "chan_name", "=", "None", ",", "n_chan", "=", "None", ")", ":", "if", "chan_name", "is", "not", "None", ":", "n_chan", "=", "len", "(", "chan_name", ")", "elif", "n_chan", "is", "not", "None", ":", "chan_name", "=", "_mak...
Create instance of Channels with random xyz coordinates Parameters ---------- chan_name : list of str names of the channels n_chan : int if chan_name is not specified, this defines the number of channels Returns ------- instance of Channels where the location of the...
[ "Create", "instance", "of", "Channels", "with", "random", "xyz", "coordinates" ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/utils/simulate.py#L145-L170
train
wonambi-python/wonambi
wonambi/utils/simulate.py
_color_noise
def _color_noise(x, s_freq, coef=0): """Add some color to the noise by changing the power spectrum. Parameters ---------- x : ndarray one vector of the original signal s_freq : int sampling frequency coef : float coefficient to apply (0 -> white noise, 1 -> pink, 2 -> br...
python
def _color_noise(x, s_freq, coef=0): """Add some color to the noise by changing the power spectrum. Parameters ---------- x : ndarray one vector of the original signal s_freq : int sampling frequency coef : float coefficient to apply (0 -> white noise, 1 -> pink, 2 -> br...
[ "def", "_color_noise", "(", "x", ",", "s_freq", ",", "coef", "=", "0", ")", ":", "y", "=", "fft", "(", "x", ")", "ph", "=", "angle", "(", "y", ")", "m", "=", "abs", "(", "y", ")", "freq", "=", "linspace", "(", "0", ",", "s_freq", "/", "2", ...
Add some color to the noise by changing the power spectrum. Parameters ---------- x : ndarray one vector of the original signal s_freq : int sampling frequency coef : float coefficient to apply (0 -> white noise, 1 -> pink, 2 -> brown, -1 -> blu...
[ "Add", "some", "color", "to", "the", "noise", "by", "changing", "the", "power", "spectrum", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/utils/simulate.py#L173-L209
train
wonambi-python/wonambi
wonambi/ioeeg/openephys.py
_read_openephys
def _read_openephys(openephys_file): """Read the channel labels and their respective files from the 'Continuous_Data.openephys' file Parameters ---------- openephys_file : Path path to Continuous_Data.openephys inside the open-ephys folder Returns ------- int sampling f...
python
def _read_openephys(openephys_file): """Read the channel labels and their respective files from the 'Continuous_Data.openephys' file Parameters ---------- openephys_file : Path path to Continuous_Data.openephys inside the open-ephys folder Returns ------- int sampling f...
[ "def", "_read_openephys", "(", "openephys_file", ")", ":", "root", "=", "ElementTree", ".", "parse", "(", "openephys_file", ")", ".", "getroot", "(", ")", "channels", "=", "[", "]", "for", "recording", "in", "root", ":", "s_freq", "=", "float", "(", "rec...
Read the channel labels and their respective files from the 'Continuous_Data.openephys' file Parameters ---------- openephys_file : Path path to Continuous_Data.openephys inside the open-ephys folder Returns ------- int sampling frequency list of dict list of ch...
[ "Read", "the", "channel", "labels", "and", "their", "respective", "files", "from", "the", "Continuous_Data", ".", "openephys", "file" ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/openephys.py#L166-L191
train
wonambi-python/wonambi
wonambi/ioeeg/openephys.py
_read_date
def _read_date(settings_file): """Get the data from the settings.xml file Parameters ---------- settings_file : Path path to settings.xml inside open-ephys folder Returns ------- datetime start time of the recordings Notes ----- The start time is present in the...
python
def _read_date(settings_file): """Get the data from the settings.xml file Parameters ---------- settings_file : Path path to settings.xml inside open-ephys folder Returns ------- datetime start time of the recordings Notes ----- The start time is present in the...
[ "def", "_read_date", "(", "settings_file", ")", ":", "root", "=", "ElementTree", ".", "parse", "(", "settings_file", ")", ".", "getroot", "(", ")", "for", "e0", "in", "root", ":", "if", "e0", ".", "tag", "==", "'INFO'", ":", "for", "e1", "in", "e0", ...
Get the data from the settings.xml file Parameters ---------- settings_file : Path path to settings.xml inside open-ephys folder Returns ------- datetime start time of the recordings Notes ----- The start time is present in the header of each file. This might be us...
[ "Get", "the", "data", "from", "the", "settings", ".", "xml", "file" ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/openephys.py#L194-L219
train
wonambi-python/wonambi
wonambi/ioeeg/openephys.py
_read_n_samples
def _read_n_samples(channel_file): """Calculate the number of samples based on the file size Parameters ---------- channel_file : Path path to single filename with the header Returns ------- int number of blocks (i.e. records, in which the data is cut) int numbe...
python
def _read_n_samples(channel_file): """Calculate the number of samples based on the file size Parameters ---------- channel_file : Path path to single filename with the header Returns ------- int number of blocks (i.e. records, in which the data is cut) int numbe...
[ "def", "_read_n_samples", "(", "channel_file", ")", ":", "n_blocks", "=", "int", "(", "(", "channel_file", ".", "stat", "(", ")", ".", "st_size", "-", "HDR_LENGTH", ")", "/", "BLK_SIZE", ")", "n_samples", "=", "n_blocks", "*", "BLK_LENGTH", "return", "n_bl...
Calculate the number of samples based on the file size Parameters ---------- channel_file : Path path to single filename with the header Returns ------- int number of blocks (i.e. records, in which the data is cut) int number of samples
[ "Calculate", "the", "number", "of", "samples", "based", "on", "the", "file", "size" ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/openephys.py#L222-L239
train
wonambi-python/wonambi
wonambi/ioeeg/openephys.py
_read_header
def _read_header(filename): """Read the text header for each file Parameters ---------- channel_file : Path path to single filename with the header Returns ------- dict header """ with filename.open('rb') as f: h = f.read(HDR_LENGTH).decode() header...
python
def _read_header(filename): """Read the text header for each file Parameters ---------- channel_file : Path path to single filename with the header Returns ------- dict header """ with filename.open('rb') as f: h = f.read(HDR_LENGTH).decode() header...
[ "def", "_read_header", "(", "filename", ")", ":", "with", "filename", ".", "open", "(", "'rb'", ")", "as", "f", ":", "h", "=", "f", ".", "read", "(", "HDR_LENGTH", ")", ".", "decode", "(", ")", "header", "=", "{", "}", "for", "line", "in", "h", ...
Read the text header for each file Parameters ---------- channel_file : Path path to single filename with the header Returns ------- dict header
[ "Read", "the", "text", "header", "for", "each", "file" ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/openephys.py#L242-L266
train
wonambi-python/wonambi
wonambi/ioeeg/openephys.py
_check_header
def _check_header(channel_file, s_freq): """For each file, make sure that the header is consistent with the information in the text file. Parameters ---------- channel_file : Path path to single filename with the header s_freq : int sampling frequency Returns ------- ...
python
def _check_header(channel_file, s_freq): """For each file, make sure that the header is consistent with the information in the text file. Parameters ---------- channel_file : Path path to single filename with the header s_freq : int sampling frequency Returns ------- ...
[ "def", "_check_header", "(", "channel_file", ",", "s_freq", ")", ":", "hdr", "=", "_read_header", "(", "channel_file", ")", "assert", "int", "(", "hdr", "[", "'header_bytes'", "]", ")", "==", "HDR_LENGTH", "assert", "int", "(", "hdr", "[", "'blockLength'", ...
For each file, make sure that the header is consistent with the information in the text file. Parameters ---------- channel_file : Path path to single filename with the header s_freq : int sampling frequency Returns ------- int gain from digital to microvolts (t...
[ "For", "each", "file", "make", "sure", "that", "the", "header", "is", "consistent", "with", "the", "information", "in", "the", "text", "file", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/openephys.py#L269-L292
train
wonambi-python/wonambi
wonambi/detect/agreement.py
MatchedEvents.all_to_annot
def all_to_annot(self, annot, names=['TPd', 'TPs', 'FP', 'FN']): """Convenience function to write all events to XML by category, showing overlapping TP detection and TP standard.""" self.to_annot(annot, 'tp_det', names[0]) self.to_annot(annot, 'tp_std', names[1]) self.to_annot(an...
python
def all_to_annot(self, annot, names=['TPd', 'TPs', 'FP', 'FN']): """Convenience function to write all events to XML by category, showing overlapping TP detection and TP standard.""" self.to_annot(annot, 'tp_det', names[0]) self.to_annot(annot, 'tp_std', names[1]) self.to_annot(an...
[ "def", "all_to_annot", "(", "self", ",", "annot", ",", "names", "=", "[", "'TPd'", ",", "'TPs'", ",", "'FP'", ",", "'FN'", "]", ")", ":", "self", ".", "to_annot", "(", "annot", ",", "'tp_det'", ",", "names", "[", "0", "]", ")", "self", ".", "to_a...
Convenience function to write all events to XML by category, showing overlapping TP detection and TP standard.
[ "Convenience", "function", "to", "write", "all", "events", "to", "XML", "by", "category", "showing", "overlapping", "TP", "detection", "and", "TP", "standard", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/agreement.py#L102-L108
train
wonambi-python/wonambi
wonambi/ioeeg/ktlx.py
convert_sample_to_video_time
def convert_sample_to_video_time(sample, orig_s_freq, sampleStamp, sampleTime): """Convert sample number to video time, using snc information. Parameters ---------- sample : int sample that you want to convert in time orig_s_freq : int sampling frequ...
python
def convert_sample_to_video_time(sample, orig_s_freq, sampleStamp, sampleTime): """Convert sample number to video time, using snc information. Parameters ---------- sample : int sample that you want to convert in time orig_s_freq : int sampling frequ...
[ "def", "convert_sample_to_video_time", "(", "sample", ",", "orig_s_freq", ",", "sampleStamp", ",", "sampleTime", ")", ":", "if", "sample", "<", "sampleStamp", "[", "0", "]", ":", "s_freq", "=", "orig_s_freq", "id0", "=", "0", "elif", "sample", ">", "sampleSt...
Convert sample number to video time, using snc information. Parameters ---------- sample : int sample that you want to convert in time orig_s_freq : int sampling frequency (used as backup) sampleStamp : list of int Sample number from start of study sampleTime : list of d...
[ "Convert", "sample", "number", "to", "video", "time", "using", "snc", "information", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L62-L106
train
wonambi-python/wonambi
wonambi/ioeeg/ktlx.py
_find_channels
def _find_channels(note): """Find the channel names within a string. The channel names are stored in the .ent file. We can read the file with _read_ent and we can parse most of the notes (comments) with _read_notes however the note containing the montage cannot be read because it's too complex. So,...
python
def _find_channels(note): """Find the channel names within a string. The channel names are stored in the .ent file. We can read the file with _read_ent and we can parse most of the notes (comments) with _read_notes however the note containing the montage cannot be read because it's too complex. So,...
[ "def", "_find_channels", "(", "note", ")", ":", "id_ch", "=", "note", ".", "index", "(", "'ChanNames'", ")", "chan_beg", "=", "note", ".", "index", "(", "'('", ",", "id_ch", ")", "chan_end", "=", "note", ".", "index", "(", "')'", ",", "chan_beg", ")"...
Find the channel names within a string. The channel names are stored in the .ent file. We can read the file with _read_ent and we can parse most of the notes (comments) with _read_notes however the note containing the montage cannot be read because it's too complex. So, instead of parsing it, we just p...
[ "Find", "the", "channel", "names", "within", "a", "string", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L253-L278
train
wonambi-python/wonambi
wonambi/ioeeg/ktlx.py
_find_start_time
def _find_start_time(hdr, s_freq): """Find the start time, usually in STC, but if that's not correct, use ERD Parameters ---------- hdr : dict header with stc (and stamps) and erd s_freq : int sampling frequency Returns ------- datetime either from stc or from e...
python
def _find_start_time(hdr, s_freq): """Find the start time, usually in STC, but if that's not correct, use ERD Parameters ---------- hdr : dict header with stc (and stamps) and erd s_freq : int sampling frequency Returns ------- datetime either from stc or from e...
[ "def", "_find_start_time", "(", "hdr", ",", "s_freq", ")", ":", "start_time", "=", "hdr", "[", "'stc'", "]", "[", "'creation_time'", "]", "for", "one_stamp", "in", "hdr", "[", "'stamps'", "]", ":", "if", "one_stamp", "[", "'segment_name'", "]", ".", "dec...
Find the start time, usually in STC, but if that's not correct, use ERD Parameters ---------- hdr : dict header with stc (and stamps) and erd s_freq : int sampling frequency Returns ------- datetime either from stc or from erd Notes ----- Sometimes, but...
[ "Find", "the", "start", "time", "usually", "in", "STC", "but", "if", "that", "s", "not", "correct", "use", "ERD" ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L281-L325
train
wonambi-python/wonambi
wonambi/ioeeg/ktlx.py
_read_ent
def _read_ent(ent_file): """Read notes stored in .ent file. This is a basic implementation, that relies on turning the information in the string in the dict format, and then evaluate it. It's not very flexible and it might not read some notes, but it's fast. I could not implement a nice, recursive ...
python
def _read_ent(ent_file): """Read notes stored in .ent file. This is a basic implementation, that relies on turning the information in the string in the dict format, and then evaluate it. It's not very flexible and it might not read some notes, but it's fast. I could not implement a nice, recursive ...
[ "def", "_read_ent", "(", "ent_file", ")", ":", "with", "ent_file", ".", "open", "(", "'rb'", ")", "as", "f", ":", "f", ".", "seek", "(", "352", ")", "note_hdr_length", "=", "16", "allnote", "=", "[", "]", "while", "True", ":", "note", "=", "{", "...
Read notes stored in .ent file. This is a basic implementation, that relies on turning the information in the string in the dict format, and then evaluate it. It's not very flexible and it might not read some notes, but it's fast. I could not implement a nice, recursive approach. Returns -----...
[ "Read", "notes", "stored", "in", ".", "ent", "file", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L353-L414
train
wonambi-python/wonambi
wonambi/ioeeg/ktlx.py
_read_packet
def _read_packet(f, pos, n_smp, n_allchan, abs_delta): """ Read a packet of compressed data Parameters ---------- f : instance of opened file erd file pos : int index of the start of the packet in the file (in bytes from beginning of the file) n_smp : int num...
python
def _read_packet(f, pos, n_smp, n_allchan, abs_delta): """ Read a packet of compressed data Parameters ---------- f : instance of opened file erd file pos : int index of the start of the packet in the file (in bytes from beginning of the file) n_smp : int num...
[ "def", "_read_packet", "(", "f", ",", "pos", ",", "n_smp", ",", "n_allchan", ",", "abs_delta", ")", ":", "if", "len", "(", "abs_delta", ")", "==", "1", ":", "abs_delta", "=", "unpack", "(", "'b'", ",", "abs_delta", ")", "[", "0", "]", "else", ":", ...
Read a packet of compressed data Parameters ---------- f : instance of opened file erd file pos : int index of the start of the packet in the file (in bytes from beginning of the file) n_smp : int number of samples to read n_allchan : int number of channe...
[ "Read", "a", "packet", "of", "compressed", "data" ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L417-L489
train
wonambi-python/wonambi
wonambi/ioeeg/ktlx.py
_read_erd
def _read_erd(erd_file, begsam, endsam): """Read the raw data and return a matrix, converted to microvolts. Parameters ---------- erd_file : str one of the .erd files to read begsam : int index of the first sample to read endsam : int index of the last sample (excluded, ...
python
def _read_erd(erd_file, begsam, endsam): """Read the raw data and return a matrix, converted to microvolts. Parameters ---------- erd_file : str one of the .erd files to read begsam : int index of the first sample to read endsam : int index of the last sample (excluded, ...
[ "def", "_read_erd", "(", "erd_file", ",", "begsam", ",", "endsam", ")", ":", "hdr", "=", "_read_hdr_file", "(", "erd_file", ")", "n_allchan", "=", "hdr", "[", "'num_channels'", "]", "shorted", "=", "hdr", "[", "'shorted'", "]", "n_shorted", "=", "sum", "...
Read the raw data and return a matrix, converted to microvolts. Parameters ---------- erd_file : str one of the .erd files to read begsam : int index of the first sample to read endsam : int index of the last sample (excluded, per python convention) Returns ------- ...
[ "Read", "the", "raw", "data", "and", "return", "a", "matrix", "converted", "to", "microvolts", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L492-L607
train
wonambi-python/wonambi
wonambi/ioeeg/ktlx.py
_read_etc
def _read_etc(etc_file): """Return information about table of content for each erd. """ etc_type = dtype([('offset', '<i'), ('samplestamp', '<i'), ('sample_num', '<i'), ('sample_span', '<h'), ('unknown', '<h')]) wit...
python
def _read_etc(etc_file): """Return information about table of content for each erd. """ etc_type = dtype([('offset', '<i'), ('samplestamp', '<i'), ('sample_num', '<i'), ('sample_span', '<h'), ('unknown', '<h')]) wit...
[ "def", "_read_etc", "(", "etc_file", ")", ":", "etc_type", "=", "dtype", "(", "[", "(", "'offset'", ",", "'<i'", ")", ",", "(", "'samplestamp'", ",", "'<i'", ")", ",", "(", "'sample_num'", ",", "'<i'", ")", ",", "(", "'sample_span'", ",", "'<h'", ")"...
Return information about table of content for each erd.
[ "Return", "information", "about", "table", "of", "content", "for", "each", "erd", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L610-L623
train
wonambi-python/wonambi
wonambi/ioeeg/ktlx.py
_read_snc
def _read_snc(snc_file): """Read Synchronization File and return sample stamp and time Returns ------- sampleStamp : list of int Sample number from start of study sampleTime : list of datetime.datetime File time representation of sampleStamp Notes ----- The synchronizat...
python
def _read_snc(snc_file): """Read Synchronization File and return sample stamp and time Returns ------- sampleStamp : list of int Sample number from start of study sampleTime : list of datetime.datetime File time representation of sampleStamp Notes ----- The synchronizat...
[ "def", "_read_snc", "(", "snc_file", ")", ":", "snc_raw_dtype", "=", "dtype", "(", "[", "(", "'sampleStamp'", ",", "'<i'", ")", ",", "(", "'sampleTime'", ",", "'<q'", ")", "]", ")", "with", "snc_file", ".", "open", "(", "'rb'", ")", "as", "f", ":", ...
Read Synchronization File and return sample stamp and time Returns ------- sampleStamp : list of int Sample number from start of study sampleTime : list of datetime.datetime File time representation of sampleStamp Notes ----- The synchronization file is used to calculate a ...
[ "Read", "Synchronization", "File", "and", "return", "sample", "stamp", "and", "time" ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L626-L665
train
wonambi-python/wonambi
wonambi/ioeeg/ktlx.py
_read_stc
def _read_stc(stc_file): """Read Segment Table of Contents file. Returns ------- hdr : dict - next_segment : Sample frequency in Hertz - final : Number of channels stored - padding : Padding stamps : ndarray of dtype - segment_name : Name of ERD / ETC file segment ...
python
def _read_stc(stc_file): """Read Segment Table of Contents file. Returns ------- hdr : dict - next_segment : Sample frequency in Hertz - final : Number of channels stored - padding : Padding stamps : ndarray of dtype - segment_name : Name of ERD / ETC file segment ...
[ "def", "_read_stc", "(", "stc_file", ")", ":", "hdr", "=", "_read_hdr_file", "(", "stc_file", ")", "stc_dtype", "=", "dtype", "(", "[", "(", "'segment_name'", ",", "'a256'", ")", ",", "(", "'start_stamp'", ",", "'<i'", ")", ",", "(", "'end_stamp'", ",", ...
Read Segment Table of Contents file. Returns ------- hdr : dict - next_segment : Sample frequency in Hertz - final : Number of channels stored - padding : Padding stamps : ndarray of dtype - segment_name : Name of ERD / ETC file segment - start_stamp : First samp...
[ "Read", "Segment", "Table", "of", "Contents", "file", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L668-L722
train
wonambi-python/wonambi
wonambi/ioeeg/ktlx.py
_read_vtc
def _read_vtc(vtc_file): """Read the VTC file. Parameters ---------- vtc_file : str path to vtc file Returns ------- mpg_file : list of str list of avi files start_time : list of datetime list of start time of the avi files end_time : list of datetime ...
python
def _read_vtc(vtc_file): """Read the VTC file. Parameters ---------- vtc_file : str path to vtc file Returns ------- mpg_file : list of str list of avi files start_time : list of datetime list of start time of the avi files end_time : list of datetime ...
[ "def", "_read_vtc", "(", "vtc_file", ")", ":", "with", "vtc_file", ".", "open", "(", "'rb'", ")", "as", "f", ":", "filebytes", "=", "f", ".", "read", "(", ")", "hdr", "=", "{", "}", "hdr", "[", "'file_guid'", "]", "=", "hexlify", "(", "filebytes", ...
Read the VTC file. Parameters ---------- vtc_file : str path to vtc file Returns ------- mpg_file : list of str list of avi files start_time : list of datetime list of start time of the avi files end_time : list of datetime list of end time of the avi fi...
[ "Read", "the", "VTC", "file", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L725-L767
train
wonambi-python/wonambi
wonambi/ioeeg/ktlx.py
Ktlx._read_hdr_dir
def _read_hdr_dir(self): """Read the header for basic information. Returns ------- hdr : dict - 'erd': header of .erd file - 'stc': general part of .stc file - 'stamps' : time stamp for each file Also, it adds the attribute _basename : Path...
python
def _read_hdr_dir(self): """Read the header for basic information. Returns ------- hdr : dict - 'erd': header of .erd file - 'stc': general part of .stc file - 'stamps' : time stamp for each file Also, it adds the attribute _basename : Path...
[ "def", "_read_hdr_dir", "(", "self", ")", ":", "foldername", "=", "Path", "(", "self", ".", "filename", ")", "stc_file", "=", "foldername", "/", "(", "foldername", ".", "stem", "+", "'.stc'", ")", "if", "stc_file", ".", "exists", "(", ")", ":", "self",...
Read the header for basic information. Returns ------- hdr : dict - 'erd': header of .erd file - 'stc': general part of .stc file - 'stamps' : time stamp for each file Also, it adds the attribute _basename : Path the name of the files i...
[ "Read", "the", "header", "for", "basic", "information", "." ]
1d8e3d7e53df8017c199f703bcab582914676e76
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L845-L893
train