Skip to content

Commit

Permalink
Merge pull request #353 from AdinaWagner/enh-bfs
Browse files Browse the repository at this point in the history
ENH/BF: add check for run_info to be a list, pass run_info in correct position.
  • Loading branch information
effigies authored Jan 25, 2019
2 parents e129325 + beba317 commit e9fc2df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion bids/variables/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
'SimpleVariable',
'SparseRunVariable',
'DenseRunVariable',
'BIDSRunInfo',
'BIDSVariableCollection',
'BIDSRunVariableCollection',
'merge_collections',
Expand Down
7 changes: 4 additions & 3 deletions bids/variables/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,7 @@ def split(self, grouper):
subsets = []
for i, (name, g) in enumerate(data.groupby(grouper)):
name = '%s.%s' % (self.name, name)
args = [name, g, self.source]
if hasattr(self, 'run_info'):
args.append(self.run_info)
args = [name, g, getattr(self, 'run_info', None), self.source]
col = self.__class__(*args)
subsets.append(col)
return subsets
Expand Down Expand Up @@ -301,6 +299,9 @@ class SparseRunVariable(SimpleVariable):
def __init__(self, name, data, run_info, source, **kwargs):
if hasattr(run_info, 'duration'):
run_info = [run_info]
if not isinstance(run_info, list):
raise TypeError("We expect a list of run_info, got %s"
% repr(run_info))
self.run_info = run_info
for sc in self._property_columns:
setattr(self, sc, data.pop(sc).values)
Expand Down

0 comments on commit e9fc2df

Please sign in to comment.