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.
Files changed (57) hide show
  1. rapidtide/RapidtideDataset.py +1 -1
  2. rapidtide/_version.py +3 -3
  3. rapidtide/calcnullsimfunc.py +1 -3
  4. rapidtide/data/examples/src/test_findmaxlag.py +1 -1
  5. rapidtide/data/examples/src/testfmri +19 -7
  6. rapidtide/data/examples/src/testnewrefine +0 -23
  7. rapidtide/fMRIData_class.py +29 -52
  8. rapidtide/fit.py +4 -4
  9. rapidtide/happy_supportfuncs.py +1 -1
  10. rapidtide/helper_classes.py +0 -1099
  11. rapidtide/linfitfiltpass.py +82 -4
  12. rapidtide/makelaggedtcs.py +10 -0
  13. rapidtide/refinedelay.py +11 -20
  14. rapidtide/refineregressor.py +1 -1
  15. rapidtide/resample.py +8 -8
  16. rapidtide/simFuncClasses.py +1132 -0
  17. rapidtide/simfuncfit.py +30 -30
  18. rapidtide/stats.py +5 -2
  19. rapidtide/tests/.coveragerc +6 -0
  20. rapidtide/tests/cleanposttest +1 -1
  21. rapidtide/tests/runlocaltest +2 -2
  22. rapidtide/tests/test_cleanregressor.py +3 -3
  23. rapidtide/tests/test_congrid.py +1 -1
  24. rapidtide/tests/test_corrpass.py +3 -3
  25. rapidtide/tests/test_delayestimation.py +9 -8
  26. rapidtide/tests/test_findmaxlag.py +2 -2
  27. rapidtide/tests/test_fullrunrapidtide_v3.py +2 -1
  28. rapidtide/tests/test_fullrunrapidtide_v8.py +66 -0
  29. rapidtide/tests/test_getparsers.py +14 -6
  30. rapidtide/tests/test_io.py +2 -6
  31. rapidtide/tests/test_nullcorr.py +3 -3
  32. rapidtide/tests/test_refinedelay.py +20 -5
  33. rapidtide/tidepoolTemplate_alt.py +1 -1
  34. rapidtide/util.py +7 -0
  35. rapidtide/voxelData.py +3 -6
  36. rapidtide/workflows/calcSimFuncMap.py +271 -0
  37. rapidtide/workflows/cleanregressor.py +2 -2
  38. rapidtide/workflows/delayvar.py +45 -59
  39. rapidtide/workflows/fitSimFuncMap.py +427 -0
  40. rapidtide/workflows/happy.py +1 -1
  41. rapidtide/workflows/rapidtide.py +499 -877
  42. rapidtide/workflows/rapidtide_parser.py +26 -38
  43. rapidtide/workflows/refineDelayMap.py +138 -0
  44. rapidtide/{RegressorRefiner.py → workflows/refineRegressor.py} +200 -28
  45. rapidtide/workflows/regressfrommaps.py +38 -30
  46. rapidtide/workflows/retrolagtcs.py +5 -6
  47. rapidtide/workflows/retroregress.py +73 -191
  48. rapidtide/workflows/showarbcorr.py +2 -2
  49. rapidtide/workflows/showxcorrx.py +5 -5
  50. rapidtide/workflows/tidepool.py +5 -5
  51. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/METADATA +2 -2
  52. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/RECORD +56 -52
  53. rapidtide/workflows/delayestimation.py +0 -483
  54. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/WHEEL +0 -0
  55. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/entry_points.txt +0 -0
  56. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/licenses/LICENSE +0 -0
  57. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.9.dist-info}/top_level.txt +0 -0
@@ -408,7 +408,7 @@ class Overlay:
408
408
 
409
409
  def maskData(self):
410
410
  self.mask = self.geommask * self.funcmask
411
- maskhash = hash(self.mask.tostring())
411
+ maskhash = hash(self.mask.tobytes())
412
412
  # these operations are expensive, so only do them if the mask is changed
413
413
  if (maskhash == self.maskhash) and (self.verbose > 1):
414
414
  print("mask has not changed")
rapidtide/_version.py CHANGED
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2025-06-16T15:12:43-0400",
11
+ "date": "2025-07-03T10:21:49-0400",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "6dead8e554dd0464bdfc65de24889374508f920d",
15
- "version": "3.0.7.1"
14
+ "full-revisionid": "292e93bbd0a9c13e2d62a00746e14522b0783156",
15
+ "version": "3.0.9"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -18,13 +18,11 @@
18
18
  #
19
19
  import sys
20
20
 
21
-
22
21
  import numpy as np
23
22
 
24
-
25
23
  import rapidtide.filter as tide_filt
26
- import rapidtide.miscmath as tide_math
27
24
  import rapidtide.genericmultiproc as tide_genericmultiproc
25
+ import rapidtide.miscmath as tide_math
28
26
 
29
27
 
30
28
  # note: rawtimecourse has been filtered, but NOT windowed
@@ -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_classes
29
29
  from rapidtide.tests.utils import get_examples_path
30
30
 
31
31
 
@@ -1,24 +1,26 @@
1
1
  #!/bin/bash
2
2
 
3
3
  rapidtide \
4
- --spatialfilt -1 \
4
+ --spatialfilt 2.5 \
5
5
  --nprocs -1 \
6
- --searchrange -5 20 \
6
+ --searchrange -7.5 30 \
7
7
  --simcalcrange 50 -1 \
8
8
  --outputlevel more \
9
- --sLFOfiltmask \
10
9
  --graymattermask sub-RAPIDTIDETEST_synthseg.nii.gz:SSEG_GRAY \
11
10
  --brainmask sub-RAPIDTIDETEST_brainmask.nii.gz \
12
11
  --whitemattermask sub-RAPIDTIDETEST_synthseg.nii.gz:SSEG_WHITE \
13
12
  --csfmask sub-RAPIDTIDETEST_synthseg.nii.gz:SSEG_CSF \
14
13
  --cleanrefined \
14
+ --nofitfilt \
15
+ --refinedelayeachpass \
16
+ --similaritymetric correlation \
15
17
  sub-RAPIDTIDETEST.nii.gz \
16
- ../dst/sub-RAPIDTIDETEST
18
+ ../dst/sub-RAPIDTIDETEST_simfunc
17
19
 
18
20
  rapidtide \
19
- --spatialfilt -1 \
21
+ --spatialfilt 2.5 \
20
22
  --nprocs -1 \
21
- --searchrange -5 20 \
23
+ --searchrange -7.5 30 \
22
24
  --simcalcrange 50 -1 \
23
25
  --outputlevel more \
24
26
  --graymattermask sub-RAPIDTIDETEST_synthseg.nii.gz:SSEG_GRAY \
@@ -26,5 +28,15 @@ rapidtide \
26
28
  --whitemattermask sub-RAPIDTIDETEST_synthseg.nii.gz:SSEG_WHITE \
27
29
  --csfmask sub-RAPIDTIDETEST_synthseg.nii.gz:SSEG_CSF \
28
30
  --cleanrefined \
31
+ --nofitfilt \
32
+ --refinedelayeachpass \
33
+ --similaritymetric riptide \
34
+ --riptidestep 1.5 \
35
+ --ampthresh 0.0 \
36
+ --numnull 0 \
29
37
  sub-RAPIDTIDETEST.nii.gz \
30
- ../dst/sub-RAPIDTIDETEST_nosLFOfiltmask
38
+ ../dst/sub-RAPIDTIDETEST_riptide
39
+
40
+ tidepool --uistyle big --dataset \
41
+ ../dst/sub-RAPIDTIDETEST_simfunc_ \
42
+ ../dst/sub-RAPIDTIDETEST_riptide_ &
@@ -6,28 +6,15 @@ rapidtide \
6
6
  --searchrange -5 20 \
7
7
  --simcalcrange 50 -1 \
8
8
  --outputlevel max \
9
- --refineregressderivs 1 \
10
9
  sub-RAPIDTIDETEST.nii.gz \
11
10
  ../dst/sub-RAPIDTIDETEST_1deriv
12
11
 
13
- rapidtide \
14
- --spatialfilt -1 \
15
- --nprocs -1 \
16
- --searchrange -5 20 \
17
- --simcalcrange 50 -1 \
18
- --outputlevel max \
19
- --refineregressderivs 2 \
20
- sub-RAPIDTIDETEST.nii.gz \
21
- ../dst/sub-RAPIDTIDETEST_2deriv
22
-
23
-
24
12
  retroregress \
25
13
  sub-RAPIDTIDETEST.nii.gz \
26
14
  ../dst/sub-RAPIDTIDETEST_1deriv \
27
15
  --alternateoutput ../dst/retrotest_1to1 \
28
16
  --nprocs -1 \
29
17
  --regressderivs 0 \
30
- --refineregressderivs 1 \
31
18
  --outputlevel max
32
19
 
33
20
  retroregress \
@@ -36,14 +23,4 @@ retroregress \
36
23
  --alternateoutput ../dst/retrotest_2to1 \
37
24
  --nprocs -1 \
38
25
  --regressderivs 0 \
39
- --refineregressderivs 1 \
40
- --outputlevel max
41
-
42
- retroregress \
43
- sub-RAPIDTIDETEST.nii.gz \
44
- ../dst/sub-RAPIDTIDETEST_1deriv \
45
- --alternateoutput ../dst/retrotest_1to2 \
46
- --nprocs -1 \
47
- --regressderivs 0 \
48
- --refineregressderivs 2 \
49
26
  --outputlevel max
@@ -16,21 +16,9 @@
16
16
  # limitations under the License.
17
17
  #
18
18
  #
19
- import sys
20
- import warnings
21
-
22
- import matplotlib.pyplot as plt
23
19
  import numpy as np
24
- import scipy as sp
25
- from numpy.polynomial import Polynomial
26
- from scipy.optimize import curve_fit
27
- from statsmodels.robust import mad
28
20
 
29
- import rapidtide.correlate as tide_corr
30
- import rapidtide.filter as tide_filt
31
- import rapidtide.fit as tide_fit
32
- import rapidtide.miscmath as tide_math
33
- import rapidtide.util as tide_util
21
+ import rapidtide.io as tide_io
34
22
 
35
23
 
36
24
  class fMRIData:
@@ -42,9 +30,7 @@ class fMRIData:
42
30
  mask = None
43
31
  validvoxels = None
44
32
  filename = None
45
- textio = False
46
- fileiscifti = False
47
- fileisnifti = False
33
+ filetype = None
48
34
 
49
35
  def __init__(
50
36
  self,
@@ -110,53 +96,44 @@ class fMRIData:
110
96
  ####################################################
111
97
  # Read data
112
98
  ####################################################
113
- # open the fmri datafil
99
+ # open the fmri datafile
114
100
  if tide_io.checkiftext(self.filename):
115
- self.textio = True
116
- else:
117
- self.textio = False
118
-
119
- if self.textio:
101
+ self.filetype = "text"
120
102
  self.data = tide_io.readvecs(self.filename)
121
103
  self.header = None
122
104
  theshape = np.shape(nim_data)
123
105
  self.xsize = theshape[0]
124
106
  self.ysize = 1
125
107
  self.numslices = 1
126
- self.fileiscifti = False
127
108
  self.timepoints = theshape[1]
128
109
  self.thesizes = [0, int(self.xsize), 1, 1, int(self.timepoints)]
129
110
  self.numspatiallocs = int(self.xsize)
130
111
  self.nativespaceshape = self.xsize
131
112
  self.cifti_hdr = None
113
+ elif tide_io.checkifcifti(self.filename):
114
+ self.filetype = "cifti"
115
+ (
116
+ cifti,
117
+ cifti_hdr,
118
+ self.data,
119
+ self.header,
120
+ thedims,
121
+ thesizes,
122
+ dummy,
123
+ ) = tide_io.readfromcifti(self.filename)
124
+ self.isgrayordinate = True
125
+ self.timepoints = nim_data.shape[1]
126
+ numspatiallocs = nim_data.shape[0]
127
+ LGR.debug(f"cifti file has {timepoints} timepoints, {numspatiallocs} numspatiallocs")
128
+ slicesize = numspatiallocs
129
+ nativespaceshape = (1, 1, 1, 1, numspatiallocs)
132
130
  else:
133
- self.fileiscifti = tide_io.checkifcifti(self.filename)
134
- if self.fileiscifti:
135
- (
136
- cifti,
137
- cifti_hdr,
138
- self.data,
139
- self.header,
140
- thedims,
141
- thesizes,
142
- dummy,
143
- ) = tide_io.readfromcifti(self.filename)
144
- self.isgrayordinate = True
145
- self.timepoints = nim_data.shape[1]
146
- numspatiallocs = nim_data.shape[0]
147
- LGR.debug(
148
- f"cifti file has {timepoints} timepoints, {numspatiallocs} numspatiallocs"
149
- )
150
- slicesize = numspatiallocs
151
- nativespaceshape = (1, 1, 1, 1, numspatiallocs)
152
- else:
153
- LGR.debug("input file is NIFTI")
154
- nim, self.data, self.header, thedims, thesizes = tide_io.readfromnifti(
155
- fmrifilename
156
- )
157
- optiondict["isgrayordinate"] = False
158
- xsize, ysize, numslices, timepoints = tide_io.parseniftidims(thedims)
159
- numspatiallocs = int(xsize) * int(ysize) * int(numslices)
160
- cifti_hdr = None
161
- nativespaceshape = (xsize, ysize, numslices)
131
+ self.filetype = "nifti"
132
+ LGR.debug("input file is NIFTI")
133
+ nim, self.data, self.header, thedims, thesizes = tide_io.readfromnifti(fmrifilename)
134
+ optiondict["isgrayordinate"] = False
135
+ xsize, ysize, numslices, timepoints = tide_io.parseniftidims(thedims)
136
+ numspatiallocs = int(xsize) * int(ysize) * int(numslices)
137
+ cifti_hdr = None
138
+ nativespaceshape = (xsize, ysize, numslices)
162
139
  xdim, ydim, slicethickness, tr = tide_io.parseniftisizes(thesizes)
rapidtide/fit.py CHANGED
@@ -1469,11 +1469,11 @@ def getpeaks(xvals, yvals, xrange=None, bipolar=False, displayplots=False):
1469
1469
  peaks = np.concatenate((peaks, negpeaks))
1470
1470
  procpeaks = []
1471
1471
  if xrange is None:
1472
- lagmin = xvals[0]
1473
- lagmax = xvals[-1]
1472
+ lagmin = xvals[0] + 0.0
1473
+ lagmax = xvals[-1] + 0.0
1474
1474
  else:
1475
- lagmin = xrange[0]
1476
- lagmax = xrange[1]
1475
+ lagmin = xrange[0] + 0.0
1476
+ lagmax = xrange[1] + 0.0
1477
1477
  originloc = tide_util.valtoindex(xvals, 0.0, discrete=False)
1478
1478
  for thepeak in peaks:
1479
1479
  if lagmin <= xvals[thepeak] <= lagmax:
@@ -22,7 +22,7 @@ import warnings
22
22
 
23
23
  import numpy as np
24
24
  from scipy.signal import savgol_filter, welch
25
- from scipy.stats import kurtosis, skew, pearsonr
25
+ from scipy.stats import kurtosis, pearsonr, skew
26
26
  from statsmodels.robust import mad
27
27
  from tqdm import tqdm
28
28