@@ -300,8 +300,7 @@ class GetTimeSeriesInputSpec(BaseInterfaceInputSpec):
300300If greater than the number of possible combinations, the exact resampling will be performed.""" )
301301
302302 sampling_interval = traits .Float (2 ,desc = "TR of the data in sec" )
303-
304-
303+
305304class GetTimeSeriesOutputSpec (TraitedSpec ):
306305 timeseries = File (desc = """The timeseries file as a compressed umpy (.npz) file with fields : TODO""" )
307306
@@ -395,6 +394,11 @@ class CorrelationAnalysisInputSpec(BaseInterfaceInputSpec):
395394 timeseries = File (
396395 exists = True ,
397396 desc = 'Timeseries file produced by GetTimeSeries interface.' )
397+
398+ time_range = traits .Tuple (
399+ (0 ,None ), * ([traits .Trait (None ,None ,traits .Int ())]* 2 ),
400+ usedefault = True ,
401+ desc = 'range of timeseries to use to compute correlation' )
398402
399403 bootstrap_estimation = traits .Bool (
400404 False , usedefault = True ,
@@ -424,14 +428,15 @@ class CorrelationAnalysis(BaseInterface):
424428 def _run_interface (self ,runtime ):
425429 tsfile = loadpkl (self .inputs .timeseries )
426430 ts = np .array ([tsfile ['timeseries' ][roi ] for roi in tsfile ['labels' ]])
431+ ts = ts [:,slice (* self .inputs .time_range )]
427432 if self .inputs .bootstrap_estimation :
428433 std ,lb ,ub ,samples = bootstrap .generic_bootstrap (
429434 ts , np .corrcoef ,
430435 self .inputs .bootstrap_nsamples )
431436 pval = std
432437 corr = samples .mean (0 )
433438 nnan = np .count_nonzero (np .isnan (samples ))
434- print nnan ,'nan in correlations'
439+ # print nnan ,'nan in correlations'
435440 partialcorr = None
436441 partialpval = None
437442 if nnan == 0 :
0 commit comments