-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure
- Loading branch information
Showing
9 changed files
with
770 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import fnmatch | ||
|
||
|
||
def heur(physinfo, name, task='', acq='', direct='', rec='', run=''): | ||
# ############################## # | ||
# ## Modify here! ## # | ||
# ## ## # | ||
# ## Possible variables are: ## # | ||
# ## -task (required) ## # | ||
# ## -run ## # | ||
# ## -rec ## # | ||
# ## -acq ## # | ||
# ## -direct ## # | ||
# ## ## # | ||
# ## ## # | ||
# ## See example below ## # | ||
# ############################## # | ||
|
||
if fnmatch.fnmatchcase(physinfo, '*samefreq*'): | ||
task = 'test' | ||
run = '00' | ||
rec = 'biopac' | ||
elif physinfo == 'Example': | ||
task = 'rest' | ||
run = '01' | ||
acq = 'resp' | ||
# ############################## # | ||
# ## Don't modify below this! ## # | ||
# ############################## # | ||
else: | ||
# #!# Transform sys.exit in debug warnings or raiseexceptions! | ||
# #!# Make all of the above a dictionary | ||
raise Warning(f'The heuristic {__file__} could not deal with {physinfo}') | ||
|
||
if not task: | ||
raise KeyError(f'No "task" attribute found') | ||
|
||
name = name + '_task-' + task | ||
|
||
# filename spec: sub-<label>[_ses-<label>]_task-<label>[_acq-<label>] ... | ||
# ... [_ce-<label>][_dir-<label>][_rec-<label>] ... | ||
# ... [_run-<index>][_recording-<label>]_physio | ||
if acq: | ||
name = name + '_acq-' + acq | ||
|
||
if direct: | ||
name = name + '_dir-' + direct | ||
|
||
if rec: | ||
name = name + '_rec-' + rec | ||
|
||
if run: | ||
name = name + '_run-' + run | ||
|
||
return name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
phys2bids interface for acqknowledge files. | ||
""" | ||
from bioread import read_file | ||
|
||
from phys2bids.physio_obj import BlueprintInput | ||
|
||
|
||
def populate_phys_input(filename, chtrig): | ||
""" | ||
Populate object phys_input | ||
""" | ||
|
||
data = read_file(filename).channels | ||
|
||
freq = [data[chtrig].samples_per_second] * 2 | ||
timeseries = [data[chtrig].time_index, data[chtrig].data] | ||
units = ['s', data[chtrig].units] | ||
names = ['time', 'trigger'] | ||
|
||
for k, ch in enumerate(data): | ||
if k != chtrig: | ||
print(f'{k:02d}. {ch}') | ||
timeseries.append(ch.data) | ||
freq.append(ch.samples_per_second) | ||
units.append(ch.units) | ||
names.append(ch.name) | ||
|
||
return BlueprintInput(timeseries, freq, names, units) |
Oops, something went wrong.