-
Notifications
You must be signed in to change notification settings - Fork 0
/
00_check_scanner.py
37 lines (27 loc) · 998 Bytes
/
00_check_scanner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""Example script for checking the data and which scanner data was recorded with.
This script has to be run on a computer with a MaxFilter license.
"""
from subprocess import PIPE, run
import numpy as np
raw_dir = "/home/mtrubshaw/Documents/ALS_dyn/data/raw/"
files = ["sXX_resting.fif"]
ids = []
dates = []
scanners = []
print()
for file in files:
path = raw_dir + file
cmd = f"/neuro/bin/util/show_fiff -v -t 100:206 {path}"
result = run(cmd.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE)
stdout = result.stdout.splitlines()
date = str(stdout[0]).split(" ")[-1][2:-1]
scanner = str(stdout[1]).split(" ")[-1][2:-1]
print(file)
print(f"date: {date}")
print(f"scanner: {scanner}")
print()
ids.append(file)
dates.append(date)
scanners.append(scanner)
output = [ids,dates,scanners]
print("See: https://github.com/OHBA-analysis/osl/tree/examples/examples/oxford/maxfilter for what to use for the --scanner argument.")