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/ioeeg/ktlx.py | Ktlx.return_dat | def return_dat(self, chan, begsam, endsam):
"""Read the data based on begsam and endsam.
Parameters
----------
chan : list of int
list of channel indeces
begsam : int
index of the first sample
endsam :
index of the last sample
... | python | def return_dat(self, chan, begsam, endsam):
"""Read the data based on begsam and endsam.
Parameters
----------
chan : list of int
list of channel indeces
begsam : int
index of the first sample
endsam :
index of the last sample
... | [
"def",
"return_dat",
"(",
"self",
",",
"chan",
",",
"begsam",
",",
"endsam",
")",
":",
"dat",
"=",
"empty",
"(",
"(",
"len",
"(",
"chan",
")",
",",
"endsam",
"-",
"begsam",
")",
")",
"dat",
".",
"fill",
"(",
"NaN",
")",
"stc",
",",
"all_stamp",
... | Read the data based on begsam and endsam.
Parameters
----------
chan : list of int
list of channel indeces
begsam : int
index of the first sample
endsam :
index of the last sample
Returns
-------
ndarray
2-... | [
"Read",
"the",
"data",
"based",
"on",
"begsam",
"and",
"endsam",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L895-L955 | train |
wonambi-python/wonambi | wonambi/ioeeg/ktlx.py | Ktlx.return_markers | def return_markers(self):
"""Reads the notes of the Ktlx recordings.
"""
ent_file = self._filename.with_suffix('.ent')
if not ent_file.exists():
ent_file = self._filename.with_suffix('.ent.old')
try:
ent_notes = _read_ent(ent_file)
except (FileNo... | python | def return_markers(self):
"""Reads the notes of the Ktlx recordings.
"""
ent_file = self._filename.with_suffix('.ent')
if not ent_file.exists():
ent_file = self._filename.with_suffix('.ent.old')
try:
ent_notes = _read_ent(ent_file)
except (FileNo... | [
"def",
"return_markers",
"(",
"self",
")",
":",
"ent_file",
"=",
"self",
".",
"_filename",
".",
"with_suffix",
"(",
"'.ent'",
")",
"if",
"not",
"ent_file",
".",
"exists",
"(",
")",
":",
"ent_file",
"=",
"self",
".",
"_filename",
".",
"with_suffix",
"(",
... | Reads the notes of the Ktlx recordings. | [
"Reads",
"the",
"notes",
"of",
"the",
"Ktlx",
"recordings",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L1024-L1082 | train |
wonambi-python/wonambi | wonambi/ioeeg/blackrock.py | BlackRock.return_markers | def return_markers(self, trigger_bits=8, trigger_zero=True):
"""We always read triggers as 16bit, but we convert them to 8 here
if requested.
"""
nev_file = splitext(self.filename)[0] + '.nev'
markers = _read_neuralev(nev_file, read_markers=True)
if trigger_bits == 8:
... | python | def return_markers(self, trigger_bits=8, trigger_zero=True):
"""We always read triggers as 16bit, but we convert them to 8 here
if requested.
"""
nev_file = splitext(self.filename)[0] + '.nev'
markers = _read_neuralev(nev_file, read_markers=True)
if trigger_bits == 8:
... | [
"def",
"return_markers",
"(",
"self",
",",
"trigger_bits",
"=",
"8",
",",
"trigger_zero",
"=",
"True",
")",
":",
"nev_file",
"=",
"splitext",
"(",
"self",
".",
"filename",
")",
"[",
"0",
"]",
"+",
"'.nev'",
"markers",
"=",
"_read_neuralev",
"(",
"nev_fil... | We always read triggers as 16bit, but we convert them to 8 here
if requested. | [
"We",
"always",
"read",
"triggers",
"as",
"16bit",
"but",
"we",
"convert",
"them",
"to",
"8",
"here",
"if",
"requested",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/blackrock.py#L144-L166 | train |
wonambi-python/wonambi | wonambi/trans/extern/dpss.py | tridi_inverse_iteration | def tridi_inverse_iteration(d, e, w, x0=None, rtol=1e-8):
"""Perform an inverse iteration to find the eigenvector corresponding
to the given eigenvalue in a symmetric tridiagonal system.
Parameters
----------
d : ndarray
main diagonal of the tridiagonal system
e : ndarray
offdiagon... | python | def tridi_inverse_iteration(d, e, w, x0=None, rtol=1e-8):
"""Perform an inverse iteration to find the eigenvector corresponding
to the given eigenvalue in a symmetric tridiagonal system.
Parameters
----------
d : ndarray
main diagonal of the tridiagonal system
e : ndarray
offdiagon... | [
"def",
"tridi_inverse_iteration",
"(",
"d",
",",
"e",
",",
"w",
",",
"x0",
"=",
"None",
",",
"rtol",
"=",
"1e-8",
")",
":",
"eig_diag",
"=",
"d",
"-",
"w",
"if",
"x0",
"is",
"None",
":",
"x0",
"=",
"np",
".",
"random",
".",
"randn",
"(",
"len",... | Perform an inverse iteration to find the eigenvector corresponding
to the given eigenvalue in a symmetric tridiagonal system.
Parameters
----------
d : ndarray
main diagonal of the tridiagonal system
e : ndarray
offdiagonal stored in e[:-1]
w : float
eigenvalue of the eigenve... | [
"Perform",
"an",
"inverse",
"iteration",
"to",
"find",
"the",
"eigenvector",
"corresponding",
"to",
"the",
"given",
"eigenvalue",
"in",
"a",
"symmetric",
"tridiagonal",
"system",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/extern/dpss.py#L136-L174 | train |
wonambi-python/wonambi | wonambi/trans/extern/dpss.py | tridisolve | def tridisolve(d, e, b, overwrite_b=True):
"""
Symmetric tridiagonal system solver,
from Golub and Van Loan, Matrix Computations pg 157
Parameters
----------
d : ndarray
main diagonal stored in d[:]
e : ndarray
superdiagonal stored in e[:-1]
b : ndarray
RHS vector
... | python | def tridisolve(d, e, b, overwrite_b=True):
"""
Symmetric tridiagonal system solver,
from Golub and Van Loan, Matrix Computations pg 157
Parameters
----------
d : ndarray
main diagonal stored in d[:]
e : ndarray
superdiagonal stored in e[:-1]
b : ndarray
RHS vector
... | [
"def",
"tridisolve",
"(",
"d",
",",
"e",
",",
"b",
",",
"overwrite_b",
"=",
"True",
")",
":",
"N",
"=",
"len",
"(",
"b",
")",
"dw",
"=",
"d",
".",
"copy",
"(",
")",
"ew",
"=",
"e",
".",
"copy",
"(",
")",
"if",
"overwrite_b",
":",
"x",
"=",
... | Symmetric tridiagonal system solver,
from Golub and Van Loan, Matrix Computations pg 157
Parameters
----------
d : ndarray
main diagonal stored in d[:]
e : ndarray
superdiagonal stored in e[:-1]
b : ndarray
RHS vector
Returns
-------
x : ndarray
Solution t... | [
"Symmetric",
"tridiagonal",
"system",
"solver",
"from",
"Golub",
"and",
"Van",
"Loan",
"Matrix",
"Computations",
"pg",
"157"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/extern/dpss.py#L177-L221 | train |
wonambi-python/wonambi | wonambi/trans/extern/dpss.py | autocov | def autocov(x, **kwargs):
"""Returns the autocovariance of signal s at all lags.
Parameters
----------
x : ndarray
axis : time axis
all_lags : {True/False}
whether to return all nonzero lags, or to clip the length of r_xy
to be the length of x and y. If False, then the zero lag c... | python | def autocov(x, **kwargs):
"""Returns the autocovariance of signal s at all lags.
Parameters
----------
x : ndarray
axis : time axis
all_lags : {True/False}
whether to return all nonzero lags, or to clip the length of r_xy
to be the length of x and y. If False, then the zero lag c... | [
"def",
"autocov",
"(",
"x",
",",
"**",
"kwargs",
")",
":",
"debias",
"=",
"kwargs",
".",
"pop",
"(",
"'debias'",
",",
"True",
")",
"axis",
"=",
"kwargs",
".",
"get",
"(",
"'axis'",
",",
"-",
"1",
")",
"if",
"debias",
":",
"x",
"=",
"remove_bias",... | Returns the autocovariance of signal s at all lags.
Parameters
----------
x : ndarray
axis : time axis
all_lags : {True/False}
whether to return all nonzero lags, or to clip the length of r_xy
to be the length of x and y. If False, then the zero lag correlation
is at index 0. ... | [
"Returns",
"the",
"autocovariance",
"of",
"signal",
"s",
"at",
"all",
"lags",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/extern/dpss.py#L255-L291 | train |
wonambi-python/wonambi | wonambi/trans/extern/dpss.py | fftconvolve | def fftconvolve(in1, in2, mode="full", axis=None):
""" Convolve two N-dimensional arrays using FFT. See convolve.
This is a fix of scipy.signal.fftconvolve, adding an axis argument and
importing locally the stuff only needed for this function
"""
s1 = np.array(in1.shape)
s2 = np.array(in2.shap... | python | def fftconvolve(in1, in2, mode="full", axis=None):
""" Convolve two N-dimensional arrays using FFT. See convolve.
This is a fix of scipy.signal.fftconvolve, adding an axis argument and
importing locally the stuff only needed for this function
"""
s1 = np.array(in1.shape)
s2 = np.array(in2.shap... | [
"def",
"fftconvolve",
"(",
"in1",
",",
"in2",
",",
"mode",
"=",
"\"full\"",
",",
"axis",
"=",
"None",
")",
":",
"s1",
"=",
"np",
".",
"array",
"(",
"in1",
".",
"shape",
")",
"s2",
"=",
"np",
".",
"array",
"(",
"in2",
".",
"shape",
")",
"complex... | Convolve two N-dimensional arrays using FFT. See convolve.
This is a fix of scipy.signal.fftconvolve, adding an axis argument and
importing locally the stuff only needed for this function | [
"Convolve",
"two",
"N",
"-",
"dimensional",
"arrays",
"using",
"FFT",
".",
"See",
"convolve",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/extern/dpss.py#L352-L399 | train |
wonambi-python/wonambi | wonambi/trans/frequency.py | band_power | def band_power(data, freq, scaling='power', n_fft=None, detrend=None,
array_out=False):
"""Compute power or energy acoss a frequency band, and its peak frequency.
Power is estimated using the mid-point rectangle rule. Input can be
ChanTime or ChanFreq.
Parameters
----------
data... | python | def band_power(data, freq, scaling='power', n_fft=None, detrend=None,
array_out=False):
"""Compute power or energy acoss a frequency band, and its peak frequency.
Power is estimated using the mid-point rectangle rule. Input can be
ChanTime or ChanFreq.
Parameters
----------
data... | [
"def",
"band_power",
"(",
"data",
",",
"freq",
",",
"scaling",
"=",
"'power'",
",",
"n_fft",
"=",
"None",
",",
"detrend",
"=",
"None",
",",
"array_out",
"=",
"False",
")",
":",
"if",
"not",
"array_out",
":",
"power",
"=",
"{",
"}",
"peakf",
"=",
"{... | Compute power or energy acoss a frequency band, and its peak frequency.
Power is estimated using the mid-point rectangle rule. Input can be
ChanTime or ChanFreq.
Parameters
----------
data : instance of ChanTime or ChanFreq
data to be analyzed, one trial only
freq : tuple of float
... | [
"Compute",
"power",
"or",
"energy",
"acoss",
"a",
"frequency",
"band",
"and",
"its",
"peak",
"frequency",
".",
"Power",
"is",
"estimated",
"using",
"the",
"mid",
"-",
"point",
"rectangle",
"rule",
".",
"Input",
"can",
"be",
"ChanTime",
"or",
"ChanFreq",
".... | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/frequency.py#L346-L424 | train |
wonambi-python/wonambi | wonambi/trans/frequency.py | _create_morlet | def _create_morlet(options, s_freq):
"""Create morlet wavelets, with scipy.signal doing the actual computation.
Parameters
----------
foi : ndarray or list or tuple
vector with frequency of interest
s_freq : int or float
sampling frequency of the data
options : dict
with... | python | def _create_morlet(options, s_freq):
"""Create morlet wavelets, with scipy.signal doing the actual computation.
Parameters
----------
foi : ndarray or list or tuple
vector with frequency of interest
s_freq : int or float
sampling frequency of the data
options : dict
with... | [
"def",
"_create_morlet",
"(",
"options",
",",
"s_freq",
")",
":",
"wavelets",
"=",
"[",
"]",
"foi",
"=",
"options",
".",
"pop",
"(",
"'foi'",
")",
"for",
"f",
"in",
"foi",
":",
"wavelets",
".",
"append",
"(",
"morlet",
"(",
"f",
",",
"s_freq",
",",... | Create morlet wavelets, with scipy.signal doing the actual computation.
Parameters
----------
foi : ndarray or list or tuple
vector with frequency of interest
s_freq : int or float
sampling frequency of the data
options : dict
with 'M_in_s' (duration of the wavelet in second... | [
"Create",
"morlet",
"wavelets",
"with",
"scipy",
".",
"signal",
"doing",
"the",
"actual",
"computation",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/frequency.py#L427-L450 | train |
wonambi-python/wonambi | wonambi/trans/frequency.py | morlet | def morlet(freq, s_freq, ratio=5, sigma_f=None, dur_in_sd=4, dur_in_s=None,
normalization='peak', zero_mean=False):
"""Create a Morlet wavelet.
Parameters
----------
freq : float
central frequency of the wavelet
s_freq : int
sampling frequency
ratio : float
ra... | python | def morlet(freq, s_freq, ratio=5, sigma_f=None, dur_in_sd=4, dur_in_s=None,
normalization='peak', zero_mean=False):
"""Create a Morlet wavelet.
Parameters
----------
freq : float
central frequency of the wavelet
s_freq : int
sampling frequency
ratio : float
ra... | [
"def",
"morlet",
"(",
"freq",
",",
"s_freq",
",",
"ratio",
"=",
"5",
",",
"sigma_f",
"=",
"None",
",",
"dur_in_sd",
"=",
"4",
",",
"dur_in_s",
"=",
"None",
",",
"normalization",
"=",
"'peak'",
",",
"zero_mean",
"=",
"False",
")",
":",
"if",
"sigma_f"... | Create a Morlet wavelet.
Parameters
----------
freq : float
central frequency of the wavelet
s_freq : int
sampling frequency
ratio : float
ratio for a wavelet family ( = freq / sigma_f)
sigma_f : float
standard deviation of the wavelet in frequency domain
dur... | [
"Create",
"a",
"Morlet",
"wavelet",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/frequency.py#L453-L530 | train |
wonambi-python/wonambi | wonambi/widgets/modal_widgets.py | ChannelDialog.create_widgets | def create_widgets(self):
"""Build basic components of dialog."""
self.bbox = QDialogButtonBox(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.idx_ok = self.bbox.button(QDialogButtonBox.Ok)
self.idx_cancel = self.bbox.button(QDialogButtonBox.Cancel)
self.idx... | python | def create_widgets(self):
"""Build basic components of dialog."""
self.bbox = QDialogButtonBox(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.idx_ok = self.bbox.button(QDialogButtonBox.Ok)
self.idx_cancel = self.bbox.button(QDialogButtonBox.Cancel)
self.idx... | [
"def",
"create_widgets",
"(",
"self",
")",
":",
"self",
".",
"bbox",
"=",
"QDialogButtonBox",
"(",
"QDialogButtonBox",
".",
"Ok",
"|",
"QDialogButtonBox",
".",
"Cancel",
")",
"self",
".",
"idx_ok",
"=",
"self",
".",
"bbox",
".",
"button",
"(",
"QDialogButt... | Build basic components of dialog. | [
"Build",
"basic",
"components",
"of",
"dialog",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/modal_widgets.py#L58-L77 | train |
wonambi-python/wonambi | wonambi/widgets/modal_widgets.py | ChannelDialog.update_groups | def update_groups(self):
"""Update the channel groups list when dialog is opened."""
self.groups = self.parent.channels.groups
self.idx_group.clear()
for gr in self.groups:
self.idx_group.addItem(gr['name'])
self.update_channels() | python | def update_groups(self):
"""Update the channel groups list when dialog is opened."""
self.groups = self.parent.channels.groups
self.idx_group.clear()
for gr in self.groups:
self.idx_group.addItem(gr['name'])
self.update_channels() | [
"def",
"update_groups",
"(",
"self",
")",
":",
"self",
".",
"groups",
"=",
"self",
".",
"parent",
".",
"channels",
".",
"groups",
"self",
".",
"idx_group",
".",
"clear",
"(",
")",
"for",
"gr",
"in",
"self",
".",
"groups",
":",
"self",
".",
"idx_group... | Update the channel groups list when dialog is opened. | [
"Update",
"the",
"channel",
"groups",
"list",
"when",
"dialog",
"is",
"opened",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/modal_widgets.py#L79-L86 | train |
wonambi-python/wonambi | wonambi/widgets/modal_widgets.py | ChannelDialog.update_channels | def update_channels(self):
"""Update the channels list when a new group is selected."""
group_dict = {k['name']: i for i, k in enumerate(self.groups)}
group_index = group_dict[self.idx_group.currentText()]
self.one_grp = self.groups[group_index]
self.idx_chan.clear()
se... | python | def update_channels(self):
"""Update the channels list when a new group is selected."""
group_dict = {k['name']: i for i, k in enumerate(self.groups)}
group_index = group_dict[self.idx_group.currentText()]
self.one_grp = self.groups[group_index]
self.idx_chan.clear()
se... | [
"def",
"update_channels",
"(",
"self",
")",
":",
"group_dict",
"=",
"{",
"k",
"[",
"'name'",
"]",
":",
"i",
"for",
"i",
",",
"k",
"in",
"enumerate",
"(",
"self",
".",
"groups",
")",
"}",
"group_index",
"=",
"group_dict",
"[",
"self",
".",
"idx_group"... | Update the channels list when a new group is selected. | [
"Update",
"the",
"channels",
"list",
"when",
"a",
"new",
"group",
"is",
"selected",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/modal_widgets.py#L88-L100 | train |
wonambi-python/wonambi | wonambi/widgets/modal_widgets.py | ChannelDialog.update_cycles | def update_cycles(self):
"""Enable cycles checkbox only if there are cycles marked, with no
errors."""
self.idx_cycle.clear()
try:
self.cycles = self.parent.notes.annot.get_cycles()
except ValueError as err:
self.idx_cycle.setEnabled(False)
m... | python | def update_cycles(self):
"""Enable cycles checkbox only if there are cycles marked, with no
errors."""
self.idx_cycle.clear()
try:
self.cycles = self.parent.notes.annot.get_cycles()
except ValueError as err:
self.idx_cycle.setEnabled(False)
m... | [
"def",
"update_cycles",
"(",
"self",
")",
":",
"self",
".",
"idx_cycle",
".",
"clear",
"(",
")",
"try",
":",
"self",
".",
"cycles",
"=",
"self",
".",
"parent",
".",
"notes",
".",
"annot",
".",
"get_cycles",
"(",
")",
"except",
"ValueError",
"as",
"er... | Enable cycles checkbox only if there are cycles marked, with no
errors. | [
"Enable",
"cycles",
"checkbox",
"only",
"if",
"there",
"are",
"cycles",
"marked",
"with",
"no",
"errors",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/modal_widgets.py#L102-L121 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | _create_data_to_plot | def _create_data_to_plot(data, chan_groups):
"""Create data after montage and filtering.
Parameters
----------
data : instance of ChanTime
the raw data
chan_groups : list of dict
information about channels to plot, to use as reference and about
filtering etc.
Returns
... | python | def _create_data_to_plot(data, chan_groups):
"""Create data after montage and filtering.
Parameters
----------
data : instance of ChanTime
the raw data
chan_groups : list of dict
information about channels to plot, to use as reference and about
filtering etc.
Returns
... | [
"def",
"_create_data_to_plot",
"(",
"data",
",",
"chan_groups",
")",
":",
"chan_to_plot",
"=",
"[",
"one_chan",
"for",
"one_grp",
"in",
"chan_groups",
"for",
"one_chan",
"in",
"one_grp",
"[",
"'chan_to_plot'",
"]",
"]",
"output",
"=",
"ChanTime",
"(",
")",
"... | Create data after montage and filtering.
Parameters
----------
data : instance of ChanTime
the raw data
chan_groups : list of dict
information about channels to plot, to use as reference and about
filtering etc.
Returns
-------
instance of ChanTime
data read... | [
"Create",
"data",
"after",
"montage",
"and",
"filtering",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L1173-L1231 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | _convert_timestr_to_seconds | def _convert_timestr_to_seconds(time_str, rec_start):
"""Convert input from user about time string to an absolute time for
the recordings.
Parameters
----------
time_str : str
time information as '123' or '22:30' or '22:30:22'
rec_start: instance of datetime
absolute start time ... | python | def _convert_timestr_to_seconds(time_str, rec_start):
"""Convert input from user about time string to an absolute time for
the recordings.
Parameters
----------
time_str : str
time information as '123' or '22:30' or '22:30:22'
rec_start: instance of datetime
absolute start time ... | [
"def",
"_convert_timestr_to_seconds",
"(",
"time_str",
",",
"rec_start",
")",
":",
"if",
"not",
"CHECK_TIME_STR",
".",
"match",
"(",
"time_str",
")",
":",
"raise",
"ValueError",
"(",
"'Input can only contain digits and colons'",
")",
"if",
"':'",
"in",
"time_str",
... | Convert input from user about time string to an absolute time for
the recordings.
Parameters
----------
time_str : str
time information as '123' or '22:30' or '22:30:22'
rec_start: instance of datetime
absolute start time of the recordings.
Returns
-------
int
s... | [
"Convert",
"input",
"from",
"user",
"about",
"time",
"string",
"to",
"an",
"absolute",
"time",
"for",
"the",
"recordings",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L1234-L1275 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.read_data | def read_data(self):
"""Read the data to plot."""
window_start = self.parent.value('window_start')
window_end = window_start + self.parent.value('window_length')
dataset = self.parent.info.dataset
groups = self.parent.channels.groups
chan_to_read = []
for one_grp... | python | def read_data(self):
"""Read the data to plot."""
window_start = self.parent.value('window_start')
window_end = window_start + self.parent.value('window_length')
dataset = self.parent.info.dataset
groups = self.parent.channels.groups
chan_to_read = []
for one_grp... | [
"def",
"read_data",
"(",
"self",
")",
":",
"window_start",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'window_start'",
")",
"window_end",
"=",
"window_start",
"+",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
")",
"dataset",
"=",
"self... | Read the data to plot. | [
"Read",
"the",
"data",
"to",
"plot",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L329-L355 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.display | def display(self):
"""Display the recordings."""
if self.data is None:
return
if self.scene is not None:
self.y_scrollbar_value = self.verticalScrollBar().value()
self.scene.clear()
self.create_chan_labels()
self.create_time_labels()
... | python | def display(self):
"""Display the recordings."""
if self.data is None:
return
if self.scene is not None:
self.y_scrollbar_value = self.verticalScrollBar().value()
self.scene.clear()
self.create_chan_labels()
self.create_time_labels()
... | [
"def",
"display",
"(",
"self",
")",
":",
"if",
"self",
".",
"data",
"is",
"None",
":",
"return",
"if",
"self",
".",
"scene",
"is",
"not",
"None",
":",
"self",
".",
"y_scrollbar_value",
"=",
"self",
".",
"verticalScrollBar",
"(",
")",
".",
"value",
"(... | Display the recordings. | [
"Display",
"the",
"recordings",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L358-L398 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.create_chan_labels | def create_chan_labels(self):
"""Create the channel labels, but don't plot them yet.
Notes
-----
It's necessary to have the width of the labels, so that we can adjust
the main scene.
"""
self.idx_label = []
for one_grp in self.parent.channels.groups:
... | python | def create_chan_labels(self):
"""Create the channel labels, but don't plot them yet.
Notes
-----
It's necessary to have the width of the labels, so that we can adjust
the main scene.
"""
self.idx_label = []
for one_grp in self.parent.channels.groups:
... | [
"def",
"create_chan_labels",
"(",
"self",
")",
":",
"self",
".",
"idx_label",
"=",
"[",
"]",
"for",
"one_grp",
"in",
"self",
".",
"parent",
".",
"channels",
".",
"groups",
":",
"for",
"one_label",
"in",
"one_grp",
"[",
"'chan_to_plot'",
"]",
":",
"item",... | Create the channel labels, but don't plot them yet.
Notes
-----
It's necessary to have the width of the labels, so that we can adjust
the main scene. | [
"Create",
"the",
"channel",
"labels",
"but",
"don",
"t",
"plot",
"them",
"yet",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L400-L414 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.create_time_labels | def create_time_labels(self):
"""Create the time labels, but don't plot them yet.
Notes
-----
It's necessary to have the height of the time labels, so that we can
adjust the main scene.
Not very robust, because it uses seconds as integers.
"""
min_time =... | python | def create_time_labels(self):
"""Create the time labels, but don't plot them yet.
Notes
-----
It's necessary to have the height of the time labels, so that we can
adjust the main scene.
Not very robust, because it uses seconds as integers.
"""
min_time =... | [
"def",
"create_time_labels",
"(",
"self",
")",
":",
"min_time",
"=",
"int",
"(",
"floor",
"(",
"min",
"(",
"self",
".",
"data",
".",
"axis",
"[",
"'time'",
"]",
"[",
"0",
"]",
")",
")",
")",
"max_time",
"=",
"int",
"(",
"ceil",
"(",
"max",
"(",
... | Create the time labels, but don't plot them yet.
Notes
-----
It's necessary to have the height of the time labels, so that we can
adjust the main scene.
Not very robust, because it uses seconds as integers. | [
"Create",
"the",
"time",
"labels",
"but",
"don",
"t",
"plot",
"them",
"yet",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L416-L440 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.add_chan_labels | def add_chan_labels(self):
"""Add channel labels on the left."""
window_start = self.parent.value('window_start')
window_length = self.parent.value('window_length')
label_width = window_length * self.parent.value('label_ratio')
for row, one_label_item in enumerate(self.idx_label... | python | def add_chan_labels(self):
"""Add channel labels on the left."""
window_start = self.parent.value('window_start')
window_length = self.parent.value('window_length')
label_width = window_length * self.parent.value('label_ratio')
for row, one_label_item in enumerate(self.idx_label... | [
"def",
"add_chan_labels",
"(",
"self",
")",
":",
"window_start",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'window_start'",
")",
"window_length",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
")",
"label_width",
"=",
"window_length",
... | Add channel labels on the left. | [
"Add",
"channel",
"labels",
"on",
"the",
"left",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L442-L452 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.add_time_labels | def add_time_labels(self):
"""Add time labels at the bottom."""
for text, pos in zip(self.idx_time, self.time_pos):
self.scene.addItem(text)
text.setPos(pos) | python | def add_time_labels(self):
"""Add time labels at the bottom."""
for text, pos in zip(self.idx_time, self.time_pos):
self.scene.addItem(text)
text.setPos(pos) | [
"def",
"add_time_labels",
"(",
"self",
")",
":",
"for",
"text",
",",
"pos",
"in",
"zip",
"(",
"self",
".",
"idx_time",
",",
"self",
".",
"time_pos",
")",
":",
"self",
".",
"scene",
".",
"addItem",
"(",
"text",
")",
"text",
".",
"setPos",
"(",
"pos"... | Add time labels at the bottom. | [
"Add",
"time",
"labels",
"at",
"the",
"bottom",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L454-L458 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.add_traces | def add_traces(self):
"""Add traces based on self.data."""
y_distance = self.parent.value('y_distance')
self.chan = []
self.chan_pos = []
self.chan_scale = []
row = 0
for one_grp in self.parent.channels.groups:
for one_chan in one_grp['chan_to_plot']:... | python | def add_traces(self):
"""Add traces based on self.data."""
y_distance = self.parent.value('y_distance')
self.chan = []
self.chan_pos = []
self.chan_scale = []
row = 0
for one_grp in self.parent.channels.groups:
for one_chan in one_grp['chan_to_plot']:... | [
"def",
"add_traces",
"(",
"self",
")",
":",
"y_distance",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'y_distance'",
")",
"self",
".",
"chan",
"=",
"[",
"]",
"self",
".",
"chan_pos",
"=",
"[",
"]",
"self",
".",
"chan_scale",
"=",
"[",
"]",
"row... | Add traces based on self.data. | [
"Add",
"traces",
"based",
"on",
"self",
".",
"data",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L460-L489 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.display_grid | def display_grid(self):
"""Display grid on x-axis and y-axis."""
window_start = self.parent.value('window_start')
window_length = self.parent.value('window_length')
window_end = window_start + window_length
if self.parent.value('grid_x'):
x_tick = self.parent.value('... | python | def display_grid(self):
"""Display grid on x-axis and y-axis."""
window_start = self.parent.value('window_start')
window_length = self.parent.value('window_length')
window_end = window_start + window_length
if self.parent.value('grid_x'):
x_tick = self.parent.value('... | [
"def",
"display_grid",
"(",
"self",
")",
":",
"window_start",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'window_start'",
")",
"window_length",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
")",
"window_end",
"=",
"window_start",
"+"... | Display grid on x-axis and y-axis. | [
"Display",
"grid",
"on",
"x",
"-",
"axis",
"and",
"y",
"-",
"axis",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L491-L530 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.display_markers | def display_markers(self):
"""Add markers on top of first plot."""
for item in self.idx_markers:
self.scene.removeItem(item)
self.idx_markers = []
window_start = self.parent.value('window_start')
window_length = self.parent.value('window_length')
window_end =... | python | def display_markers(self):
"""Add markers on top of first plot."""
for item in self.idx_markers:
self.scene.removeItem(item)
self.idx_markers = []
window_start = self.parent.value('window_start')
window_length = self.parent.value('window_length')
window_end =... | [
"def",
"display_markers",
"(",
"self",
")",
":",
"for",
"item",
"in",
"self",
".",
"idx_markers",
":",
"self",
".",
"scene",
".",
"removeItem",
"(",
"item",
")",
"self",
".",
"idx_markers",
"=",
"[",
"]",
"window_start",
"=",
"self",
".",
"parent",
"."... | Add markers on top of first plot. | [
"Add",
"markers",
"on",
"top",
"of",
"first",
"plot",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L532-L571 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.step_prev | def step_prev(self):
"""Go to the previous step."""
window_start = around(self.parent.value('window_start') -
self.parent.value('window_length') /
self.parent.value('window_step'), 2)
if window_start < 0:
return
self... | python | def step_prev(self):
"""Go to the previous step."""
window_start = around(self.parent.value('window_start') -
self.parent.value('window_length') /
self.parent.value('window_step'), 2)
if window_start < 0:
return
self... | [
"def",
"step_prev",
"(",
"self",
")",
":",
"window_start",
"=",
"around",
"(",
"self",
".",
"parent",
".",
"value",
"(",
"'window_start'",
")",
"-",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
")",
"/",
"self",
".",
"parent",
".",
"val... | Go to the previous step. | [
"Go",
"to",
"the",
"previous",
"step",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L645-L652 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.step_next | def step_next(self):
"""Go to the next step."""
window_start = around(self.parent.value('window_start') +
self.parent.value('window_length') /
self.parent.value('window_step'), 2)
self.parent.overview.update_position(window_start) | python | def step_next(self):
"""Go to the next step."""
window_start = around(self.parent.value('window_start') +
self.parent.value('window_length') /
self.parent.value('window_step'), 2)
self.parent.overview.update_position(window_start) | [
"def",
"step_next",
"(",
"self",
")",
":",
"window_start",
"=",
"around",
"(",
"self",
".",
"parent",
".",
"value",
"(",
"'window_start'",
")",
"+",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
")",
"/",
"self",
".",
"parent",
".",
"val... | Go to the next step. | [
"Go",
"to",
"the",
"next",
"step",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L654-L660 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.page_prev | def page_prev(self):
"""Go to the previous page."""
window_start = (self.parent.value('window_start') -
self.parent.value('window_length'))
if window_start < 0:
return
self.parent.overview.update_position(window_start) | python | def page_prev(self):
"""Go to the previous page."""
window_start = (self.parent.value('window_start') -
self.parent.value('window_length'))
if window_start < 0:
return
self.parent.overview.update_position(window_start) | [
"def",
"page_prev",
"(",
"self",
")",
":",
"window_start",
"=",
"(",
"self",
".",
"parent",
".",
"value",
"(",
"'window_start'",
")",
"-",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
")",
")",
"if",
"window_start",
"<",
"0",
":",
"retu... | Go to the previous page. | [
"Go",
"to",
"the",
"previous",
"page",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L662-L668 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.page_next | def page_next(self):
"""Go to the next page."""
window_start = (self.parent.value('window_start') +
self.parent.value('window_length'))
self.parent.overview.update_position(window_start) | python | def page_next(self):
"""Go to the next page."""
window_start = (self.parent.value('window_start') +
self.parent.value('window_length'))
self.parent.overview.update_position(window_start) | [
"def",
"page_next",
"(",
"self",
")",
":",
"window_start",
"=",
"(",
"self",
".",
"parent",
".",
"value",
"(",
"'window_start'",
")",
"+",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
")",
")",
"self",
".",
"parent",
".",
"overview",
".... | Go to the next page. | [
"Go",
"to",
"the",
"next",
"page",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L670-L674 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.go_to_epoch | def go_to_epoch(self, checked=False, test_text_str=None):
"""Go to any window"""
if test_text_str is not None:
time_str = test_text_str
ok = True
else:
time_str, ok = QInputDialog.getText(self,
'Go To Epoch',
... | python | def go_to_epoch(self, checked=False, test_text_str=None):
"""Go to any window"""
if test_text_str is not None:
time_str = test_text_str
ok = True
else:
time_str, ok = QInputDialog.getText(self,
'Go To Epoch',
... | [
"def",
"go_to_epoch",
"(",
"self",
",",
"checked",
"=",
"False",
",",
"test_text_str",
"=",
"None",
")",
":",
"if",
"test_text_str",
"is",
"not",
"None",
":",
"time_str",
"=",
"test_text_str",
"ok",
"=",
"True",
"else",
":",
"time_str",
",",
"ok",
"=",
... | Go to any window | [
"Go",
"to",
"any",
"window"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L676-L704 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.line_up_with_epoch | def line_up_with_epoch(self):
"""Go to the start of the present epoch."""
if self.parent.notes.annot is None: # TODO: remove if buttons are disabled
error_dialog = QErrorMessage()
error_dialog.setWindowTitle('Error moving to epoch')
error_dialog.showMessage('No score... | python | def line_up_with_epoch(self):
"""Go to the start of the present epoch."""
if self.parent.notes.annot is None: # TODO: remove if buttons are disabled
error_dialog = QErrorMessage()
error_dialog.setWindowTitle('Error moving to epoch')
error_dialog.showMessage('No score... | [
"def",
"line_up_with_epoch",
"(",
"self",
")",
":",
"if",
"self",
".",
"parent",
".",
"notes",
".",
"annot",
"is",
"None",
":",
"error_dialog",
"=",
"QErrorMessage",
"(",
")",
"error_dialog",
".",
"setWindowTitle",
"(",
"'Error moving to epoch'",
")",
"error_d... | Go to the start of the present epoch. | [
"Go",
"to",
"the",
"start",
"of",
"the",
"present",
"epoch",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L706-L718 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.add_time | def add_time(self, extra_time):
"""Go to the predefined time forward."""
window_start = self.parent.value('window_start') + extra_time
self.parent.overview.update_position(window_start) | python | def add_time(self, extra_time):
"""Go to the predefined time forward."""
window_start = self.parent.value('window_start') + extra_time
self.parent.overview.update_position(window_start) | [
"def",
"add_time",
"(",
"self",
",",
"extra_time",
")",
":",
"window_start",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'window_start'",
")",
"+",
"extra_time",
"self",
".",
"parent",
".",
"overview",
".",
"update_position",
"(",
"window_start",
")"
] | Go to the predefined time forward. | [
"Go",
"to",
"the",
"predefined",
"time",
"forward",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L720-L723 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.X_more | def X_more(self):
"""Zoom in on the x-axis."""
if self.parent.value('window_length') < 0.3:
return
self.parent.value('window_length',
self.parent.value('window_length') * 2)
self.parent.overview.update_position() | python | def X_more(self):
"""Zoom in on the x-axis."""
if self.parent.value('window_length') < 0.3:
return
self.parent.value('window_length',
self.parent.value('window_length') * 2)
self.parent.overview.update_position() | [
"def",
"X_more",
"(",
"self",
")",
":",
"if",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
")",
"<",
"0.3",
":",
"return",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
",",
"self",
".",
"parent",
".",
"value",
"(",
"'w... | Zoom in on the x-axis. | [
"Zoom",
"in",
"on",
"the",
"x",
"-",
"axis",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L725-L731 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.X_less | def X_less(self):
"""Zoom out on the x-axis."""
self.parent.value('window_length',
self.parent.value('window_length') / 2)
self.parent.overview.update_position() | python | def X_less(self):
"""Zoom out on the x-axis."""
self.parent.value('window_length',
self.parent.value('window_length') / 2)
self.parent.overview.update_position() | [
"def",
"X_less",
"(",
"self",
")",
":",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
",",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
")",
"/",
"2",
")",
"self",
".",
"parent",
".",
"overview",
".",
"update_position",
"... | Zoom out on the x-axis. | [
"Zoom",
"out",
"on",
"the",
"x",
"-",
"axis",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L733-L737 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.X_length | def X_length(self, new_window_length):
"""Use presets for length of the window."""
self.parent.value('window_length', new_window_length)
self.parent.overview.update_position() | python | def X_length(self, new_window_length):
"""Use presets for length of the window."""
self.parent.value('window_length', new_window_length)
self.parent.overview.update_position() | [
"def",
"X_length",
"(",
"self",
",",
"new_window_length",
")",
":",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
",",
"new_window_length",
")",
"self",
".",
"parent",
".",
"overview",
".",
"update_position",
"(",
")"
] | Use presets for length of the window. | [
"Use",
"presets",
"for",
"length",
"of",
"the",
"window",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L739-L742 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.Y_more | def Y_more(self):
"""Increase the scaling."""
self.parent.value('y_scale', self.parent.value('y_scale') * 2)
self.parent.traces.display() | python | def Y_more(self):
"""Increase the scaling."""
self.parent.value('y_scale', self.parent.value('y_scale') * 2)
self.parent.traces.display() | [
"def",
"Y_more",
"(",
"self",
")",
":",
"self",
".",
"parent",
".",
"value",
"(",
"'y_scale'",
",",
"self",
".",
"parent",
".",
"value",
"(",
"'y_scale'",
")",
"*",
"2",
")",
"self",
".",
"parent",
".",
"traces",
".",
"display",
"(",
")"
] | Increase the scaling. | [
"Increase",
"the",
"scaling",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L744-L747 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.Y_less | def Y_less(self):
"""Decrease the scaling."""
self.parent.value('y_scale', self.parent.value('y_scale') / 2)
self.parent.traces.display() | python | def Y_less(self):
"""Decrease the scaling."""
self.parent.value('y_scale', self.parent.value('y_scale') / 2)
self.parent.traces.display() | [
"def",
"Y_less",
"(",
"self",
")",
":",
"self",
".",
"parent",
".",
"value",
"(",
"'y_scale'",
",",
"self",
".",
"parent",
".",
"value",
"(",
"'y_scale'",
")",
"/",
"2",
")",
"self",
".",
"parent",
".",
"traces",
".",
"display",
"(",
")"
] | Decrease the scaling. | [
"Decrease",
"the",
"scaling",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L749-L752 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.Y_ampl | def Y_ampl(self, new_y_scale):
"""Make scaling on Y axis using predefined values"""
self.parent.value('y_scale', new_y_scale)
self.parent.traces.display() | python | def Y_ampl(self, new_y_scale):
"""Make scaling on Y axis using predefined values"""
self.parent.value('y_scale', new_y_scale)
self.parent.traces.display() | [
"def",
"Y_ampl",
"(",
"self",
",",
"new_y_scale",
")",
":",
"self",
".",
"parent",
".",
"value",
"(",
"'y_scale'",
",",
"new_y_scale",
")",
"self",
".",
"parent",
".",
"traces",
".",
"display",
"(",
")"
] | Make scaling on Y axis using predefined values | [
"Make",
"scaling",
"on",
"Y",
"axis",
"using",
"predefined",
"values"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L754-L757 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.Y_wider | def Y_wider(self):
"""Increase the distance of the lines."""
self.parent.value('y_distance', self.parent.value('y_distance') * 1.4)
self.parent.traces.display() | python | def Y_wider(self):
"""Increase the distance of the lines."""
self.parent.value('y_distance', self.parent.value('y_distance') * 1.4)
self.parent.traces.display() | [
"def",
"Y_wider",
"(",
"self",
")",
":",
"self",
".",
"parent",
".",
"value",
"(",
"'y_distance'",
",",
"self",
".",
"parent",
".",
"value",
"(",
"'y_distance'",
")",
"*",
"1.4",
")",
"self",
".",
"parent",
".",
"traces",
".",
"display",
"(",
")"
] | Increase the distance of the lines. | [
"Increase",
"the",
"distance",
"of",
"the",
"lines",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L759-L762 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.Y_tighter | def Y_tighter(self):
"""Decrease the distance of the lines."""
self.parent.value('y_distance', self.parent.value('y_distance') / 1.4)
self.parent.traces.display() | python | def Y_tighter(self):
"""Decrease the distance of the lines."""
self.parent.value('y_distance', self.parent.value('y_distance') / 1.4)
self.parent.traces.display() | [
"def",
"Y_tighter",
"(",
"self",
")",
":",
"self",
".",
"parent",
".",
"value",
"(",
"'y_distance'",
",",
"self",
".",
"parent",
".",
"value",
"(",
"'y_distance'",
")",
"/",
"1.4",
")",
"self",
".",
"parent",
".",
"traces",
".",
"display",
"(",
")"
] | Decrease the distance of the lines. | [
"Decrease",
"the",
"distance",
"of",
"the",
"lines",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L764-L767 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.Y_dist | def Y_dist(self, new_y_distance):
"""Use preset values for the distance between lines."""
self.parent.value('y_distance', new_y_distance)
self.parent.traces.display() | python | def Y_dist(self, new_y_distance):
"""Use preset values for the distance between lines."""
self.parent.value('y_distance', new_y_distance)
self.parent.traces.display() | [
"def",
"Y_dist",
"(",
"self",
",",
"new_y_distance",
")",
":",
"self",
".",
"parent",
".",
"value",
"(",
"'y_distance'",
",",
"new_y_distance",
")",
"self",
".",
"parent",
".",
"traces",
".",
"display",
"(",
")"
] | Use preset values for the distance between lines. | [
"Use",
"preset",
"values",
"for",
"the",
"distance",
"between",
"lines",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L769-L772 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.mousePressEvent | def mousePressEvent(self, event):
"""Create a marker or start selection
Parameters
----------
event : instance of QtCore.QEvent
it contains the position that was clicked.
"""
if not self.scene:
return
if self.event_sel or self... | python | def mousePressEvent(self, event):
"""Create a marker or start selection
Parameters
----------
event : instance of QtCore.QEvent
it contains the position that was clicked.
"""
if not self.scene:
return
if self.event_sel or self... | [
"def",
"mousePressEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"scene",
":",
"return",
"if",
"self",
".",
"event_sel",
"or",
"self",
".",
"current_event",
":",
"self",
".",
"parent",
".",
"notes",
".",
"idx_eventtype",
".",
"s... | Create a marker or start selection
Parameters
----------
event : instance of QtCore.QEvent
it contains the position that was clicked. | [
"Create",
"a",
"marker",
"or",
"start",
"selection"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L774-L823 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.mouseReleaseEvent | def mouseReleaseEvent(self, event):
"""Create a new event or marker, or show the previous power spectrum
"""
if not self.scene:
return
if self.event_sel:
return
if self.deselect:
self.deselect = False
return
if not self.r... | python | def mouseReleaseEvent(self, event):
"""Create a new event or marker, or show the previous power spectrum
"""
if not self.scene:
return
if self.event_sel:
return
if self.deselect:
self.deselect = False
return
if not self.r... | [
"def",
"mouseReleaseEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"scene",
":",
"return",
"if",
"self",
".",
"event_sel",
":",
"return",
"if",
"self",
".",
"deselect",
":",
"self",
".",
"deselect",
"=",
"False",
"return",
"if",... | Create a new event or marker, or show the previous power spectrum | [
"Create",
"a",
"new",
"event",
"or",
"marker",
"or",
"show",
"the",
"previous",
"power",
"spectrum"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L907-L980 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.next_event | def next_event(self, delete=False):
"""Go to next event."""
if delete:
msg = "Delete this event? This cannot be undone."
msgbox = QMessageBox(QMessageBox.Question, 'Delete event', msg)
msgbox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
msgbox.setD... | python | def next_event(self, delete=False):
"""Go to next event."""
if delete:
msg = "Delete this event? This cannot be undone."
msgbox = QMessageBox(QMessageBox.Question, 'Delete event', msg)
msgbox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
msgbox.setD... | [
"def",
"next_event",
"(",
"self",
",",
"delete",
"=",
"False",
")",
":",
"if",
"delete",
":",
"msg",
"=",
"\"Delete this event? This cannot be undone.\"",
"msgbox",
"=",
"QMessageBox",
"(",
"QMessageBox",
".",
"Question",
",",
"'Delete event'",
",",
"msg",
")",
... | Go to next event. | [
"Go",
"to",
"next",
"event",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L1048-L1101 | train |
wonambi-python/wonambi | wonambi/widgets/traces.py | Traces.resizeEvent | def resizeEvent(self, event):
"""Resize scene so that it fits the whole widget.
Parameters
----------
event : instance of QtCore.QEvent
not important
Notes
-----
This function overwrites Qt function, therefore the non-standard
name. Argument ... | python | def resizeEvent(self, event):
"""Resize scene so that it fits the whole widget.
Parameters
----------
event : instance of QtCore.QEvent
not important
Notes
-----
This function overwrites Qt function, therefore the non-standard
name. Argument ... | [
"def",
"resizeEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"scene",
"is",
"not",
"None",
":",
"ratio",
"=",
"self",
".",
"width",
"(",
")",
"/",
"(",
"self",
".",
"scene",
".",
"width",
"(",
")",
"*",
"1.1",
")",
"self",
".",... | Resize scene so that it fits the whole widget.
Parameters
----------
event : instance of QtCore.QEvent
not important
Notes
-----
This function overwrites Qt function, therefore the non-standard
name. Argument also depends on Qt.
The function... | [
"Resize",
"scene",
"so",
"that",
"it",
"fits",
"the",
"whole",
"widget",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/traces.py#L1130-L1152 | train |
wonambi-python/wonambi | wonambi/ioeeg/edf.py | Edf.return_dat | def return_dat(self, chan, begsam, endsam):
"""Read data from an EDF file.
Reads channel by channel, and adjusts the values by calibration.
Parameters
----------
chan : list of int
index (indices) of the channels to read
begsam : int
index of the... | python | def return_dat(self, chan, begsam, endsam):
"""Read data from an EDF file.
Reads channel by channel, and adjusts the values by calibration.
Parameters
----------
chan : list of int
index (indices) of the channels to read
begsam : int
index of the... | [
"def",
"return_dat",
"(",
"self",
",",
"chan",
",",
"begsam",
",",
"endsam",
")",
":",
"assert",
"begsam",
"<",
"endsam",
"dat",
"=",
"empty",
"(",
"(",
"len",
"(",
"chan",
")",
",",
"endsam",
"-",
"begsam",
")",
")",
"dat",
".",
"fill",
"(",
"Na... | Read data from an EDF file.
Reads channel by channel, and adjusts the values by calibration.
Parameters
----------
chan : list of int
index (indices) of the channels to read
begsam : int
index of the first sample
endsam : int
index of... | [
"Read",
"data",
"from",
"an",
"EDF",
"file",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/edf.py#L177-L212 | train |
wonambi-python/wonambi | wonambi/ioeeg/edf.py | Edf._read_record | def _read_record(self, f, blk, chans):
"""Read raw data from a single EDF channel.
Parameters
----------
i_chan : int
index of the channel to read
begsam : int
index of the first sample
endsam : int
index of the last sample
Re... | python | def _read_record(self, f, blk, chans):
"""Read raw data from a single EDF channel.
Parameters
----------
i_chan : int
index of the channel to read
begsam : int
index of the first sample
endsam : int
index of the last sample
Re... | [
"def",
"_read_record",
"(",
"self",
",",
"f",
",",
"blk",
",",
"chans",
")",
":",
"dat_in_rec",
"=",
"empty",
"(",
"(",
"len",
"(",
"chans",
")",
",",
"self",
".",
"max_smp",
")",
")",
"i_ch_in_dat",
"=",
"0",
"for",
"i_ch",
"in",
"chans",
":",
"... | Read raw data from a single EDF channel.
Parameters
----------
i_chan : int
index of the channel to read
begsam : int
index of the first sample
endsam : int
index of the last sample
Returns
-------
numpy.ndarray
... | [
"Read",
"raw",
"data",
"from",
"a",
"single",
"EDF",
"channel",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/edf.py#L214-L244 | train |
wonambi-python/wonambi | wonambi/ioeeg/brainvision.py | write_brainvision | def write_brainvision(data, filename, markers=None):
"""Export data in BrainVision format
Parameters
----------
data : instance of ChanTime
data with only one trial
filename : path to file
file to export to (use '.vhdr' as extension)
"""
filename = Path(filename).resolve().w... | python | def write_brainvision(data, filename, markers=None):
"""Export data in BrainVision format
Parameters
----------
data : instance of ChanTime
data with only one trial
filename : path to file
file to export to (use '.vhdr' as extension)
"""
filename = Path(filename).resolve().w... | [
"def",
"write_brainvision",
"(",
"data",
",",
"filename",
",",
"markers",
"=",
"None",
")",
":",
"filename",
"=",
"Path",
"(",
"filename",
")",
".",
"resolve",
"(",
")",
".",
"with_suffix",
"(",
"'.vhdr'",
")",
"if",
"markers",
"is",
"None",
":",
"mark... | Export data in BrainVision format
Parameters
----------
data : instance of ChanTime
data with only one trial
filename : path to file
file to export to (use '.vhdr' as extension) | [
"Export",
"data",
"in",
"BrainVision",
"format"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/brainvision.py#L226-L246 | train |
wonambi-python/wonambi | wonambi/source/linear.py | calc_xyz2surf | def calc_xyz2surf(surf, xyz, threshold=20, exponent=None, std=None):
"""Calculate transformation matrix from xyz values to vertices.
Parameters
----------
surf : instance of wonambi.attr.Surf
the surface of only one hemisphere.
xyz : numpy.ndarray
nChan x 3 matrix, with the location... | python | def calc_xyz2surf(surf, xyz, threshold=20, exponent=None, std=None):
"""Calculate transformation matrix from xyz values to vertices.
Parameters
----------
surf : instance of wonambi.attr.Surf
the surface of only one hemisphere.
xyz : numpy.ndarray
nChan x 3 matrix, with the location... | [
"def",
"calc_xyz2surf",
"(",
"surf",
",",
"xyz",
",",
"threshold",
"=",
"20",
",",
"exponent",
"=",
"None",
",",
"std",
"=",
"None",
")",
":",
"if",
"exponent",
"is",
"None",
"and",
"std",
"is",
"None",
":",
"exponent",
"=",
"1",
"if",
"exponent",
... | Calculate transformation matrix from xyz values to vertices.
Parameters
----------
surf : instance of wonambi.attr.Surf
the surface of only one hemisphere.
xyz : numpy.ndarray
nChan x 3 matrix, with the locations in x, y, z.
std : float
distance in mm of the Gaussian kernel
... | [
"Calculate",
"transformation",
"matrix",
"from",
"xyz",
"values",
"to",
"vertices",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/source/linear.py#L57-L136 | train |
wonambi-python/wonambi | wonambi/source/linear.py | calc_one_vert_inverse | def calc_one_vert_inverse(one_vert, xyz=None, exponent=None):
"""Calculate how many electrodes influence one vertex, using the inverse
function.
Parameters
----------
one_vert : ndarray
vector of xyz position of a vertex
xyz : ndarray
nChan X 3 with the position of all the chann... | python | def calc_one_vert_inverse(one_vert, xyz=None, exponent=None):
"""Calculate how many electrodes influence one vertex, using the inverse
function.
Parameters
----------
one_vert : ndarray
vector of xyz position of a vertex
xyz : ndarray
nChan X 3 with the position of all the chann... | [
"def",
"calc_one_vert_inverse",
"(",
"one_vert",
",",
"xyz",
"=",
"None",
",",
"exponent",
"=",
"None",
")",
":",
"trans",
"=",
"empty",
"(",
"xyz",
".",
"shape",
"[",
"0",
"]",
")",
"for",
"i",
",",
"one_xyz",
"in",
"enumerate",
"(",
"xyz",
")",
"... | Calculate how many electrodes influence one vertex, using the inverse
function.
Parameters
----------
one_vert : ndarray
vector of xyz position of a vertex
xyz : ndarray
nChan X 3 with the position of all the channels
exponent : int
inverse law (1-> direct inverse, 2-> i... | [
"Calculate",
"how",
"many",
"electrodes",
"influence",
"one",
"vertex",
"using",
"the",
"inverse",
"function",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/source/linear.py#L139-L160 | train |
wonambi-python/wonambi | wonambi/source/linear.py | calc_one_vert_gauss | def calc_one_vert_gauss(one_vert, xyz=None, std=None):
"""Calculate how many electrodes influence one vertex, using a Gaussian
function.
Parameters
----------
one_vert : ndarray
vector of xyz position of a vertex
xyz : ndarray
nChan X 3 with the position of all the channels
... | python | def calc_one_vert_gauss(one_vert, xyz=None, std=None):
"""Calculate how many electrodes influence one vertex, using a Gaussian
function.
Parameters
----------
one_vert : ndarray
vector of xyz position of a vertex
xyz : ndarray
nChan X 3 with the position of all the channels
... | [
"def",
"calc_one_vert_gauss",
"(",
"one_vert",
",",
"xyz",
"=",
"None",
",",
"std",
"=",
"None",
")",
":",
"trans",
"=",
"empty",
"(",
"xyz",
".",
"shape",
"[",
"0",
"]",
")",
"for",
"i",
",",
"one_xyz",
"in",
"enumerate",
"(",
"xyz",
")",
":",
"... | Calculate how many electrodes influence one vertex, using a Gaussian
function.
Parameters
----------
one_vert : ndarray
vector of xyz position of a vertex
xyz : ndarray
nChan X 3 with the position of all the channels
std : float
distance in mm of the Gaussian kernel
... | [
"Calculate",
"how",
"many",
"electrodes",
"influence",
"one",
"vertex",
"using",
"a",
"Gaussian",
"function",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/source/linear.py#L163-L184 | train |
wonambi-python/wonambi | wonambi/ioeeg/micromed.py | _read_history | def _read_history(f, zone):
"""This matches the Matlab reader from Matlab Exchange but doesn't seem
correct.
"""
pos, length = zone
f.seek(pos, SEEK_SET)
histories = []
while f.tell() < (pos + length):
history = {
'nSample': unpack(MAX_SAMPLE * 'I', f.read(MAX_SAMPLE * 4... | python | def _read_history(f, zone):
"""This matches the Matlab reader from Matlab Exchange but doesn't seem
correct.
"""
pos, length = zone
f.seek(pos, SEEK_SET)
histories = []
while f.tell() < (pos + length):
history = {
'nSample': unpack(MAX_SAMPLE * 'I', f.read(MAX_SAMPLE * 4... | [
"def",
"_read_history",
"(",
"f",
",",
"zone",
")",
":",
"pos",
",",
"length",
"=",
"zone",
"f",
".",
"seek",
"(",
"pos",
",",
"SEEK_SET",
")",
"histories",
"=",
"[",
"]",
"while",
"f",
".",
"tell",
"(",
")",
"<",
"(",
"pos",
"+",
"length",
")"... | This matches the Matlab reader from Matlab Exchange but doesn't seem
correct. | [
"This",
"matches",
"the",
"Matlab",
"reader",
"from",
"Matlab",
"Exchange",
"but",
"doesn",
"t",
"seem",
"correct",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/micromed.py#L458-L486 | train |
wonambi-python/wonambi | wonambi/widgets/video.py | Video.create_video | def create_video(self):
"""Create video widget."""
self.instance = vlc.Instance()
video_widget = QFrame()
self.mediaplayer = self.instance.media_player_new()
if system() == 'Linux':
self.mediaplayer.set_xwindow(video_widget.winId())
elif system() == 'Windows... | python | def create_video(self):
"""Create video widget."""
self.instance = vlc.Instance()
video_widget = QFrame()
self.mediaplayer = self.instance.media_player_new()
if system() == 'Linux':
self.mediaplayer.set_xwindow(video_widget.winId())
elif system() == 'Windows... | [
"def",
"create_video",
"(",
"self",
")",
":",
"self",
".",
"instance",
"=",
"vlc",
".",
"Instance",
"(",
")",
"video_widget",
"=",
"QFrame",
"(",
")",
"self",
".",
"mediaplayer",
"=",
"self",
".",
"instance",
".",
"media_player_new",
"(",
")",
"if",
"s... | Create video widget. | [
"Create",
"video",
"widget",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/video.py#L74-L104 | train |
wonambi-python/wonambi | wonambi/widgets/video.py | Video.stop_video | def stop_video(self, tick):
"""Stop video if tick is more than the end, only for last file.
Parameters
----------
tick : int
time in ms from the beginning of the file
useless?
"""
if self.cnt_video == self.n_video:
if tick >= self.end_dif... | python | def stop_video(self, tick):
"""Stop video if tick is more than the end, only for last file.
Parameters
----------
tick : int
time in ms from the beginning of the file
useless?
"""
if self.cnt_video == self.n_video:
if tick >= self.end_dif... | [
"def",
"stop_video",
"(",
"self",
",",
"tick",
")",
":",
"if",
"self",
".",
"cnt_video",
"==",
"self",
".",
"n_video",
":",
"if",
"tick",
">=",
"self",
".",
"end_diff",
":",
"self",
".",
"idx_button",
".",
"setText",
"(",
"'Start'",
")",
"self",
".",... | Stop video if tick is more than the end, only for last file.
Parameters
----------
tick : int
time in ms from the beginning of the file
useless? | [
"Stop",
"video",
"if",
"tick",
"is",
"more",
"than",
"the",
"end",
"only",
"for",
"last",
"file",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/video.py#L106-L119 | train |
wonambi-python/wonambi | wonambi/widgets/video.py | Video.next_video | def next_video(self, _):
"""Also runs when file is loaded, so index starts at 2."""
self.cnt_video += 1
lg.info('Update video to ' + str(self.cnt_video)) | python | def next_video(self, _):
"""Also runs when file is loaded, so index starts at 2."""
self.cnt_video += 1
lg.info('Update video to ' + str(self.cnt_video)) | [
"def",
"next_video",
"(",
"self",
",",
"_",
")",
":",
"self",
".",
"cnt_video",
"+=",
"1",
"lg",
".",
"info",
"(",
"'Update video to '",
"+",
"str",
"(",
"self",
".",
"cnt_video",
")",
")"
] | Also runs when file is loaded, so index starts at 2. | [
"Also",
"runs",
"when",
"file",
"is",
"loaded",
"so",
"index",
"starts",
"at",
"2",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/video.py#L128-L131 | train |
wonambi-python/wonambi | wonambi/widgets/video.py | Video.start_stop_video | def start_stop_video(self):
"""Start and stop the video, and change the button.
"""
if self.parent.info.dataset is None:
self.parent.statusBar().showMessage('No Dataset Loaded')
return
# & is added automatically by PyQt, it seems
if 'Start' in self.idx_bu... | python | def start_stop_video(self):
"""Start and stop the video, and change the button.
"""
if self.parent.info.dataset is None:
self.parent.statusBar().showMessage('No Dataset Loaded')
return
# & is added automatically by PyQt, it seems
if 'Start' in self.idx_bu... | [
"def",
"start_stop_video",
"(",
"self",
")",
":",
"if",
"self",
".",
"parent",
".",
"info",
".",
"dataset",
"is",
"None",
":",
"self",
".",
"parent",
".",
"statusBar",
"(",
")",
".",
"showMessage",
"(",
"'No Dataset Loaded'",
")",
"return",
"if",
"'Start... | Start and stop the video, and change the button. | [
"Start",
"and",
"stop",
"the",
"video",
"and",
"change",
"the",
"button",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/video.py#L133-L158 | train |
wonambi-python/wonambi | wonambi/widgets/video.py | Video.update_video | def update_video(self):
"""Read list of files, convert to video time, and add video to queue.
"""
window_start = self.parent.value('window_start')
window_length = self.parent.value('window_length')
d = self.parent.info.dataset
videos, begsec, endsec = d.read_videos(windo... | python | def update_video(self):
"""Read list of files, convert to video time, and add video to queue.
"""
window_start = self.parent.value('window_start')
window_length = self.parent.value('window_length')
d = self.parent.info.dataset
videos, begsec, endsec = d.read_videos(windo... | [
"def",
"update_video",
"(",
"self",
")",
":",
"window_start",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'window_start'",
")",
"window_length",
"=",
"self",
".",
"parent",
".",
"value",
"(",
"'window_length'",
")",
"d",
"=",
"self",
".",
"parent",
"... | Read list of files, convert to video time, and add video to queue. | [
"Read",
"list",
"of",
"files",
"convert",
"to",
"video",
"time",
"and",
"add",
"video",
"to",
"queue",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/video.py#L160-L184 | train |
wonambi-python/wonambi | wonambi/trans/montage.py | montage | def montage(data, ref_chan=None, ref_to_avg=False, bipolar=None,
method='average'):
"""Apply linear transformation to the channels.
Parameters
----------
data : instance of DataRaw
the data to filter
ref_chan : list of str
list of channels used as reference
ref_to_av... | python | def montage(data, ref_chan=None, ref_to_avg=False, bipolar=None,
method='average'):
"""Apply linear transformation to the channels.
Parameters
----------
data : instance of DataRaw
the data to filter
ref_chan : list of str
list of channels used as reference
ref_to_av... | [
"def",
"montage",
"(",
"data",
",",
"ref_chan",
"=",
"None",
",",
"ref_to_avg",
"=",
"False",
",",
"bipolar",
"=",
"None",
",",
"method",
"=",
"'average'",
")",
":",
"if",
"ref_to_avg",
"and",
"ref_chan",
"is",
"not",
"None",
":",
"raise",
"TypeError",
... | Apply linear transformation to the channels.
Parameters
----------
data : instance of DataRaw
the data to filter
ref_chan : list of str
list of channels used as reference
ref_to_avg : bool
if re-reference to average or not
bipolar : float
distance in mm to consid... | [
"Apply",
"linear",
"transformation",
"to",
"the",
"channels",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/montage.py#L18-L99 | train |
wonambi-python/wonambi | wonambi/trans/montage.py | _assert_equal_channels | def _assert_equal_channels(axis):
"""check that all the trials have the same channels, in the same order.
Parameters
----------
axis : ndarray of ndarray
one of the data axis
Raises
------
"""
for i0 in axis:
for i1 in axis:
if not all(i0 == i1):
... | python | def _assert_equal_channels(axis):
"""check that all the trials have the same channels, in the same order.
Parameters
----------
axis : ndarray of ndarray
one of the data axis
Raises
------
"""
for i0 in axis:
for i1 in axis:
if not all(i0 == i1):
... | [
"def",
"_assert_equal_channels",
"(",
"axis",
")",
":",
"for",
"i0",
"in",
"axis",
":",
"for",
"i1",
"in",
"axis",
":",
"if",
"not",
"all",
"(",
"i0",
"==",
"i1",
")",
":",
"raise",
"ValueError",
"(",
"'The channels for all the trials should have '",
"'the s... | check that all the trials have the same channels, in the same order.
Parameters
----------
axis : ndarray of ndarray
one of the data axis
Raises
------ | [
"check",
"that",
"all",
"the",
"trials",
"have",
"the",
"same",
"channels",
"in",
"the",
"same",
"order",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/montage.py#L102-L118 | train |
wonambi-python/wonambi | wonambi/trans/montage.py | compute_average_regress | def compute_average_regress(x, idx_chan):
"""Take the mean across channels and regress out the mean from each channel
Parameters
----------
x : ndarray
2d array with channels on one dimension
idx_chan:
which axis contains channels
Returns
-------
ndarray
same as... | python | def compute_average_regress(x, idx_chan):
"""Take the mean across channels and regress out the mean from each channel
Parameters
----------
x : ndarray
2d array with channels on one dimension
idx_chan:
which axis contains channels
Returns
-------
ndarray
same as... | [
"def",
"compute_average_regress",
"(",
"x",
",",
"idx_chan",
")",
":",
"if",
"x",
".",
"ndim",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"f'The number of dimensions must be 2, not {x.ndim}'",
")",
"x",
"=",
"moveaxis",
"(",
"x",
",",
"idx_chan",
",",
"0",
... | Take the mean across channels and regress out the mean from each channel
Parameters
----------
x : ndarray
2d array with channels on one dimension
idx_chan:
which axis contains channels
Returns
-------
ndarray
same as x, but with the mean being regressed out | [
"Take",
"the",
"mean",
"across",
"channels",
"and",
"regress",
"out",
"the",
"mean",
"from",
"each",
"channel"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/montage.py#L155-L182 | train |
wonambi-python/wonambi | wonambi/widgets/utils.py | keep_recent_datasets | def keep_recent_datasets(max_dataset_history, info=None):
"""Keep track of the most recent recordings.
Parameters
----------
max_dataset_history : int
maximum number of datasets to remember
info : str, optional TODO
path to file
Returns
-------
list of str
paths... | python | def keep_recent_datasets(max_dataset_history, info=None):
"""Keep track of the most recent recordings.
Parameters
----------
max_dataset_history : int
maximum number of datasets to remember
info : str, optional TODO
path to file
Returns
-------
list of str
paths... | [
"def",
"keep_recent_datasets",
"(",
"max_dataset_history",
",",
"info",
"=",
"None",
")",
":",
"history",
"=",
"settings",
".",
"value",
"(",
"'recent_recordings'",
",",
"[",
"]",
")",
"if",
"isinstance",
"(",
"history",
",",
"str",
")",
":",
"history",
"=... | Keep track of the most recent recordings.
Parameters
----------
max_dataset_history : int
maximum number of datasets to remember
info : str, optional TODO
path to file
Returns
-------
list of str
paths to most recent datasets (only if you don't specify
new_d... | [
"Keep",
"track",
"of",
"the",
"most",
"recent",
"recordings",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/utils.py#L687-L723 | train |
wonambi-python/wonambi | wonambi/widgets/utils.py | choose_file_or_dir | def choose_file_or_dir():
"""Create a simple message box to see if the user wants to open dir or file
Returns
-------
str
'dir' or 'file' or 'abort'
"""
question = QMessageBox(QMessageBox.Information, 'Open Dataset',
'Do you want to open a file or a directory... | python | def choose_file_or_dir():
"""Create a simple message box to see if the user wants to open dir or file
Returns
-------
str
'dir' or 'file' or 'abort'
"""
question = QMessageBox(QMessageBox.Information, 'Open Dataset',
'Do you want to open a file or a directory... | [
"def",
"choose_file_or_dir",
"(",
")",
":",
"question",
"=",
"QMessageBox",
"(",
"QMessageBox",
".",
"Information",
",",
"'Open Dataset'",
",",
"'Do you want to open a file or a directory?'",
")",
"dir_button",
"=",
"question",
".",
"addButton",
"(",
"'Directory'",
",... | Create a simple message box to see if the user wants to open dir or file
Returns
-------
str
'dir' or 'file' or 'abort' | [
"Create",
"a",
"simple",
"message",
"box",
"to",
"see",
"if",
"the",
"user",
"wants",
"to",
"open",
"dir",
"or",
"file"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/utils.py#L726-L748 | train |
wonambi-python/wonambi | wonambi/widgets/utils.py | convert_name_to_color | def convert_name_to_color(s):
"""Convert any string to an RGB color.
Parameters
----------
s : str
string to convert
selection : bool, optional
if an event is being selected, it's lighter
Returns
-------
instance of QColor
one of the possible color
Notes
... | python | def convert_name_to_color(s):
"""Convert any string to an RGB color.
Parameters
----------
s : str
string to convert
selection : bool, optional
if an event is being selected, it's lighter
Returns
-------
instance of QColor
one of the possible color
Notes
... | [
"def",
"convert_name_to_color",
"(",
"s",
")",
":",
"h",
"=",
"100",
"v",
"=",
"[",
"5",
"*",
"ord",
"(",
"x",
")",
"for",
"x",
"in",
"s",
"]",
"sum_mod",
"=",
"lambda",
"x",
":",
"sum",
"(",
"x",
")",
"%",
"100",
"color",
"=",
"QColor",
"(",... | Convert any string to an RGB color.
Parameters
----------
s : str
string to convert
selection : bool, optional
if an event is being selected, it's lighter
Returns
-------
instance of QColor
one of the possible color
Notes
-----
It takes any string and c... | [
"Convert",
"any",
"string",
"to",
"an",
"RGB",
"color",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/utils.py#L760-L790 | train |
wonambi-python/wonambi | wonambi/widgets/utils.py | freq_from_str | def freq_from_str(freq_str):
"""Obtain frequency ranges from input string, either as list or dynamic
notation.
Parameters
----------
freq_str : str
String with frequency ranges, either as a list:
e.g. [[1-3], [3-5], [5-8]];
or with a dynamic definition: (start, stop, width, ... | python | def freq_from_str(freq_str):
"""Obtain frequency ranges from input string, either as list or dynamic
notation.
Parameters
----------
freq_str : str
String with frequency ranges, either as a list:
e.g. [[1-3], [3-5], [5-8]];
or with a dynamic definition: (start, stop, width, ... | [
"def",
"freq_from_str",
"(",
"freq_str",
")",
":",
"freq",
"=",
"[",
"]",
"as_list",
"=",
"freq_str",
"[",
"1",
":",
"-",
"1",
"]",
".",
"replace",
"(",
"' '",
",",
"''",
")",
".",
"split",
"(",
"','",
")",
"try",
":",
"if",
"freq_str",
"[",
"0... | Obtain frequency ranges from input string, either as list or dynamic
notation.
Parameters
----------
freq_str : str
String with frequency ranges, either as a list:
e.g. [[1-3], [3-5], [5-8]];
or with a dynamic definition: (start, stop, width, step).
Returns
-------
... | [
"Obtain",
"frequency",
"ranges",
"from",
"input",
"string",
"either",
"as",
"list",
"or",
"dynamic",
"notation",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/utils.py#L793-L838 | train |
wonambi-python/wonambi | wonambi/widgets/utils.py | export_graphics_to_svg | def export_graphics_to_svg(widget, filename):
"""Export graphics to svg
Parameters
----------
widget : instance of QGraphicsView
traces or overview
filename : str
path to save svg
"""
generator = QSvgGenerator()
generator.setFileName(filename)
generator.setSize(widge... | python | def export_graphics_to_svg(widget, filename):
"""Export graphics to svg
Parameters
----------
widget : instance of QGraphicsView
traces or overview
filename : str
path to save svg
"""
generator = QSvgGenerator()
generator.setFileName(filename)
generator.setSize(widge... | [
"def",
"export_graphics_to_svg",
"(",
"widget",
",",
"filename",
")",
":",
"generator",
"=",
"QSvgGenerator",
"(",
")",
"generator",
".",
"setFileName",
"(",
"filename",
")",
"generator",
".",
"setSize",
"(",
"widget",
".",
"size",
"(",
")",
")",
"generator"... | Export graphics to svg
Parameters
----------
widget : instance of QGraphicsView
traces or overview
filename : str
path to save svg | [
"Export",
"graphics",
"to",
"svg"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/utils.py#L869-L887 | train |
wonambi-python/wonambi | wonambi/widgets/utils.py | FormList.get_value | def get_value(self, default=None):
"""Get int from widget.
Parameters
----------
default : list
list with widgets
Returns
-------
list
list that might contain int or str or float etc
"""
if default is None:
de... | python | def get_value(self, default=None):
"""Get int from widget.
Parameters
----------
default : list
list with widgets
Returns
-------
list
list that might contain int or str or float etc
"""
if default is None:
de... | [
"def",
"get_value",
"(",
"self",
",",
"default",
"=",
"None",
")",
":",
"if",
"default",
"is",
"None",
":",
"default",
"=",
"[",
"]",
"try",
":",
"text",
"=",
"literal_eval",
"(",
"self",
".",
"text",
"(",
")",
")",
"if",
"not",
"isinstance",
"(",
... | Get int from widget.
Parameters
----------
default : list
list with widgets
Returns
-------
list
list that might contain int or str or float etc | [
"Get",
"int",
"from",
"widget",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/utils.py#L390-L419 | train |
wonambi-python/wonambi | wonambi/widgets/utils.py | FormDir.connect | def connect(self, funct):
"""Call funct when the text was changed.
Parameters
----------
funct : function
function that broadcasts a change.
Notes
-----
There is something wrong here. When you run this function, it calls
for opening a directo... | python | def connect(self, funct):
"""Call funct when the text was changed.
Parameters
----------
funct : function
function that broadcasts a change.
Notes
-----
There is something wrong here. When you run this function, it calls
for opening a directo... | [
"def",
"connect",
"(",
"self",
",",
"funct",
")",
":",
"def",
"get_directory",
"(",
")",
":",
"rec",
"=",
"QFileDialog",
".",
"getExistingDirectory",
"(",
"self",
",",
"'Path to Recording'",
"' Directory'",
")",
"if",
"rec",
"==",
"''",
":",
"return",
"sel... | Call funct when the text was changed.
Parameters
----------
funct : function
function that broadcasts a change.
Notes
-----
There is something wrong here. When you run this function, it calls
for opening a directory three or four times. This is obvio... | [
"Call",
"funct",
"when",
"the",
"text",
"was",
"changed",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/utils.py#L528-L554 | train |
wonambi-python/wonambi | wonambi/widgets/utils.py | FormMenu.get_value | def get_value(self, default=None):
"""Get selection from widget.
Parameters
----------
default : str
str for use by widget
Returns
-------
str
selected item from the combobox
"""
if default is None:
default = ... | python | def get_value(self, default=None):
"""Get selection from widget.
Parameters
----------
default : str
str for use by widget
Returns
-------
str
selected item from the combobox
"""
if default is None:
default = ... | [
"def",
"get_value",
"(",
"self",
",",
"default",
"=",
"None",
")",
":",
"if",
"default",
"is",
"None",
":",
"default",
"=",
"''",
"try",
":",
"text",
"=",
"self",
".",
"currentText",
"(",
")",
"except",
"ValueError",
":",
"lg",
".",
"debug",
"(",
"... | Get selection from widget.
Parameters
----------
default : str
str for use by widget
Returns
-------
str
selected item from the combobox | [
"Get",
"selection",
"from",
"widget",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/utils.py#L572-L598 | train |
wonambi-python/wonambi | wonambi/ioeeg/bids.py | _write_ieeg_json | def _write_ieeg_json(output_file):
"""Use only required fields
"""
dataset_info = {
"TaskName": "unknown",
"Manufacturer": "n/a",
"PowerLineFrequency": 50,
"iEEGReference": "n/a",
}
with output_file.open('w') as f:
dump(dataset_info, f, indent=' ') | python | def _write_ieeg_json(output_file):
"""Use only required fields
"""
dataset_info = {
"TaskName": "unknown",
"Manufacturer": "n/a",
"PowerLineFrequency": 50,
"iEEGReference": "n/a",
}
with output_file.open('w') as f:
dump(dataset_info, f, indent=' ') | [
"def",
"_write_ieeg_json",
"(",
"output_file",
")",
":",
"dataset_info",
"=",
"{",
"\"TaskName\"",
":",
"\"unknown\"",
",",
"\"Manufacturer\"",
":",
"\"n/a\"",
",",
"\"PowerLineFrequency\"",
":",
"50",
",",
"\"iEEGReference\"",
":",
"\"n/a\"",
",",
"}",
"with",
... | Use only required fields | [
"Use",
"only",
"required",
"fields"
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/bids.py#L115-L126 | train |
wonambi-python/wonambi | wonambi/scroll_data.py | MainWindow.value | def value(self, parameter, new_value=None):
"""This function is a shortcut for any parameter. Instead of calling
the widget, its config and its values, you can call directly the
parameter.
Parameters
----------
parameter : str
name of the parameter of interes... | python | def value(self, parameter, new_value=None):
"""This function is a shortcut for any parameter. Instead of calling
the widget, its config and its values, you can call directly the
parameter.
Parameters
----------
parameter : str
name of the parameter of interes... | [
"def",
"value",
"(",
"self",
",",
"parameter",
",",
"new_value",
"=",
"None",
")",
":",
"for",
"widget_name",
",",
"values",
"in",
"DEFAULTS",
".",
"items",
"(",
")",
":",
"if",
"parameter",
"in",
"values",
".",
"keys",
"(",
")",
":",
"widget",
"=",
... | This function is a shortcut for any parameter. Instead of calling
the widget, its config and its values, you can call directly the
parameter.
Parameters
----------
parameter : str
name of the parameter of interest
new_value : str or float, optional
... | [
"This",
"function",
"is",
"a",
"shortcut",
"for",
"any",
"parameter",
".",
"Instead",
"of",
"calling",
"the",
"widget",
"its",
"config",
"and",
"its",
"values",
"you",
"can",
"call",
"directly",
"the",
"parameter",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/scroll_data.py#L88-L119 | train |
wonambi-python/wonambi | wonambi/scroll_data.py | MainWindow.update | def update(self):
"""Once you open a dataset, it activates all the widgets.
"""
self.info.display_dataset()
self.overview.update()
self.labels.update(labels=self.info.dataset.header['chan_name'])
self.channels.update()
try:
self.info.markers = self.in... | python | def update(self):
"""Once you open a dataset, it activates all the widgets.
"""
self.info.display_dataset()
self.overview.update()
self.labels.update(labels=self.info.dataset.header['chan_name'])
self.channels.update()
try:
self.info.markers = self.in... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"info",
".",
"display_dataset",
"(",
")",
"self",
".",
"overview",
".",
"update",
"(",
")",
"self",
".",
"labels",
".",
"update",
"(",
"labels",
"=",
"self",
".",
"info",
".",
"dataset",
".",
"he... | Once you open a dataset, it activates all the widgets. | [
"Once",
"you",
"open",
"a",
"dataset",
"it",
"activates",
"all",
"the",
"widgets",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/scroll_data.py#L121-L134 | train |
wonambi-python/wonambi | wonambi/scroll_data.py | MainWindow.reset | def reset(self):
"""Remove all the information from previous dataset before loading a
new dataset.
"""
# store current dataset
max_dataset_history = self.value('max_dataset_history')
keep_recent_datasets(max_dataset_history, self.info)
# reset all the widgets
... | python | def reset(self):
"""Remove all the information from previous dataset before loading a
new dataset.
"""
# store current dataset
max_dataset_history = self.value('max_dataset_history')
keep_recent_datasets(max_dataset_history, self.info)
# reset all the widgets
... | [
"def",
"reset",
"(",
"self",
")",
":",
"max_dataset_history",
"=",
"self",
".",
"value",
"(",
"'max_dataset_history'",
")",
"keep_recent_datasets",
"(",
"max_dataset_history",
",",
"self",
".",
"info",
")",
"self",
".",
"labels",
".",
"reset",
"(",
")",
"sel... | Remove all the information from previous dataset before loading a
new dataset. | [
"Remove",
"all",
"the",
"information",
"from",
"previous",
"dataset",
"before",
"loading",
"a",
"new",
"dataset",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/scroll_data.py#L136-L152 | train |
wonambi-python/wonambi | wonambi/scroll_data.py | MainWindow.show_settings | def show_settings(self):
"""Open the Setting windows, after updating the values in GUI. """
self.notes.config.put_values()
self.overview.config.put_values()
self.settings.config.put_values()
self.spectrum.config.put_values()
self.traces.config.put_values()
self.vi... | python | def show_settings(self):
"""Open the Setting windows, after updating the values in GUI. """
self.notes.config.put_values()
self.overview.config.put_values()
self.settings.config.put_values()
self.spectrum.config.put_values()
self.traces.config.put_values()
self.vi... | [
"def",
"show_settings",
"(",
"self",
")",
":",
"self",
".",
"notes",
".",
"config",
".",
"put_values",
"(",
")",
"self",
".",
"overview",
".",
"config",
".",
"put_values",
"(",
")",
"self",
".",
"settings",
".",
"config",
".",
"put_values",
"(",
")",
... | Open the Setting windows, after updating the values in GUI. | [
"Open",
"the",
"Setting",
"windows",
"after",
"updating",
"the",
"values",
"in",
"GUI",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/scroll_data.py#L154-L163 | train |
wonambi-python/wonambi | wonambi/scroll_data.py | MainWindow.show_spindle_dialog | def show_spindle_dialog(self):
"""Create the spindle detection dialog."""
self.spindle_dialog.update_groups()
self.spindle_dialog.update_cycles()
self.spindle_dialog.show() | python | def show_spindle_dialog(self):
"""Create the spindle detection dialog."""
self.spindle_dialog.update_groups()
self.spindle_dialog.update_cycles()
self.spindle_dialog.show() | [
"def",
"show_spindle_dialog",
"(",
"self",
")",
":",
"self",
".",
"spindle_dialog",
".",
"update_groups",
"(",
")",
"self",
".",
"spindle_dialog",
".",
"update_cycles",
"(",
")",
"self",
".",
"spindle_dialog",
".",
"show",
"(",
")"
] | Create the spindle detection dialog. | [
"Create",
"the",
"spindle",
"detection",
"dialog",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/scroll_data.py#L180-L184 | train |
wonambi-python/wonambi | wonambi/scroll_data.py | MainWindow.show_slow_wave_dialog | def show_slow_wave_dialog(self):
"""Create the SW detection dialog."""
self.slow_wave_dialog.update_groups()
self.slow_wave_dialog.update_cycles()
self.slow_wave_dialog.show() | python | def show_slow_wave_dialog(self):
"""Create the SW detection dialog."""
self.slow_wave_dialog.update_groups()
self.slow_wave_dialog.update_cycles()
self.slow_wave_dialog.show() | [
"def",
"show_slow_wave_dialog",
"(",
"self",
")",
":",
"self",
".",
"slow_wave_dialog",
".",
"update_groups",
"(",
")",
"self",
".",
"slow_wave_dialog",
".",
"update_cycles",
"(",
")",
"self",
".",
"slow_wave_dialog",
".",
"show",
"(",
")"
] | Create the SW detection dialog. | [
"Create",
"the",
"SW",
"detection",
"dialog",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/scroll_data.py#L186-L190 | train |
wonambi-python/wonambi | wonambi/scroll_data.py | MainWindow.show_event_analysis_dialog | def show_event_analysis_dialog(self):
"""Create the event analysis dialog."""
self.event_analysis_dialog.update_types()
self.event_analysis_dialog.update_groups()
self.event_analysis_dialog.update_cycles()
self.event_analysis_dialog.show() | python | def show_event_analysis_dialog(self):
"""Create the event analysis dialog."""
self.event_analysis_dialog.update_types()
self.event_analysis_dialog.update_groups()
self.event_analysis_dialog.update_cycles()
self.event_analysis_dialog.show() | [
"def",
"show_event_analysis_dialog",
"(",
"self",
")",
":",
"self",
".",
"event_analysis_dialog",
".",
"update_types",
"(",
")",
"self",
".",
"event_analysis_dialog",
".",
"update_groups",
"(",
")",
"self",
".",
"event_analysis_dialog",
".",
"update_cycles",
"(",
... | Create the event analysis dialog. | [
"Create",
"the",
"event",
"analysis",
"dialog",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/scroll_data.py#L192-L197 | train |
wonambi-python/wonambi | wonambi/scroll_data.py | MainWindow.show_analysis_dialog | def show_analysis_dialog(self):
"""Create the analysis dialog."""
self.analysis_dialog.update_evt_types()
self.analysis_dialog.update_groups()
self.analysis_dialog.update_cycles()
self.analysis_dialog.show() | python | def show_analysis_dialog(self):
"""Create the analysis dialog."""
self.analysis_dialog.update_evt_types()
self.analysis_dialog.update_groups()
self.analysis_dialog.update_cycles()
self.analysis_dialog.show() | [
"def",
"show_analysis_dialog",
"(",
"self",
")",
":",
"self",
".",
"analysis_dialog",
".",
"update_evt_types",
"(",
")",
"self",
".",
"analysis_dialog",
".",
"update_groups",
"(",
")",
"self",
".",
"analysis_dialog",
".",
"update_cycles",
"(",
")",
"self",
"."... | Create the analysis dialog. | [
"Create",
"the",
"analysis",
"dialog",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/scroll_data.py#L199-L204 | train |
wonambi-python/wonambi | wonambi/scroll_data.py | MainWindow.closeEvent | def closeEvent(self, event):
"""save the name of the last open dataset."""
max_dataset_history = self.value('max_dataset_history')
keep_recent_datasets(max_dataset_history, self.info)
settings.setValue('window/geometry', self.saveGeometry())
settings.setValue('window/state', sel... | python | def closeEvent(self, event):
"""save the name of the last open dataset."""
max_dataset_history = self.value('max_dataset_history')
keep_recent_datasets(max_dataset_history, self.info)
settings.setValue('window/geometry', self.saveGeometry())
settings.setValue('window/state', sel... | [
"def",
"closeEvent",
"(",
"self",
",",
"event",
")",
":",
"max_dataset_history",
"=",
"self",
".",
"value",
"(",
"'max_dataset_history'",
")",
"keep_recent_datasets",
"(",
"max_dataset_history",
",",
"self",
".",
"info",
")",
"settings",
".",
"setValue",
"(",
... | save the name of the last open dataset. | [
"save",
"the",
"name",
"of",
"the",
"last",
"open",
"dataset",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/scroll_data.py#L243-L251 | train |
wonambi-python/wonambi | wonambi/ioeeg/bci2000.py | _read_header | def _read_header(filename):
"""It's a pain to parse the header. It might be better to use the cpp code
but I would need to include it here.
"""
header = _read_header_text(filename)
first_row = header[0]
EXTRA_ROWS = 3 # drop DefaultValue1 LowRange1 HighRange1
hdr = {}
for group in find... | python | def _read_header(filename):
"""It's a pain to parse the header. It might be better to use the cpp code
but I would need to include it here.
"""
header = _read_header_text(filename)
first_row = header[0]
EXTRA_ROWS = 3 # drop DefaultValue1 LowRange1 HighRange1
hdr = {}
for group in find... | [
"def",
"_read_header",
"(",
"filename",
")",
":",
"header",
"=",
"_read_header_text",
"(",
"filename",
")",
"first_row",
"=",
"header",
"[",
"0",
"]",
"EXTRA_ROWS",
"=",
"3",
"hdr",
"=",
"{",
"}",
"for",
"group",
"in",
"finditer",
"(",
"'(\\w*)= ([\\w.]*)'... | It's a pain to parse the header. It might be better to use the cpp code
but I would need to include it here. | [
"It",
"s",
"a",
"pain",
"to",
"parse",
"the",
"header",
".",
"It",
"might",
"be",
"better",
"to",
"use",
"the",
"cpp",
"code",
"but",
"I",
"would",
"need",
"to",
"include",
"it",
"here",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/bci2000.py#L212-L260 | train |
wonambi-python/wonambi | wonambi/trans/reject.py | remove_artf_evts | def remove_artf_evts(times, annot, chan=None, min_dur=0.1):
"""Correct times to remove events marked 'Artefact'.
Parameters
----------
times : list of tuple of float
the start and end times of each segment
annot : instance of Annotations
the annotation file containing events and epo... | python | def remove_artf_evts(times, annot, chan=None, min_dur=0.1):
"""Correct times to remove events marked 'Artefact'.
Parameters
----------
times : list of tuple of float
the start and end times of each segment
annot : instance of Annotations
the annotation file containing events and epo... | [
"def",
"remove_artf_evts",
"(",
"times",
",",
"annot",
",",
"chan",
"=",
"None",
",",
"min_dur",
"=",
"0.1",
")",
":",
"new_times",
"=",
"times",
"beg",
"=",
"times",
"[",
"0",
"]",
"[",
"0",
"]",
"end",
"=",
"times",
"[",
"-",
"1",
"]",
"[",
"... | Correct times to remove events marked 'Artefact'.
Parameters
----------
times : list of tuple of float
the start and end times of each segment
annot : instance of Annotations
the annotation file containing events and epochs
chan : str, optional
full name of channel on which ... | [
"Correct",
"times",
"to",
"remove",
"events",
"marked",
"Artefact",
"."
] | 1d8e3d7e53df8017c199f703bcab582914676e76 | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/reject.py#L13-L83 | train |
SuLab/WikidataIntegrator | wikidataintegrator/wdi_core.py | WDBaseDataType.statement_ref_mode | def statement_ref_mode(self, value):
"""Set the reference mode for a statement, always overrides the global reference state."""
valid_values = ['STRICT_KEEP', 'STRICT_KEEP_APPEND', 'STRICT_OVERWRITE', 'KEEP_GOOD', 'CUSTOM']
if value not in valid_values:
raise ValueError('Not an allow... | python | def statement_ref_mode(self, value):
"""Set the reference mode for a statement, always overrides the global reference state."""
valid_values = ['STRICT_KEEP', 'STRICT_KEEP_APPEND', 'STRICT_OVERWRITE', 'KEEP_GOOD', 'CUSTOM']
if value not in valid_values:
raise ValueError('Not an allow... | [
"def",
"statement_ref_mode",
"(",
"self",
",",
"value",
")",
":",
"valid_values",
"=",
"[",
"'STRICT_KEEP'",
",",
"'STRICT_KEEP_APPEND'",
",",
"'STRICT_OVERWRITE'",
",",
"'KEEP_GOOD'",
",",
"'CUSTOM'",
"]",
"if",
"value",
"not",
"in",
"valid_values",
":",
"raise... | Set the reference mode for a statement, always overrides the global reference state. | [
"Set",
"the",
"reference",
"mode",
"for",
"a",
"statement",
"always",
"overrides",
"the",
"global",
"reference",
"state",
"."
] | 8ceb2ed1c08fec070ec9edfcf7db7b8691481b62 | https://github.com/SuLab/WikidataIntegrator/blob/8ceb2ed1c08fec070ec9edfcf7db7b8691481b62/wikidataintegrator/wdi_core.py#L1641-L1647 | train |
SuLab/WikidataIntegrator | wikidataintegrator/wdi_core.py | WDBaseDataType.equals | def equals(self, that, include_ref=False, fref=None):
"""
Tests for equality of two statements.
If comparing references, the order of the arguments matters!!!
self is the current statement, the next argument is the new statement.
Allows passing in a function to use to compare the... | python | def equals(self, that, include_ref=False, fref=None):
"""
Tests for equality of two statements.
If comparing references, the order of the arguments matters!!!
self is the current statement, the next argument is the new statement.
Allows passing in a function to use to compare the... | [
"def",
"equals",
"(",
"self",
",",
"that",
",",
"include_ref",
"=",
"False",
",",
"fref",
"=",
"None",
")",
":",
"if",
"not",
"include_ref",
":",
"return",
"self",
"==",
"that",
"if",
"include_ref",
"and",
"self",
"!=",
"that",
":",
"return",
"False",
... | Tests for equality of two statements.
If comparing references, the order of the arguments matters!!!
self is the current statement, the next argument is the new statement.
Allows passing in a function to use to compare the references 'fref'. Default is equality.
fref accepts two argument... | [
"Tests",
"for",
"equality",
"of",
"two",
"statements",
".",
"If",
"comparing",
"references",
"the",
"order",
"of",
"the",
"arguments",
"matters!!!",
"self",
"is",
"the",
"current",
"statement",
"the",
"next",
"argument",
"is",
"the",
"new",
"statement",
".",
... | 8ceb2ed1c08fec070ec9edfcf7db7b8691481b62 | https://github.com/SuLab/WikidataIntegrator/blob/8ceb2ed1c08fec070ec9edfcf7db7b8691481b62/wikidataintegrator/wdi_core.py#L1798-L1814 | train |
SuLab/WikidataIntegrator | wikidataintegrator/wdi_core.py | WDBaseDataType.refs_equal | def refs_equal(olditem, newitem):
"""
tests for exactly identical references
"""
oldrefs = olditem.references
newrefs = newitem.references
ref_equal = lambda oldref, newref: True if (len(oldref) == len(newref)) and all(
x in oldref for x in newref) else False... | python | def refs_equal(olditem, newitem):
"""
tests for exactly identical references
"""
oldrefs = olditem.references
newrefs = newitem.references
ref_equal = lambda oldref, newref: True if (len(oldref) == len(newref)) and all(
x in oldref for x in newref) else False... | [
"def",
"refs_equal",
"(",
"olditem",
",",
"newitem",
")",
":",
"oldrefs",
"=",
"olditem",
".",
"references",
"newrefs",
"=",
"newitem",
".",
"references",
"ref_equal",
"=",
"lambda",
"oldref",
",",
"newref",
":",
"True",
"if",
"(",
"len",
"(",
"oldref",
... | tests for exactly identical references | [
"tests",
"for",
"exactly",
"identical",
"references"
] | 8ceb2ed1c08fec070ec9edfcf7db7b8691481b62 | https://github.com/SuLab/WikidataIntegrator/blob/8ceb2ed1c08fec070ec9edfcf7db7b8691481b62/wikidataintegrator/wdi_core.py#L1817-L1830 | train |
SuLab/WikidataIntegrator | wikidataintegrator/wdi_helpers/__init__.py | try_write | def try_write(wd_item, record_id, record_prop, login, edit_summary='', write=True):
"""
Write a PBB_core item. Log if item was created, updated, or skipped.
Catch and log all errors.
:param wd_item: A wikidata item that will be written
:type wd_item: PBB_Core.WDItemEngine
:param record_id: An e... | python | def try_write(wd_item, record_id, record_prop, login, edit_summary='', write=True):
"""
Write a PBB_core item. Log if item was created, updated, or skipped.
Catch and log all errors.
:param wd_item: A wikidata item that will be written
:type wd_item: PBB_Core.WDItemEngine
:param record_id: An e... | [
"def",
"try_write",
"(",
"wd_item",
",",
"record_id",
",",
"record_prop",
",",
"login",
",",
"edit_summary",
"=",
"''",
",",
"write",
"=",
"True",
")",
":",
"if",
"wd_item",
".",
"require_write",
":",
"if",
"wd_item",
".",
"create_new_item",
":",
"msg",
... | Write a PBB_core item. Log if item was created, updated, or skipped.
Catch and log all errors.
:param wd_item: A wikidata item that will be written
:type wd_item: PBB_Core.WDItemEngine
:param record_id: An external identifier, to be used for logging
:type record_id: str
:param record_prop: Prop... | [
"Write",
"a",
"PBB_core",
"item",
".",
"Log",
"if",
"item",
"was",
"created",
"updated",
"or",
"skipped",
".",
"Catch",
"and",
"log",
"all",
"errors",
"."
] | 8ceb2ed1c08fec070ec9edfcf7db7b8691481b62 | https://github.com/SuLab/WikidataIntegrator/blob/8ceb2ed1c08fec070ec9edfcf7db7b8691481b62/wikidataintegrator/wdi_helpers/__init__.py#L58-L101 | train |
maykinmedia/django-admin-index | django_admin_index/compat/django18.py | _build_app_dict | def _build_app_dict(site, request, label=None):
"""
Builds the app dictionary. Takes an optional label parameters to filter
models of a specific app.
"""
app_dict = {}
if label:
models = {
m: m_a for m, m_a in site._registry.items()
if m._meta.app_label == label
... | python | def _build_app_dict(site, request, label=None):
"""
Builds the app dictionary. Takes an optional label parameters to filter
models of a specific app.
"""
app_dict = {}
if label:
models = {
m: m_a for m, m_a in site._registry.items()
if m._meta.app_label == label
... | [
"def",
"_build_app_dict",
"(",
"site",
",",
"request",
",",
"label",
"=",
"None",
")",
":",
"app_dict",
"=",
"{",
"}",
"if",
"label",
":",
"models",
"=",
"{",
"m",
":",
"m_a",
"for",
"m",
",",
"m_a",
"in",
"site",
".",
"_registry",
".",
"items",
... | Builds the app dictionary. Takes an optional label parameters to filter
models of a specific app. | [
"Builds",
"the",
"app",
"dictionary",
".",
"Takes",
"an",
"optional",
"label",
"parameters",
"to",
"filter",
"models",
"of",
"a",
"specific",
"app",
"."
] | 5bfd90e6945775865d722e0f5058824769f68f04 | https://github.com/maykinmedia/django-admin-index/blob/5bfd90e6945775865d722e0f5058824769f68f04/django_admin_index/compat/django18.py#L13-L76 | train |
maykinmedia/django-admin-index | django_admin_index/compat/django18.py | get_app_list | def get_app_list(site, request):
"""
Returns a sorted list of all the installed apps that have been
registered in this site.
"""
app_dict = _build_app_dict(site, request)
# Sort the apps alphabetically.
app_list = sorted(app_dict.values(), key=lambda x: x['name'].lower())
# Sort the mo... | python | def get_app_list(site, request):
"""
Returns a sorted list of all the installed apps that have been
registered in this site.
"""
app_dict = _build_app_dict(site, request)
# Sort the apps alphabetically.
app_list = sorted(app_dict.values(), key=lambda x: x['name'].lower())
# Sort the mo... | [
"def",
"get_app_list",
"(",
"site",
",",
"request",
")",
":",
"app_dict",
"=",
"_build_app_dict",
"(",
"site",
",",
"request",
")",
"app_list",
"=",
"sorted",
"(",
"app_dict",
".",
"values",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"'... | Returns a sorted list of all the installed apps that have been
registered in this site. | [
"Returns",
"a",
"sorted",
"list",
"of",
"all",
"the",
"installed",
"apps",
"that",
"have",
"been",
"registered",
"in",
"this",
"site",
"."
] | 5bfd90e6945775865d722e0f5058824769f68f04 | https://github.com/maykinmedia/django-admin-index/blob/5bfd90e6945775865d722e0f5058824769f68f04/django_admin_index/compat/django18.py#L79-L93 | train |
SuLab/WikidataIntegrator | wikidataintegrator/wdi_fastrun.py | FastRunContainer.format_query_results | def format_query_results(self, r, prop_nr):
"""
`r` is the results of the sparql query in _query_data and is modified in place
`prop_nr` is needed to get the property datatype to determine how to format the value
`r` is a list of dicts. The keys are:
item: the subject. the i... | python | def format_query_results(self, r, prop_nr):
"""
`r` is the results of the sparql query in _query_data and is modified in place
`prop_nr` is needed to get the property datatype to determine how to format the value
`r` is a list of dicts. The keys are:
item: the subject. the i... | [
"def",
"format_query_results",
"(",
"self",
",",
"r",
",",
"prop_nr",
")",
":",
"prop_dt",
"=",
"self",
".",
"get_prop_datatype",
"(",
"prop_nr",
")",
"for",
"i",
"in",
"r",
":",
"for",
"value",
"in",
"{",
"'item'",
",",
"'sid'",
",",
"'pq'",
",",
"'... | `r` is the results of the sparql query in _query_data and is modified in place
`prop_nr` is needed to get the property datatype to determine how to format the value
`r` is a list of dicts. The keys are:
item: the subject. the item this statement is on
v: the object. The value fo... | [
"r",
"is",
"the",
"results",
"of",
"the",
"sparql",
"query",
"in",
"_query_data",
"and",
"is",
"modified",
"in",
"place",
"prop_nr",
"is",
"needed",
"to",
"get",
"the",
"property",
"datatype",
"to",
"determine",
"how",
"to",
"format",
"the",
"value"
] | 8ceb2ed1c08fec070ec9edfcf7db7b8691481b62 | https://github.com/SuLab/WikidataIntegrator/blob/8ceb2ed1c08fec070ec9edfcf7db7b8691481b62/wikidataintegrator/wdi_fastrun.py#L299-L358 | train |
SuLab/WikidataIntegrator | wikidataintegrator/wdi_fastrun.py | FastRunContainer.clear | def clear(self):
"""
convinience function to empty this fastrun container
"""
self.prop_dt_map = dict()
self.prop_data = dict()
self.rev_lookup = defaultdict(set) | python | def clear(self):
"""
convinience function to empty this fastrun container
"""
self.prop_dt_map = dict()
self.prop_data = dict()
self.rev_lookup = defaultdict(set) | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"prop_dt_map",
"=",
"dict",
"(",
")",
"self",
".",
"prop_data",
"=",
"dict",
"(",
")",
"self",
".",
"rev_lookup",
"=",
"defaultdict",
"(",
"set",
")"
] | convinience function to empty this fastrun container | [
"convinience",
"function",
"to",
"empty",
"this",
"fastrun",
"container"
] | 8ceb2ed1c08fec070ec9edfcf7db7b8691481b62 | https://github.com/SuLab/WikidataIntegrator/blob/8ceb2ed1c08fec070ec9edfcf7db7b8691481b62/wikidataintegrator/wdi_fastrun.py#L504-L510 | train |
sighingnow/parsec.py | src/parsec/__init__.py | times | def times(p, mint, maxt=None):
'''Repeat a parser between `mint` and `maxt` times. DO AS MUCH MATCH AS IT CAN.
Return a list of values.'''
maxt = maxt if maxt else mint
@Parser
def times_parser(text, index):
cnt, values, res = 0, Value.success(index, []), None
while cnt < maxt:
... | python | def times(p, mint, maxt=None):
'''Repeat a parser between `mint` and `maxt` times. DO AS MUCH MATCH AS IT CAN.
Return a list of values.'''
maxt = maxt if maxt else mint
@Parser
def times_parser(text, index):
cnt, values, res = 0, Value.success(index, []), None
while cnt < maxt:
... | [
"def",
"times",
"(",
"p",
",",
"mint",
",",
"maxt",
"=",
"None",
")",
":",
"maxt",
"=",
"maxt",
"if",
"maxt",
"else",
"mint",
"@",
"Parser",
"def",
"times_parser",
"(",
"text",
",",
"index",
")",
":",
"cnt",
",",
"values",
",",
"res",
"=",
"0",
... | Repeat a parser between `mint` and `maxt` times. DO AS MUCH MATCH AS IT CAN.
Return a list of values. | [
"Repeat",
"a",
"parser",
"between",
"mint",
"and",
"maxt",
"times",
".",
"DO",
"AS",
"MUCH",
"MATCH",
"AS",
"IT",
"CAN",
".",
"Return",
"a",
"list",
"of",
"values",
"."
] | ed50e1e259142757470b925f8d20dfe5ad223af0 | https://github.com/sighingnow/parsec.py/blob/ed50e1e259142757470b925f8d20dfe5ad223af0/src/parsec/__init__.py#L405-L441 | train |
sighingnow/parsec.py | src/parsec/__init__.py | optional | def optional(p, default_value=None):
'''`Make a parser as optional. If success, return the result, otherwise return
default_value silently, without raising any exception. If default_value is not
provided None is returned instead.
'''
@Parser
def optional_parser(text, index):
res = p(text... | python | def optional(p, default_value=None):
'''`Make a parser as optional. If success, return the result, otherwise return
default_value silently, without raising any exception. If default_value is not
provided None is returned instead.
'''
@Parser
def optional_parser(text, index):
res = p(text... | [
"def",
"optional",
"(",
"p",
",",
"default_value",
"=",
"None",
")",
":",
"@",
"Parser",
"def",
"optional_parser",
"(",
"text",
",",
"index",
")",
":",
"res",
"=",
"p",
"(",
"text",
",",
"index",
")",
"if",
"res",
".",
"status",
":",
"return",
"Val... | `Make a parser as optional. If success, return the result, otherwise return
default_value silently, without raising any exception. If default_value is not
provided None is returned instead. | [
"Make",
"a",
"parser",
"as",
"optional",
".",
"If",
"success",
"return",
"the",
"result",
"otherwise",
"return",
"default_value",
"silently",
"without",
"raising",
"any",
"exception",
".",
"If",
"default_value",
"is",
"not",
"provided",
"None",
"is",
"returned",... | ed50e1e259142757470b925f8d20dfe5ad223af0 | https://github.com/sighingnow/parsec.py/blob/ed50e1e259142757470b925f8d20dfe5ad223af0/src/parsec/__init__.py#L450-L463 | train |
sighingnow/parsec.py | src/parsec/__init__.py | separated | def separated(p, sep, mint, maxt=None, end=None):
'''Repeat a parser `p` separated by `s` between `mint` and `maxt` times.
When `end` is None, a trailing separator is optional.
When `end` is True, a trailing separator is required.
When `end` is False, a trailing separator is not allowed.
MATCHES AS ... | python | def separated(p, sep, mint, maxt=None, end=None):
'''Repeat a parser `p` separated by `s` between `mint` and `maxt` times.
When `end` is None, a trailing separator is optional.
When `end` is True, a trailing separator is required.
When `end` is False, a trailing separator is not allowed.
MATCHES AS ... | [
"def",
"separated",
"(",
"p",
",",
"sep",
",",
"mint",
",",
"maxt",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"maxt",
"=",
"maxt",
"if",
"maxt",
"else",
"mint",
"@",
"Parser",
"def",
"sep_parser",
"(",
"text",
",",
"index",
")",
":",
"cnt",... | Repeat a parser `p` separated by `s` between `mint` and `maxt` times.
When `end` is None, a trailing separator is optional.
When `end` is True, a trailing separator is required.
When `end` is False, a trailing separator is not allowed.
MATCHES AS MUCH AS POSSIBLE.
Return list of values returned by `... | [
"Repeat",
"a",
"parser",
"p",
"separated",
"by",
"s",
"between",
"mint",
"and",
"maxt",
"times",
".",
"When",
"end",
"is",
"None",
"a",
"trailing",
"separator",
"is",
"optional",
".",
"When",
"end",
"is",
"True",
"a",
"trailing",
"separator",
"is",
"requ... | ed50e1e259142757470b925f8d20dfe5ad223af0 | https://github.com/sighingnow/parsec.py/blob/ed50e1e259142757470b925f8d20dfe5ad223af0/src/parsec/__init__.py#L478-L522 | train |
sighingnow/parsec.py | src/parsec/__init__.py | one_of | def one_of(s):
'''Parser a char from specified string.'''
@Parser
def one_of_parser(text, index=0):
if index < len(text) and text[index] in s:
return Value.success(index + 1, text[index])
else:
return Value.failure(index, 'one of {}'.format(s))
return one_of_parse... | python | def one_of(s):
'''Parser a char from specified string.'''
@Parser
def one_of_parser(text, index=0):
if index < len(text) and text[index] in s:
return Value.success(index + 1, text[index])
else:
return Value.failure(index, 'one of {}'.format(s))
return one_of_parse... | [
"def",
"one_of",
"(",
"s",
")",
":",
"@",
"Parser",
"def",
"one_of_parser",
"(",
"text",
",",
"index",
"=",
"0",
")",
":",
"if",
"index",
"<",
"len",
"(",
"text",
")",
"and",
"text",
"[",
"index",
"]",
"in",
"s",
":",
"return",
"Value",
".",
"s... | Parser a char from specified string. | [
"Parser",
"a",
"char",
"from",
"specified",
"string",
"."
] | ed50e1e259142757470b925f8d20dfe5ad223af0 | https://github.com/sighingnow/parsec.py/blob/ed50e1e259142757470b925f8d20dfe5ad223af0/src/parsec/__init__.py#L567-L575 | train |
sighingnow/parsec.py | src/parsec/__init__.py | none_of | def none_of(s):
'''Parser a char NOT from specified string.'''
@Parser
def none_of_parser(text, index=0):
if index < len(text) and text[index] not in s:
return Value.success(index + 1, text[index])
else:
return Value.failure(index, 'none of {}'.format(s))
return n... | python | def none_of(s):
'''Parser a char NOT from specified string.'''
@Parser
def none_of_parser(text, index=0):
if index < len(text) and text[index] not in s:
return Value.success(index + 1, text[index])
else:
return Value.failure(index, 'none of {}'.format(s))
return n... | [
"def",
"none_of",
"(",
"s",
")",
":",
"@",
"Parser",
"def",
"none_of_parser",
"(",
"text",
",",
"index",
"=",
"0",
")",
":",
"if",
"index",
"<",
"len",
"(",
"text",
")",
"and",
"text",
"[",
"index",
"]",
"not",
"in",
"s",
":",
"return",
"Value",
... | Parser a char NOT from specified string. | [
"Parser",
"a",
"char",
"NOT",
"from",
"specified",
"string",
"."
] | ed50e1e259142757470b925f8d20dfe5ad223af0 | https://github.com/sighingnow/parsec.py/blob/ed50e1e259142757470b925f8d20dfe5ad223af0/src/parsec/__init__.py#L578-L586 | train |
sighingnow/parsec.py | src/parsec/__init__.py | space | def space():
'''Parser a whitespace character.'''
@Parser
def space_parser(text, index=0):
if index < len(text) and text[index].isspace():
return Value.success(index + 1, text[index])
else:
return Value.failure(index, 'one space')
return space_parser | python | def space():
'''Parser a whitespace character.'''
@Parser
def space_parser(text, index=0):
if index < len(text) and text[index].isspace():
return Value.success(index + 1, text[index])
else:
return Value.failure(index, 'one space')
return space_parser | [
"def",
"space",
"(",
")",
":",
"@",
"Parser",
"def",
"space_parser",
"(",
"text",
",",
"index",
"=",
"0",
")",
":",
"if",
"index",
"<",
"len",
"(",
"text",
")",
"and",
"text",
"[",
"index",
"]",
".",
"isspace",
"(",
")",
":",
"return",
"Value",
... | Parser a whitespace character. | [
"Parser",
"a",
"whitespace",
"character",
"."
] | ed50e1e259142757470b925f8d20dfe5ad223af0 | https://github.com/sighingnow/parsec.py/blob/ed50e1e259142757470b925f8d20dfe5ad223af0/src/parsec/__init__.py#L589-L597 | train |
sighingnow/parsec.py | src/parsec/__init__.py | letter | def letter():
'''Parse a letter in alphabet.'''
@Parser
def letter_parser(text, index=0):
if index < len(text) and text[index].isalpha():
return Value.success(index + 1, text[index])
else:
return Value.failure(index, 'a letter')
return letter_parser | python | def letter():
'''Parse a letter in alphabet.'''
@Parser
def letter_parser(text, index=0):
if index < len(text) and text[index].isalpha():
return Value.success(index + 1, text[index])
else:
return Value.failure(index, 'a letter')
return letter_parser | [
"def",
"letter",
"(",
")",
":",
"@",
"Parser",
"def",
"letter_parser",
"(",
"text",
",",
"index",
"=",
"0",
")",
":",
"if",
"index",
"<",
"len",
"(",
"text",
")",
"and",
"text",
"[",
"index",
"]",
".",
"isalpha",
"(",
")",
":",
"return",
"Value",... | Parse a letter in alphabet. | [
"Parse",
"a",
"letter",
"in",
"alphabet",
"."
] | ed50e1e259142757470b925f8d20dfe5ad223af0 | https://github.com/sighingnow/parsec.py/blob/ed50e1e259142757470b925f8d20dfe5ad223af0/src/parsec/__init__.py#L605-L613 | train |
sighingnow/parsec.py | src/parsec/__init__.py | digit | def digit():
'''Parse a digit character.'''
@Parser
def digit_parser(text, index=0):
if index < len(text) and text[index].isdigit():
return Value.success(index + 1, text[index])
else:
return Value.failure(index, 'a digit')
return digit_parser | python | def digit():
'''Parse a digit character.'''
@Parser
def digit_parser(text, index=0):
if index < len(text) and text[index].isdigit():
return Value.success(index + 1, text[index])
else:
return Value.failure(index, 'a digit')
return digit_parser | [
"def",
"digit",
"(",
")",
":",
"@",
"Parser",
"def",
"digit_parser",
"(",
"text",
",",
"index",
"=",
"0",
")",
":",
"if",
"index",
"<",
"len",
"(",
"text",
")",
"and",
"text",
"[",
"index",
"]",
".",
"isdigit",
"(",
")",
":",
"return",
"Value",
... | Parse a digit character. | [
"Parse",
"a",
"digit",
"character",
"."
] | ed50e1e259142757470b925f8d20dfe5ad223af0 | https://github.com/sighingnow/parsec.py/blob/ed50e1e259142757470b925f8d20dfe5ad223af0/src/parsec/__init__.py#L616-L624 | train |
sighingnow/parsec.py | src/parsec/__init__.py | eof | def eof():
'''Parser EOF flag of a string.'''
@Parser
def eof_parser(text, index=0):
if index >= len(text):
return Value.success(index, None)
else:
return Value.failure(index, 'EOF')
return eof_parser | python | def eof():
'''Parser EOF flag of a string.'''
@Parser
def eof_parser(text, index=0):
if index >= len(text):
return Value.success(index, None)
else:
return Value.failure(index, 'EOF')
return eof_parser | [
"def",
"eof",
"(",
")",
":",
"@",
"Parser",
"def",
"eof_parser",
"(",
"text",
",",
"index",
"=",
"0",
")",
":",
"if",
"index",
">=",
"len",
"(",
"text",
")",
":",
"return",
"Value",
".",
"success",
"(",
"index",
",",
"None",
")",
"else",
":",
"... | Parser EOF flag of a string. | [
"Parser",
"EOF",
"flag",
"of",
"a",
"string",
"."
] | ed50e1e259142757470b925f8d20dfe5ad223af0 | https://github.com/sighingnow/parsec.py/blob/ed50e1e259142757470b925f8d20dfe5ad223af0/src/parsec/__init__.py#L627-L635 | train |
sighingnow/parsec.py | src/parsec/__init__.py | string | def string(s):
'''Parser a string.'''
@Parser
def string_parser(text, index=0):
slen, tlen = len(s), len(text)
if text[index:index + slen] == s:
return Value.success(index + slen, s)
else:
matched = 0
while matched < slen and index + matched < tlen... | python | def string(s):
'''Parser a string.'''
@Parser
def string_parser(text, index=0):
slen, tlen = len(s), len(text)
if text[index:index + slen] == s:
return Value.success(index + slen, s)
else:
matched = 0
while matched < slen and index + matched < tlen... | [
"def",
"string",
"(",
"s",
")",
":",
"@",
"Parser",
"def",
"string_parser",
"(",
"text",
",",
"index",
"=",
"0",
")",
":",
"slen",
",",
"tlen",
"=",
"len",
"(",
"s",
")",
",",
"len",
"(",
"text",
")",
"if",
"text",
"[",
"index",
":",
"index",
... | Parser a string. | [
"Parser",
"a",
"string",
"."
] | ed50e1e259142757470b925f8d20dfe5ad223af0 | https://github.com/sighingnow/parsec.py/blob/ed50e1e259142757470b925f8d20dfe5ad223af0/src/parsec/__init__.py#L638-L650 | train |
sighingnow/parsec.py | src/parsec/__init__.py | ParseError.loc_info | def loc_info(text, index):
'''Location of `index` in source code `text`.'''
if index > len(text):
raise ValueError('Invalid index.')
line, last_ln = text.count('\n', 0, index), text.rfind('\n', 0, index)
col = index - (last_ln + 1)
return (line, col) | python | def loc_info(text, index):
'''Location of `index` in source code `text`.'''
if index > len(text):
raise ValueError('Invalid index.')
line, last_ln = text.count('\n', 0, index), text.rfind('\n', 0, index)
col = index - (last_ln + 1)
return (line, col) | [
"def",
"loc_info",
"(",
"text",
",",
"index",
")",
":",
"if",
"index",
">",
"len",
"(",
"text",
")",
":",
"raise",
"ValueError",
"(",
"'Invalid index.'",
")",
"line",
",",
"last_ln",
"=",
"text",
".",
"count",
"(",
"'\\n'",
",",
"0",
",",
"index",
... | Location of `index` in source code `text`. | [
"Location",
"of",
"index",
"in",
"source",
"code",
"text",
"."
] | ed50e1e259142757470b925f8d20dfe5ad223af0 | https://github.com/sighingnow/parsec.py/blob/ed50e1e259142757470b925f8d20dfe5ad223af0/src/parsec/__init__.py#L29-L35 | train |
sighingnow/parsec.py | src/parsec/__init__.py | ParseError.loc | def loc(self):
'''Locate the error position in the source code text.'''
try:
return '{}:{}'.format(*ParseError.loc_info(self.text, self.index))
except ValueError:
return '<out of bounds index {!r}>'.format(self.index) | python | def loc(self):
'''Locate the error position in the source code text.'''
try:
return '{}:{}'.format(*ParseError.loc_info(self.text, self.index))
except ValueError:
return '<out of bounds index {!r}>'.format(self.index) | [
"def",
"loc",
"(",
"self",
")",
":",
"try",
":",
"return",
"'{}:{}'",
".",
"format",
"(",
"*",
"ParseError",
".",
"loc_info",
"(",
"self",
".",
"text",
",",
"self",
".",
"index",
")",
")",
"except",
"ValueError",
":",
"return",
"'<out of bounds index {!r... | Locate the error position in the source code text. | [
"Locate",
"the",
"error",
"position",
"in",
"the",
"source",
"code",
"text",
"."
] | ed50e1e259142757470b925f8d20dfe5ad223af0 | https://github.com/sighingnow/parsec.py/blob/ed50e1e259142757470b925f8d20dfe5ad223af0/src/parsec/__init__.py#L37-L42 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.