rapidtide 3.0.4__py3-none-any.whl → 3.0.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. rapidtide/_version.py +3 -3
  2. rapidtide/calccoherence.py +51 -73
  3. rapidtide/calcnullsimfunc.py +65 -111
  4. rapidtide/calcsimfunc.py +73 -91
  5. rapidtide/data/examples/src/testatlasaverage +22 -0
  6. rapidtide/data/examples/src/testfmri +1 -1
  7. rapidtide/data/examples/src/testhappy +7 -6
  8. rapidtide/genericmultiproc.py +122 -0
  9. rapidtide/happy_supportfuncs.py +10 -1
  10. rapidtide/io.py +4 -2
  11. rapidtide/linfitfiltpass.py +8 -1
  12. rapidtide/makelaggedtcs.py +49 -78
  13. rapidtide/multiproc.py +5 -17
  14. rapidtide/refineregressor.py +59 -81
  15. rapidtide/tests/.coveragerc +9 -0
  16. rapidtide/tests/test_externaltools.py +69 -0
  17. rapidtide/tests/test_fastresampler.py +1 -0
  18. rapidtide/tests/test_fullrunrapidtide_v2.py +1 -0
  19. rapidtide/tests/test_nullcorr.py +2 -5
  20. rapidtide/tests/test_parserfuncs.py +46 -15
  21. rapidtide/tests/test_zRapidtideDataset.py +2 -2
  22. rapidtide/workflows/ccorrica.py +1 -2
  23. rapidtide/workflows/happy.py +3 -1
  24. rapidtide/workflows/rapidtide.py +3 -9
  25. rapidtide/workflows/rapidtide_parser.py +3 -3
  26. rapidtide/workflows/regressfrommaps.py +0 -2
  27. rapidtide/workflows/showxcorrx.py +4 -8
  28. rapidtide/workflows/simdata.py +17 -23
  29. {rapidtide-3.0.4.dist-info → rapidtide-3.0.6.dist-info}/METADATA +1 -1
  30. {rapidtide-3.0.4.dist-info → rapidtide-3.0.6.dist-info}/RECORD +34 -35
  31. {rapidtide-3.0.4.dist-info → rapidtide-3.0.6.dist-info}/WHEEL +1 -1
  32. rapidtide/DerivativeDelay.py +0 -209
  33. rapidtide/calcandfitcorrpairs.py +0 -262
  34. rapidtide/transformerdlfilter.py +0 -126
  35. {rapidtide-3.0.4.dist-info → rapidtide-3.0.6.dist-info}/entry_points.txt +0 -0
  36. {rapidtide-3.0.4.dist-info → rapidtide-3.0.6.dist-info}/licenses/LICENSE +0 -0
  37. {rapidtide-3.0.4.dist-info → rapidtide-3.0.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ # Copyright 2016-2025 Blaise Frederick
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ #
19
+ import gc
20
+ import logging
21
+
22
+ import numpy as np
23
+ from tqdm import tqdm
24
+
25
+ import rapidtide.multiproc as tide_multiproc
26
+
27
+
28
+ def run_multiproc(
29
+ voxelfunc,
30
+ packfunc,
31
+ unpackfunc,
32
+ voxelargs,
33
+ voxelproducts,
34
+ inputshape,
35
+ voxelmask,
36
+ LGR,
37
+ nprocs,
38
+ alwaysmultiproc,
39
+ showprogressbar,
40
+ chunksize,
41
+ indexaxis=0,
42
+ procunit="voxels",
43
+ debug=False,
44
+ **kwargs,
45
+ ):
46
+ if debug:
47
+ print(f"{len(voxelproducts)=}, {voxelproducts[0].shape}")
48
+ if nprocs > 1 or alwaysmultiproc:
49
+ # define the consumer function here so it inherits most of the arguments
50
+ def theconsumerfunc(inQ, outQ):
51
+ while True:
52
+ try:
53
+ # get a new message
54
+ val = inQ.get()
55
+
56
+ # this is the 'TERM' signal
57
+ if val is None:
58
+ break
59
+
60
+ # process and send the data
61
+ outQ.put(
62
+ voxelfunc(
63
+ val,
64
+ packfunc(val, voxelargs),
65
+ debug=debug,
66
+ **kwargs,
67
+ )
68
+ )
69
+ except Exception as e:
70
+ print("error!", e)
71
+ break
72
+
73
+ data_out = tide_multiproc.run_multiproc(
74
+ theconsumerfunc,
75
+ inputshape,
76
+ voxelmask,
77
+ indexaxis=indexaxis,
78
+ procunit=procunit,
79
+ verbose=(LGR is not None),
80
+ nprocs=nprocs,
81
+ showprogressbar=showprogressbar,
82
+ chunksize=chunksize,
83
+ )
84
+
85
+ # unpack the data
86
+ volumetotal = 0
87
+ for returnvals in data_out:
88
+ volumetotal += 1
89
+ unpackfunc(returnvals, voxelproducts)
90
+ del data_out
91
+ else:
92
+ volumetotal = 0
93
+ for vox in tqdm(
94
+ range(0, inputshape[indexaxis]),
95
+ desc="Voxel",
96
+ unit=procunit,
97
+ disable=(not showprogressbar),
98
+ ):
99
+ if voxelmask[vox] > 0:
100
+ dothisone = True
101
+ else:
102
+ dothisone = False
103
+ if dothisone:
104
+ returnvals = voxelfunc(
105
+ vox,
106
+ packfunc(vox, voxelargs),
107
+ debug=debug,
108
+ **kwargs,
109
+ )
110
+ unpackfunc(returnvals, voxelproducts)
111
+ volumetotal += 1
112
+
113
+ # garbage collect
114
+ uncollected = gc.collect()
115
+ if uncollected != 0:
116
+ if LGR is not None:
117
+ LGR.info(f"garbage collected - unable to collect {uncollected} objects")
118
+ else:
119
+ if LGR is not None:
120
+ LGR.info("garbage collected")
121
+
122
+ return volumetotal
@@ -364,7 +364,16 @@ def getcardcoeffs(
364
364
  return peakfreq
365
365
 
366
366
 
367
- def normalizevoxels(fmri_data, detrendorder, validvoxels, time, timings, showprogressbar=False):
367
+ def normalizevoxels(
368
+ fmri_data,
369
+ detrendorder,
370
+ validvoxels,
371
+ time,
372
+ timings,
373
+ LGR=None,
374
+ nprocs=1,
375
+ showprogressbar=False,
376
+ ):
368
377
  print("Normalizing voxels...")
369
378
  normdata = fmri_data * 0.0
370
379
  demeandata = fmri_data * 0.0
rapidtide/io.py CHANGED
@@ -1426,6 +1426,8 @@ def writebidstsv(
1426
1426
  yaxislabel="arbitrary value",
1427
1427
  starttime=0.0,
1428
1428
  append=False,
1429
+ samplerate_tolerance=1e-6,
1430
+ starttime_tolerance=1e-6,
1429
1431
  colsinjson=True,
1430
1432
  colsintsv=False,
1431
1433
  omitjson=False,
@@ -1498,8 +1500,8 @@ def writebidstsv(
1498
1500
  )
1499
1501
  compressed = incompressed
1500
1502
  if (
1501
- (insamplerate == samplerate)
1502
- and (instarttime == starttime)
1503
+ np.fabs(insamplerate - samplerate) < samplerate_tolerance
1504
+ and np.fabs(instarttime - starttime) < starttime_tolerance
1503
1505
  and reshapeddata.shape[1] == indata.shape[1]
1504
1506
  ):
1505
1507
  startcol = len(incolumns)
@@ -106,6 +106,12 @@ def linfitfiltpass(
106
106
  print(f"{fmri_data.shape=}")
107
107
  print(f"{threshval=}")
108
108
  print(f"{theevs.shape=}")
109
+ if procbyvoxel:
110
+ indexaxis = 0
111
+ procunit = "voxels"
112
+ else:
113
+ indexaxis = 1
114
+ procunit = "timepoints"
109
115
  if threshval is None:
110
116
  themask = None
111
117
  else:
@@ -187,7 +193,8 @@ def linfitfiltpass(
187
193
  themask,
188
194
  verbose=verbose,
189
195
  nprocs=nprocs,
190
- procbyvoxel=procbyvoxel,
196
+ indexaxis=indexaxis,
197
+ procunit=procunit,
191
198
  showprogressbar=showprogressbar,
192
199
  chunksize=mp_chunksize,
193
200
  )
@@ -17,32 +17,47 @@
17
17
  #
18
18
  #
19
19
  import gc
20
- import logging
21
20
 
22
21
  import numpy as np
23
- from tqdm import tqdm
24
22
 
25
- import rapidtide.multiproc as tide_multiproc
23
+ import rapidtide.genericmultiproc as tide_genericmultiproc
26
24
 
27
25
 
28
26
  def _procOneVoxelMakelagtc(
29
27
  vox,
30
- lagtcgenerator,
31
- maxlag,
32
- timeaxis,
33
- rt_floatset=np.float64,
34
- rt_floattype="float64",
28
+ voxelargs,
29
+ **kwargs,
35
30
  ):
31
+ # unpack arguments
32
+ options = {
33
+ "rt_floatset": np.float64,
34
+ "debug": False,
35
+ }
36
+ options.update(kwargs)
37
+ rt_floatset = options["rt_floatset"]
38
+ debug = options["debug"]
39
+ (lagtcgenerator, thelag, timeaxis) = voxelargs
40
+ if debug:
41
+ print(f"{vox=}, {thelag=}, {timeaxis=}")
42
+
36
43
  # question - should maxlag be added or subtracted? As of 10/18, it is subtracted
37
44
  # potential answer - tried adding, results are terrible.
38
- thelagtc = rt_floatset(lagtcgenerator.yfromx(timeaxis - maxlag))
45
+ thelagtc = rt_floatset(lagtcgenerator.yfromx(timeaxis - thelag))
39
46
 
40
47
  return (
41
48
  vox,
42
- thelagtc,
49
+ (thelagtc),
43
50
  )
44
51
 
45
52
 
53
+ def _packvoxeldata(voxnum, voxelargs):
54
+ return [voxelargs[0], (voxelargs[1])[voxnum], voxelargs[2]]
55
+
56
+
57
+ def _unpackvoxeldata(retvals, voxelproducts):
58
+ (voxelproducts[0])[retvals[0], :] = retvals[1]
59
+
60
+
46
61
  def makelaggedtcs(
47
62
  lagtcgenerator,
48
63
  timeaxis,
@@ -58,75 +73,31 @@ def makelaggedtcs(
58
73
  rt_floattype="float64",
59
74
  ):
60
75
  inputshape = lagtc.shape
61
- if nprocs > 1 or alwaysmultiproc:
62
- # define the consumer function here so it inherits most of the arguments
63
- def makelagtc_consumer(inQ, outQ):
64
- while True:
65
- try:
66
- # get a new message
67
- val = inQ.get()
68
-
69
- # this is the 'TERM' signal
70
- if val is None:
71
- break
72
-
73
- # process and send the data
74
- outQ.put(
75
- _procOneVoxelMakelagtc(
76
- val,
77
- lagtcgenerator,
78
- lagtimes[val],
79
- timeaxis,
80
- rt_floatset=rt_floatset,
81
- rt_floattype=rt_floattype,
82
- )
83
- )
84
- except Exception as e:
85
- print("error!", e)
86
- break
87
-
88
- data_out = tide_multiproc.run_multiproc(
89
- makelagtc_consumer,
90
- inputshape,
91
- lagmask,
92
- verbose=(LGR is not None),
93
- nprocs=nprocs,
94
- showprogressbar=showprogressbar,
95
- chunksize=chunksize,
96
- )
97
-
98
- # unpack the data
99
- volumetotal = 0
100
- for voxel in data_out:
101
- volumetotal += 1
102
- lagtc[voxel[0], :] = voxel[1]
103
- del data_out
104
- else:
105
- volumetotal = 0
106
- for vox in tqdm(
107
- range(0, inputshape[0]),
108
- desc="Voxel",
109
- unit="voxels",
110
- disable=(not showprogressbar),
111
- ):
112
- if lagmask[vox] > 0:
113
- dothisone = True
114
- else:
115
- dothisone = False
116
- if dothisone:
117
- (
118
- dummy,
119
- lagtc[vox, :],
120
- ) = _procOneVoxelMakelagtc(
121
- vox,
122
- lagtcgenerator,
123
- lagtimes[vox],
124
- timeaxis,
125
- rt_floatset=rt_floatset,
126
- rt_floattype=rt_floattype,
127
- )
128
- volumetotal += 1
76
+ voxelargs = [
77
+ lagtcgenerator,
78
+ lagtimes,
79
+ timeaxis,
80
+ ]
81
+ voxelfunc = _procOneVoxelMakelagtc
82
+ packfunc = _packvoxeldata
83
+ unpackfunc = _unpackvoxeldata
84
+ voxeltargets = [lagtc]
129
85
 
86
+ volumetotal = tide_genericmultiproc.run_multiproc(
87
+ voxelfunc,
88
+ packfunc,
89
+ unpackfunc,
90
+ voxelargs,
91
+ voxeltargets,
92
+ inputshape,
93
+ lagmask,
94
+ LGR,
95
+ nprocs,
96
+ alwaysmultiproc,
97
+ showprogressbar,
98
+ chunksize,
99
+ rt_floatset=rt_floatset,
100
+ )
130
101
  if LGR is not None:
131
102
  LGR.info(f"\nLagged timecourses created for {volumetotal} voxels")
132
103
 
rapidtide/multiproc.py CHANGED
@@ -36,7 +36,7 @@ def maxcpus(reservecpu=True):
36
36
  return mp.cpu_count()
37
37
 
38
38
 
39
- def _process_data(data_in, inQ, outQ, showprogressbar=True, reportstep=1000, chunksize=10000):
39
+ def _process_data(data_in, inQ, outQ, showprogressbar=True, chunksize=10000):
40
40
  # send pos/data to workers
41
41
  data_out = []
42
42
  totalnum = len(data_in)
@@ -89,7 +89,8 @@ def run_multiproc(
89
89
  maskarray,
90
90
  nprocs=1,
91
91
  verbose=True,
92
- procbyvoxel=True,
92
+ indexaxis=0,
93
+ procunit="voxels",
93
94
  showprogressbar=True,
94
95
  chunksize=1000,
95
96
  ):
@@ -113,13 +114,6 @@ def run_multiproc(
113
114
  for i, w in enumerate(workers):
114
115
  w.start()
115
116
 
116
- if procbyvoxel:
117
- indexaxis = 0
118
- procunit = "voxels"
119
- else:
120
- indexaxis = 1
121
- procunit = "timepoints"
122
-
123
117
  # check that the mask array matches the index dimension
124
118
  if maskarray is not None:
125
119
  if inputshape[indexaxis] != len(maskarray):
@@ -159,7 +153,8 @@ def run_multithread(
159
153
  maskarray,
160
154
  verbose=True,
161
155
  nprocs=1,
162
- procbyvoxel=True,
156
+ indexaxis=0,
157
+ procunit="voxels",
163
158
  showprogressbar=True,
164
159
  chunksize=1000,
165
160
  ):
@@ -171,13 +166,6 @@ def run_multithread(
171
166
  for i, w in enumerate(workers):
172
167
  w.start()
173
168
 
174
- if procbyvoxel:
175
- indexaxis = 0
176
- procunit = "voxels"
177
- else:
178
- indexaxis = 1
179
- procunit = "timepoints"
180
-
181
169
  # check that the mask array matches the index dimension
182
170
  if maskarray is not None:
183
171
  if inputshape[indexaxis] != len(maskarray):
@@ -23,12 +23,11 @@ import sys
23
23
  import numpy as np
24
24
  from scipy.stats import pearsonr
25
25
  from sklearn.decomposition import PCA, FastICA
26
- from tqdm import tqdm
27
26
 
28
27
  import rapidtide.fit as tide_fit
28
+ import rapidtide.genericmultiproc as tide_genericmultiproc
29
29
  import rapidtide.io as tide_io
30
30
  import rapidtide.miscmath as tide_math
31
- import rapidtide.multiproc as tide_multiproc
32
31
  import rapidtide.resample as tide_resample
33
32
  import rapidtide.stats as tide_stats
34
33
 
@@ -37,15 +36,26 @@ LGR = logging.getLogger("GENERAL")
37
36
 
38
37
  def _procOneVoxelTimeShift(
39
38
  vox,
40
- fmritc,
41
- lagtime,
42
- padtrs,
43
- fmritr,
44
- detrendorder=1,
45
- offsettime=0.0,
46
- rt_floatset=np.float64,
47
- rt_floattype="float64",
39
+ voxelargs,
40
+ **kwargs,
48
41
  ):
42
+ options = {
43
+ "detrendorder": 1,
44
+ "offsettime": 0.0,
45
+ "debug": False,
46
+ }
47
+ options.update(kwargs)
48
+ detrendorder = options["detrendorder"]
49
+ offsettime = options["offsettime"]
50
+ debug = options["debug"]
51
+ if debug:
52
+ print(f"{detrendorder=} {offsettime=}")
53
+ (
54
+ fmritc,
55
+ lagtime,
56
+ padtrs,
57
+ fmritr,
58
+ ) = voxelargs
49
59
  if detrendorder > 0:
50
60
  normtc = tide_fit.detrend(fmritc, order=detrendorder, demean=True)
51
61
  else:
@@ -57,6 +67,17 @@ def _procOneVoxelTimeShift(
57
67
  return vox, shiftedtc, weights, paddedshiftedtc, paddedweights
58
68
 
59
69
 
70
+ def _packvoxeldata(voxnum, voxelargs):
71
+ return [(voxelargs[0])[voxnum, :], (voxelargs[1])[voxnum], voxelargs[2], voxelargs[3]]
72
+
73
+
74
+ def _unpackvoxeldata(retvals, voxelproducts):
75
+ (voxelproducts[0])[retvals[0], :] = retvals[1]
76
+ (voxelproducts[1])[retvals[0], :] = retvals[2]
77
+ (voxelproducts[2])[retvals[0], :] = retvals[3]
78
+ (voxelproducts[3])[retvals[0], :] = retvals[4]
79
+
80
+
60
81
  def alignvoxels(
61
82
  fmridata,
62
83
  fmritr,
@@ -150,83 +171,40 @@ def alignvoxels(
150
171
  Mask of voxels used for refinement
151
172
  """
152
173
  inputshape = np.shape(fmridata)
153
- volumetotal = np.sum(lagmask)
174
+ voxelargs = [fmridata, lagtimes, padtrs, fmritr]
175
+ voxelfunc = _procOneVoxelTimeShift
176
+ packfunc = _packvoxeldata
177
+ unpackfunc = _unpackvoxeldata
178
+ voxeltargets = [
179
+ shiftedtcs,
180
+ weights,
181
+ paddedshiftedtcs,
182
+ paddedweights,
183
+ ]
154
184
  if debug:
155
185
  print("alignvoxels: {inputshape}")
156
186
  print("volumetotal: {volumetotal}")
157
187
 
158
188
  # timeshift the valid voxels
159
- if nprocs > 1 or alwaysmultiproc:
160
- # define the consumer function here so it inherits most of the arguments
161
- def timeshift_consumer(inQ, outQ):
162
- while True:
163
- try:
164
- # get a new message
165
- val = inQ.get()
166
-
167
- # this is the 'TERM' signal
168
- if val is None:
169
- break
170
-
171
- # process and send the data
172
- outQ.put(
173
- _procOneVoxelTimeShift(
174
- val,
175
- fmridata[val, :],
176
- lagtimes[val],
177
- padtrs,
178
- fmritr,
179
- detrendorder=detrendorder,
180
- offsettime=offsettime,
181
- rt_floatset=rt_floatset,
182
- rt_floattype=rt_floattype,
183
- )
184
- )
185
-
186
- except Exception as e:
187
- print("error!", e)
188
- break
189
-
190
- data_out = tide_multiproc.run_multiproc(
191
- timeshift_consumer,
192
- inputshape,
193
- lagmask,
194
- nprocs=nprocs,
195
- showprogressbar=showprogressbar,
196
- chunksize=chunksize,
197
- )
198
-
199
- # unpack the data
200
- for voxel in data_out:
201
- shiftedtcs[voxel[0], :] = voxel[1]
202
- weights[voxel[0], :] = voxel[2]
203
- paddedshiftedtcs[voxel[0], :] = voxel[3]
204
- paddedweights[voxel[0], :] = voxel[4]
205
- del data_out
189
+ # NOTE need to figure out how to use kwargs to pass extra arguments
190
+ volumetotal = tide_genericmultiproc.run_multiproc(
191
+ voxelfunc,
192
+ packfunc,
193
+ unpackfunc,
194
+ voxelargs,
195
+ voxeltargets,
196
+ inputshape,
197
+ lagmask,
198
+ LGR,
199
+ nprocs,
200
+ alwaysmultiproc,
201
+ showprogressbar,
202
+ chunksize,
203
+ detrendorder=detrendorder,
204
+ offsettime=offsettime,
205
+ debug=debug,
206
+ )
206
207
 
207
- else:
208
- for vox in tqdm(
209
- range(0, inputshape[0]),
210
- desc="Voxel timeshifts",
211
- unit="voxels",
212
- disable=(not showprogressbar),
213
- ):
214
- if lagmask[vox] > 0.5:
215
- retvals = _procOneVoxelTimeShift(
216
- vox,
217
- fmridata[vox, :],
218
- lagtimes[vox],
219
- padtrs,
220
- fmritr,
221
- detrendorder=detrendorder,
222
- offsettime=offsettime,
223
- rt_floatset=rt_floatset,
224
- rt_floattype=rt_floattype,
225
- )
226
- shiftedtcs[retvals[0], :] = retvals[1]
227
- weights[retvals[0], :] = retvals[2]
228
- paddedshiftedtcs[retvals[0], :] = retvals[3]
229
- paddedweights[retvals[0], :] = retvals[4]
230
208
  LGR.info(
231
209
  "Timeshift applied to " + str(int(volumetotal)) + " voxels",
232
210
  )
@@ -11,13 +11,22 @@ omit =
11
11
  ../OrthoImageItem.py
12
12
  ../wiener2.py
13
13
  ../tidepoolTemplate.py
14
+ ../tidepoolTemplate_qt6.py
14
15
  ../tidepoolTemplate_alt.py
16
+ ../tidepoolTemplate_alt_qt6.py
17
+ ../tidepoolTemplate_big.py
18
+ ../tidepoolTemplate_big_qt6.py
19
+ ../notreadyforprimetime/*
15
20
 
16
21
  [report]
17
22
  exclude_lines =
18
23
  # Don't complain if non-runnable code isn't run:
19
24
  if displayplots:
25
+ if doplot:
20
26
  if args.displayplots:
21
27
  if debug:
28
+ if self.debug:
22
29
  if False:
23
30
  if __name__ == .__main__.:
31
+ except np.lib.RankWarning:
32
+ except IndexError:
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ # Copyright 2016-2025 Blaise Frederick
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ #
19
+ import os
20
+
21
+ import matplotlib as mpl
22
+
23
+ import rapidtide.externaltools as tide_exttools
24
+ from rapidtide.tests.utils import get_examples_path, get_test_temp_path, mse
25
+
26
+
27
+ def test_externaltools(debug=False, local=False):
28
+ # set input and output directories
29
+ if local:
30
+ exampleroot = "../data/examples/src"
31
+ testtemproot = "./tmp"
32
+ else:
33
+ exampleroot = get_examples_path()
34
+ testtemproot = get_test_temp_path()
35
+
36
+ thefsldir = tide_exttools.fslinfo()
37
+ if debug:
38
+ print(f"{thefsldir=}")
39
+
40
+ if not local:
41
+ os.environ["FSLDIR"] = "/plausible_FSLDIR"
42
+
43
+ thefsldir = tide_exttools.fslinfo()
44
+ if debug:
45
+ print(f"{thefsldir=}")
46
+
47
+ fslexists, c3dexists, antsexists = tide_exttools.whatexists()
48
+ if debug:
49
+ print(f"{fslexists=}, {c3dexists=}, {antsexists=}")
50
+
51
+ fslsubcmd, flirtcmd, applywarpcmd = tide_exttools.getfslcmds()
52
+ if debug:
53
+ print(f"{fslsubcmd=}, {flirtcmd=}, {applywarpcmd=}")
54
+
55
+ tide_exttools.runflirt(
56
+ "inputname", "targetname", "xform", "outputname", warpfile="thewarp", fake=True
57
+ )
58
+ tide_exttools.runflirt("inputname", "targetname", "xform", "outputname", fake=True)
59
+
60
+ tide_exttools.n4correct("inputname", "outputdir", fake=True)
61
+
62
+ tide_exttools.antsapply(
63
+ "inputname", "targetname", "outputroot", ["transform1", "transform2"], fake=True
64
+ )
65
+
66
+
67
+ if __name__ == "__main__":
68
+ mpl.use("TkAgg")
69
+ test_externaltools(debug=True, local=True)
@@ -45,6 +45,7 @@ def test_FastResampler(debug=False):
45
45
  if debug:
46
46
  print(f"{genlaggedtc.initstart=}, {genlaggedtc.initend=}, {genlaggedtc.initstep=}")
47
47
  print(f"{genlaggedtc.hiresstart=}, {genlaggedtc.hiresend=}, {genlaggedtc.hiresstep=}")
48
+ genlaggedtc.info()
48
49
 
49
50
  # save and reload with another name
50
51
  resamplername = os.path.join(get_test_temp_path(), "savedresampler")
@@ -68,6 +68,7 @@ def test_fullrunrapidtide_v2(debug=False, local=False, displayplots=False):
68
68
  "--outputlevel",
69
69
  "max",
70
70
  "--calccoherence",
71
+ "--cleanrefined",
71
72
  "--dispersioncalc",
72
73
  "--nprocs",
73
74
  "1",