Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -508,16 +508,16 @@ max-attributes=20
max-bool-expr=5

# Maximum number of branch for function / method body
max-branches=12
max-branches=20

# Maximum number of locals for function / method body
max-locals=30
max-locals=40

# Maximum number of parents for a class (see R0901).
max-parents=7

# Maximum number of public methods for a class (see R0904).
max-public-methods=20
max-public-methods=30

# Maximum number of return / yield for function / method body
max-returns=6
Expand Down
17 changes: 8 additions & 9 deletions cebl/eeg/base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""Module containing EEG base class and related routines.
"""

class EEGBase:
"""Base class for all EEG types.
"""
def __init__(self, nObs, nChan, sampRate=256.0, chanNames=None, deviceName=''):
def __init__(self, nObs, nChan, sampRate=256.0, chanNames=None, deviceName=""):
"""Construct a new EEGBase instance.

Args:
Expand All @@ -17,7 +16,7 @@ def __init__(self, nObs, nChan, sampRate=256.0, chanNames=None, deviceName=''):

chanNames: A list of names of the channels in the eeg data.
If None (default) then the channel names are set
to '1', '2', ... 'nChan'.
to "1", "2", ... "nChan".

deviceName: The name of the device used to record the eeg data.
"""
Expand Down Expand Up @@ -72,7 +71,7 @@ def getChanNames(self, chans=None):
else:
chanNames.append(None)
else:
if c < self.nChan and c >= 0:
if 0 <= c < self.nChan:
chanNames.append(self.chanNames[c])
else:
chanNames.append(None)
Expand All @@ -84,14 +83,14 @@ def setChanNames(self, chanNames=None):

Args:
chanNames: A list or tuple of channel names. If None (default)
then the channel names are set to '1', '2', ... 'nChan'.
then the channel names are set to "1", "2", ... "nChan".
"""
if chanNames is None:
chanNames = [str(i) for i in range(self.nChan)]

if len(chanNames) != self.nChan:
raise RuntimeError('Length of chanNames ' + str(len(chanNames)) + \
' does not match number of channels ' + str(self.nChan))
raise RuntimeError("Length of chanNames " + str(len(chanNames)) +
" does not match number of channels " + str(self.nChan))

self.chanNames = list(chanNames)

Expand Down Expand Up @@ -121,7 +120,7 @@ def getChanIndices(self, chans=None):
else:
chanIndices.append(None)
else:
if c < self.nChan and c >= 0:
if 0 <= c < self.nChan:
chanIndices.append(c)
else:
chanIndices.append(None)
Expand All @@ -137,7 +136,7 @@ def setDeviceName(self, deviceName):
"""Set the name of the device used to record the eeg data.
"""
if deviceName is None:
deviceName = ''
deviceName = ""
self.deviceName = str(deviceName)
return self

Expand Down
Loading