Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding txt support for labchart #54

Merged
merged 18 commits into from
Dec 2, 2019
Merged
Changes from 1 commit
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
14 changes: 10 additions & 4 deletions phys2bids/interfaces/txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
phys2bids interface for txt files.
"""

import numpy as np
from phys2bids.physio_obj import BlueprintInput

import numpy as np
def populate_phys_input(filename, chtrig):
"""
Populate object phys_input
Expand Down Expand Up @@ -54,10 +54,16 @@ def populate_phys_input(filename, chtrig):
for item in range_list:
units.append(item.split(' ')[1])
# get names
header[4][1:]
names = ['time']+header[4][1:]
orig_names=header[4][1:]
names = ['time',orig_names[chtrig]]
smoia marked this conversation as resolved.
Show resolved Hide resolved
orig_names.pop(chtrig)
names=names+orig_names
# get channels
timeseries = np.matrix(channel_list).T.tolist()
freq = [1/interval[0]]*len(timeseries)
timeseries=[np.array(darray) for darray in timeseries]
return BlueprintInput(timeseries, freq, names, units)
ordered_timeseries=[timeseries[0],timeseries[chtrig]]
timeseries.pop(chtrig)
timeseries.pop(0)
ordered_timeseries=ordered_timeseries+timeseries
return BlueprintInput(ordered_timeseries, freq, names, units)