Skip to content

Commit

Permalink
sqc fixes for unicorn (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnGriffiths authored Jul 20, 2022
1 parent f208e08 commit 453b85d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
40 changes: 22 additions & 18 deletions eegnb/analysis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@
logger = logging.getLogger(__name__)


# Empirically determined lower and upper bounds of
# acceptable temporal standard deviations
# for different EEG devices tested by us
openbci_devices = ['ganglion', 'ganglion_wifi', 'cyton', 'cyton_wifi', 'cyton_daisy_wifi']
muse_devices = ['muse' + model + sfx for model in ['2016', '2', 'S'] for sfx in ['', '_bfn', '_bfb']]
neurosity_devices = ['notion1', 'notion2', 'crown']
gtec_devices = ['unicorn']
alltesteddevices = openbci_devices + muse_devices + neurosity_devices + gtec_devices
thres_stds = {}
for device in alltesteddevices:
if device in openbci_devices: thres_stds[device] = [1,9]
elif device in muse_devices: thres_stds[device] = [1,18]
elif device in neurosity_devices: thres_stds[device] = [1,15]
elif device in gtec_devices: thres_stds[device] = [1,15]


def load_csv_as_raw(
fnames: List[str],
sfreq: float,
Expand Down Expand Up @@ -445,25 +461,13 @@ def check_report(eeg: EEG, n_times: int=60, pause_time=5, thres_std_low=None, th

# If no upper and lower std thresholds set in function call,
# set thresholds based on the following per-device name defaults
if thres_std_high is None:
if eeg.device_name in ["ganglion", "ganglion_wifi", "cyton",
"cyton_wifi", "cyton_daisy", "cyton_daisy_wifi"]:
thres_std_high = 9
elif eeg.device_name in ["notion1", "notion2", "crown"]:
thres_std_high = 15
elif 'muse' in eeg.device_name:
thres_std_high = 18

edn = eeg.device_name
if thres_std_low is None:

if 'muse' in eeg.device_name:
thres_std_low = 1

elif eeg.device_name in ["ganglion", "ganglion_wifi", "cyton",
"cyton_wifi", "cyton_daisy", "cyton_daisy_wifi",
"notion1", "notion2", "crown"]:
thres_std_low = 1

if edn in thres_stds.keys():
thres_std_low = thres_stds[edn][0]
if thres_std_high is None:
if edn in thres_stds.keys():
thres_std_high = thres_stds[edn][1]

print("\n\nRunning signal quality check...")
print(f"Accepting threshold stdev between: {thres_std_low} - {thres_std_high}")
Expand Down
2 changes: 1 addition & 1 deletion eegnb/cli/introprompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def device_prompt() -> EEG:
"ganglion": "OpenBCI Ganglion",
"cyton": "OpenBCI Cyton",
"cyton_daisy": "OpenBCI Cyton + Daisy",
"unicord": "G.Tec Unicorn",
"unicorn": "G.Tec Unicorn",
"brainbit": "BrainBit",
"notion1": "Notion 1",
"notion2": "Notion 2",
Expand Down

0 comments on commit 453b85d

Please sign in to comment.