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/detect/spindle.py | detect_UCSD | def detect_UCSD(dat_orig, s_freq, time, opts):
"""Spindle detection based on the UCSD method
Parameters
----------
dat_orig : ndarray (dtype='float')
vector with the data for one channel
s_freq : float
sampling frequency
time : ndarray (dtype='float')
vector with the tim... | python | def detect_UCSD(dat_orig, s_freq, time, opts):
"""Spindle detection based on the UCSD method
Parameters
----------
dat_orig : ndarray (dtype='float')
vector with the data for one channel
s_freq : float
sampling frequency
time : ndarray (dtype='float')
vector with the tim... | [
"def",
"detect_UCSD",
"(",
"dat_orig",
",",
"s_freq",
",",
"time",
",",
"opts",
")",
":",
"dat_det",
"=",
"transform_signal",
"(",
"dat_orig",
",",
"s_freq",
",",
"'wavelet_real'",
",",
"opts",
".",
"det_wavelet",
")",
"det_value",
"=",
"define_threshold",
"... | Spindle detection based on the UCSD method
Parameters
----------
dat_orig : ndarray (dtype='float')
vector with the data for one channel
s_freq : float
sampling frequency
time : ndarray (dtype='float')
vector with the time points for each sample
opts : instance of 'Detec... | [
"Spindle",
"detection",
"based",
"on",
"the",
"UCSD",
"method"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L984-L1051 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | detect_Concordia | def detect_Concordia(dat_orig, s_freq, time, opts):
"""Spindle detection, experimental Concordia method. Similar to Moelle 2011
and Nir2011.
Parameters
----------
dat_orig : ndarray (dtype='float')
vector with the data for one channel
s_freq : float
sampling frequency
opts :... | python | def detect_Concordia(dat_orig, s_freq, time, opts):
"""Spindle detection, experimental Concordia method. Similar to Moelle 2011
and Nir2011.
Parameters
----------
dat_orig : ndarray (dtype='float')
vector with the data for one channel
s_freq : float
sampling frequency
opts :... | [
"def",
"detect_Concordia",
"(",
"dat_orig",
",",
"s_freq",
",",
"time",
",",
"opts",
")",
":",
"dat_det",
"=",
"transform_signal",
"(",
"dat_orig",
",",
"s_freq",
",",
"'butter'",
",",
"opts",
".",
"det_butter",
")",
"dat_det",
"=",
"transform_signal",
"(",
... | Spindle detection, experimental Concordia method. Similar to Moelle 2011
and Nir2011.
Parameters
----------
dat_orig : ndarray (dtype='float')
vector with the data for one channel
s_freq : float
sampling frequency
opts : instance of 'DetectSpindle'
'det_butter' : dict
... | [
"Spindle",
"detection",
"experimental",
"Concordia",
"method",
".",
"Similar",
"to",
"Moelle",
"2011",
"and",
"Nir2011",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L1054-L1125 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | define_threshold | def define_threshold(dat, s_freq, method, value, nbins=120):
"""Return the value of the threshold based on relative values.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after selection-transformation
s_freq : float
sampling frequency
method : str
... | python | def define_threshold(dat, s_freq, method, value, nbins=120):
"""Return the value of the threshold based on relative values.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after selection-transformation
s_freq : float
sampling frequency
method : str
... | [
"def",
"define_threshold",
"(",
"dat",
",",
"s_freq",
",",
"method",
",",
"value",
",",
"nbins",
"=",
"120",
")",
":",
"if",
"method",
"==",
"'mean'",
":",
"value",
"=",
"value",
"*",
"mean",
"(",
"dat",
")",
"elif",
"method",
"==",
"'median'",
":",
... | Return the value of the threshold based on relative values.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after selection-transformation
s_freq : float
sampling frequency
method : str
one of 'mean', 'median', 'std', 'mean+std', 'median+std', 'histm... | [
"Return",
"the",
"value",
"of",
"the",
"threshold",
"based",
"on",
"relative",
"values",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L1483-L1521 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | detect_events | def detect_events(dat, method, value=None):
"""Detect events using 'above_thresh', 'below_thresh' or
'maxima' method.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after transformation
method : str
'above_thresh', 'below_thresh' or 'maxima'
value :... | python | def detect_events(dat, method, value=None):
"""Detect events using 'above_thresh', 'below_thresh' or
'maxima' method.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after transformation
method : str
'above_thresh', 'below_thresh' or 'maxima'
value :... | [
"def",
"detect_events",
"(",
"dat",
",",
"method",
",",
"value",
"=",
"None",
")",
":",
"if",
"'thresh'",
"in",
"method",
"or",
"'custom'",
"==",
"method",
":",
"if",
"method",
"==",
"'above_thresh'",
":",
"above_det",
"=",
"dat",
">=",
"value",
"detecte... | Detect events using 'above_thresh', 'below_thresh' or
'maxima' method.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after transformation
method : str
'above_thresh', 'below_thresh' or 'maxima'
value : float or tuple of float
for 'above_thresh'... | [
"Detect",
"events",
"using",
"above_thresh",
"below_thresh",
"or",
"maxima",
"method",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L1556-L1619 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | select_events | def select_events(dat, detected, method, value):
"""Select start sample and end sample of the events.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after selection-transformation
detected : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
... | python | def select_events(dat, detected, method, value):
"""Select start sample and end sample of the events.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after selection-transformation
detected : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
... | [
"def",
"select_events",
"(",
"dat",
",",
"detected",
",",
"method",
",",
"value",
")",
":",
"if",
"method",
"==",
"'above_thresh'",
":",
"above_sel",
"=",
"dat",
">=",
"value",
"detected",
"=",
"_select_period",
"(",
"detected",
",",
"above_sel",
")",
"eli... | Select start sample and end sample of the events.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after selection-transformation
detected : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
method : str
'above_thresh', 'below_thresh'
... | [
"Select",
"start",
"sample",
"and",
"end",
"sample",
"of",
"the",
"events",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L1622-L1649 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | merge_close | def merge_close(events, min_interval, merge_to_longer=False):
"""Merge events that are separated by a less than a minimum interval.
Parameters
----------
events : list of dict
events with 'start' and 'end' times, from one or several channels.
**Events must be sorted by their start time.... | python | def merge_close(events, min_interval, merge_to_longer=False):
"""Merge events that are separated by a less than a minimum interval.
Parameters
----------
events : list of dict
events with 'start' and 'end' times, from one or several channels.
**Events must be sorted by their start time.... | [
"def",
"merge_close",
"(",
"events",
",",
"min_interval",
",",
"merge_to_longer",
"=",
"False",
")",
":",
"half_iv",
"=",
"min_interval",
"/",
"2",
"merged",
"=",
"[",
"]",
"for",
"higher",
"in",
"events",
":",
"if",
"not",
"merged",
":",
"merged",
".",
... | Merge events that are separated by a less than a minimum interval.
Parameters
----------
events : list of dict
events with 'start' and 'end' times, from one or several channels.
**Events must be sorted by their start time.**
min_interval : float
minimum delay between consecutive... | [
"Merge",
"events",
"that",
"are",
"separated",
"by",
"a",
"less",
"than",
"a",
"minimum",
"interval",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L1652-L1697 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | within_duration | def within_duration(events, time, limits):
"""Check whether event is within time limits.
Parameters
----------
events : ndarray (dtype='int')
N x M matrix with start sample first and end samples last on M
time : ndarray (dtype='float')
vector with time points
limits : tuple of f... | python | def within_duration(events, time, limits):
"""Check whether event is within time limits.
Parameters
----------
events : ndarray (dtype='int')
N x M matrix with start sample first and end samples last on M
time : ndarray (dtype='float')
vector with time points
limits : tuple of f... | [
"def",
"within_duration",
"(",
"events",
",",
"time",
",",
"limits",
")",
":",
"min_dur",
"=",
"max_dur",
"=",
"ones",
"(",
"events",
".",
"shape",
"[",
"0",
"]",
",",
"dtype",
"=",
"bool",
")",
"if",
"limits",
"[",
"0",
"]",
"is",
"not",
"None",
... | Check whether event is within time limits.
Parameters
----------
events : ndarray (dtype='int')
N x M matrix with start sample first and end samples last on M
time : ndarray (dtype='float')
vector with time points
limits : tuple of float
low and high limit for spindle durati... | [
"Check",
"whether",
"event",
"is",
"within",
"time",
"limits",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L1700-L1725 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | remove_straddlers | def remove_straddlers(events, time, s_freq, toler=0.1):
"""Reject an event if it straddles a stitch, by comparing its
duration to its timespan.
Parameters
----------
events : ndarray (dtype='int')
N x M matrix with start, ..., end samples
time : ndarray (dtype='float')
vector w... | python | def remove_straddlers(events, time, s_freq, toler=0.1):
"""Reject an event if it straddles a stitch, by comparing its
duration to its timespan.
Parameters
----------
events : ndarray (dtype='int')
N x M matrix with start, ..., end samples
time : ndarray (dtype='float')
vector w... | [
"def",
"remove_straddlers",
"(",
"events",
",",
"time",
",",
"s_freq",
",",
"toler",
"=",
"0.1",
")",
":",
"dur",
"=",
"(",
"events",
"[",
":",
",",
"-",
"1",
"]",
"-",
"1",
"-",
"events",
"[",
":",
",",
"0",
"]",
")",
"/",
"s_freq",
"continuou... | Reject an event if it straddles a stitch, by comparing its
duration to its timespan.
Parameters
----------
events : ndarray (dtype='int')
N x M matrix with start, ..., end samples
time : ndarray (dtype='float')
vector with time points
s_freq : float
sampling frequency
... | [
"Reject",
"an",
"event",
"if",
"it",
"straddles",
"a",
"stitch",
"by",
"comparing",
"its",
"duration",
"to",
"its",
"timespan",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L1728-L1751 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | power_ratio | def power_ratio(events, dat, s_freq, limits, ratio_thresh):
"""Estimate the ratio in power between spindle band and lower frequencies.
Parameters
----------
events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
dat : ndarray (dtype='float')
vector with the origin... | python | def power_ratio(events, dat, s_freq, limits, ratio_thresh):
"""Estimate the ratio in power between spindle band and lower frequencies.
Parameters
----------
events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
dat : ndarray (dtype='float')
vector with the origin... | [
"def",
"power_ratio",
"(",
"events",
",",
"dat",
",",
"s_freq",
",",
"limits",
",",
"ratio_thresh",
")",
":",
"ratio",
"=",
"empty",
"(",
"events",
".",
"shape",
"[",
"0",
"]",
")",
"for",
"i",
",",
"one_event",
"in",
"enumerate",
"(",
"events",
")",... | Estimate the ratio in power between spindle band and lower frequencies.
Parameters
----------
events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
dat : ndarray (dtype='float')
vector with the original data
s_freq : float
sampling frequency
limits : ... | [
"Estimate",
"the",
"ratio",
"in",
"power",
"between",
"spindle",
"band",
"and",
"lower",
"frequencies",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L1755-L1801 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | peak_in_power | def peak_in_power(events, dat, s_freq, method, value=None):
"""Define peak in power of the signal.
Parameters
----------
events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
dat : ndarray (dtype='float')
vector with the original data
s_freq : float
s... | python | def peak_in_power(events, dat, s_freq, method, value=None):
"""Define peak in power of the signal.
Parameters
----------
events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
dat : ndarray (dtype='float')
vector with the original data
s_freq : float
s... | [
"def",
"peak_in_power",
"(",
"events",
",",
"dat",
",",
"s_freq",
",",
"method",
",",
"value",
"=",
"None",
")",
":",
"dat",
"=",
"diff",
"(",
"dat",
")",
"peak",
"=",
"empty",
"(",
"events",
".",
"shape",
"[",
"0",
"]",
")",
"peak",
".",
"fill",... | Define peak in power of the signal.
Parameters
----------
events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
dat : ndarray (dtype='float')
vector with the original data
s_freq : float
sampling frequency
method : str or None
'peak' or 'inter... | [
"Define",
"peak",
"in",
"power",
"of",
"the",
"signal",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L1804-L1849 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | power_in_band | def power_in_band(events, dat, s_freq, frequency):
"""Define power of the signal within frequency band.
Parameters
----------
events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
dat : ndarray (dtype='float')
vector with the original data
s_freq : float
... | python | def power_in_band(events, dat, s_freq, frequency):
"""Define power of the signal within frequency band.
Parameters
----------
events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
dat : ndarray (dtype='float')
vector with the original data
s_freq : float
... | [
"def",
"power_in_band",
"(",
"events",
",",
"dat",
",",
"s_freq",
",",
"frequency",
")",
":",
"dat",
"=",
"diff",
"(",
"dat",
")",
"pw",
"=",
"empty",
"(",
"events",
".",
"shape",
"[",
"0",
"]",
")",
"pw",
".",
"fill",
"(",
"nan",
")",
"for",
"... | Define power of the signal within frequency band.
Parameters
----------
events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
dat : ndarray (dtype='float')
vector with the original data
s_freq : float
sampling frequency
frequency : tuple of float
... | [
"Define",
"power",
"of",
"the",
"signal",
"within",
"frequency",
"band",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L1852-L1890 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | make_spindles | def make_spindles(events, power_peaks, powers, dat_det, dat_orig, time,
s_freq):
"""Create dict for each spindle, based on events of time points.
Parameters
----------
events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples, and peak frequency
power_peaks... | python | def make_spindles(events, power_peaks, powers, dat_det, dat_orig, time,
s_freq):
"""Create dict for each spindle, based on events of time points.
Parameters
----------
events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples, and peak frequency
power_peaks... | [
"def",
"make_spindles",
"(",
"events",
",",
"power_peaks",
",",
"powers",
",",
"dat_det",
",",
"dat_orig",
",",
"time",
",",
"s_freq",
")",
":",
"i",
",",
"events",
"=",
"_remove_duplicate",
"(",
"events",
",",
"dat_det",
")",
"power_peaks",
"=",
"power_pe... | Create dict for each spindle, based on events of time points.
Parameters
----------
events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples, and peak frequency
power_peaks : ndarray (dtype='float')
peak in power spectrum for each event
powers : ndarray (dtype='floa... | [
"Create",
"dict",
"for",
"each",
"spindle",
"based",
"on",
"events",
"of",
"time",
"points",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L1893-L1943 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | _remove_duplicate | def _remove_duplicate(old_events, dat):
"""Remove duplicates from the events.
Parameters
----------
old_events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
dat : ndarray (dtype='float')
vector with the data after detection-transformation (to compute peak)
... | python | def _remove_duplicate(old_events, dat):
"""Remove duplicates from the events.
Parameters
----------
old_events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
dat : ndarray (dtype='float')
vector with the data after detection-transformation (to compute peak)
... | [
"def",
"_remove_duplicate",
"(",
"old_events",
",",
"dat",
")",
":",
"diff_events",
"=",
"diff",
"(",
"old_events",
",",
"axis",
"=",
"0",
")",
"dupl",
"=",
"where",
"(",
"(",
"diff_events",
"[",
":",
",",
"0",
"]",
"==",
"0",
")",
"&",
"(",
"diff_... | Remove duplicates from the events.
Parameters
----------
old_events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
dat : ndarray (dtype='float')
vector with the data after detection-transformation (to compute peak)
Returns
-------
ndarray (dtype='int')
... | [
"Remove",
"duplicates",
"from",
"the",
"events",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L1946-L1995 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | _detect_start_end | def _detect_start_end(true_values):
"""From ndarray of bool values, return intervals of True values.
Parameters
----------
true_values : ndarray (dtype='bool')
array with bool values
Returns
-------
ndarray (dtype='int')
N x 2 matrix with starting and ending times.
"""
... | python | def _detect_start_end(true_values):
"""From ndarray of bool values, return intervals of True values.
Parameters
----------
true_values : ndarray (dtype='bool')
array with bool values
Returns
-------
ndarray (dtype='int')
N x 2 matrix with starting and ending times.
"""
... | [
"def",
"_detect_start_end",
"(",
"true_values",
")",
":",
"neg",
"=",
"zeros",
"(",
"(",
"1",
")",
",",
"dtype",
"=",
"'bool'",
")",
"int_values",
"=",
"asarray",
"(",
"concatenate",
"(",
"(",
"neg",
",",
"true_values",
"[",
":",
"-",
"1",
"]",
",",
... | From ndarray of bool values, return intervals of True values.
Parameters
----------
true_values : ndarray (dtype='bool')
array with bool values
Returns
-------
ndarray (dtype='int')
N x 2 matrix with starting and ending times. | [
"From",
"ndarray",
"of",
"bool",
"values",
"return",
"intervals",
"of",
"True",
"values",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L1998-L2026 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | _merge_close | def _merge_close(dat, events, time, min_interval):
"""Merge together events separated by less than a minimum interval.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after selection-transformation
events : ndarray (dtype='int')
N x 3 matrix with start, peak... | python | def _merge_close(dat, events, time, min_interval):
"""Merge together events separated by less than a minimum interval.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after selection-transformation
events : ndarray (dtype='int')
N x 3 matrix with start, peak... | [
"def",
"_merge_close",
"(",
"dat",
",",
"events",
",",
"time",
",",
"min_interval",
")",
":",
"if",
"not",
"events",
".",
"any",
"(",
")",
":",
"return",
"events",
"no_merge",
"=",
"time",
"[",
"events",
"[",
"1",
":",
",",
"0",
"]",
"-",
"1",
"]... | Merge together events separated by less than a minimum interval.
Parameters
----------
dat : ndarray (dtype='float')
vector with the data after selection-transformation
events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
time : ndarray (dtype='float')
v... | [
"Merge",
"together",
"events",
"separated",
"by",
"less",
"than",
"a",
"minimum",
"interval",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L2068-L2106 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | _wmorlet | def _wmorlet(f0, sd, sampling_rate, ns=5):
"""
adapted from nitime
returns a complex morlet wavelet in the time domain
Parameters
----------
f0 : center frequency
sd : standard deviation of frequency
sampling_rate : samplingrate
ns : window length in number of stand... | python | def _wmorlet(f0, sd, sampling_rate, ns=5):
"""
adapted from nitime
returns a complex morlet wavelet in the time domain
Parameters
----------
f0 : center frequency
sd : standard deviation of frequency
sampling_rate : samplingrate
ns : window length in number of stand... | [
"def",
"_wmorlet",
"(",
"f0",
",",
"sd",
",",
"sampling_rate",
",",
"ns",
"=",
"5",
")",
":",
"st",
"=",
"1.",
"/",
"(",
"2.",
"*",
"pi",
"*",
"sd",
")",
"w_sz",
"=",
"float",
"(",
"int",
"(",
"ns",
"*",
"st",
"*",
"sampling_rate",
")",
")",
... | adapted from nitime
returns a complex morlet wavelet in the time domain
Parameters
----------
f0 : center frequency
sd : standard deviation of frequency
sampling_rate : samplingrate
ns : window length in number of standard deviations | [
"adapted",
"from",
"nitime"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L2109-L2127 | train |
wonambi-python/wonambi | wonambi/detect/spindle.py | _realwavelets | def _realwavelets(s_freq, freqs, dur, width):
"""Create real wavelets, for UCSD.
Parameters
----------
s_freq : int
sampling frequency
freqs : ndarray
vector with frequencies of interest
dur : float
duration of the wavelets in s
width : float
parameter contro... | python | def _realwavelets(s_freq, freqs, dur, width):
"""Create real wavelets, for UCSD.
Parameters
----------
s_freq : int
sampling frequency
freqs : ndarray
vector with frequencies of interest
dur : float
duration of the wavelets in s
width : float
parameter contro... | [
"def",
"_realwavelets",
"(",
"s_freq",
",",
"freqs",
",",
"dur",
",",
"width",
")",
":",
"x",
"=",
"arange",
"(",
"-",
"dur",
"/",
"2",
",",
"dur",
"/",
"2",
",",
"1",
"/",
"s_freq",
")",
"wavelets",
"=",
"empty",
"(",
"(",
"len",
"(",
"freqs",... | Create real wavelets, for UCSD.
Parameters
----------
s_freq : int
sampling frequency
freqs : ndarray
vector with frequencies of interest
dur : float
duration of the wavelets in s
width : float
parameter controlling gaussian shape
Returns
-------
nda... | [
"Create",
"real",
"wavelets",
"for",
"UCSD",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/spindle.py#L2130-L2158 | train |
wonambi-python/wonambi | wonambi/widgets/detect_dialogs.py | SpindleDialog.count_channels | def count_channels(self):
"""If more than one channel selected, activate merge checkbox."""
merge = self.index['merge']
if len(self.idx_chan.selectedItems()) > 1:
if merge.isEnabled():
return
else:
merge.setEnabled(True)
else:
... | python | def count_channels(self):
"""If more than one channel selected, activate merge checkbox."""
merge = self.index['merge']
if len(self.idx_chan.selectedItems()) > 1:
if merge.isEnabled():
return
else:
merge.setEnabled(True)
else:
... | [
"def",
"count_channels",
"(",
"self",
")",
":",
"merge",
"=",
"self",
".",
"index",
"[",
"'merge'",
"]",
"if",
"len",
"(",
"self",
".",
"idx_chan",
".",
"selectedItems",
"(",
")",
")",
">",
"1",
":",
"if",
"merge",
".",
"isEnabled",
"(",
")",
":",
... | If more than one channel selected, activate merge checkbox. | [
"If",
"more",
"than",
"one",
"channel",
"selected",
"activate",
"merge",
"checkbox",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/detect_dialogs.py#L465-L476 | train |
wonambi-python/wonambi | wonambi/trans/math.py | math | def math(data, operator=None, operator_name=None, axis=None):
"""Apply mathematical operation to each trial and channel individually.
Parameters
----------
data : instance of DataTime, DataFreq, or DataTimeFreq
operator : function or tuple of functions, optional
function(s) to run on the d... | python | def math(data, operator=None, operator_name=None, axis=None):
"""Apply mathematical operation to each trial and channel individually.
Parameters
----------
data : instance of DataTime, DataFreq, or DataTimeFreq
operator : function or tuple of functions, optional
function(s) to run on the d... | [
"def",
"math",
"(",
"data",
",",
"operator",
"=",
"None",
",",
"operator_name",
"=",
"None",
",",
"axis",
"=",
"None",
")",
":",
"if",
"operator",
"is",
"not",
"None",
"and",
"operator_name",
"is",
"not",
"None",
":",
"raise",
"TypeError",
"(",
"'Param... | Apply mathematical operation to each trial and channel individually.
Parameters
----------
data : instance of DataTime, DataFreq, or DataTimeFreq
operator : function or tuple of functions, optional
function(s) to run on the data.
operator_name : str or tuple of str, optional
name o... | [
"Apply",
"mathematical",
"operation",
"to",
"each",
"trial",
"and",
"channel",
"individually",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/math.py#L46-L209 | train |
wonambi-python/wonambi | wonambi/trans/math.py | get_descriptives | def get_descriptives(data):
"""Get mean, SD, and mean and SD of log values.
Parameters
----------
data : ndarray
Data with segment as first dimension
and all other dimensions raveled into second dimension.
Returns
-------
dict of ndarray
each entry is a 1-D vector o... | python | def get_descriptives(data):
"""Get mean, SD, and mean and SD of log values.
Parameters
----------
data : ndarray
Data with segment as first dimension
and all other dimensions raveled into second dimension.
Returns
-------
dict of ndarray
each entry is a 1-D vector o... | [
"def",
"get_descriptives",
"(",
"data",
")",
":",
"output",
"=",
"{",
"}",
"dat_log",
"=",
"log",
"(",
"abs",
"(",
"data",
")",
")",
"output",
"[",
"'mean'",
"]",
"=",
"nanmean",
"(",
"data",
",",
"axis",
"=",
"0",
")",
"output",
"[",
"'sd'",
"]"... | Get mean, SD, and mean and SD of log values.
Parameters
----------
data : ndarray
Data with segment as first dimension
and all other dimensions raveled into second dimension.
Returns
-------
dict of ndarray
each entry is a 1-D vector of descriptives over segment dimensi... | [
"Get",
"mean",
"SD",
"and",
"mean",
"and",
"SD",
"of",
"log",
"values",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/math.py#L211-L232 | train |
wonambi-python/wonambi | wonambi/ioeeg/abf.py | _read_info_as_dict | def _read_info_as_dict(fid, values):
"""Convenience function to read info in axon data to a nicely organized
dict.
"""
output = {}
for key, fmt in values:
val = unpack(fmt, fid.read(calcsize(fmt)))
if len(val) == 1:
output[key] = val[0]
else:
output[ke... | python | def _read_info_as_dict(fid, values):
"""Convenience function to read info in axon data to a nicely organized
dict.
"""
output = {}
for key, fmt in values:
val = unpack(fmt, fid.read(calcsize(fmt)))
if len(val) == 1:
output[key] = val[0]
else:
output[ke... | [
"def",
"_read_info_as_dict",
"(",
"fid",
",",
"values",
")",
":",
"output",
"=",
"{",
"}",
"for",
"key",
",",
"fmt",
"in",
"values",
":",
"val",
"=",
"unpack",
"(",
"fmt",
",",
"fid",
".",
"read",
"(",
"calcsize",
"(",
"fmt",
")",
")",
")",
"if",... | Convenience function to read info in axon data to a nicely organized
dict. | [
"Convenience",
"function",
"to",
"read",
"info",
"in",
"axon",
"data",
"to",
"a",
"nicely",
"organized",
"dict",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/abf.py#L251-L262 | train |
wonambi-python/wonambi | wonambi/widgets/settings.py | read_settings | def read_settings(widget, value_name):
"""Read Settings information, either from INI or from default values.
Parameters
----------
widget : str
name of the widget
value_name : str
name of the value of interest.
Returns
-------
multiple types
type depends on the ... | python | def read_settings(widget, value_name):
"""Read Settings information, either from INI or from default values.
Parameters
----------
widget : str
name of the widget
value_name : str
name of the value of interest.
Returns
-------
multiple types
type depends on the ... | [
"def",
"read_settings",
"(",
"widget",
",",
"value_name",
")",
":",
"setting_name",
"=",
"widget",
"+",
"'/'",
"+",
"value_name",
"default_value",
"=",
"DEFAULTS",
"[",
"widget",
"]",
"[",
"value_name",
"]",
"default_type",
"=",
"type",
"(",
"default_value",
... | Read Settings information, either from INI or from default values.
Parameters
----------
widget : str
name of the widget
value_name : str
name of the value of interest.
Returns
-------
multiple types
type depends on the type in the default values. | [
"Read",
"Settings",
"information",
"either",
"from",
"INI",
"or",
"from",
"default",
"values",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/settings.py#L314-L338 | train |
wonambi-python/wonambi | wonambi/widgets/settings.py | Settings.create_settings | def create_settings(self):
"""Create the widget, organized in two parts.
Notes
-----
When you add widgets in config, remember to update show_settings too
"""
bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Apply |
QDialogBut... | python | def create_settings(self):
"""Create the widget, organized in two parts.
Notes
-----
When you add widgets in config, remember to update show_settings too
"""
bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Apply |
QDialogBut... | [
"def",
"create_settings",
"(",
"self",
")",
":",
"bbox",
"=",
"QDialogButtonBox",
"(",
"QDialogButtonBox",
".",
"Ok",
"|",
"QDialogButtonBox",
".",
"Apply",
"|",
"QDialogButtonBox",
".",
"Cancel",
")",
"self",
".",
"idx_ok",
"=",
"bbox",
".",
"button",
"(",
... | Create the widget, organized in two parts.
Notes
-----
When you add widgets in config, remember to update show_settings too | [
"Create",
"the",
"widget",
"organized",
"in",
"two",
"parts",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/settings.py#L90-L134 | train |
wonambi-python/wonambi | wonambi/widgets/settings.py | Config.create_values | def create_values(self, value_names):
"""Read original values from the settings or the defaults.
Parameters
----------
value_names : list of str
list of value names to read
Returns
-------
dict
dictionary with the value names as keys
... | python | def create_values(self, value_names):
"""Read original values from the settings or the defaults.
Parameters
----------
value_names : list of str
list of value names to read
Returns
-------
dict
dictionary with the value names as keys
... | [
"def",
"create_values",
"(",
"self",
",",
"value_names",
")",
":",
"output",
"=",
"{",
"}",
"for",
"value_name",
"in",
"value_names",
":",
"output",
"[",
"value_name",
"]",
"=",
"read_settings",
"(",
"self",
".",
"widget",
",",
"value_name",
")",
"return",... | Read original values from the settings or the defaults.
Parameters
----------
value_names : list of str
list of value names to read
Returns
-------
dict
dictionary with the value names as keys | [
"Read",
"original",
"values",
"from",
"the",
"settings",
"or",
"the",
"defaults",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/settings.py#L213-L230 | train |
wonambi-python/wonambi | wonambi/widgets/settings.py | Config.get_values | def get_values(self):
"""Get values from the GUI and save them in preference file."""
for value_name, widget in self.index.items():
self.value[value_name] = widget.get_value(self.value[value_name])
setting_name = self.widget + '/' + value_name
settings.setValue(setti... | python | def get_values(self):
"""Get values from the GUI and save them in preference file."""
for value_name, widget in self.index.items():
self.value[value_name] = widget.get_value(self.value[value_name])
setting_name = self.widget + '/' + value_name
settings.setValue(setti... | [
"def",
"get_values",
"(",
"self",
")",
":",
"for",
"value_name",
",",
"widget",
"in",
"self",
".",
"index",
".",
"items",
"(",
")",
":",
"self",
".",
"value",
"[",
"value_name",
"]",
"=",
"widget",
".",
"get_value",
"(",
"self",
".",
"value",
"[",
... | Get values from the GUI and save them in preference file. | [
"Get",
"values",
"from",
"the",
"GUI",
"and",
"save",
"them",
"in",
"preference",
"file",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/settings.py#L238-L244 | train |
wonambi-python/wonambi | wonambi/widgets/settings.py | Config.put_values | def put_values(self):
"""Put values to the GUI.
Notes
-----
In addition, when one small widget has been changed, it calls
set_modified, so that we know that the preference widget was modified.
"""
for value_name, widget in self.index.items():
widget.... | python | def put_values(self):
"""Put values to the GUI.
Notes
-----
In addition, when one small widget has been changed, it calls
set_modified, so that we know that the preference widget was modified.
"""
for value_name, widget in self.index.items():
widget.... | [
"def",
"put_values",
"(",
"self",
")",
":",
"for",
"value_name",
",",
"widget",
"in",
"self",
".",
"index",
".",
"items",
"(",
")",
":",
"widget",
".",
"set_value",
"(",
"self",
".",
"value",
"[",
"value_name",
"]",
")",
"widget",
".",
"connect",
"("... | Put values to the GUI.
Notes
-----
In addition, when one small widget has been changed, it calls
set_modified, so that we know that the preference widget was modified. | [
"Put",
"values",
"to",
"the",
"GUI",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/settings.py#L246-L257 | train |
wonambi-python/wonambi | wonambi/datatype.py | _get_indices | def _get_indices(values, selected, tolerance):
"""Get indices based on user-selected values.
Parameters
----------
values : ndarray (any dtype)
values present in the axis.
selected : ndarray (any dtype) or tuple or list
values selected by the user
tolerance : float
avoid... | python | def _get_indices(values, selected, tolerance):
"""Get indices based on user-selected values.
Parameters
----------
values : ndarray (any dtype)
values present in the axis.
selected : ndarray (any dtype) or tuple or list
values selected by the user
tolerance : float
avoid... | [
"def",
"_get_indices",
"(",
"values",
",",
"selected",
",",
"tolerance",
")",
":",
"idx_data",
"=",
"[",
"]",
"idx_output",
"=",
"[",
"]",
"for",
"idx_of_selected",
",",
"one_selected",
"in",
"enumerate",
"(",
"selected",
")",
":",
"if",
"tolerance",
"is",... | Get indices based on user-selected values.
Parameters
----------
values : ndarray (any dtype)
values present in the axis.
selected : ndarray (any dtype) or tuple or list
values selected by the user
tolerance : float
avoid rounding errors.
Returns
-------
idx_dat... | [
"Get",
"indices",
"based",
"on",
"user",
"-",
"selected",
"values",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/datatype.py#L468-L512 | train |
wonambi-python/wonambi | wonambi/datatype.py | Data.number_of | def number_of(self, axis):
"""Return the number of in one axis, as generally as possible.
Parameters
----------
axis : str
Name of the axis (such as 'trial', 'time', etc)
Returns
-------
int or ndarray (dtype='int')
number of trial (as in... | python | def number_of(self, axis):
"""Return the number of in one axis, as generally as possible.
Parameters
----------
axis : str
Name of the axis (such as 'trial', 'time', etc)
Returns
-------
int or ndarray (dtype='int')
number of trial (as in... | [
"def",
"number_of",
"(",
"self",
",",
"axis",
")",
":",
"if",
"axis",
"==",
"'trial'",
":",
"return",
"len",
"(",
"self",
".",
"data",
")",
"else",
":",
"n_trial",
"=",
"self",
".",
"number_of",
"(",
"'trial'",
")",
"output",
"=",
"empty",
"(",
"n_... | Return the number of in one axis, as generally as possible.
Parameters
----------
axis : str
Name of the axis (such as 'trial', 'time', etc)
Returns
-------
int or ndarray (dtype='int')
number of trial (as int) or number of element in the selecte... | [
"Return",
"the",
"number",
"of",
"in",
"one",
"axis",
"as",
"generally",
"as",
"possible",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/datatype.py#L216-L248 | train |
wonambi-python/wonambi | wonambi/datatype.py | Data._copy | def _copy(self, axis=True, attr=True, data=False):
"""Create a new instance of Data, but does not copy the data
necessarily.
Parameters
----------
axis : bool, optional
deep copy the axes (default: True)
attr : bool, optional
deep copy the attribu... | python | def _copy(self, axis=True, attr=True, data=False):
"""Create a new instance of Data, but does not copy the data
necessarily.
Parameters
----------
axis : bool, optional
deep copy the axes (default: True)
attr : bool, optional
deep copy the attribu... | [
"def",
"_copy",
"(",
"self",
",",
"axis",
"=",
"True",
",",
"attr",
"=",
"True",
",",
"data",
"=",
"False",
")",
":",
"cdata",
"=",
"type",
"(",
"self",
")",
"(",
")",
"cdata",
".",
"s_freq",
"=",
"self",
".",
"s_freq",
"cdata",
".",
"start_time"... | Create a new instance of Data, but does not copy the data
necessarily.
Parameters
----------
axis : bool, optional
deep copy the axes (default: True)
attr : bool, optional
deep copy the attributes (default: True)
data : bool, optional
... | [
"Create",
"a",
"new",
"instance",
"of",
"Data",
"but",
"does",
"not",
"copy",
"the",
"data",
"necessarily",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/datatype.py#L302-L351 | train |
wonambi-python/wonambi | wonambi/datatype.py | Data.export | def export(self, filename, export_format='FieldTrip', **options):
"""Export data in other formats.
Parameters
----------
filename : path to file
file to write
export_format : str, optional
supported export format is currently FieldTrip, EDF, FIFF, Wonambi... | python | def export(self, filename, export_format='FieldTrip', **options):
"""Export data in other formats.
Parameters
----------
filename : path to file
file to write
export_format : str, optional
supported export format is currently FieldTrip, EDF, FIFF, Wonambi... | [
"def",
"export",
"(",
"self",
",",
"filename",
",",
"export_format",
"=",
"'FieldTrip'",
",",
"**",
"options",
")",
":",
"filename",
"=",
"Path",
"(",
"filename",
")",
"filename",
".",
"parent",
".",
"mkdir",
"(",
"parents",
"=",
"True",
",",
"exist_ok",... | Export data in other formats.
Parameters
----------
filename : path to file
file to write
export_format : str, optional
supported export format is currently FieldTrip, EDF, FIFF, Wonambi,
BrainVision
Notes
-----
'edf' takes an... | [
"Export",
"data",
"in",
"other",
"formats",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/datatype.py#L353-L410 | train |
wonambi-python/wonambi | wonambi/widgets/channels.py | ChannelsGroup.highlight_channels | def highlight_channels(self, l, selected_chan):
"""Highlight channels in the list of channels.
Parameters
----------
selected_chan : list of str
channels to indicate as selected.
"""
for row in range(l.count()):
item = l.item(row)
if i... | python | def highlight_channels(self, l, selected_chan):
"""Highlight channels in the list of channels.
Parameters
----------
selected_chan : list of str
channels to indicate as selected.
"""
for row in range(l.count()):
item = l.item(row)
if i... | [
"def",
"highlight_channels",
"(",
"self",
",",
"l",
",",
"selected_chan",
")",
":",
"for",
"row",
"in",
"range",
"(",
"l",
".",
"count",
"(",
")",
")",
":",
"item",
"=",
"l",
".",
"item",
"(",
"row",
")",
"if",
"item",
".",
"text",
"(",
")",
"i... | Highlight channels in the list of channels.
Parameters
----------
selected_chan : list of str
channels to indicate as selected. | [
"Highlight",
"channels",
"in",
"the",
"list",
"of",
"channels",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L196-L209 | train |
wonambi-python/wonambi | wonambi/widgets/channels.py | ChannelsGroup.rereference | def rereference(self):
"""Automatically highlight channels to use as reference, based on
selected channels."""
selectedItems = self.idx_l0.selectedItems()
chan_to_plot = []
for selected in selectedItems:
chan_to_plot.append(selected.text())
self.highlight_cha... | python | def rereference(self):
"""Automatically highlight channels to use as reference, based on
selected channels."""
selectedItems = self.idx_l0.selectedItems()
chan_to_plot = []
for selected in selectedItems:
chan_to_plot.append(selected.text())
self.highlight_cha... | [
"def",
"rereference",
"(",
"self",
")",
":",
"selectedItems",
"=",
"self",
".",
"idx_l0",
".",
"selectedItems",
"(",
")",
"chan_to_plot",
"=",
"[",
"]",
"for",
"selected",
"in",
"selectedItems",
":",
"chan_to_plot",
".",
"append",
"(",
"selected",
".",
"te... | Automatically highlight channels to use as reference, based on
selected channels. | [
"Automatically",
"highlight",
"channels",
"to",
"use",
"as",
"reference",
"based",
"on",
"selected",
"channels",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L211-L219 | train |
wonambi-python/wonambi | wonambi/widgets/channels.py | ChannelsGroup.get_info | def get_info(self):
"""Get the information about the channel groups.
Returns
-------
dict
information about this channel group
Notes
-----
The items in selectedItems() are ordered based on the user's selection
(which appears pretty random). I... | python | def get_info(self):
"""Get the information about the channel groups.
Returns
-------
dict
information about this channel group
Notes
-----
The items in selectedItems() are ordered based on the user's selection
(which appears pretty random). I... | [
"def",
"get_info",
"(",
"self",
")",
":",
"selectedItems",
"=",
"self",
".",
"idx_l0",
".",
"selectedItems",
"(",
")",
"selected_chan",
"=",
"[",
"x",
".",
"text",
"(",
")",
"for",
"x",
"in",
"selectedItems",
"]",
"chan_to_plot",
"=",
"[",
"]",
"for",
... | Get the information about the channel groups.
Returns
-------
dict
information about this channel group
Notes
-----
The items in selectedItems() are ordered based on the user's selection
(which appears pretty random). It's more consistent to use the ... | [
"Get",
"the",
"information",
"about",
"the",
"channel",
"groups",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L221-L271 | train |
wonambi-python/wonambi | wonambi/widgets/channels.py | Channels.create | def create(self):
"""Create Channels Widget"""
add_button = QPushButton('New')
add_button.clicked.connect(self.new_group)
color_button = QPushButton('Color')
color_button.clicked.connect(self.color_group)
del_button = QPushButton('Delete')
del_button.clicked.conne... | python | def create(self):
"""Create Channels Widget"""
add_button = QPushButton('New')
add_button.clicked.connect(self.new_group)
color_button = QPushButton('Color')
color_button.clicked.connect(self.color_group)
del_button = QPushButton('Delete')
del_button.clicked.conne... | [
"def",
"create",
"(",
"self",
")",
":",
"add_button",
"=",
"QPushButton",
"(",
"'New'",
")",
"add_button",
".",
"clicked",
".",
"connect",
"(",
"self",
".",
"new_group",
")",
"color_button",
"=",
"QPushButton",
"(",
"'Color'",
")",
"color_button",
".",
"cl... | Create Channels Widget | [
"Create",
"Channels",
"Widget"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L305-L338 | train |
wonambi-python/wonambi | wonambi/widgets/channels.py | Channels.create_action | def create_action(self):
"""Create actions related to channel selection."""
actions = {}
act = QAction('Load Montage...', self)
act.triggered.connect(self.load_channels)
act.setEnabled(False)
actions['load_channels'] = act
act = QAction('Save Montage...', self)
... | python | def create_action(self):
"""Create actions related to channel selection."""
actions = {}
act = QAction('Load Montage...', self)
act.triggered.connect(self.load_channels)
act.setEnabled(False)
actions['load_channels'] = act
act = QAction('Save Montage...', self)
... | [
"def",
"create_action",
"(",
"self",
")",
":",
"actions",
"=",
"{",
"}",
"act",
"=",
"QAction",
"(",
"'Load Montage...'",
",",
"self",
")",
"act",
".",
"triggered",
".",
"connect",
"(",
"self",
".",
"load_channels",
")",
"act",
".",
"setEnabled",
"(",
... | Create actions related to channel selection. | [
"Create",
"actions",
"related",
"to",
"channel",
"selection",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L340-L354 | train |
wonambi-python/wonambi | wonambi/widgets/channels.py | Channels.new_group | def new_group(self, checked=False, test_name=None):
"""Create a new channel group.
Parameters
----------
checked : bool
comes from QAbstractButton.clicked
test_name : str
used for testing purposes to avoid modal window
Notes
-----
... | python | def new_group(self, checked=False, test_name=None):
"""Create a new channel group.
Parameters
----------
checked : bool
comes from QAbstractButton.clicked
test_name : str
used for testing purposes to avoid modal window
Notes
-----
... | [
"def",
"new_group",
"(",
"self",
",",
"checked",
"=",
"False",
",",
"test_name",
"=",
"None",
")",
":",
"chan_name",
"=",
"self",
".",
"parent",
".",
"labels",
".",
"chan_name",
"if",
"chan_name",
"is",
"None",
":",
"msg",
"=",
"'No dataset loaded'",
"se... | Create a new channel group.
Parameters
----------
checked : bool
comes from QAbstractButton.clicked
test_name : str
used for testing purposes to avoid modal window
Notes
-----
Don't call self.apply() just yet, only if the user wants it. | [
"Create",
"a",
"new",
"channel",
"group",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L361-L398 | train |
wonambi-python/wonambi | wonambi/widgets/channels.py | Channels.color_group | def color_group(self, checked=False, test_color=None):
"""Change the color of the group."""
group = self.tabs.currentWidget()
if test_color is None:
newcolor = QColorDialog.getColor(group.idx_color)
else:
newcolor = test_color
group.idx_color = newcolor
... | python | def color_group(self, checked=False, test_color=None):
"""Change the color of the group."""
group = self.tabs.currentWidget()
if test_color is None:
newcolor = QColorDialog.getColor(group.idx_color)
else:
newcolor = test_color
group.idx_color = newcolor
... | [
"def",
"color_group",
"(",
"self",
",",
"checked",
"=",
"False",
",",
"test_color",
"=",
"None",
")",
":",
"group",
"=",
"self",
".",
"tabs",
".",
"currentWidget",
"(",
")",
"if",
"test_color",
"is",
"None",
":",
"newcolor",
"=",
"QColorDialog",
".",
"... | Change the color of the group. | [
"Change",
"the",
"color",
"of",
"the",
"group",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L400-L409 | train |
wonambi-python/wonambi | wonambi/widgets/channels.py | Channels.del_group | def del_group(self):
"""Delete current group."""
idx = self.tabs.currentIndex()
self.tabs.removeTab(idx)
self.apply() | python | def del_group(self):
"""Delete current group."""
idx = self.tabs.currentIndex()
self.tabs.removeTab(idx)
self.apply() | [
"def",
"del_group",
"(",
"self",
")",
":",
"idx",
"=",
"self",
".",
"tabs",
".",
"currentIndex",
"(",
")",
"self",
".",
"tabs",
".",
"removeTab",
"(",
"idx",
")",
"self",
".",
"apply",
"(",
")"
] | Delete current group. | [
"Delete",
"current",
"group",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L411-L416 | train |
wonambi-python/wonambi | wonambi/widgets/channels.py | Channels.apply | def apply(self):
"""Apply changes to the plots."""
self.read_group_info()
if self.tabs.count() == 0:
# disactivate buttons
self.button_color.setEnabled(False)
self.button_del.setEnabled(False)
self.button_apply.setEnabled(False)
else:
... | python | def apply(self):
"""Apply changes to the plots."""
self.read_group_info()
if self.tabs.count() == 0:
# disactivate buttons
self.button_color.setEnabled(False)
self.button_del.setEnabled(False)
self.button_apply.setEnabled(False)
else:
... | [
"def",
"apply",
"(",
"self",
")",
":",
"self",
".",
"read_group_info",
"(",
")",
"if",
"self",
".",
"tabs",
".",
"count",
"(",
")",
"==",
"0",
":",
"self",
".",
"button_color",
".",
"setEnabled",
"(",
"False",
")",
"self",
".",
"button_del",
".",
"... | Apply changes to the plots. | [
"Apply",
"changes",
"to",
"the",
"plots",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L418-L440 | train |
wonambi-python/wonambi | wonambi/widgets/channels.py | Channels.read_group_info | def read_group_info(self):
"""Get information about groups directly from the widget."""
self.groups = []
for i in range(self.tabs.count()):
one_group = self.tabs.widget(i).get_info()
# one_group['name'] = self.tabs.tabText(i)
self.groups.append(one_group) | python | def read_group_info(self):
"""Get information about groups directly from the widget."""
self.groups = []
for i in range(self.tabs.count()):
one_group = self.tabs.widget(i).get_info()
# one_group['name'] = self.tabs.tabText(i)
self.groups.append(one_group) | [
"def",
"read_group_info",
"(",
"self",
")",
":",
"self",
".",
"groups",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"tabs",
".",
"count",
"(",
")",
")",
":",
"one_group",
"=",
"self",
".",
"tabs",
".",
"widget",
"(",
"i",
")",
"... | Get information about groups directly from the widget. | [
"Get",
"information",
"about",
"groups",
"directly",
"from",
"the",
"widget",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L442-L448 | train |
wonambi-python/wonambi | wonambi/widgets/channels.py | Channels.load_channels | def load_channels(self, checked=False, test_name=None):
"""Load channel groups from file.
Parameters
----------
test_name : path to file
when debugging the function, you can open a channels file from the
command line
"""
chan_name = self.parent.la... | python | def load_channels(self, checked=False, test_name=None):
"""Load channel groups from file.
Parameters
----------
test_name : path to file
when debugging the function, you can open a channels file from the
command line
"""
chan_name = self.parent.la... | [
"def",
"load_channels",
"(",
"self",
",",
"checked",
"=",
"False",
",",
"test_name",
"=",
"None",
")",
":",
"chan_name",
"=",
"self",
".",
"parent",
".",
"labels",
".",
"chan_name",
"if",
"self",
".",
"filename",
"is",
"not",
"None",
":",
"filename",
"... | Load channel groups from file.
Parameters
----------
test_name : path to file
when debugging the function, you can open a channels file from the
command line | [
"Load",
"channel",
"groups",
"from",
"file",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L450-L502 | train |
wonambi-python/wonambi | wonambi/widgets/channels.py | Channels.save_channels | def save_channels(self, checked=False, test_name=None):
"""Save channel groups to file."""
self.read_group_info()
if self.filename is not None:
filename = self.filename
elif self.parent.info.filename is not None:
filename = (splitext(self.parent.info.filename)[0]... | python | def save_channels(self, checked=False, test_name=None):
"""Save channel groups to file."""
self.read_group_info()
if self.filename is not None:
filename = self.filename
elif self.parent.info.filename is not None:
filename = (splitext(self.parent.info.filename)[0]... | [
"def",
"save_channels",
"(",
"self",
",",
"checked",
"=",
"False",
",",
"test_name",
"=",
"None",
")",
":",
"self",
".",
"read_group_info",
"(",
")",
"if",
"self",
".",
"filename",
"is",
"not",
"None",
":",
"filename",
"=",
"self",
".",
"filename",
"el... | Save channel groups to file. | [
"Save",
"channel",
"groups",
"to",
"file",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L504-L534 | train |
wonambi-python/wonambi | wonambi/widgets/channels.py | Channels.reset | def reset(self):
"""Reset all the information of this widget."""
self.filename = None
self.groups = []
self.tabs.clear()
self.setEnabled(False)
self.button_color.setEnabled(False)
self.button_del.setEnabled(False)
self.button_apply.setEnabled(False)
... | python | def reset(self):
"""Reset all the information of this widget."""
self.filename = None
self.groups = []
self.tabs.clear()
self.setEnabled(False)
self.button_color.setEnabled(False)
self.button_del.setEnabled(False)
self.button_apply.setEnabled(False)
... | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"filename",
"=",
"None",
"self",
".",
"groups",
"=",
"[",
"]",
"self",
".",
"tabs",
".",
"clear",
"(",
")",
"self",
".",
"setEnabled",
"(",
"False",
")",
"self",
".",
"button_color",
".",
"setEnab... | Reset all the information of this widget. | [
"Reset",
"all",
"the",
"information",
"of",
"this",
"widget",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L536-L548 | train |
wonambi-python/wonambi | wonambi/widgets/spectrum.py | Spectrum.create | def create(self):
"""Create empty scene for power spectrum."""
self.idx_chan = QComboBox()
self.idx_chan.activated.connect(self.display_window)
self.idx_fig = QGraphicsView(self)
self.idx_fig.scale(1, -1)
layout = QVBoxLayout()
layout.addWidget(self.idx_chan)
... | python | def create(self):
"""Create empty scene for power spectrum."""
self.idx_chan = QComboBox()
self.idx_chan.activated.connect(self.display_window)
self.idx_fig = QGraphicsView(self)
self.idx_fig.scale(1, -1)
layout = QVBoxLayout()
layout.addWidget(self.idx_chan)
... | [
"def",
"create",
"(",
"self",
")",
":",
"self",
".",
"idx_chan",
"=",
"QComboBox",
"(",
")",
"self",
".",
"idx_chan",
".",
"activated",
".",
"connect",
"(",
"self",
".",
"display_window",
")",
"self",
".",
"idx_fig",
"=",
"QGraphicsView",
"(",
"self",
... | Create empty scene for power spectrum. | [
"Create",
"empty",
"scene",
"for",
"power",
"spectrum",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/spectrum.py#L104-L117 | train |
wonambi-python/wonambi | wonambi/widgets/spectrum.py | Spectrum.update | def update(self):
"""Add channel names to the combobox."""
self.idx_chan.clear()
for chan_name in self.parent.traces.chan:
self.idx_chan.addItem(chan_name)
if self.selected_chan is not None:
self.idx_chan.setCurrentIndex(self.selected_chan)
self.selec... | python | def update(self):
"""Add channel names to the combobox."""
self.idx_chan.clear()
for chan_name in self.parent.traces.chan:
self.idx_chan.addItem(chan_name)
if self.selected_chan is not None:
self.idx_chan.setCurrentIndex(self.selected_chan)
self.selec... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"idx_chan",
".",
"clear",
"(",
")",
"for",
"chan_name",
"in",
"self",
".",
"parent",
".",
"traces",
".",
"chan",
":",
"self",
".",
"idx_chan",
".",
"addItem",
"(",
"chan_name",
")",
"if",
"self",
... | Add channel names to the combobox. | [
"Add",
"channel",
"names",
"to",
"the",
"combobox",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/spectrum.py#L126-L134 | train |
wonambi-python/wonambi | wonambi/widgets/spectrum.py | Spectrum.display_window | def display_window(self):
"""Read the channel name from QComboBox and plot its spectrum.
This function is necessary it reads the data and it sends it to
self.display. When the user selects a smaller chunk of data from the
visible traces, then we don't need to call this function.
... | python | def display_window(self):
"""Read the channel name from QComboBox and plot its spectrum.
This function is necessary it reads the data and it sends it to
self.display. When the user selects a smaller chunk of data from the
visible traces, then we don't need to call this function.
... | [
"def",
"display_window",
"(",
"self",
")",
":",
"if",
"self",
".",
"idx_chan",
".",
"count",
"(",
")",
"==",
"0",
":",
"self",
".",
"update",
"(",
")",
"chan_name",
"=",
"self",
".",
"idx_chan",
".",
"currentText",
"(",
")",
"lg",
".",
"debug",
"("... | Read the channel name from QComboBox and plot its spectrum.
This function is necessary it reads the data and it sends it to
self.display. When the user selects a smaller chunk of data from the
visible traces, then we don't need to call this function. | [
"Read",
"the",
"channel",
"name",
"from",
"QComboBox",
"and",
"plot",
"its",
"spectrum",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/spectrum.py#L136-L154 | train |
wonambi-python/wonambi | wonambi/widgets/spectrum.py | Spectrum.display | def display(self, data):
"""Make graphicsitem for spectrum figure.
Parameters
----------
data : ndarray
1D vector containing the data only
This function can be called by self.display_window (which reads the
data for the selected channel) or by the mouse-even... | python | def display(self, data):
"""Make graphicsitem for spectrum figure.
Parameters
----------
data : ndarray
1D vector containing the data only
This function can be called by self.display_window (which reads the
data for the selected channel) or by the mouse-even... | [
"def",
"display",
"(",
"self",
",",
"data",
")",
":",
"value",
"=",
"self",
".",
"config",
".",
"value",
"self",
".",
"scene",
"=",
"QGraphicsScene",
"(",
"value",
"[",
"'x_min'",
"]",
",",
"value",
"[",
"'y_min'",
"]",
",",
"value",
"[",
"'x_max'",
... | Make graphicsitem for spectrum figure.
Parameters
----------
data : ndarray
1D vector containing the data only
This function can be called by self.display_window (which reads the
data for the selected channel) or by the mouse-events functions in
traces (whic... | [
"Make",
"graphicsitem",
"for",
"spectrum",
"figure",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/spectrum.py#L156-L189 | train |
wonambi-python/wonambi | wonambi/widgets/spectrum.py | Spectrum.add_grid | def add_grid(self):
"""Add axis and ticks to figure.
Notes
-----
I know that visvis and pyqtgraphs can do this in much simpler way, but
those packages create too large a padding around the figure and this is
pretty fast.
"""
value = self.config.value
... | python | def add_grid(self):
"""Add axis and ticks to figure.
Notes
-----
I know that visvis and pyqtgraphs can do this in much simpler way, but
those packages create too large a padding around the figure and this is
pretty fast.
"""
value = self.config.value
... | [
"def",
"add_grid",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"config",
".",
"value",
"self",
".",
"scene",
".",
"addLine",
"(",
"value",
"[",
"'x_min'",
"]",
",",
"value",
"[",
"'y_min'",
"]",
",",
"value",
"[",
"'x_min'",
"]",
",",
"value"... | Add axis and ticks to figure.
Notes
-----
I know that visvis and pyqtgraphs can do this in much simpler way, but
those packages create too large a padding around the figure and this is
pretty fast. | [
"Add",
"axis",
"and",
"ticks",
"to",
"figure",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/spectrum.py#L191-L238 | train |
wonambi-python/wonambi | wonambi/widgets/spectrum.py | Spectrum.resizeEvent | def resizeEvent(self, event):
"""Fit the whole scene in view.
Parameters
----------
event : instance of Qt.Event
not important
"""
value = self.config.value
self.idx_fig.fitInView(value['x_min'],
value['y_min'],
... | python | def resizeEvent(self, event):
"""Fit the whole scene in view.
Parameters
----------
event : instance of Qt.Event
not important
"""
value = self.config.value
self.idx_fig.fitInView(value['x_min'],
value['y_min'],
... | [
"def",
"resizeEvent",
"(",
"self",
",",
"event",
")",
":",
"value",
"=",
"self",
".",
"config",
".",
"value",
"self",
".",
"idx_fig",
".",
"fitInView",
"(",
"value",
"[",
"'x_min'",
"]",
",",
"value",
"[",
"'y_min'",
"]",
",",
"value",
"[",
"'x_max'"... | Fit the whole scene in view.
Parameters
----------
event : instance of Qt.Event
not important | [
"Fit",
"the",
"whole",
"scene",
"in",
"view",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/spectrum.py#L240-L253 | train |
wonambi-python/wonambi | wonambi/widgets/spectrum.py | Spectrum.reset | def reset(self):
"""Reset widget as new"""
self.idx_chan.clear()
if self.scene is not None:
self.scene.clear()
self.scene = None | python | def reset(self):
"""Reset widget as new"""
self.idx_chan.clear()
if self.scene is not None:
self.scene.clear()
self.scene = None | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"idx_chan",
".",
"clear",
"(",
")",
"if",
"self",
".",
"scene",
"is",
"not",
"None",
":",
"self",
".",
"scene",
".",
"clear",
"(",
")",
"self",
".",
"scene",
"=",
"None"
] | Reset widget as new | [
"Reset",
"widget",
"as",
"new"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/spectrum.py#L255-L260 | train |
wonambi-python/wonambi | wonambi/detect/slowwave.py | detect_Massimini2004 | def detect_Massimini2004(dat_orig, s_freq, time, opts):
"""Slow wave detection based on Massimini et al., 2004.
Parameters
----------
dat_orig : ndarray (dtype='float')
vector with the data for one channel
s_freq : float
sampling frequency
time : ndarray (dtype='float')
... | python | def detect_Massimini2004(dat_orig, s_freq, time, opts):
"""Slow wave detection based on Massimini et al., 2004.
Parameters
----------
dat_orig : ndarray (dtype='float')
vector with the data for one channel
s_freq : float
sampling frequency
time : ndarray (dtype='float')
... | [
"def",
"detect_Massimini2004",
"(",
"dat_orig",
",",
"s_freq",
",",
"time",
",",
"opts",
")",
":",
"if",
"opts",
".",
"invert",
":",
"dat_orig",
"=",
"-",
"dat_orig",
"dat_det",
"=",
"transform_signal",
"(",
"dat_orig",
",",
"s_freq",
",",
"'double_butter'",... | Slow wave detection based on Massimini et al., 2004.
Parameters
----------
dat_orig : ndarray (dtype='float')
vector with the data for one channel
s_freq : float
sampling frequency
time : ndarray (dtype='float')
vector with the time points for each sample
opts : instance... | [
"Slow",
"wave",
"detection",
"based",
"on",
"Massimini",
"et",
"al",
".",
"2004",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/slowwave.py#L124-L187 | train |
wonambi-python/wonambi | wonambi/detect/slowwave.py | select_peaks | def select_peaks(data, events, limit):
"""Check whether event satisfies amplitude limit.
Parameters
----------
data : ndarray (dtype='float')
vector with data
events : ndarray (dtype='int')
N x 2+ matrix with peak/trough in second position
limit : float
low and high limi... | python | def select_peaks(data, events, limit):
"""Check whether event satisfies amplitude limit.
Parameters
----------
data : ndarray (dtype='float')
vector with data
events : ndarray (dtype='int')
N x 2+ matrix with peak/trough in second position
limit : float
low and high limi... | [
"def",
"select_peaks",
"(",
"data",
",",
"events",
",",
"limit",
")",
":",
"selected",
"=",
"abs",
"(",
"data",
"[",
"events",
"[",
":",
",",
"1",
"]",
"]",
")",
">=",
"abs",
"(",
"limit",
")",
"return",
"events",
"[",
"selected",
",",
":",
"]"
] | Check whether event satisfies amplitude limit.
Parameters
----------
data : ndarray (dtype='float')
vector with data
events : ndarray (dtype='int')
N x 2+ matrix with peak/trough in second position
limit : float
low and high limit for spindle duration
Returns
------... | [
"Check",
"whether",
"event",
"satisfies",
"amplitude",
"limit",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/slowwave.py#L190-L210 | train |
wonambi-python/wonambi | wonambi/detect/slowwave.py | make_slow_waves | def make_slow_waves(events, data, time, s_freq):
"""Create dict for each slow wave, based on events of time points.
Parameters
----------
events : ndarray (dtype='int')
N x 5 matrix with start, trough, zero, peak, end samples
data : ndarray (dtype='float')
vector with the data
t... | python | def make_slow_waves(events, data, time, s_freq):
"""Create dict for each slow wave, based on events of time points.
Parameters
----------
events : ndarray (dtype='int')
N x 5 matrix with start, trough, zero, peak, end samples
data : ndarray (dtype='float')
vector with the data
t... | [
"def",
"make_slow_waves",
"(",
"events",
",",
"data",
",",
"time",
",",
"s_freq",
")",
":",
"slow_waves",
"=",
"[",
"]",
"for",
"ev",
"in",
"events",
":",
"one_sw",
"=",
"{",
"'start'",
":",
"time",
"[",
"ev",
"[",
"0",
"]",
"]",
",",
"'trough_time... | Create dict for each slow wave, based on events of time points.
Parameters
----------
events : ndarray (dtype='int')
N x 5 matrix with start, trough, zero, peak, end samples
data : ndarray (dtype='float')
vector with the data
time : ndarray (dtype='float')
vector with time p... | [
"Create",
"dict",
"for",
"each",
"slow",
"wave",
"based",
"on",
"events",
"of",
"time",
"points",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/slowwave.py#L213-L249 | train |
wonambi-python/wonambi | wonambi/detect/slowwave.py | _add_halfwave | def _add_halfwave(data, events, s_freq, opts):
"""Find the next zero crossing and the intervening peak and add
them to events. If no zero found before max_dur, event is discarded. If
peak-to-peak is smaller than min_ptp, the event is discarded.
Parameters
----------
data : ndarray (dtype='float... | python | def _add_halfwave(data, events, s_freq, opts):
"""Find the next zero crossing and the intervening peak and add
them to events. If no zero found before max_dur, event is discarded. If
peak-to-peak is smaller than min_ptp, the event is discarded.
Parameters
----------
data : ndarray (dtype='float... | [
"def",
"_add_halfwave",
"(",
"data",
",",
"events",
",",
"s_freq",
",",
"opts",
")",
":",
"max_dur",
"=",
"opts",
".",
"duration",
"[",
"1",
"]",
"if",
"max_dur",
"is",
"None",
":",
"max_dur",
"=",
"MAXIMUM_DURATION",
"window",
"=",
"int",
"(",
"s_freq... | Find the next zero crossing and the intervening peak and add
them to events. If no zero found before max_dur, event is discarded. If
peak-to-peak is smaller than min_ptp, the event is discarded.
Parameters
----------
data : ndarray (dtype='float')
vector with the data
events : ndarray (... | [
"Find",
"the",
"next",
"zero",
"crossing",
"and",
"the",
"intervening",
"peak",
"and",
"add",
"them",
"to",
"events",
".",
"If",
"no",
"zero",
"found",
"before",
"max_dur",
"event",
"is",
"discarded",
".",
"If",
"peak",
"-",
"to",
"-",
"peak",
"is",
"s... | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/detect/slowwave.py#L252-L309 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.create | def create(self):
"""Create the widget layout with all the annotations."""
""" ------ MARKERS ------ """
tab0 = QTableWidget()
self.idx_marker = tab0
tab0.setColumnCount(3)
tab0.horizontalHeader().setStretchLastSection(True)
tab0.setSelectionBehavior(QAbstractIt... | python | def create(self):
"""Create the widget layout with all the annotations."""
""" ------ MARKERS ------ """
tab0 = QTableWidget()
self.idx_marker = tab0
tab0.setColumnCount(3)
tab0.horizontalHeader().setStretchLastSection(True)
tab0.setSelectionBehavior(QAbstractIt... | [
"def",
"create",
"(",
"self",
")",
":",
"tab0",
"=",
"QTableWidget",
"(",
")",
"self",
".",
"idx_marker",
"=",
"tab0",
"tab0",
".",
"setColumnCount",
"(",
"3",
")",
"tab0",
".",
"horizontalHeader",
"(",
")",
".",
"setStretchLastSection",
"(",
"True",
")"... | Create the widget layout with all the annotations. | [
"Create",
"the",
"widget",
"layout",
"with",
"all",
"the",
"annotations",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L202-L280 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.update_notes | def update_notes(self, xml_file, new=False):
"""Update information about the sleep scoring.
Parameters
----------
xml_file : str
file of the new or existing .xml file
new : bool
if the xml_file should be a new file or an existing one
"""
i... | python | def update_notes(self, xml_file, new=False):
"""Update information about the sleep scoring.
Parameters
----------
xml_file : str
file of the new or existing .xml file
new : bool
if the xml_file should be a new file or an existing one
"""
i... | [
"def",
"update_notes",
"(",
"self",
",",
"xml_file",
",",
"new",
"=",
"False",
")",
":",
"if",
"new",
":",
"create_empty_annotations",
"(",
"xml_file",
",",
"self",
".",
"parent",
".",
"info",
".",
"dataset",
")",
"self",
".",
"annot",
"=",
"Annotations"... | Update information about the sleep scoring.
Parameters
----------
xml_file : str
file of the new or existing .xml file
new : bool
if the xml_file should be a new file or an existing one | [
"Update",
"information",
"about",
"the",
"sleep",
"scoring",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L507-L560 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.enable_events | def enable_events(self):
"""enable slow wave and spindle detection if both
annotations and channels are active.
"""
if self.annot is not None and self.parent.channels.groups:
self.action['spindle'].setEnabled(True)
self.action['slow_wave'].setEnabled(True)
... | python | def enable_events(self):
"""enable slow wave and spindle detection if both
annotations and channels are active.
"""
if self.annot is not None and self.parent.channels.groups:
self.action['spindle'].setEnabled(True)
self.action['slow_wave'].setEnabled(True)
... | [
"def",
"enable_events",
"(",
"self",
")",
":",
"if",
"self",
".",
"annot",
"is",
"not",
"None",
"and",
"self",
".",
"parent",
".",
"channels",
".",
"groups",
":",
"self",
".",
"action",
"[",
"'spindle'",
"]",
".",
"setEnabled",
"(",
"True",
")",
"sel... | enable slow wave and spindle detection if both
annotations and channels are active. | [
"enable",
"slow",
"wave",
"and",
"spindle",
"detection",
"if",
"both",
"annotations",
"and",
"channels",
"are",
"active",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L562-L573 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.display_notes | def display_notes(self):
"""Display information about scores and raters.
"""
if self.annot is not None:
short_xml_file = short_strings(basename(self.annot.xml_file))
self.idx_annotations.setText(short_xml_file)
# if annotations were loaded without dataset
... | python | def display_notes(self):
"""Display information about scores and raters.
"""
if self.annot is not None:
short_xml_file = short_strings(basename(self.annot.xml_file))
self.idx_annotations.setText(short_xml_file)
# if annotations were loaded without dataset
... | [
"def",
"display_notes",
"(",
"self",
")",
":",
"if",
"self",
".",
"annot",
"is",
"not",
"None",
":",
"short_xml_file",
"=",
"short_strings",
"(",
"basename",
"(",
"self",
".",
"annot",
".",
"xml_file",
")",
")",
"self",
".",
"idx_annotations",
".",
"setT... | Display information about scores and raters. | [
"Display",
"information",
"about",
"scores",
"and",
"raters",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L575-L592 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.display_stats | def display_stats(self):
"""Display summary statistics about duration in each stage."""
for i, one_stage in enumerate(STAGE_NAME):
second_in_stage = self.annot.time_in_stage(one_stage)
time_in_stage = str(timedelta(seconds=second_in_stage))
label = self.idx_stage_sta... | python | def display_stats(self):
"""Display summary statistics about duration in each stage."""
for i, one_stage in enumerate(STAGE_NAME):
second_in_stage = self.annot.time_in_stage(one_stage)
time_in_stage = str(timedelta(seconds=second_in_stage))
label = self.idx_stage_sta... | [
"def",
"display_stats",
"(",
"self",
")",
":",
"for",
"i",
",",
"one_stage",
"in",
"enumerate",
"(",
"STAGE_NAME",
")",
":",
"second_in_stage",
"=",
"self",
".",
"annot",
".",
"time_in_stage",
"(",
"one_stage",
")",
"time_in_stage",
"=",
"str",
"(",
"timed... | Display summary statistics about duration in each stage. | [
"Display",
"summary",
"statistics",
"about",
"duration",
"in",
"each",
"stage",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L594-L610 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.add_bookmark | def add_bookmark(self, time):
"""Run this function when user adds a new bookmark.
Parameters
----------
time : tuple of float
start and end of the new bookmark, in s
"""
if self.annot is None: # remove if buttons are disabled
msg = 'No score file... | python | def add_bookmark(self, time):
"""Run this function when user adds a new bookmark.
Parameters
----------
time : tuple of float
start and end of the new bookmark, in s
"""
if self.annot is None: # remove if buttons are disabled
msg = 'No score file... | [
"def",
"add_bookmark",
"(",
"self",
",",
"time",
")",
":",
"if",
"self",
".",
"annot",
"is",
"None",
":",
"msg",
"=",
"'No score file loaded'",
"lg",
".",
"debug",
"(",
"msg",
")",
"error_dialog",
"=",
"QErrorMessage",
"(",
")",
"error_dialog",
".",
"set... | Run this function when user adds a new bookmark.
Parameters
----------
time : tuple of float
start and end of the new bookmark, in s | [
"Run",
"this",
"function",
"when",
"user",
"adds",
"a",
"new",
"bookmark",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L612-L636 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.remove_bookmark | def remove_bookmark(self, time):
"""User removes bookmark.
Parameters
----------
time : tuple of float
start and end of the new bookmark, in s
"""
self.annot.remove_bookmark(time=time)
self.update_annotations() | python | def remove_bookmark(self, time):
"""User removes bookmark.
Parameters
----------
time : tuple of float
start and end of the new bookmark, in s
"""
self.annot.remove_bookmark(time=time)
self.update_annotations() | [
"def",
"remove_bookmark",
"(",
"self",
",",
"time",
")",
":",
"self",
".",
"annot",
".",
"remove_bookmark",
"(",
"time",
"=",
"time",
")",
"self",
".",
"update_annotations",
"(",
")"
] | User removes bookmark.
Parameters
----------
time : tuple of float
start and end of the new bookmark, in s | [
"User",
"removes",
"bookmark",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L638-L647 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.update_dataset_marker | def update_dataset_marker(self):
"""Update markers which are in the dataset. It always updates the list
of events. Depending on the settings, it might add the markers to
overview and traces.
"""
start_time = self.parent.overview.start_time
markers = []
if self.pa... | python | def update_dataset_marker(self):
"""Update markers which are in the dataset. It always updates the list
of events. Depending on the settings, it might add the markers to
overview and traces.
"""
start_time = self.parent.overview.start_time
markers = []
if self.pa... | [
"def",
"update_dataset_marker",
"(",
"self",
")",
":",
"start_time",
"=",
"self",
".",
"parent",
".",
"overview",
".",
"start_time",
"markers",
"=",
"[",
"]",
"if",
"self",
".",
"parent",
".",
"info",
".",
"markers",
"is",
"not",
"None",
":",
"markers",
... | Update markers which are in the dataset. It always updates the list
of events. Depending on the settings, it might add the markers to
overview and traces. | [
"Update",
"markers",
"which",
"are",
"in",
"the",
"dataset",
".",
"It",
"always",
"updates",
"the",
"list",
"of",
"events",
".",
"Depending",
"on",
"the",
"settings",
"it",
"might",
"add",
"the",
"markers",
"to",
"overview",
"and",
"traces",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L649-L691 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.display_eventtype | def display_eventtype(self):
"""Read the list of event types in the annotations and update widgets.
"""
if self.annot is not None:
event_types = sorted(self.annot.event_types, key=str.lower)
else:
event_types = []
self.idx_eventtype.clear()
evtty... | python | def display_eventtype(self):
"""Read the list of event types in the annotations and update widgets.
"""
if self.annot is not None:
event_types = sorted(self.annot.event_types, key=str.lower)
else:
event_types = []
self.idx_eventtype.clear()
evtty... | [
"def",
"display_eventtype",
"(",
"self",
")",
":",
"if",
"self",
".",
"annot",
"is",
"not",
"None",
":",
"event_types",
"=",
"sorted",
"(",
"self",
".",
"annot",
".",
"event_types",
",",
"key",
"=",
"str",
".",
"lower",
")",
"else",
":",
"event_types",... | Read the list of event types in the annotations and update widgets. | [
"Read",
"the",
"list",
"of",
"event",
"types",
"in",
"the",
"annotations",
"and",
"update",
"widgets",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L693-L722 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.toggle_eventtype | def toggle_eventtype(self):
"""Check or uncheck all event types in event type scroll."""
check = self.check_all_eventtype.isChecked()
for btn in self.idx_eventtype_list:
btn.setChecked(check) | python | def toggle_eventtype(self):
"""Check or uncheck all event types in event type scroll."""
check = self.check_all_eventtype.isChecked()
for btn in self.idx_eventtype_list:
btn.setChecked(check) | [
"def",
"toggle_eventtype",
"(",
"self",
")",
":",
"check",
"=",
"self",
".",
"check_all_eventtype",
".",
"isChecked",
"(",
")",
"for",
"btn",
"in",
"self",
".",
"idx_eventtype_list",
":",
"btn",
".",
"setChecked",
"(",
"check",
")"
] | Check or uncheck all event types in event type scroll. | [
"Check",
"or",
"uncheck",
"all",
"event",
"types",
"in",
"event",
"type",
"scroll",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L724-L729 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.toggle_check_all_eventtype | def toggle_check_all_eventtype(self):
"""Check 'All' if all event types are checked in event type scroll."""
checklist = asarray([btn.isChecked for btn in self.idx_eventtype_list])
if not checklist.all():
self.check_all_eventtype.setChecked(False) | python | def toggle_check_all_eventtype(self):
"""Check 'All' if all event types are checked in event type scroll."""
checklist = asarray([btn.isChecked for btn in self.idx_eventtype_list])
if not checklist.all():
self.check_all_eventtype.setChecked(False) | [
"def",
"toggle_check_all_eventtype",
"(",
"self",
")",
":",
"checklist",
"=",
"asarray",
"(",
"[",
"btn",
".",
"isChecked",
"for",
"btn",
"in",
"self",
".",
"idx_eventtype_list",
"]",
")",
"if",
"not",
"checklist",
".",
"all",
"(",
")",
":",
"self",
".",... | Check 'All' if all event types are checked in event type scroll. | [
"Check",
"All",
"if",
"all",
"event",
"types",
"are",
"checked",
"in",
"event",
"type",
"scroll",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L731-L736 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.get_selected_events | def get_selected_events(self, time_selection=None):
"""Returns which events are present in one time window.
Parameters
----------
time_selection : tuple of float
start and end of the window of interest
Returns
-------
list of dict
list of... | python | def get_selected_events(self, time_selection=None):
"""Returns which events are present in one time window.
Parameters
----------
time_selection : tuple of float
start and end of the window of interest
Returns
-------
list of dict
list of... | [
"def",
"get_selected_events",
"(",
"self",
",",
"time_selection",
"=",
"None",
")",
":",
"events",
"=",
"[",
"]",
"for",
"checkbox",
"in",
"self",
".",
"idx_eventtype_list",
":",
"if",
"checkbox",
".",
"checkState",
"(",
")",
"==",
"Qt",
".",
"Checked",
... | Returns which events are present in one time window.
Parameters
----------
time_selection : tuple of float
start and end of the window of interest
Returns
-------
list of dict
list of events in the window of interest | [
"Returns",
"which",
"events",
"are",
"present",
"in",
"one",
"time",
"window",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L738-L757 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.update_annotations | def update_annotations(self):
"""Update annotations made by the user, including bookmarks and events.
Depending on the settings, it might add the bookmarks to overview and
traces.
"""
start_time = self.parent.overview.start_time
if self.parent.notes.annot is None:
... | python | def update_annotations(self):
"""Update annotations made by the user, including bookmarks and events.
Depending on the settings, it might add the bookmarks to overview and
traces.
"""
start_time = self.parent.overview.start_time
if self.parent.notes.annot is None:
... | [
"def",
"update_annotations",
"(",
"self",
")",
":",
"start_time",
"=",
"self",
".",
"parent",
".",
"overview",
".",
"start_time",
"if",
"self",
".",
"parent",
".",
"notes",
".",
"annot",
"is",
"None",
":",
"all_annot",
"=",
"[",
"]",
"else",
":",
"book... | Update annotations made by the user, including bookmarks and events.
Depending on the settings, it might add the bookmarks to overview and
traces. | [
"Update",
"annotations",
"made",
"by",
"the",
"user",
"including",
"bookmarks",
"and",
"events",
".",
"Depending",
"on",
"the",
"settings",
"it",
"might",
"add",
"the",
"bookmarks",
"to",
"overview",
"and",
"traces",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L759-L821 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.delete_row | def delete_row(self):
"""Delete bookmarks or event from annotations, based on row."""
sel_model = self.idx_annot_list.selectionModel()
for row in sel_model.selectedRows():
i = row.row()
start = self.idx_annot_list.property('start')[i]
end = self.idx_annot_list... | python | def delete_row(self):
"""Delete bookmarks or event from annotations, based on row."""
sel_model = self.idx_annot_list.selectionModel()
for row in sel_model.selectedRows():
i = row.row()
start = self.idx_annot_list.property('start')[i]
end = self.idx_annot_list... | [
"def",
"delete_row",
"(",
"self",
")",
":",
"sel_model",
"=",
"self",
".",
"idx_annot_list",
".",
"selectionModel",
"(",
")",
"for",
"row",
"in",
"sel_model",
".",
"selectedRows",
"(",
")",
":",
"i",
"=",
"row",
".",
"row",
"(",
")",
"start",
"=",
"s... | Delete bookmarks or event from annotations, based on row. | [
"Delete",
"bookmarks",
"or",
"event",
"from",
"annotations",
"based",
"on",
"row",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L823-L842 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.go_to_marker | def go_to_marker(self, row, col, table_type):
"""Move to point in time marked by the marker.
Parameters
----------
row : QtCore.int
column : QtCore.int
table_type : str
'dataset' table or 'annot' table, it works on either
"""
if table_type =... | python | def go_to_marker(self, row, col, table_type):
"""Move to point in time marked by the marker.
Parameters
----------
row : QtCore.int
column : QtCore.int
table_type : str
'dataset' table or 'annot' table, it works on either
"""
if table_type =... | [
"def",
"go_to_marker",
"(",
"self",
",",
"row",
",",
"col",
",",
"table_type",
")",
":",
"if",
"table_type",
"==",
"'dataset'",
":",
"marker_time",
"=",
"self",
".",
"idx_marker",
".",
"property",
"(",
"'start'",
")",
"[",
"row",
"]",
"marker_end_time",
... | Move to point in time marked by the marker.
Parameters
----------
row : QtCore.int
column : QtCore.int
table_type : str
'dataset' table or 'annot' table, it works on either | [
"Move",
"to",
"point",
"in",
"time",
"marked",
"by",
"the",
"marker",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L844-L876 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.get_sleepstage | def get_sleepstage(self, stage_idx=None):
"""Score the sleep stage, using shortcuts or combobox."""
if self.annot is None: # remove if buttons are disabled
error_dialog = QErrorMessage()
error_dialog.setWindowTitle('Error getting sleep stage')
error_dialog.showMessag... | python | def get_sleepstage(self, stage_idx=None):
"""Score the sleep stage, using shortcuts or combobox."""
if self.annot is None: # remove if buttons are disabled
error_dialog = QErrorMessage()
error_dialog.setWindowTitle('Error getting sleep stage')
error_dialog.showMessag... | [
"def",
"get_sleepstage",
"(",
"self",
",",
"stage_idx",
"=",
"None",
")",
":",
"if",
"self",
".",
"annot",
"is",
"None",
":",
"error_dialog",
"=",
"QErrorMessage",
"(",
")",
"error_dialog",
".",
"setWindowTitle",
"(",
"'Error getting sleep stage'",
")",
"error... | Score the sleep stage, using shortcuts or combobox. | [
"Score",
"the",
"sleep",
"stage",
"using",
"shortcuts",
"or",
"combobox",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L910-L955 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.get_quality | def get_quality(self, qual_idx=None):
"""Get the signal qualifier, using shortcuts or combobox."""
if self.annot is None: # remove if buttons are disabled
msg = 'No score file loaded'
error_dialog = QErrorMessage()
error_dialog.setWindowTitle('Error getting quality')... | python | def get_quality(self, qual_idx=None):
"""Get the signal qualifier, using shortcuts or combobox."""
if self.annot is None: # remove if buttons are disabled
msg = 'No score file loaded'
error_dialog = QErrorMessage()
error_dialog.setWindowTitle('Error getting quality')... | [
"def",
"get_quality",
"(",
"self",
",",
"qual_idx",
"=",
"None",
")",
":",
"if",
"self",
".",
"annot",
"is",
"None",
":",
"msg",
"=",
"'No score file loaded'",
"error_dialog",
"=",
"QErrorMessage",
"(",
")",
"error_dialog",
".",
"setWindowTitle",
"(",
"'Erro... | Get the signal qualifier, using shortcuts or combobox. | [
"Get",
"the",
"signal",
"qualifier",
"using",
"shortcuts",
"or",
"combobox",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L957-L993 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.get_cycle_mrkr | def get_cycle_mrkr(self, end=False):
"""Mark cycle start or end.
Parameters
----------
end : bool
If True, marks a cycle end; otherwise, it's a cycle start
"""
if self.annot is None: # remove if buttons are disabled
self.parent.statusBar().showMe... | python | def get_cycle_mrkr(self, end=False):
"""Mark cycle start or end.
Parameters
----------
end : bool
If True, marks a cycle end; otherwise, it's a cycle start
"""
if self.annot is None: # remove if buttons are disabled
self.parent.statusBar().showMe... | [
"def",
"get_cycle_mrkr",
"(",
"self",
",",
"end",
"=",
"False",
")",
":",
"if",
"self",
".",
"annot",
"is",
"None",
":",
"self",
".",
"parent",
".",
"statusBar",
"(",
")",
".",
"showMessage",
"(",
"'No score file loaded'",
")",
"return",
"window_start",
... | Mark cycle start or end.
Parameters
----------
end : bool
If True, marks a cycle end; otherwise, it's a cycle start | [
"Mark",
"cycle",
"start",
"or",
"end",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L995-L1027 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.remove_cycle_mrkr | def remove_cycle_mrkr(self):
"""Remove cycle marker."""
window_start = self.parent.value('window_start')
try:
self.annot.remove_cycle_mrkr(window_start)
except KeyError:
msg = ('The start of the window does not correspond to any cycle '
'marke... | python | def remove_cycle_mrkr(self):
"""Remove cycle marker."""
window_start = self.parent.value('window_start')
try:
self.annot.remove_cycle_mrkr(window_start)
except KeyError:
msg = ('The start of the window does not correspond to any cycle '
'marke... | [
"def",
"remove_cycle_mrkr",
"(",
"self",
")",
":",
"window_start",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'window_start'",
")",
"try",
":",
"self",
".",
"annot",
".",
"remove_cycle_mrkr",
"(",
"window_start",
")",
"except",
"KeyError",
":",
"msg",
... | Remove cycle marker. | [
"Remove",
"cycle",
"marker",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L1029-L1046 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.clear_cycle_mrkrs | def clear_cycle_mrkrs(self, test=False):
"""Remove all cycle markers."""
if not test:
msgBox = QMessageBox(QMessageBox.Question, 'Clear Cycle Markers',
'Are you sure you want to remove all cycle '
'markers for this rater?')
... | python | def clear_cycle_mrkrs(self, test=False):
"""Remove all cycle markers."""
if not test:
msgBox = QMessageBox(QMessageBox.Question, 'Clear Cycle Markers',
'Are you sure you want to remove all cycle '
'markers for this rater?')
... | [
"def",
"clear_cycle_mrkrs",
"(",
"self",
",",
"test",
"=",
"False",
")",
":",
"if",
"not",
"test",
":",
"msgBox",
"=",
"QMessageBox",
"(",
"QMessageBox",
".",
"Question",
",",
"'Clear Cycle Markers'",
",",
"'Are you sure you want to remove all cycle '",
"'markers fo... | Remove all cycle markers. | [
"Remove",
"all",
"cycle",
"markers",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L1048-L1064 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.set_stage_index | def set_stage_index(self):
"""Set the current stage in combobox."""
window_start = self.parent.value('window_start')
window_length = self.parent.value('window_length')
stage = self.annot.get_stage_for_epoch(window_start, window_length)
#lg.info('winstart: ' + str(window_start) + ... | python | def set_stage_index(self):
"""Set the current stage in combobox."""
window_start = self.parent.value('window_start')
window_length = self.parent.value('window_length')
stage = self.annot.get_stage_for_epoch(window_start, window_length)
#lg.info('winstart: ' + str(window_start) + ... | [
"def",
"set_stage_index",
"(",
"self",
")",
":",
"window_start",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'window_start'",
")",
"window_length",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
")",
"stage",
"=",
"self",
".",
"annot... | Set the current stage in combobox. | [
"Set",
"the",
"current",
"stage",
"in",
"combobox",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L1066-L1076 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.set_quality_index | def set_quality_index(self):
"""Set the current signal quality in combobox."""
window_start = self.parent.value('window_start')
window_length = self.parent.value('window_length')
qual = self.annot.get_stage_for_epoch(window_start, window_length,
... | python | def set_quality_index(self):
"""Set the current signal quality in combobox."""
window_start = self.parent.value('window_start')
window_length = self.parent.value('window_length')
qual = self.annot.get_stage_for_epoch(window_start, window_length,
... | [
"def",
"set_quality_index",
"(",
"self",
")",
":",
"window_start",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'window_start'",
")",
"window_length",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
")",
"qual",
"=",
"self",
".",
"anno... | Set the current signal quality in combobox. | [
"Set",
"the",
"current",
"signal",
"quality",
"in",
"combobox",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L1078-L1089 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.markers_to_events | def markers_to_events(self, keep_name=False):
"""Copy all markers in dataset to event type. """
markers = self.parent.info.markers
if markers is None:
self.parent.statusBar.showMessage('No markers in dataset.')
return
if not keep_name:
... | python | def markers_to_events(self, keep_name=False):
"""Copy all markers in dataset to event type. """
markers = self.parent.info.markers
if markers is None:
self.parent.statusBar.showMessage('No markers in dataset.')
return
if not keep_name:
... | [
"def",
"markers_to_events",
"(",
"self",
",",
"keep_name",
"=",
"False",
")",
":",
"markers",
"=",
"self",
".",
"parent",
".",
"info",
".",
"markers",
"if",
"markers",
"is",
"None",
":",
"self",
".",
"parent",
".",
"statusBar",
".",
"showMessage",
"(",
... | Copy all markers in dataset to event type. | [
"Copy",
"all",
"markers",
"in",
"dataset",
"to",
"event",
"type",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L1433-L1455 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | Notes.reset | def reset(self):
"""Remove all annotations from window."""
self.idx_annotations.setText('Load Annotation File...')
self.idx_rater.setText('')
self.annot = None
self.dataset_markers = None
# remove dataset marker
self.idx_marker.clearContents()
self.idx_m... | python | def reset(self):
"""Remove all annotations from window."""
self.idx_annotations.setText('Load Annotation File...')
self.idx_rater.setText('')
self.annot = None
self.dataset_markers = None
# remove dataset marker
self.idx_marker.clearContents()
self.idx_m... | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"idx_annotations",
".",
"setText",
"(",
"'Load Annotation File...'",
")",
"self",
".",
"idx_rater",
".",
"setText",
"(",
"''",
")",
"self",
".",
"annot",
"=",
"None",
"self",
".",
"dataset_markers",
"=",
... | Remove all annotations from window. | [
"Remove",
"all",
"annotations",
"from",
"window",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L1652-L1680 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | MergeDialog.update_event_types | def update_event_types(self):
"""Update event types in event type box."""
self.idx_evt_type.clear()
self.idx_evt_type.setSelectionMode(QAbstractItemView.ExtendedSelection)
event_types = sorted(self.parent.notes.annot.event_types,
key=str.lower)
for t... | python | def update_event_types(self):
"""Update event types in event type box."""
self.idx_evt_type.clear()
self.idx_evt_type.setSelectionMode(QAbstractItemView.ExtendedSelection)
event_types = sorted(self.parent.notes.annot.event_types,
key=str.lower)
for t... | [
"def",
"update_event_types",
"(",
"self",
")",
":",
"self",
".",
"idx_evt_type",
".",
"clear",
"(",
")",
"self",
".",
"idx_evt_type",
".",
"setSelectionMode",
"(",
"QAbstractItemView",
".",
"ExtendedSelection",
")",
"event_types",
"=",
"sorted",
"(",
"self",
"... | Update event types in event type box. | [
"Update",
"event",
"types",
"in",
"event",
"type",
"box",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L1838-L1847 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | ExportEventsDialog.update | def update(self):
"""Update the event types list, info, when dialog is opened."""
self.filename = self.parent.notes.annot.xml_file
self.event_types = self.parent.notes.annot.event_types
self.idx_evt_type.clear()
for ev in self.event_types:
self.idx_evt_type.a... | python | def update(self):
"""Update the event types list, info, when dialog is opened."""
self.filename = self.parent.notes.annot.xml_file
self.event_types = self.parent.notes.annot.event_types
self.idx_evt_type.clear()
for ev in self.event_types:
self.idx_evt_type.a... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"filename",
"=",
"self",
".",
"parent",
".",
"notes",
".",
"annot",
".",
"xml_file",
"self",
".",
"event_types",
"=",
"self",
".",
"parent",
".",
"notes",
".",
"annot",
".",
"event_types",
"self",
... | Update the event types list, info, when dialog is opened. | [
"Update",
"the",
"event",
"types",
"list",
"info",
"when",
"dialog",
"is",
"opened",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L1976-L1983 | train |
wonambi-python/wonambi | wonambi/widgets/notes.py | ExportEventsDialog.save_as | def save_as(self):
"""Dialog for getting name, location of dataset export."""
filename = splitext(self.filename)[0]
filename, _ = QFileDialog.getSaveFileName(self, 'Export events',
filename)
if filename == '':
return
... | python | def save_as(self):
"""Dialog for getting name, location of dataset export."""
filename = splitext(self.filename)[0]
filename, _ = QFileDialog.getSaveFileName(self, 'Export events',
filename)
if filename == '':
return
... | [
"def",
"save_as",
"(",
"self",
")",
":",
"filename",
"=",
"splitext",
"(",
"self",
".",
"filename",
")",
"[",
"0",
"]",
"filename",
",",
"_",
"=",
"QFileDialog",
".",
"getSaveFileName",
"(",
"self",
",",
"'Export events'",
",",
"filename",
")",
"if",
"... | Dialog for getting name, location of dataset export. | [
"Dialog",
"for",
"getting",
"name",
"location",
"of",
"dataset",
"export",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L1990-L2000 | train |
wonambi-python/wonambi | wonambi/attr/chan.py | _convert_unit | def _convert_unit(unit):
"""Convert different names into SI units.
Parameters
----------
unit : str
unit to convert to SI
Returns
-------
str
unit in SI format.
Notes
-----
SI unit such as mV (milliVolt, mVolt), μV (microVolt, muV).
"""
if unit is None... | python | def _convert_unit(unit):
"""Convert different names into SI units.
Parameters
----------
unit : str
unit to convert to SI
Returns
-------
str
unit in SI format.
Notes
-----
SI unit such as mV (milliVolt, mVolt), μV (microVolt, muV).
"""
if unit is None... | [
"def",
"_convert_unit",
"(",
"unit",
")",
":",
"if",
"unit",
"is",
"None",
":",
"return",
"''",
"prefix",
"=",
"None",
"suffix",
"=",
"None",
"if",
"unit",
"[",
":",
"5",
"]",
".",
"lower",
"(",
")",
"==",
"'milli'",
":",
"prefix",
"=",
"'m'",
"u... | Convert different names into SI units.
Parameters
----------
unit : str
unit to convert to SI
Returns
-------
str
unit in SI format.
Notes
-----
SI unit such as mV (milliVolt, mVolt), μV (microVolt, muV). | [
"Convert",
"different",
"names",
"into",
"SI",
"units",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/chan.py#L32-L78 | train |
wonambi-python/wonambi | wonambi/attr/chan.py | detect_format | def detect_format(filename):
"""Detect file format of the channels based on extension.
Parameters
----------
filename : Path
name of the filename
Returns
-------
str
file format
"""
filename = Path(filename)
if filename.suffix == '.csv':
recformat = 'cs... | python | def detect_format(filename):
"""Detect file format of the channels based on extension.
Parameters
----------
filename : Path
name of the filename
Returns
-------
str
file format
"""
filename = Path(filename)
if filename.suffix == '.csv':
recformat = 'cs... | [
"def",
"detect_format",
"(",
"filename",
")",
":",
"filename",
"=",
"Path",
"(",
"filename",
")",
"if",
"filename",
".",
"suffix",
"==",
"'.csv'",
":",
"recformat",
"=",
"'csv'",
"elif",
"filename",
".",
"suffix",
"==",
"'.sfp'",
":",
"recformat",
"=",
"... | Detect file format of the channels based on extension.
Parameters
----------
filename : Path
name of the filename
Returns
-------
str
file format | [
"Detect",
"file",
"format",
"of",
"the",
"channels",
"based",
"on",
"extension",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/chan.py#L105-L128 | train |
wonambi-python/wonambi | wonambi/attr/chan.py | assign_region_to_channels | def assign_region_to_channels(channels, anat, parc_type='aparc', max_approx=3,
exclude_regions=None):
"""Assign a brain region based on the channel location.
Parameters
----------
channels : instance of wonambi.attr.chan.Channels
channels to assign regions to
a... | python | def assign_region_to_channels(channels, anat, parc_type='aparc', max_approx=3,
exclude_regions=None):
"""Assign a brain region based on the channel location.
Parameters
----------
channels : instance of wonambi.attr.chan.Channels
channels to assign regions to
a... | [
"def",
"assign_region_to_channels",
"(",
"channels",
",",
"anat",
",",
"parc_type",
"=",
"'aparc'",
",",
"max_approx",
"=",
"3",
",",
"exclude_regions",
"=",
"None",
")",
":",
"for",
"one_chan",
"in",
"channels",
".",
"chan",
":",
"one_region",
",",
"approx"... | Assign a brain region based on the channel location.
Parameters
----------
channels : instance of wonambi.attr.chan.Channels
channels to assign regions to
anat : instance of wonambi.attr.anat.Freesurfer
anatomical information taken from freesurfer.
parc_type : str
'aparc', '... | [
"Assign",
"a",
"brain",
"region",
"based",
"on",
"the",
"channel",
"location",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/chan.py#L362-L395 | train |
wonambi-python/wonambi | wonambi/attr/chan.py | find_chan_in_region | def find_chan_in_region(channels, anat, region_name):
"""Find which channels are in a specific region.
Parameters
----------
channels : instance of wonambi.attr.chan.Channels
channels, that have locations
anat : instance of wonambi.attr.anat.Freesurfer
anatomical information taken f... | python | def find_chan_in_region(channels, anat, region_name):
"""Find which channels are in a specific region.
Parameters
----------
channels : instance of wonambi.attr.chan.Channels
channels, that have locations
anat : instance of wonambi.attr.anat.Freesurfer
anatomical information taken f... | [
"def",
"find_chan_in_region",
"(",
"channels",
",",
"anat",
",",
"region_name",
")",
":",
"if",
"'region'",
"not",
"in",
"channels",
".",
"chan",
"[",
"0",
"]",
".",
"attr",
".",
"keys",
"(",
")",
":",
"lg",
".",
"info",
"(",
"'Computing region for each ... | Find which channels are in a specific region.
Parameters
----------
channels : instance of wonambi.attr.chan.Channels
channels, that have locations
anat : instance of wonambi.attr.anat.Freesurfer
anatomical information taken from freesurfer.
region_name : str
the name of the... | [
"Find",
"which",
"channels",
"are",
"in",
"a",
"specific",
"region",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/chan.py#L398-L424 | train |
wonambi-python/wonambi | wonambi/attr/chan.py | create_sphere_around_elec | def create_sphere_around_elec(xyz, template_mri, distance=8, freesurfer=None):
"""Create an MRI mask around an electrode location,
Parameters
----------
xyz : ndarray
3x0 array
template_mri : path or str (as path) or nibabel.Nifti
(path to) MRI to be used as template
distance : ... | python | def create_sphere_around_elec(xyz, template_mri, distance=8, freesurfer=None):
"""Create an MRI mask around an electrode location,
Parameters
----------
xyz : ndarray
3x0 array
template_mri : path or str (as path) or nibabel.Nifti
(path to) MRI to be used as template
distance : ... | [
"def",
"create_sphere_around_elec",
"(",
"xyz",
",",
"template_mri",
",",
"distance",
"=",
"8",
",",
"freesurfer",
"=",
"None",
")",
":",
"if",
"freesurfer",
"is",
"None",
":",
"shift",
"=",
"0",
"else",
":",
"shift",
"=",
"freesurfer",
".",
"surface_ras_s... | Create an MRI mask around an electrode location,
Parameters
----------
xyz : ndarray
3x0 array
template_mri : path or str (as path) or nibabel.Nifti
(path to) MRI to be used as template
distance : float
distance in mm between electrode and selected voxels
freesurfer : in... | [
"Create",
"an",
"MRI",
"mask",
"around",
"an",
"electrode",
"location"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/chan.py#L453-L495 | train |
wonambi-python/wonambi | wonambi/attr/chan.py | Channels.return_attr | def return_attr(self, attr, labels=None):
"""return the attributes for each channels.
Parameters
----------
attr : str
attribute specified in Chan.attr.keys()
"""
all_labels = self.return_label()
if labels is None:
labels = all_labels
... | python | def return_attr(self, attr, labels=None):
"""return the attributes for each channels.
Parameters
----------
attr : str
attribute specified in Chan.attr.keys()
"""
all_labels = self.return_label()
if labels is None:
labels = all_labels
... | [
"def",
"return_attr",
"(",
"self",
",",
"attr",
",",
"labels",
"=",
"None",
")",
":",
"all_labels",
"=",
"self",
".",
"return_label",
"(",
")",
"if",
"labels",
"is",
"None",
":",
"labels",
"=",
"all_labels",
"all_attr",
"=",
"[",
"]",
"for",
"one_label... | return the attributes for each channels.
Parameters
----------
attr : str
attribute specified in Chan.attr.keys() | [
"return",
"the",
"attributes",
"for",
"each",
"channels",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/chan.py#L308-L333 | train |
wonambi-python/wonambi | wonambi/attr/chan.py | Channels.export | def export(self, elec_file):
"""Export channel name and location to file.
Parameters
----------
elec_file : Path or str
path to file where to save csv
"""
elec_file = Path(elec_file)
if elec_file.suffix == '.csv':
sep = ', '
elif e... | python | def export(self, elec_file):
"""Export channel name and location to file.
Parameters
----------
elec_file : Path or str
path to file where to save csv
"""
elec_file = Path(elec_file)
if elec_file.suffix == '.csv':
sep = ', '
elif e... | [
"def",
"export",
"(",
"self",
",",
"elec_file",
")",
":",
"elec_file",
"=",
"Path",
"(",
"elec_file",
")",
"if",
"elec_file",
".",
"suffix",
"==",
"'.csv'",
":",
"sep",
"=",
"', '",
"elif",
"elec_file",
".",
"suffix",
"==",
"'.sfp'",
":",
"sep",
"=",
... | Export channel name and location to file.
Parameters
----------
elec_file : Path or str
path to file where to save csv | [
"Export",
"channel",
"name",
"and",
"location",
"to",
"file",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/chan.py#L340-L359 | train |
wonambi-python/wonambi | wonambi/trans/filter.py | filter_ | def filter_(data, axis='time', low_cut=None, high_cut=None, order=4,
ftype='butter', Rs=None, notchfreq=50, notchquality=25):
"""Design filter and apply it.
Parameters
----------
ftype : str
'butter', 'cheby1', 'cheby2', 'ellip', 'bessel', 'diff', or 'notch'
axis : str, optional... | python | def filter_(data, axis='time', low_cut=None, high_cut=None, order=4,
ftype='butter', Rs=None, notchfreq=50, notchquality=25):
"""Design filter and apply it.
Parameters
----------
ftype : str
'butter', 'cheby1', 'cheby2', 'ellip', 'bessel', 'diff', or 'notch'
axis : str, optional... | [
"def",
"filter_",
"(",
"data",
",",
"axis",
"=",
"'time'",
",",
"low_cut",
"=",
"None",
",",
"high_cut",
"=",
"None",
",",
"order",
"=",
"4",
",",
"ftype",
"=",
"'butter'",
",",
"Rs",
"=",
"None",
",",
"notchfreq",
"=",
"50",
",",
"notchquality",
"... | Design filter and apply it.
Parameters
----------
ftype : str
'butter', 'cheby1', 'cheby2', 'ellip', 'bessel', 'diff', or 'notch'
axis : str, optional
axis to apply the filter on.
low_cut : float, optional
(not for notch) low cutoff for high-pass filter
high_cut : float,... | [
"Design",
"filter",
"and",
"apply",
"it",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/filter.py#L18-L108 | train |
wonambi-python/wonambi | wonambi/trans/filter.py | convolve | def convolve(data, window, axis='time', length=1):
"""Design taper and convolve it with the signal.
Parameters
----------
data : instance of Data
the data to filter.
window : str
one of the windows in scipy, using get_window
length : float, optional
length of the window
... | python | def convolve(data, window, axis='time', length=1):
"""Design taper and convolve it with the signal.
Parameters
----------
data : instance of Data
the data to filter.
window : str
one of the windows in scipy, using get_window
length : float, optional
length of the window
... | [
"def",
"convolve",
"(",
"data",
",",
"window",
",",
"axis",
"=",
"'time'",
",",
"length",
"=",
"1",
")",
":",
"taper",
"=",
"get_window",
"(",
"window",
",",
"int",
"(",
"length",
"*",
"data",
".",
"s_freq",
")",
")",
"taper",
"=",
"taper",
"/",
... | Design taper and convolve it with the signal.
Parameters
----------
data : instance of Data
the data to filter.
window : str
one of the windows in scipy, using get_window
length : float, optional
length of the window
axis : str, optional
axis to apply the filter ... | [
"Design",
"taper",
"and",
"convolve",
"it",
"with",
"the",
"signal",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/filter.py#L111-L176 | train |
wonambi-python/wonambi | wonambi/viz/base.py | normalize | def normalize(x, min_value, max_value):
"""Normalize value between min and max values.
It also clips the values, so that you cannot have values higher or lower
than 0 - 1."""
x = (x - min_value) / (max_value - min_value)
return clip(x, 0, 1) | python | def normalize(x, min_value, max_value):
"""Normalize value between min and max values.
It also clips the values, so that you cannot have values higher or lower
than 0 - 1."""
x = (x - min_value) / (max_value - min_value)
return clip(x, 0, 1) | [
"def",
"normalize",
"(",
"x",
",",
"min_value",
",",
"max_value",
")",
":",
"x",
"=",
"(",
"x",
"-",
"min_value",
")",
"/",
"(",
"max_value",
"-",
"min_value",
")",
"return",
"clip",
"(",
"x",
",",
"0",
",",
"1",
")"
] | Normalize value between min and max values.
It also clips the values, so that you cannot have values higher or lower
than 0 - 1. | [
"Normalize",
"value",
"between",
"min",
"and",
"max",
"values",
".",
"It",
"also",
"clips",
"the",
"values",
"so",
"that",
"you",
"cannot",
"have",
"values",
"higher",
"or",
"lower",
"than",
"0",
"-",
"1",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/viz/base.py#L55-L60 | train |
wonambi-python/wonambi | wonambi/viz/base.py | Viz._repr_png_ | def _repr_png_(self):
"""This is used by ipython to plot inline.
"""
app.process_events()
QApplication.processEvents()
img = read_pixels()
return bytes(_make_png(img)) | python | def _repr_png_(self):
"""This is used by ipython to plot inline.
"""
app.process_events()
QApplication.processEvents()
img = read_pixels()
return bytes(_make_png(img)) | [
"def",
"_repr_png_",
"(",
"self",
")",
":",
"app",
".",
"process_events",
"(",
")",
"QApplication",
".",
"processEvents",
"(",
")",
"img",
"=",
"read_pixels",
"(",
")",
"return",
"bytes",
"(",
"_make_png",
"(",
"img",
")",
")"
] | This is used by ipython to plot inline. | [
"This",
"is",
"used",
"by",
"ipython",
"to",
"plot",
"inline",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/viz/base.py#L30-L37 | train |
wonambi-python/wonambi | wonambi/viz/base.py | Viz.save | def save(self, png_file):
"""Save png to disk.
Parameters
----------
png_file : path to file
file to write to
Notes
-----
It relies on _repr_png_, so fix issues there.
"""
with open(png_file, 'wb') as f:
f.write(self._repr... | python | def save(self, png_file):
"""Save png to disk.
Parameters
----------
png_file : path to file
file to write to
Notes
-----
It relies on _repr_png_, so fix issues there.
"""
with open(png_file, 'wb') as f:
f.write(self._repr... | [
"def",
"save",
"(",
"self",
",",
"png_file",
")",
":",
"with",
"open",
"(",
"png_file",
",",
"'wb'",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"self",
".",
"_repr_png_",
"(",
")",
")"
] | Save png to disk.
Parameters
----------
png_file : path to file
file to write to
Notes
-----
It relies on _repr_png_, so fix issues there. | [
"Save",
"png",
"to",
"disk",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/viz/base.py#L39-L52 | train |
wonambi-python/wonambi | wonambi/widgets/overview.py | _make_timestamps | def _make_timestamps(start_time, minimum, maximum, steps):
"""Create timestamps on x-axis, every so often.
Parameters
----------
start_time : instance of datetime
actual start time of the dataset
minimum : int
start time of the recording from start_time, in s
maximum : int
... | python | def _make_timestamps(start_time, minimum, maximum, steps):
"""Create timestamps on x-axis, every so often.
Parameters
----------
start_time : instance of datetime
actual start time of the dataset
minimum : int
start time of the recording from start_time, in s
maximum : int
... | [
"def",
"_make_timestamps",
"(",
"start_time",
",",
"minimum",
",",
"maximum",
",",
"steps",
")",
":",
"t0",
"=",
"start_time",
"+",
"timedelta",
"(",
"seconds",
"=",
"minimum",
")",
"t1",
"=",
"start_time",
"+",
"timedelta",
"(",
"seconds",
"=",
"maximum",... | Create timestamps on x-axis, every so often.
Parameters
----------
start_time : instance of datetime
actual start time of the dataset
minimum : int
start time of the recording from start_time, in s
maximum : int
end time of the recording from start_time, in s
steps : int... | [
"Create",
"timestamps",
"on",
"x",
"-",
"axis",
"every",
"so",
"often",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/overview.py#L527-L570 | train |
wonambi-python/wonambi | wonambi/widgets/overview.py | Overview.update | def update(self, reset=True):
"""Read full duration and update maximum.
Parameters
----------
reset: bool
If True, current window start time is reset to 0.
"""
if self.parent.info.dataset is not None:
# read from the dataset, if available
... | python | def update(self, reset=True):
"""Read full duration and update maximum.
Parameters
----------
reset: bool
If True, current window start time is reset to 0.
"""
if self.parent.info.dataset is not None:
# read from the dataset, if available
... | [
"def",
"update",
"(",
"self",
",",
"reset",
"=",
"True",
")",
":",
"if",
"self",
".",
"parent",
".",
"info",
".",
"dataset",
"is",
"not",
"None",
":",
"header",
"=",
"self",
".",
"parent",
".",
"info",
".",
"dataset",
".",
"header",
"maximum",
"=",... | Read full duration and update maximum.
Parameters
----------
reset: bool
If True, current window start time is reset to 0. | [
"Read",
"full",
"duration",
"and",
"update",
"maximum",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/overview.py#L125-L154 | train |
wonambi-python/wonambi | wonambi/widgets/overview.py | Overview.display | def display(self):
"""Updates the widgets, especially based on length of recordings."""
lg.debug('GraphicsScene is between {}s and {}s'.format(self.minimum,
self.maximum))
x_scale = 1 / self.parent.value('overview_scale')
lg... | python | def display(self):
"""Updates the widgets, especially based on length of recordings."""
lg.debug('GraphicsScene is between {}s and {}s'.format(self.minimum,
self.maximum))
x_scale = 1 / self.parent.value('overview_scale')
lg... | [
"def",
"display",
"(",
"self",
")",
":",
"lg",
".",
"debug",
"(",
"'GraphicsScene is between {}s and {}s'",
".",
"format",
"(",
"self",
".",
"minimum",
",",
"self",
".",
"maximum",
")",
")",
"x_scale",
"=",
"1",
"/",
"self",
".",
"parent",
".",
"value",
... | Updates the widgets, especially based on length of recordings. | [
"Updates",
"the",
"widgets",
"especially",
"based",
"on",
"length",
"of",
"recordings",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/overview.py#L156-L184 | train |
wonambi-python/wonambi | wonambi/widgets/overview.py | Overview.add_timestamps | def add_timestamps(self):
"""Add timestamps at the bottom of the overview."""
transform, _ = self.transform().inverted()
stamps = _make_timestamps(self.start_time, self.minimum, self.maximum,
self.parent.value('timestamp_steps'))
for stamp, xpos in zip... | python | def add_timestamps(self):
"""Add timestamps at the bottom of the overview."""
transform, _ = self.transform().inverted()
stamps = _make_timestamps(self.start_time, self.minimum, self.maximum,
self.parent.value('timestamp_steps'))
for stamp, xpos in zip... | [
"def",
"add_timestamps",
"(",
"self",
")",
":",
"transform",
",",
"_",
"=",
"self",
".",
"transform",
"(",
")",
".",
"inverted",
"(",
")",
"stamps",
"=",
"_make_timestamps",
"(",
"self",
".",
"start_time",
",",
"self",
".",
"minimum",
",",
"self",
".",... | Add timestamps at the bottom of the overview. | [
"Add",
"timestamps",
"at",
"the",
"bottom",
"of",
"the",
"overview",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/overview.py#L186-L199 | train |
wonambi-python/wonambi | wonambi/widgets/overview.py | Overview.update_settings | def update_settings(self):
"""After changing the settings, we need to recreate the whole image."""
self.display()
self.display_markers()
if self.parent.notes.annot is not None:
self.parent.notes.display_notes() | python | def update_settings(self):
"""After changing the settings, we need to recreate the whole image."""
self.display()
self.display_markers()
if self.parent.notes.annot is not None:
self.parent.notes.display_notes() | [
"def",
"update_settings",
"(",
"self",
")",
":",
"self",
".",
"display",
"(",
")",
"self",
".",
"display_markers",
"(",
")",
"if",
"self",
".",
"parent",
".",
"notes",
".",
"annot",
"is",
"not",
"None",
":",
"self",
".",
"parent",
".",
"notes",
".",
... | After changing the settings, we need to recreate the whole image. | [
"After",
"changing",
"the",
"settings",
"we",
"need",
"to",
"recreate",
"the",
"whole",
"image",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/overview.py#L201-L206 | train |
wonambi-python/wonambi | wonambi/widgets/overview.py | Overview.update_position | def update_position(self, new_position=None):
"""Update the cursor position and much more.
Parameters
----------
new_position : int or float
new position in s, for plotting etc.
Notes
-----
This is a central function. It updates the cursor, then upda... | python | def update_position(self, new_position=None):
"""Update the cursor position and much more.
Parameters
----------
new_position : int or float
new position in s, for plotting etc.
Notes
-----
This is a central function. It updates the cursor, then upda... | [
"def",
"update_position",
"(",
"self",
",",
"new_position",
"=",
"None",
")",
":",
"if",
"new_position",
"is",
"not",
"None",
":",
"lg",
".",
"debug",
"(",
"'Updating position to {}'",
".",
"format",
"(",
"new_position",
")",
")",
"self",
".",
"parent",
".... | Update the cursor position and much more.
Parameters
----------
new_position : int or float
new position in s, for plotting etc.
Notes
-----
This is a central function. It updates the cursor, then updates
the traces, the scores, and the power spectru... | [
"Update",
"the",
"cursor",
"position",
"and",
"much",
"more",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/overview.py#L208-L248 | train |
wonambi-python/wonambi | wonambi/widgets/overview.py | Overview.display_current | def display_current(self):
"""Create a rectangle showing the current window."""
if self.idx_current in self.scene.items():
self.scene.removeItem(self.idx_current)
item = QGraphicsRectItem(0,
CURR['pos0'],
self.parent.... | python | def display_current(self):
"""Create a rectangle showing the current window."""
if self.idx_current in self.scene.items():
self.scene.removeItem(self.idx_current)
item = QGraphicsRectItem(0,
CURR['pos0'],
self.parent.... | [
"def",
"display_current",
"(",
"self",
")",
":",
"if",
"self",
".",
"idx_current",
"in",
"self",
".",
"scene",
".",
"items",
"(",
")",
":",
"self",
".",
"scene",
".",
"removeItem",
"(",
"self",
".",
"idx_current",
")",
"item",
"=",
"QGraphicsRectItem",
... | Create a rectangle showing the current window. | [
"Create",
"a",
"rectangle",
"showing",
"the",
"current",
"window",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/overview.py#L250-L265 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.