rapidtide 3.0.7.1__py3-none-any.whl → 3.0.9__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.
- rapidtide/RapidtideDataset.py +1 -1
- rapidtide/_version.py +3 -3
- rapidtide/calcnullsimfunc.py +1 -3
- rapidtide/data/examples/src/test_findmaxlag.py +1 -1
- rapidtide/data/examples/src/testfmri +19 -7
- rapidtide/data/examples/src/testnewrefine +0 -23
- rapidtide/fMRIData_class.py +29 -52
- rapidtide/fit.py +4 -4
- rapidtide/happy_supportfuncs.py +1 -1
- rapidtide/helper_classes.py +0 -1099
- rapidtide/linfitfiltpass.py +82 -4
- rapidtide/makelaggedtcs.py +10 -0
- rapidtide/refinedelay.py +11 -20
- rapidtide/refineregressor.py +1 -1
- rapidtide/resample.py +8 -8
- rapidtide/simFuncClasses.py +1132 -0
- rapidtide/simfuncfit.py +30 -30
- rapidtide/stats.py +5 -2
- rapidtide/tests/.coveragerc +6 -0
- rapidtide/tests/cleanposttest +1 -1
- rapidtide/tests/runlocaltest +2 -2
- rapidtide/tests/test_cleanregressor.py +3 -3
- rapidtide/tests/test_congrid.py +1 -1
- rapidtide/tests/test_corrpass.py +3 -3
- rapidtide/tests/test_delayestimation.py +9 -8
- rapidtide/tests/test_findmaxlag.py +2 -2
- rapidtide/tests/test_fullrunrapidtide_v3.py +2 -1
- rapidtide/tests/test_fullrunrapidtide_v8.py +66 -0
- rapidtide/tests/test_getparsers.py +14 -6
- rapidtide/tests/test_io.py +2 -6
- rapidtide/tests/test_nullcorr.py +3 -3
- rapidtide/tests/test_refinedelay.py +20 -5
- rapidtide/tidepoolTemplate_alt.py +1 -1
- rapidtide/util.py +7 -0
- rapidtide/voxelData.py +3 -6
- rapidtide/workflows/calcSimFuncMap.py +271 -0
- rapidtide/workflows/cleanregressor.py +2 -2
- rapidtide/workflows/delayvar.py +45 -59
- rapidtide/workflows/fitSimFuncMap.py +427 -0
- rapidtide/workflows/happy.py +1 -1
- rapidtide/workflows/rapidtide.py +499 -877
- rapidtide/workflows/rapidtide_parser.py +26 -38
- rapidtide/workflows/refineDelayMap.py +138 -0
- rapidtide/{RegressorRefiner.py → workflows/refineRegressor.py} +200 -28
- rapidtide/workflows/regressfrommaps.py +38 -30
- rapidtide/workflows/retrolagtcs.py +5 -6
- rapidtide/workflows/retroregress.py +73 -191
- rapidtide/workflows/showarbcorr.py +2 -2
- rapidtide/workflows/showxcorrx.py +5 -5
- rapidtide/workflows/tidepool.py +5 -5
- {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/METADATA +2 -2
- {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/RECORD +56 -52
- rapidtide/workflows/delayestimation.py +0 -483
- {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/WHEEL +0 -0
- {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/entry_points.txt +0 -0
- {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/licenses/LICENSE +0 -0
- {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/top_level.txt +0 -0
rapidtide/simfuncfit.py
CHANGED
|
@@ -208,10 +208,10 @@ def fitcorr(
|
|
|
208
208
|
break
|
|
209
209
|
|
|
210
210
|
# process and send the data
|
|
211
|
-
if (
|
|
211
|
+
if (themask is None) or (initiallags is None):
|
|
212
212
|
thislag = None
|
|
213
213
|
else:
|
|
214
|
-
if
|
|
214
|
+
if themask[val] > 0:
|
|
215
215
|
thislag = initiallags[val]
|
|
216
216
|
else:
|
|
217
217
|
thislag = None
|
|
@@ -289,32 +289,23 @@ def fitcorr(
|
|
|
289
289
|
unit="voxels",
|
|
290
290
|
disable=(not showprogressbar),
|
|
291
291
|
):
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
# process and send the data
|
|
293
|
+
if (themask is None) or (initiallags is None):
|
|
294
294
|
thislag = None
|
|
295
|
-
elif themask[vox] > 0:
|
|
296
295
|
dothisone = True
|
|
297
|
-
thislag = initiallags[vox]
|
|
298
296
|
else:
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
if themask[vox] > 0:
|
|
298
|
+
thislag = initiallags[vox]
|
|
299
|
+
dothisone = True
|
|
300
|
+
else:
|
|
301
|
+
thislag = None
|
|
302
|
+
dothisone = False
|
|
301
303
|
if isinstance(initialdelayvalue, np.ndarray):
|
|
302
304
|
thisinitialdelayvalue = initialdelayvalue[vox]
|
|
303
305
|
else:
|
|
304
306
|
thisinitialdelayvalue = initialdelayvalue
|
|
305
307
|
if dothisone:
|
|
306
|
-
(
|
|
307
|
-
dummy,
|
|
308
|
-
volumetotalinc,
|
|
309
|
-
lagtimes[vox],
|
|
310
|
-
lagstrengths[vox],
|
|
311
|
-
lagsigma[vox],
|
|
312
|
-
gaussout[vox, :],
|
|
313
|
-
windowout[vox, :],
|
|
314
|
-
R2[vox],
|
|
315
|
-
lagmask[vox],
|
|
316
|
-
failreason,
|
|
317
|
-
) = _procOneVoxelFitcorr(
|
|
308
|
+
voxel = _procOneVoxelFitcorr(
|
|
318
309
|
vox,
|
|
319
310
|
corrout[vox, :],
|
|
320
311
|
thefitter,
|
|
@@ -326,29 +317,38 @@ def fitcorr(
|
|
|
326
317
|
rt_floatset=rt_floatset,
|
|
327
318
|
rt_floattype=rt_floattype,
|
|
328
319
|
)
|
|
329
|
-
volumetotal += volumetotalinc
|
|
330
320
|
if (
|
|
331
321
|
thefitter.FML_INITAMPLOW
|
|
332
322
|
| thefitter.FML_INITAMPHIGH
|
|
333
323
|
| thefitter.FML_FITAMPLOW
|
|
334
324
|
| thefitter.FML_FITAMPHIGH
|
|
335
|
-
) &
|
|
325
|
+
) & voxel[9]:
|
|
336
326
|
ampfails += 1
|
|
337
|
-
if (thefitter.FML_INITWIDTHLOW | thefitter.FML_FITWIDTHLOW) &
|
|
327
|
+
if (thefitter.FML_INITWIDTHLOW | thefitter.FML_FITWIDTHLOW) & voxel[9]:
|
|
338
328
|
lowwidthfails += 1
|
|
339
|
-
if (thefitter.FML_INITWIDTHHIGH | thefitter.FML_FITWIDTHHIGH) &
|
|
329
|
+
if (thefitter.FML_INITWIDTHHIGH | thefitter.FML_FITWIDTHHIGH) & voxel[9]:
|
|
340
330
|
highwidthfails += 1
|
|
341
|
-
if (thefitter.FML_INITLAGLOW | thefitter.
|
|
331
|
+
if (thefitter.FML_INITLAGLOW | thefitter.FML_FITLAGLOW) & voxel[9]:
|
|
342
332
|
lowlagfails += 1
|
|
343
|
-
if (thefitter.
|
|
344
|
-
lowlagfails += 1
|
|
345
|
-
if (thefitter.FML_INITLAGHIGH | thefitter.FML_FITLAGHIGH) & failreason:
|
|
333
|
+
if (thefitter.FML_INITLAGHIGH | thefitter.FML_FITLAGHIGH) & voxel[9]:
|
|
346
334
|
highlagfails += 1
|
|
347
|
-
if thefitter.FML_INITFAIL &
|
|
335
|
+
if thefitter.FML_INITFAIL & voxel[9]:
|
|
348
336
|
initfails += 1
|
|
349
|
-
if thefitter.FML_FITFAIL &
|
|
337
|
+
if thefitter.FML_FITFAIL & voxel[9]:
|
|
350
338
|
fitfails += 1
|
|
351
339
|
|
|
340
|
+
# if this is a despeckle pass, only accept the new values if the fit did not fail
|
|
341
|
+
if (voxel[9] == 0) or not despeckling:
|
|
342
|
+
volumetotal += voxel[1]
|
|
343
|
+
lagtimes[vox] = voxel[2]
|
|
344
|
+
lagstrengths[vox] = voxel[3]
|
|
345
|
+
lagsigma[vox] = voxel[4]
|
|
346
|
+
gaussout[vox, :] = voxel[5]
|
|
347
|
+
windowout[vox, :] = voxel[6]
|
|
348
|
+
R2[vox] = voxel[7]
|
|
349
|
+
lagmask[vox] = voxel[8]
|
|
350
|
+
failimage[vox] = voxel[9] & 0xFFFF
|
|
351
|
+
|
|
352
352
|
LGR.info(f"\nSimilarity function fitted in {volumetotal} voxels")
|
|
353
353
|
LGR.info(
|
|
354
354
|
f"\tampfails: {ampfails}"
|
rapidtide/stats.py
CHANGED
|
@@ -269,7 +269,7 @@ def sigFromDistributionData(
|
|
|
269
269
|
# check to make sure there are nonzero values first
|
|
270
270
|
if len(np.where(vallist != 0.0)[0]) == 0:
|
|
271
271
|
print("no nonzero values - skipping percentile calculation")
|
|
272
|
-
return None,
|
|
272
|
+
return None, None, None
|
|
273
273
|
thehistogram, peakheight, peakloc, peakwidth, centerofmass, peakpercentile = makehistogram(
|
|
274
274
|
np.abs(vallist), histlen, therange=[0.0, 1.0]
|
|
275
275
|
)
|
|
@@ -300,7 +300,10 @@ def sigFromDistributionData(
|
|
|
300
300
|
pcts_fit = getfracvalsfromfit(histfit, thepercentiles)
|
|
301
301
|
return pcts_data, pcts_fit, histfit
|
|
302
302
|
else:
|
|
303
|
-
|
|
303
|
+
pcts_fit = []
|
|
304
|
+
for i in len(pcts_data):
|
|
305
|
+
pcts_fit.append(None)
|
|
306
|
+
return pcts_data, pcts_fit, None
|
|
304
307
|
|
|
305
308
|
|
|
306
309
|
global neglogpfromr_interpolator, minrforneglogp, maxrforneglogp
|
rapidtide/tests/.coveragerc
CHANGED
|
@@ -22,9 +22,15 @@ omit =
|
|
|
22
22
|
exclude_lines =
|
|
23
23
|
# Don't complain if non-runnable code isn't run:
|
|
24
24
|
if displayplots:
|
|
25
|
+
if args.displayplots:
|
|
26
|
+
if args.display:
|
|
25
27
|
if doplot:
|
|
28
|
+
if args.doplot:
|
|
26
29
|
if args.displayplots:
|
|
27
30
|
if debug:
|
|
31
|
+
if optiondict["debug"]:
|
|
32
|
+
if optiondict['debug']:
|
|
33
|
+
if args.debug:
|
|
28
34
|
if self.debug:
|
|
29
35
|
if False:
|
|
30
36
|
if __name__ == .__main__.:
|
rapidtide/tests/cleanposttest
CHANGED
rapidtide/tests/runlocaltest
CHANGED
|
@@ -22,9 +22,9 @@ import matplotlib as mpl
|
|
|
22
22
|
import numpy as np
|
|
23
23
|
|
|
24
24
|
import rapidtide.filter as tide_filt
|
|
25
|
-
import rapidtide.helper_classes as tide_classes
|
|
26
25
|
import rapidtide.miscmath as tide_math
|
|
27
26
|
import rapidtide.resample as tide_resample
|
|
27
|
+
import rapidtide.simFuncClasses as tide_simFuncClasses
|
|
28
28
|
import rapidtide.workflows.cleanregressor as tide_cleanregressor
|
|
29
29
|
from rapidtide.tests.utils import get_examples_path, get_test_temp_path, mse
|
|
30
30
|
|
|
@@ -58,14 +58,14 @@ def test_cleanregressor(debug=False, local=False, displayplots=False):
|
|
|
58
58
|
osvalidsimcalcstart = 0
|
|
59
59
|
osvalidsimcalcend = tclen * oversampfac
|
|
60
60
|
|
|
61
|
-
theCorrelator =
|
|
61
|
+
theCorrelator = tide_simFuncClasses.Correlator(
|
|
62
62
|
Fs=oversampfreq,
|
|
63
63
|
ncprefilter=theprefilter,
|
|
64
64
|
detrendorder=1,
|
|
65
65
|
windowfunc="hamming",
|
|
66
66
|
corrweighting="phat",
|
|
67
67
|
)
|
|
68
|
-
theFitter =
|
|
68
|
+
theFitter = tide_simFuncClasses.SimilarityFunctionFitter(
|
|
69
69
|
lagmod=lagmod,
|
|
70
70
|
lagmin=lagmin,
|
|
71
71
|
lagmax=lagmax,
|
rapidtide/tests/test_congrid.py
CHANGED
|
@@ -20,8 +20,8 @@ import matplotlib as mpl
|
|
|
20
20
|
import matplotlib.pyplot as plt
|
|
21
21
|
import numpy as np
|
|
22
22
|
|
|
23
|
-
from rapidtide.resample import congrid
|
|
24
23
|
from rapidtide.happy_supportfuncs import preloadcongrid
|
|
24
|
+
from rapidtide.resample import congrid
|
|
25
25
|
from rapidtide.tests.utils import mse
|
|
26
26
|
|
|
27
27
|
|
rapidtide/tests/test_corrpass.py
CHANGED
|
@@ -23,8 +23,8 @@ import numpy as np
|
|
|
23
23
|
import rapidtide.calcsimfunc as tide_calcsimfunc
|
|
24
24
|
import rapidtide.correlate as tide_corr
|
|
25
25
|
import rapidtide.filter as tide_filt
|
|
26
|
-
import rapidtide.helper_classes as tide_classes
|
|
27
26
|
import rapidtide.resample as tide_resample
|
|
27
|
+
import rapidtide.simFuncClasses as tide_simFuncClasses
|
|
28
28
|
import rapidtide.simfuncfit as tide_simfuncfit
|
|
29
29
|
from rapidtide.tests.utils import mse
|
|
30
30
|
|
|
@@ -133,7 +133,7 @@ def test_calcsimfunc(debug=False, displayplots=False):
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
theprefilter = tide_filt.NoncausalFilter("lfo")
|
|
136
|
-
theCorrelator =
|
|
136
|
+
theCorrelator = tide_simFuncClasses.Correlator(
|
|
137
137
|
Fs=oversampfreq,
|
|
138
138
|
ncprefilter=theprefilter,
|
|
139
139
|
detrendorder=optiondict["detrendorder"],
|
|
@@ -141,7 +141,7 @@ def test_calcsimfunc(debug=False, displayplots=False):
|
|
|
141
141
|
corrweighting=optiondict["corrweighting"],
|
|
142
142
|
)
|
|
143
143
|
|
|
144
|
-
thefitter =
|
|
144
|
+
thefitter = tide_simFuncClasses.SimilarityFunctionFitter(
|
|
145
145
|
lagmod=optiondict["lagmod"],
|
|
146
146
|
lthreshval=optiondict["lthreshval"],
|
|
147
147
|
uthreshval=optiondict["uthreshval"],
|
|
@@ -24,11 +24,11 @@ import numpy as np
|
|
|
24
24
|
|
|
25
25
|
import rapidtide.calcsimfunc as tide_calcsimfunc
|
|
26
26
|
import rapidtide.filter as tide_filt
|
|
27
|
-
import rapidtide.helper_classes as tide_classes
|
|
28
27
|
import rapidtide.linfitfiltpass as tide_linfitfiltpass
|
|
29
28
|
import rapidtide.miscmath as tide_math
|
|
30
29
|
import rapidtide.peakeval as tide_peakeval
|
|
31
30
|
import rapidtide.resample as tide_resample
|
|
31
|
+
import rapidtide.simFuncClasses as tide_simFuncClasses
|
|
32
32
|
import rapidtide.simfuncfit as tide_simfuncfit
|
|
33
33
|
import rapidtide.util as tide_util
|
|
34
34
|
|
|
@@ -130,7 +130,7 @@ def test_delayestimation(displayplots=False, debug=False):
|
|
|
130
130
|
# set up theCorrelator
|
|
131
131
|
if debug:
|
|
132
132
|
print("\n\nsetting up theCorrelator")
|
|
133
|
-
theCorrelator =
|
|
133
|
+
theCorrelator = tide_simFuncClasses.Correlator(
|
|
134
134
|
Fs=oversampfreq,
|
|
135
135
|
ncprefilter=theprefilter,
|
|
136
136
|
detrendorder=detrendorder,
|
|
@@ -152,7 +152,7 @@ def test_delayestimation(displayplots=False, debug=False):
|
|
|
152
152
|
# set up theMutualInformationator
|
|
153
153
|
if debug:
|
|
154
154
|
print("\n\nsetting up theMutualInformationator")
|
|
155
|
-
theMutualInformationator =
|
|
155
|
+
theMutualInformationator = tide_simFuncClasses.MutualInformationator(
|
|
156
156
|
Fs=oversampfreq,
|
|
157
157
|
smoothingtime=smoothingtime,
|
|
158
158
|
ncprefilter=theprefilter,
|
|
@@ -170,7 +170,7 @@ def test_delayestimation(displayplots=False, debug=False):
|
|
|
170
170
|
# set up thefitter
|
|
171
171
|
if debug:
|
|
172
172
|
print("\n\nsetting up thefitter")
|
|
173
|
-
thefitter =
|
|
173
|
+
thefitter = tide_simFuncClasses.SimilarityFunctionFitter(
|
|
174
174
|
lagmod=lagmod,
|
|
175
175
|
lthreshval=0.0,
|
|
176
176
|
uthreshval=1.0,
|
|
@@ -350,7 +350,7 @@ def test_delayestimation(displayplots=False, debug=False):
|
|
|
350
350
|
nprocs=nprocs,
|
|
351
351
|
alwaysmultiproc=False,
|
|
352
352
|
showprogressbar=False,
|
|
353
|
-
|
|
353
|
+
chunksize=chunksize,
|
|
354
354
|
)
|
|
355
355
|
|
|
356
356
|
if nprocs == 1:
|
|
@@ -360,9 +360,10 @@ def test_delayestimation(displayplots=False, debug=False):
|
|
|
360
360
|
diffsignal = filtereddata
|
|
361
361
|
fig = plt.figure()
|
|
362
362
|
ax = fig.add_subplot(1, 1, 1)
|
|
363
|
-
# ax.plot(
|
|
364
|
-
ax.plot(
|
|
365
|
-
ax.plot(timepoints, movingsignal[refnum, :], label="movingsignal")
|
|
363
|
+
# ax.plot(oversamptimepoints, referencetc, label="referencetc")
|
|
364
|
+
ax.plot(timepoints, waveforms[refnum, :], label="waveform")
|
|
365
|
+
ax.plot(timepoints, fitcoff[refnum] * movingsignal[refnum, :], label="movingsignal")
|
|
366
|
+
# ax.plot(timepoints, filtereddata[refnum, :], label="filtereddata")
|
|
366
367
|
ax.legend()
|
|
367
368
|
plt.show()
|
|
368
369
|
|
|
@@ -24,8 +24,8 @@ import matplotlib.pyplot as plt
|
|
|
24
24
|
import numpy as np
|
|
25
25
|
|
|
26
26
|
import rapidtide.fit as tide_fit
|
|
27
|
-
import rapidtide.helper_classes as tide_classes
|
|
28
27
|
import rapidtide.io as tide_io
|
|
28
|
+
import rapidtide.simFuncClasses as tide_simFuncClasses
|
|
29
29
|
from rapidtide.tests.utils import get_examples_path
|
|
30
30
|
|
|
31
31
|
|
|
@@ -101,7 +101,7 @@ def test_findmaxlag(displayplots=False, debug=False):
|
|
|
101
101
|
fmlc_lfailreasons = np.zeros(len(testlags), dtype=np.uint16)
|
|
102
102
|
|
|
103
103
|
# initialize the correlation fitter
|
|
104
|
-
thefitter =
|
|
104
|
+
thefitter = tide_simFuncClasses.SimilarityFunctionFitter(
|
|
105
105
|
corrtimeaxis=xvecs,
|
|
106
106
|
lagmin=lagmin,
|
|
107
107
|
lagmax=lagmax,
|
|
@@ -22,8 +22,8 @@ import matplotlib as mpl
|
|
|
22
22
|
|
|
23
23
|
import rapidtide.workflows.rapidtide as rapidtide_workflow
|
|
24
24
|
import rapidtide.workflows.rapidtide_parser as rapidtide_parser
|
|
25
|
-
from rapidtide.tests.utils import get_examples_path, get_test_temp_path
|
|
26
25
|
import rapidtide.workflows.retroregress as rapidtide_retroregress
|
|
26
|
+
from rapidtide.tests.utils import get_examples_path, get_test_temp_path
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
def test_fullrunrapidtide_v3(debug=False, local=False, displayplots=False):
|
|
@@ -87,6 +87,7 @@ def test_fullrunrapidtide_v3(debug=False, local=False, displayplots=False):
|
|
|
87
87
|
]
|
|
88
88
|
rapidtide_retroregress.retroregress(rapidtide_retroregress.process_args(inputargs=inputargs))
|
|
89
89
|
|
|
90
|
+
|
|
90
91
|
if __name__ == "__main__":
|
|
91
92
|
mpl.use("TkAgg")
|
|
92
93
|
test_fullrunrapidtide_v3(debug=True, local=True, displayplots=True)
|
|
@@ -0,0 +1,66 @@
|
|
|
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.qualitycheck as rapidtide_quality
|
|
24
|
+
import rapidtide.workflows.rapidtide as rapidtide_workflow
|
|
25
|
+
import rapidtide.workflows.rapidtide_parser as rapidtide_parser
|
|
26
|
+
from rapidtide.tests.utils import get_examples_path, get_test_temp_path
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_fullrunrapidtide_v8(debug=False, local=False, displayplots=False):
|
|
30
|
+
# set input and output directories
|
|
31
|
+
if local:
|
|
32
|
+
exampleroot = "../data/examples/src"
|
|
33
|
+
testtemproot = "./tmp"
|
|
34
|
+
else:
|
|
35
|
+
exampleroot = get_examples_path()
|
|
36
|
+
testtemproot = get_test_temp_path()
|
|
37
|
+
|
|
38
|
+
# run rapidtide
|
|
39
|
+
inputargs = [
|
|
40
|
+
os.path.join(exampleroot, "sub-RAPIDTIDETEST.nii.gz"),
|
|
41
|
+
os.path.join(testtemproot, "sub-RAPIDTIDETEST8"),
|
|
42
|
+
"--spatialfilt",
|
|
43
|
+
"2",
|
|
44
|
+
"--simcalcrange",
|
|
45
|
+
"4",
|
|
46
|
+
"-1",
|
|
47
|
+
"--searchrange",
|
|
48
|
+
"-5",
|
|
49
|
+
"10",
|
|
50
|
+
"--nprocs",
|
|
51
|
+
"-1",
|
|
52
|
+
"--passes",
|
|
53
|
+
"1",
|
|
54
|
+
"--despecklepasses",
|
|
55
|
+
"3",
|
|
56
|
+
"--similaritymetric",
|
|
57
|
+
"riptide",
|
|
58
|
+
"--riptidestep",
|
|
59
|
+
"1.5",
|
|
60
|
+
]
|
|
61
|
+
rapidtide_workflow.rapidtide_main(rapidtide_parser.process_args(inputargs=inputargs))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
if __name__ == "__main__":
|
|
65
|
+
mpl.use("TkAgg")
|
|
66
|
+
test_fullrunrapidtide_v8(debug=True, local=True, displayplots=True)
|
|
@@ -33,18 +33,24 @@ from rapidtide.workflows.filtnifti import _get_parser as filtnifti_getparser
|
|
|
33
33
|
from rapidtide.workflows.filttc import _get_parser as filttc_getparser
|
|
34
34
|
from rapidtide.workflows.fixtr import _get_parser as fixtr_getparser
|
|
35
35
|
from rapidtide.workflows.gmscalc import _get_parser as gmscalc_getparser
|
|
36
|
-
from rapidtide.workflows.happy_parser import _get_parser as happy_parser_getparser
|
|
37
36
|
from rapidtide.workflows.happy2std import _get_parser as happy2std_getparser
|
|
37
|
+
from rapidtide.workflows.happy_parser import _get_parser as happy_parser_getparser
|
|
38
38
|
from rapidtide.workflows.histnifti import _get_parser as histnifti_getparser
|
|
39
39
|
from rapidtide.workflows.histtc import _get_parser as histtc_getparser
|
|
40
40
|
from rapidtide.workflows.linfitfilt import _get_parser as linfitfilt_getparser
|
|
41
41
|
from rapidtide.workflows.localflow import _get_parser as localflow_getparser
|
|
42
42
|
from rapidtide.workflows.mergequality import _get_parser as mergequality_getparser
|
|
43
|
-
from rapidtide.workflows.niftidecomp import
|
|
44
|
-
|
|
43
|
+
from rapidtide.workflows.niftidecomp import (
|
|
44
|
+
_get_parser_spatial as niftidecomp_getparser_spatial,
|
|
45
|
+
)
|
|
46
|
+
from rapidtide.workflows.niftidecomp import (
|
|
47
|
+
_get_parser_temporal as niftidecomp_getparser_temporal,
|
|
48
|
+
)
|
|
45
49
|
from rapidtide.workflows.niftistats import _get_parser as niftistats_getparser
|
|
46
50
|
from rapidtide.workflows.pairproc import _get_parser as pairproc_getparser
|
|
47
|
-
from rapidtide.workflows.pairwisemergenifti import
|
|
51
|
+
from rapidtide.workflows.pairwisemergenifti import (
|
|
52
|
+
_get_parser as pairwisemergenifti_getparser,
|
|
53
|
+
)
|
|
48
54
|
from rapidtide.workflows.physiofreq import _get_parser as physiofreq_getparser
|
|
49
55
|
from rapidtide.workflows.pixelcomp import _get_parser as pixelcomp_getparser
|
|
50
56
|
from rapidtide.workflows.plethquality import _get_parser as plethquality_getparser
|
|
@@ -75,7 +81,8 @@ from rapidtide.workflows.variabilityizer import _get_parser as variabilityizer_g
|
|
|
75
81
|
|
|
76
82
|
|
|
77
83
|
def test_parsers(debug=False):
|
|
78
|
-
parserlist = [
|
|
84
|
+
parserlist = [
|
|
85
|
+
adjustoffset_getparser,
|
|
79
86
|
aligntcs_getparser,
|
|
80
87
|
applydlfilter_getparser,
|
|
81
88
|
atlasaverage_getparser,
|
|
@@ -128,7 +135,8 @@ def test_parsers(debug=False):
|
|
|
128
135
|
synthASL_getparser,
|
|
129
136
|
tcfrom2col_getparser,
|
|
130
137
|
tcfrom3col_getparser,
|
|
131
|
-
variabilityizer_getparser
|
|
138
|
+
variabilityizer_getparser,
|
|
139
|
+
]
|
|
132
140
|
|
|
133
141
|
for thegetparser in parserlist:
|
|
134
142
|
theusage = thegetparser().format_help()
|
rapidtide/tests/test_io.py
CHANGED
|
@@ -95,14 +95,10 @@ def test_io(debug=True, local=False, displayplots=False):
|
|
|
95
95
|
|
|
96
96
|
# test fmritimeinfo
|
|
97
97
|
fmritimeinfothresh = 1e-2
|
|
98
|
-
tr, timepoints = tide_io.fmritimeinfo(
|
|
99
|
-
os.path.join(exampleroot, "sub-HAPPYTEST.nii.gz")
|
|
100
|
-
)
|
|
98
|
+
tr, timepoints = tide_io.fmritimeinfo(os.path.join(exampleroot, "sub-HAPPYTEST.nii.gz"))
|
|
101
99
|
assert np.fabs(tr - 1.16) < fmritimeinfothresh
|
|
102
100
|
assert timepoints == 110
|
|
103
|
-
tr, timepoints = tide_io.fmritimeinfo(
|
|
104
|
-
os.path.join(exampleroot, "sub-RAPIDTIDETEST.nii.gz")
|
|
105
|
-
)
|
|
101
|
+
tr, timepoints = tide_io.fmritimeinfo(os.path.join(exampleroot, "sub-RAPIDTIDETEST.nii.gz"))
|
|
106
102
|
assert np.fabs(tr - 1.5) < fmritimeinfothresh
|
|
107
103
|
assert timepoints == 260
|
|
108
104
|
|
rapidtide/tests/test_nullcorr.py
CHANGED
|
@@ -25,8 +25,8 @@ import numpy as np
|
|
|
25
25
|
import rapidtide.calcnullsimfunc as tide_nullsimfunc
|
|
26
26
|
import rapidtide.correlate as tide_corr
|
|
27
27
|
import rapidtide.filter as tide_filt
|
|
28
|
-
import rapidtide.helper_classes as tide_classes
|
|
29
28
|
import rapidtide.io as tide_io
|
|
29
|
+
import rapidtide.simFuncClasses as tide_simFuncClasses
|
|
30
30
|
import rapidtide.stats as tide_stats
|
|
31
31
|
from rapidtide.tests.utils import get_test_data_path, get_test_temp_path
|
|
32
32
|
|
|
@@ -94,7 +94,7 @@ def test_nullsimfunc(debug=False, displayplots=False):
|
|
|
94
94
|
"hardlimit": True,
|
|
95
95
|
}
|
|
96
96
|
theprefilter = tide_filt.NoncausalFilter("lfo")
|
|
97
|
-
theCorrelator =
|
|
97
|
+
theCorrelator = tide_simFuncClasses.Correlator(
|
|
98
98
|
Fs=Fs,
|
|
99
99
|
ncprefilter=theprefilter,
|
|
100
100
|
detrendorder=optiondict["detrendorder"],
|
|
@@ -102,7 +102,7 @@ def test_nullsimfunc(debug=False, displayplots=False):
|
|
|
102
102
|
corrweighting=optiondict["corrweighting"],
|
|
103
103
|
)
|
|
104
104
|
|
|
105
|
-
thefitter =
|
|
105
|
+
thefitter = tide_simFuncClasses.SimilarityFunctionFitter(
|
|
106
106
|
lagmod=optiondict["lagmod"],
|
|
107
107
|
lthreshval=optiondict["lthreshval"],
|
|
108
108
|
uthreshval=optiondict["uthreshval"],
|
|
@@ -36,6 +36,7 @@ def eval_refinedelay(
|
|
|
36
36
|
tclengthinsecs=300.0,
|
|
37
37
|
mindelay=-5.0,
|
|
38
38
|
maxdelay=5.0,
|
|
39
|
+
lagpad=0.0,
|
|
39
40
|
numpoints=501,
|
|
40
41
|
smoothpts=3,
|
|
41
42
|
nativespaceshape=(10, 10, 10),
|
|
@@ -43,8 +44,17 @@ def eval_refinedelay(
|
|
|
43
44
|
padtime=30.0,
|
|
44
45
|
noiselevel=0.0,
|
|
45
46
|
outputsuffix="",
|
|
47
|
+
local=False,
|
|
46
48
|
debug=False,
|
|
47
49
|
):
|
|
50
|
+
# set input and output directories
|
|
51
|
+
if local:
|
|
52
|
+
exampleroot = "../data/examples/src"
|
|
53
|
+
testtemproot = "./tmp"
|
|
54
|
+
else:
|
|
55
|
+
exampleroot = get_examples_path()
|
|
56
|
+
testtemproot = get_test_temp_path()
|
|
57
|
+
|
|
48
58
|
np.random.seed(12345)
|
|
49
59
|
tclen = int(tclengthinsecs // sampletime)
|
|
50
60
|
|
|
@@ -84,7 +94,7 @@ def eval_refinedelay(
|
|
|
84
94
|
tide_refinedelay.trainratiotooffset(
|
|
85
95
|
lagtcgenerator,
|
|
86
96
|
timeaxis,
|
|
87
|
-
os.path.join(
|
|
97
|
+
os.path.join(testtemproot, "refinedelaytest" + outputsuffix),
|
|
88
98
|
"norm",
|
|
89
99
|
mindelay=mindelay,
|
|
90
100
|
maxdelay=maxdelay,
|
|
@@ -95,7 +105,7 @@ def eval_refinedelay(
|
|
|
95
105
|
|
|
96
106
|
# make a delay map
|
|
97
107
|
numlags = nativespaceshape[0] * nativespaceshape[1] * nativespaceshape[2]
|
|
98
|
-
lagtimes = np.linspace(mindelay, maxdelay, numlags, endpoint=True)
|
|
108
|
+
lagtimes = np.linspace(mindelay - lagpad, maxdelay + lagpad, numlags, endpoint=True)
|
|
99
109
|
if debug:
|
|
100
110
|
print(" lagtimes=", lagtimes)
|
|
101
111
|
|
|
@@ -120,7 +130,7 @@ def eval_refinedelay(
|
|
|
120
130
|
|
|
121
131
|
# make a fake header
|
|
122
132
|
nim, nim_data, nim_hdr, thedims, thesizes = tide_io.readfromnifti(
|
|
123
|
-
os.path.join(
|
|
133
|
+
os.path.join(exampleroot, "sub-RAPIDTIDETEST_brainmask.nii.gz")
|
|
124
134
|
)
|
|
125
135
|
xdim, ydim, slicedim, fmritr = tide_io.parseniftisizes(thesizes)
|
|
126
136
|
theheader = copy.copy(nim_hdr)
|
|
@@ -212,7 +222,7 @@ def eval_refinedelay(
|
|
|
212
222
|
plt.show()
|
|
213
223
|
|
|
214
224
|
|
|
215
|
-
def test_refinedelay(displayplots=False, debug=False):
|
|
225
|
+
def test_refinedelay(displayplots=False, local=False, debug=False):
|
|
216
226
|
for noiselevel in np.linspace(0.0, 0.5, num=5, endpoint=True):
|
|
217
227
|
eval_refinedelay(
|
|
218
228
|
sampletime=0.72,
|
|
@@ -225,6 +235,7 @@ def test_refinedelay(displayplots=False, debug=False):
|
|
|
225
235
|
displayplots=displayplots,
|
|
226
236
|
outputsuffix="_1",
|
|
227
237
|
noiselevel=noiselevel,
|
|
238
|
+
local=local,
|
|
228
239
|
debug=debug,
|
|
229
240
|
)
|
|
230
241
|
eval_refinedelay(
|
|
@@ -237,6 +248,7 @@ def test_refinedelay(displayplots=False, debug=False):
|
|
|
237
248
|
nativespaceshape=(10, 10, 10),
|
|
238
249
|
displayplots=displayplots,
|
|
239
250
|
outputsuffix="_2",
|
|
251
|
+
local=local,
|
|
240
252
|
debug=debug,
|
|
241
253
|
)
|
|
242
254
|
eval_refinedelay(
|
|
@@ -249,6 +261,7 @@ def test_refinedelay(displayplots=False, debug=False):
|
|
|
249
261
|
nativespaceshape=(10, 10, 10),
|
|
250
262
|
displayplots=displayplots,
|
|
251
263
|
outputsuffix="_3",
|
|
264
|
+
local=local,
|
|
252
265
|
debug=debug,
|
|
253
266
|
)
|
|
254
267
|
eval_refinedelay(
|
|
@@ -261,6 +274,7 @@ def test_refinedelay(displayplots=False, debug=False):
|
|
|
261
274
|
nativespaceshape=(10, 10, 10),
|
|
262
275
|
displayplots=displayplots,
|
|
263
276
|
outputsuffix="_1p5_501_3",
|
|
277
|
+
local=local,
|
|
264
278
|
debug=debug,
|
|
265
279
|
)
|
|
266
280
|
eval_refinedelay(
|
|
@@ -273,10 +287,11 @@ def test_refinedelay(displayplots=False, debug=False):
|
|
|
273
287
|
nativespaceshape=(10, 10, 10),
|
|
274
288
|
displayplots=displayplots,
|
|
275
289
|
outputsuffix="_3p0_501_3",
|
|
290
|
+
local=local,
|
|
276
291
|
debug=debug,
|
|
277
292
|
)
|
|
278
293
|
|
|
279
294
|
|
|
280
295
|
if __name__ == "__main__":
|
|
281
296
|
mpl.use("TkAgg")
|
|
282
|
-
test_refinedelay(displayplots=True, debug=True)
|
|
297
|
+
test_refinedelay(displayplots=True, local=True, debug=True)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Form implementation generated from reading ui file 'tidepoolTemplate_alt.ui'
|
|
4
4
|
#
|
|
5
|
-
# Created by: PyQt5 UI code generator 5.15.
|
|
5
|
+
# Created by: PyQt5 UI code generator 5.15.11
|
|
6
6
|
#
|
|
7
7
|
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
|
8
8
|
# run again. Do not edit this file unless you know what you are doing.
|
rapidtide/util.py
CHANGED
|
@@ -1106,6 +1106,13 @@ def allocshared(theshape, thetype, name=None):
|
|
|
1106
1106
|
return outarray, shm # Return both the array and the shared memory object
|
|
1107
1107
|
|
|
1108
1108
|
|
|
1109
|
+
def allocarray(theshape, thetype, shared=False, name=None):
|
|
1110
|
+
if shared:
|
|
1111
|
+
return allocshared(theshape, thetype, name)
|
|
1112
|
+
else:
|
|
1113
|
+
return np.zeros(theshape, dtype=thetype), None
|
|
1114
|
+
|
|
1115
|
+
|
|
1109
1116
|
def cleanup_shm(shm):
|
|
1110
1117
|
# Cleanup
|
|
1111
1118
|
pass
|
rapidtide/voxelData.py
CHANGED
|
@@ -61,12 +61,9 @@ class dataVolume:
|
|
|
61
61
|
print(f"illegal shape: {shape}")
|
|
62
62
|
self.numspatiallocs = self.xsize * self.ysize * self.numslices
|
|
63
63
|
self.dtype = dtype
|
|
64
|
-
|
|
65
|
-
self.
|
|
66
|
-
|
|
67
|
-
self.data, self.data_shm = tide_util.allocshared(
|
|
68
|
-
shape, self.dtype, name=f"filtereddata_{thepid}"
|
|
69
|
-
)
|
|
64
|
+
self.data, self.data_shm = tide_util.allocarray(
|
|
65
|
+
shape, self.dtype, shared=shared, name=f"filtereddata_{thepid}"
|
|
66
|
+
)
|
|
70
67
|
return self.data
|
|
71
68
|
|
|
72
69
|
def byvol(self):
|