Skip to content

Commit 2723c61

Browse files
committed
RF: NitimeBaseInterface
1 parent 3a54409 commit 2723c61

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

nipype/interfaces/nitime/analysis.py

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,15 @@
1919

2020
from ...utils.misc import package_check
2121
from ...utils.filemanip import fname_presuffix
22-
from ..base import (TraitedSpec, File, Undefined, traits, BaseInterface,
22+
from .base import NitimeBaseInterface
23+
from ..base import (TraitedSpec, File, Undefined, traits,
2324
isdefined, BaseInterfaceInputSpec)
2425

2526
have_nitime = True
2627
try:
2728
package_check('nitime')
28-
except Exception as e:
29+
except ImportError:
2930
have_nitime = False
30-
else:
31-
import nitime.analysis as nta
32-
from nitime.timeseries import TimeSeries
33-
import nitime.viz as viz
3431

3532

3633
class CoherenceAnalyzerInputSpec(BaseInterfaceInputSpec):
@@ -116,7 +113,7 @@ class CoherenceAnalyzerOutputSpec(TraitedSpec):
116113
timedelay_fig = File(desc=('Figure representing coherence values'))
117114

118115

119-
class CoherenceAnalyzer(BaseInterface):
116+
class CoherenceAnalyzer(NitimeBaseInterface):
120117

121118
input_spec = CoherenceAnalyzerInputSpec
122119
output_spec = CoherenceAnalyzerOutputSpec
@@ -148,6 +145,7 @@ def _read_csv(self):
148145

149146
def _csv2ts(self):
150147
""" Read data from the in_file and generate a nitime TimeSeries object"""
148+
from nitime.timeseries import TimeSeries
151149
data, roi_names = self._read_csv()
152150

153151
TS = TimeSeries(
@@ -159,6 +157,7 @@ def _csv2ts(self):
159157

160158
# Rewrite _run_interface, but not run
161159
def _run_interface(self, runtime):
160+
import nitime.analysis as nta
162161
lb, ub = self.inputs.frequency_range
163162

164163
if self.inputs.in_TS is Undefined:
@@ -253,6 +252,7 @@ def _make_output_figures(self):
253252
self.inputs.output_figure_file
254253
255254
"""
255+
import nitime.viz as viz
256256
if self.inputs.figure_type == 'matrix':
257257
fig_coh = viz.drawmatrix_channels(
258258
self.coherence, channel_names=self.ROIs, color_anchor=0)
@@ -281,16 +281,3 @@ def _make_output_figures(self):
281281
fig_dt.savefig(
282282
fname_presuffix(
283283
self.inputs.output_figure_file, suffix='_delay'))
284-
285-
286-
class GetTimeSeriesInputSpec(object):
287-
pass
288-
289-
290-
class GetTimeSeriesOutputSpec(object):
291-
pass
292-
293-
294-
class GetTimeSeries(object):
295-
# getting time series data from nifti files and ROIs
296-
pass

nipype/interfaces/nitime/base.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# -*- coding: utf-8 -*-
2+
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
3+
# vi: set ft=python sts=4 ts=4 sw=4 et:
4+
""" Base interface for nitime """
5+
6+
from ..base import LibraryBaseInterface
7+
8+
9+
class NitimeBaseInterface(LibraryBaseInterface):
10+
_pkg = 'nitime'

0 commit comments

Comments
 (0)