rapidtide 3.0.11__py3-none-any.whl → 3.1.1__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 (144) hide show
  1. rapidtide/Colortables.py +492 -27
  2. rapidtide/OrthoImageItem.py +1049 -46
  3. rapidtide/RapidtideDataset.py +1533 -86
  4. rapidtide/_version.py +3 -3
  5. rapidtide/calccoherence.py +196 -29
  6. rapidtide/calcnullsimfunc.py +188 -40
  7. rapidtide/calcsimfunc.py +242 -42
  8. rapidtide/correlate.py +1203 -383
  9. rapidtide/data/examples/src/testLD +56 -0
  10. rapidtide/data/examples/src/testalign +1 -1
  11. rapidtide/data/examples/src/testdelayvar +0 -1
  12. rapidtide/data/examples/src/testfmri +53 -3
  13. rapidtide/data/examples/src/testglmfilt +5 -5
  14. rapidtide/data/examples/src/testhappy +29 -7
  15. rapidtide/data/examples/src/testppgproc +17 -0
  16. rapidtide/data/examples/src/testrolloff +11 -0
  17. rapidtide/data/models/model_cnn_pytorch/best_model.pth +0 -0
  18. rapidtide/data/models/model_cnn_pytorch/loss.png +0 -0
  19. rapidtide/data/models/model_cnn_pytorch/loss.txt +1 -0
  20. rapidtide/data/models/model_cnn_pytorch/model.pth +0 -0
  21. rapidtide/data/models/model_cnn_pytorch/model_meta.json +68 -0
  22. rapidtide/decorators.py +91 -0
  23. rapidtide/dlfilter.py +2226 -110
  24. rapidtide/dlfiltertorch.py +4842 -0
  25. rapidtide/externaltools.py +327 -12
  26. rapidtide/fMRIData_class.py +79 -40
  27. rapidtide/filter.py +1899 -810
  28. rapidtide/fit.py +2011 -581
  29. rapidtide/genericmultiproc.py +93 -18
  30. rapidtide/happy_supportfuncs.py +2047 -172
  31. rapidtide/helper_classes.py +584 -43
  32. rapidtide/io.py +2370 -372
  33. rapidtide/linfitfiltpass.py +346 -99
  34. rapidtide/makelaggedtcs.py +210 -24
  35. rapidtide/maskutil.py +448 -62
  36. rapidtide/miscmath.py +827 -121
  37. rapidtide/multiproc.py +210 -22
  38. rapidtide/patchmatch.py +242 -42
  39. rapidtide/peakeval.py +31 -31
  40. rapidtide/ppgproc.py +2203 -0
  41. rapidtide/qualitycheck.py +352 -39
  42. rapidtide/refinedelay.py +431 -57
  43. rapidtide/refineregressor.py +494 -189
  44. rapidtide/resample.py +671 -185
  45. rapidtide/scripts/applyppgproc.py +28 -0
  46. rapidtide/scripts/showxcorr_legacy.py +7 -7
  47. rapidtide/scripts/stupidramtricks.py +15 -17
  48. rapidtide/simFuncClasses.py +1052 -77
  49. rapidtide/simfuncfit.py +269 -69
  50. rapidtide/stats.py +540 -238
  51. rapidtide/tests/happycomp +9 -0
  52. rapidtide/tests/test_cleanregressor.py +1 -2
  53. rapidtide/tests/test_dlfiltertorch.py +627 -0
  54. rapidtide/tests/test_findmaxlag.py +24 -8
  55. rapidtide/tests/test_fullrunhappy_v1.py +0 -2
  56. rapidtide/tests/test_fullrunhappy_v2.py +0 -2
  57. rapidtide/tests/test_fullrunhappy_v3.py +11 -4
  58. rapidtide/tests/test_fullrunhappy_v4.py +10 -2
  59. rapidtide/tests/test_fullrunrapidtide_v7.py +1 -1
  60. rapidtide/tests/test_getparsers.py +11 -3
  61. rapidtide/tests/test_refinedelay.py +0 -1
  62. rapidtide/tests/test_simroundtrip.py +16 -8
  63. rapidtide/tests/test_stcorrelate.py +3 -1
  64. rapidtide/tests/utils.py +9 -8
  65. rapidtide/tidepoolTemplate.py +142 -38
  66. rapidtide/tidepoolTemplate_alt.py +165 -44
  67. rapidtide/tidepoolTemplate_big.py +189 -52
  68. rapidtide/util.py +1217 -118
  69. rapidtide/voxelData.py +684 -37
  70. rapidtide/wiener.py +136 -23
  71. rapidtide/wiener2.py +113 -7
  72. rapidtide/workflows/adjustoffset.py +105 -3
  73. rapidtide/workflows/aligntcs.py +85 -2
  74. rapidtide/workflows/applydlfilter.py +87 -10
  75. rapidtide/workflows/applyppgproc.py +540 -0
  76. rapidtide/workflows/atlasaverage.py +210 -47
  77. rapidtide/workflows/atlastool.py +100 -3
  78. rapidtide/workflows/calcSimFuncMap.py +288 -69
  79. rapidtide/workflows/calctexticc.py +201 -9
  80. rapidtide/workflows/ccorrica.py +101 -6
  81. rapidtide/workflows/cleanregressor.py +165 -31
  82. rapidtide/workflows/delayvar.py +171 -23
  83. rapidtide/workflows/diffrois.py +81 -3
  84. rapidtide/workflows/endtidalproc.py +144 -4
  85. rapidtide/workflows/fdica.py +195 -15
  86. rapidtide/workflows/filtnifti.py +70 -3
  87. rapidtide/workflows/filttc.py +74 -3
  88. rapidtide/workflows/fitSimFuncMap.py +202 -51
  89. rapidtide/workflows/fixtr.py +73 -3
  90. rapidtide/workflows/gmscalc.py +113 -3
  91. rapidtide/workflows/happy.py +801 -199
  92. rapidtide/workflows/happy2std.py +144 -12
  93. rapidtide/workflows/happy_parser.py +163 -23
  94. rapidtide/workflows/histnifti.py +118 -2
  95. rapidtide/workflows/histtc.py +84 -3
  96. rapidtide/workflows/linfitfilt.py +117 -4
  97. rapidtide/workflows/localflow.py +328 -28
  98. rapidtide/workflows/mergequality.py +79 -3
  99. rapidtide/workflows/niftidecomp.py +322 -18
  100. rapidtide/workflows/niftistats.py +174 -4
  101. rapidtide/workflows/pairproc.py +98 -4
  102. rapidtide/workflows/pairwisemergenifti.py +85 -2
  103. rapidtide/workflows/parser_funcs.py +1421 -40
  104. rapidtide/workflows/physiofreq.py +137 -11
  105. rapidtide/workflows/pixelcomp.py +207 -5
  106. rapidtide/workflows/plethquality.py +103 -21
  107. rapidtide/workflows/polyfitim.py +151 -11
  108. rapidtide/workflows/proj2flow.py +75 -2
  109. rapidtide/workflows/rankimage.py +111 -4
  110. rapidtide/workflows/rapidtide.py +368 -76
  111. rapidtide/workflows/rapidtide2std.py +98 -2
  112. rapidtide/workflows/rapidtide_parser.py +109 -9
  113. rapidtide/workflows/refineDelayMap.py +144 -33
  114. rapidtide/workflows/refineRegressor.py +675 -96
  115. rapidtide/workflows/regressfrommaps.py +161 -37
  116. rapidtide/workflows/resamplenifti.py +85 -3
  117. rapidtide/workflows/resampletc.py +91 -3
  118. rapidtide/workflows/retrolagtcs.py +99 -9
  119. rapidtide/workflows/retroregress.py +176 -26
  120. rapidtide/workflows/roisummarize.py +174 -5
  121. rapidtide/workflows/runqualitycheck.py +71 -3
  122. rapidtide/workflows/showarbcorr.py +149 -6
  123. rapidtide/workflows/showhist.py +86 -2
  124. rapidtide/workflows/showstxcorr.py +160 -3
  125. rapidtide/workflows/showtc.py +159 -3
  126. rapidtide/workflows/showxcorrx.py +190 -10
  127. rapidtide/workflows/showxy.py +185 -15
  128. rapidtide/workflows/simdata.py +264 -38
  129. rapidtide/workflows/spatialfit.py +77 -2
  130. rapidtide/workflows/spatialmi.py +250 -27
  131. rapidtide/workflows/spectrogram.py +305 -32
  132. rapidtide/workflows/synthASL.py +154 -3
  133. rapidtide/workflows/tcfrom2col.py +76 -2
  134. rapidtide/workflows/tcfrom3col.py +74 -2
  135. rapidtide/workflows/tidepool.py +2971 -130
  136. rapidtide/workflows/utils.py +19 -14
  137. rapidtide/workflows/utils_doc.py +293 -0
  138. rapidtide/workflows/variabilityizer.py +116 -3
  139. {rapidtide-3.0.11.dist-info → rapidtide-3.1.1.dist-info}/METADATA +10 -8
  140. {rapidtide-3.0.11.dist-info → rapidtide-3.1.1.dist-info}/RECORD +144 -128
  141. {rapidtide-3.0.11.dist-info → rapidtide-3.1.1.dist-info}/entry_points.txt +1 -0
  142. {rapidtide-3.0.11.dist-info → rapidtide-3.1.1.dist-info}/WHEEL +0 -0
  143. {rapidtide-3.0.11.dist-info → rapidtide-3.1.1.dist-info}/licenses/LICENSE +0 -0
  144. {rapidtide-3.0.11.dist-info → rapidtide-3.1.1.dist-info}/top_level.txt +0 -0
rapidtide/simfuncfit.py CHANGED
@@ -19,8 +19,10 @@
19
19
  import bisect
20
20
  import gc
21
21
  import logging
22
+ from typing import Any, Callable, Optional, Tuple, Union
22
23
 
23
24
  import numpy as np
25
+ from numpy.typing import ArrayLike, NDArray
24
26
  from tqdm import tqdm
25
27
 
26
28
  import rapidtide.fit as tide_fit
@@ -30,17 +32,73 @@ LGR = logging.getLogger("GENERAL")
30
32
 
31
33
 
32
34
  def onesimfuncfit(
33
- correlationfunc,
34
- thefitter,
35
- disablethresholds=False,
36
- initiallag=None,
37
- despeckle_thresh=5.0,
38
- lthreshval=0.0,
39
- fixdelay=False,
40
- initialdelayvalue=0.0,
41
- rt_floatset=np.float64,
42
- rt_floattype="float64",
43
- ):
35
+ correlationfunc: ArrayLike,
36
+ thefitter: Any,
37
+ disablethresholds: bool = False,
38
+ initiallag: Optional[float] = None,
39
+ despeckle_thresh: float = 5.0,
40
+ lthreshval: float = 0.0,
41
+ fixdelay: bool = False,
42
+ initialdelayvalue: float = 0.0,
43
+ rt_floattype: np.dtype = np.float64,
44
+ ) -> Tuple[int, float, float, float, int, int, int, int]:
45
+ """
46
+ Perform a single fit on a correlation function using the provided fitter.
47
+
48
+ This function sets up the fitter with initial parameters and thresholds,
49
+ then performs a fit on the provided correlation function. If `fixdelay` is
50
+ True, the fit is skipped and a fixed delay value is used instead.
51
+
52
+ Parameters
53
+ ----------
54
+ correlationfunc : ArrayLike
55
+ The correlation function data to be fitted.
56
+ thefitter : Any
57
+ An object with methods `setguess`, `setrange`, `setlthresh`, and `fit`.
58
+ disablethresholds : bool, optional
59
+ If True, disables the threshold setting in the fitter. Default is False.
60
+ initiallag : float, optional
61
+ Initial guess for the lag value. If None, no initial guess is set.
62
+ Default is None.
63
+ despeckle_thresh : float, optional
64
+ Threshold for despeckling. Default is 5.0.
65
+ lthreshval : float, optional
66
+ Low threshold value for the fitter. Default is 0.0.
67
+ fixdelay : bool, optional
68
+ If True, uses a fixed delay value instead of performing a fit.
69
+ Default is False.
70
+ initialdelayvalue : float, optional
71
+ The fixed delay value to use when `fixdelay=True`. Default is 0.0.
72
+ rt_floattype : np.dtype, optional
73
+ The data type to use for floating-point values. Default is `np.float64`.
74
+
75
+ Returns
76
+ -------
77
+ tuple of (int, float, float, float, int, int, int, int)
78
+ A tuple containing:
79
+ - maxindex (int): Index of the maximum value in the correlation function.
80
+ - maxlag (float): The lag value at the maximum.
81
+ - maxval (float): The maximum value in the correlation function.
82
+ - maxsigma (float): The sigma (standard deviation) of the fit.
83
+ - maskval (int): A mask value indicating fit quality.
84
+ - peakstart (int): Start index of the fitted peak.
85
+ - peakend (int): End index of the fitted peak.
86
+ - failreason (int): Reason for fit failure (0 if successful).
87
+
88
+ Notes
89
+ -----
90
+ When `fixdelay=True`, the function bypasses the fitting process and returns
91
+ precomputed values based on `initialdelayvalue`.
92
+
93
+ Examples
94
+ --------
95
+ >>> import numpy as np
96
+ >>> corr_func = np.random.rand(100)
97
+ >>> fitter = some_fitter_class()
98
+ >>> result = onesimfuncfit(corr_func, fitter)
99
+ >>> print(result)
100
+ (50, 0.5, 0.95, 0.02, 1, 45, 55, 0)
101
+ """
44
102
  if initiallag is not None:
45
103
  thefitter.setguess(True, maxguess=initiallag)
46
104
  thefitter.setrange(-despeckle_thresh / 2.0, despeckle_thresh / 2.0)
@@ -66,10 +124,10 @@ def onesimfuncfit(
66
124
  else:
67
125
  # do something different
68
126
  failreason = np.uint32(0)
69
- maxlag = rt_floatset(initialdelayvalue)
127
+ maxlag = initialdelayvalue
70
128
  maxindex = np.int16(bisect.bisect_left(thefitter.corrtimeaxis, initialdelayvalue))
71
- maxval = rt_floatset(correlationfunc[maxindex])
72
- maxsigma = rt_floatset(1.0)
129
+ maxval = correlationfunc[maxindex]
130
+ maxsigma = 1.0
73
131
  maskval = np.uint16(1)
74
132
  peakstart = maxindex
75
133
  peakend = maxindex
@@ -78,17 +136,80 @@ def onesimfuncfit(
78
136
 
79
137
 
80
138
  def _procOneVoxelFitcorr(
81
- vox,
82
- corr_y,
83
- thefitter,
84
- disablethresholds=False,
85
- despeckle_thresh=5.0,
86
- initiallag=None,
87
- fixdelay=False,
88
- initialdelayvalue=0.0,
89
- rt_floatset=np.float64,
90
- rt_floattype="float64",
91
- ):
139
+ vox: int,
140
+ corr_y: ArrayLike,
141
+ thefitter: Any,
142
+ disablethresholds: bool = False,
143
+ despeckle_thresh: float = 5.0,
144
+ initiallag: Optional[float] = None,
145
+ fixdelay: bool = False,
146
+ initialdelayvalue: float = 0.0,
147
+ rt_floattype: np.dtype = np.float64,
148
+ ) -> Tuple[int, int, float, float, float, NDArray, NDArray, float, int, int]:
149
+ """
150
+ Process a single voxel for correlation fitting.
151
+
152
+ This function performs correlation fitting on a single voxel's data using the provided fitter.
153
+ It returns fitting results including time, strength, sigma, Gaussian fit, window mask, R² value,
154
+ and metadata such as mask value and failure reason.
155
+
156
+ Parameters
157
+ ----------
158
+ vox : int
159
+ Voxel index.
160
+ corr_y : ArrayLike
161
+ Correlation data for the voxel.
162
+ thefitter : Any
163
+ Fitter object containing fitting parameters and methods.
164
+ disablethresholds : bool, optional
165
+ If True, disables thresholding during fitting. Default is False.
166
+ despeckle_thresh : float, optional
167
+ Threshold for despeckling. Default is 5.0.
168
+ initiallag : float, optional
169
+ Initial lag value for fitting. Default is None.
170
+ fixdelay : bool, optional
171
+ If True, fixes the delay during fitting. Default is False.
172
+ initialdelayvalue : float, optional
173
+ Initial delay value if `fixdelay` is True. Default is 0.0.
174
+ rt_floattype : np.dtype, optional
175
+ Type to use for real-valued floating-point arrays. Default is `np.float64`.
176
+
177
+ Returns
178
+ -------
179
+ tuple of (int, int, float, float, float, ndarray, ndarray, float, int, int)
180
+ A tuple containing:
181
+ - `vox`: Voxel index.
182
+ - `volumetotalinc`: 1 if fit was successful, 0 otherwise.
183
+ - `thetime`: Fitted time value.
184
+ - `thestrength`: Fitted strength value.
185
+ - `thesigma`: Fitted sigma value.
186
+ - `thegaussout`: Gaussian fit evaluated over the time axis.
187
+ - `thewindowout`: Binary window mask indicating the peak region.
188
+ - `theR2`: R-squared value of the fit.
189
+ - `maskval`: Mask value from the fitting process.
190
+ - `failreason`: Reason for failure, if any.
191
+
192
+ Notes
193
+ -----
194
+ - If `maxval > 0.3`, plotting is disabled.
195
+ - The function uses `onesimfuncfit` to perform the actual fitting.
196
+ - The `thefitter` object must have attributes like `zerooutbadfit`, `lagmod`, and `corrtimeaxis`.
197
+
198
+ Examples
199
+ --------
200
+ >>> result = _procOneVoxelFitcorr(
201
+ ... vox=10,
202
+ ... corr_y=corr_data,
203
+ ... thefitter=fitter_obj,
204
+ ... disablethresholds=False,
205
+ ... despeckle_thresh=5.0,
206
+ ... fixdelay=False,
207
+ ... initialdelayvalue=0.0,
208
+ ... rt_floattype=np.float64,
209
+ ... )
210
+ >>> print(result)
211
+ (10, 1, 1.23, 0.95, 0.12, array([...]), array([...]), 0.90, 1, 0)
212
+ """
92
213
  (
93
214
  maxindex,
94
215
  maxlag,
@@ -106,7 +227,6 @@ def _procOneVoxelFitcorr(
106
227
  fixdelay=fixdelay,
107
228
  initialdelayvalue=initialdelayvalue,
108
229
  initiallag=initiallag,
109
- rt_floatset=rt_floatset,
110
230
  rt_floattype=rt_floattype,
111
231
  )
112
232
 
@@ -115,29 +235,29 @@ def _procOneVoxelFitcorr(
115
235
 
116
236
  # now tuck everything away in the appropriate output array
117
237
  volumetotalinc = 0
118
- thewindowout = rt_floatset(0.0 * corr_y)
238
+ thewindowout = np.zeros_like(corr_y, rt_floattype)
119
239
  thewindowout[peakstart : peakend + 1] = 1.0
120
240
  if (maskval == 0) and thefitter.zerooutbadfit:
121
- thetime = rt_floatset(0.0)
122
- thestrength = rt_floatset(0.0)
123
- thesigma = rt_floatset(0.0)
124
- thegaussout = 0.0 * corr_y
125
- theR2 = rt_floatset(0.0)
241
+ thetime = 0.0
242
+ thestrength = 0.0
243
+ thesigma = 0.0
244
+ thegaussout = np.zeros_like(corr_y, rt_floattype)
245
+ theR2 = 0.0
126
246
  else:
127
247
  volumetotalinc = 1
128
- thetime = rt_floatset(np.fmod(maxlag, thefitter.lagmod))
129
- thestrength = rt_floatset(maxval)
130
- thesigma = rt_floatset(maxsigma)
131
- thegaussout = rt_floatset(0.0 * corr_y)
132
- thewindowout = rt_floatset(0.0 * corr_y)
248
+ thetime = np.fmod(maxlag, thefitter.lagmod)
249
+ thestrength = maxval
250
+ thesigma = maxsigma
251
+ thegaussout = np.zeros_like(corr_y, rt_floattype)
252
+ thewindowout = np.zeros_like(corr_y, rt_floattype)
133
253
  if (not fixdelay) and (maxsigma != 0.0):
134
- thegaussout = rt_floatset(
135
- tide_fit.gauss_eval(thefitter.corrtimeaxis, [maxval, maxlag, maxsigma])
136
- )
254
+ thegaussout = tide_fit.gauss_eval(
255
+ thefitter.corrtimeaxis, [maxval, maxlag, maxsigma]
256
+ ).astype(rt_floattype)
137
257
  else:
138
- thegaussout = rt_floatset(0.0)
139
- thewindowout = rt_floatset(0.0)
140
- theR2 = rt_floatset(thestrength * thestrength)
258
+ thegaussout = 0.0
259
+ thewindowout = 0.0
260
+ theR2 = thestrength * thestrength
141
261
 
142
262
  return (
143
263
  vox,
@@ -154,30 +274,112 @@ def _procOneVoxelFitcorr(
154
274
 
155
275
 
156
276
  def fitcorr(
157
- corrtimescale,
158
- thefitter,
159
- corrout,
160
- lagmask,
161
- failimage,
162
- lagtimes,
163
- lagstrengths,
164
- lagsigma,
165
- gaussout,
166
- windowout,
167
- R2,
168
- despeckling=False,
169
- peakdict=None,
170
- nprocs=1,
171
- alwaysmultiproc=False,
172
- fixdelay=False,
173
- initialdelayvalue=0.0,
174
- showprogressbar=True,
175
- chunksize=1000,
176
- despeckle_thresh=5.0,
177
- initiallags=None,
178
- rt_floatset=np.float64,
179
- rt_floattype="float64",
180
- ):
277
+ corrtimescale: ArrayLike,
278
+ thefitter: Any,
279
+ corrout: NDArray,
280
+ lagmask: NDArray,
281
+ failimage: NDArray,
282
+ lagtimes: NDArray,
283
+ lagstrengths: NDArray,
284
+ lagsigma: NDArray,
285
+ gaussout: NDArray,
286
+ windowout: NDArray,
287
+ R2: NDArray,
288
+ despeckling: bool = False,
289
+ peakdict: Optional[dict] = None,
290
+ nprocs: int = 1,
291
+ alwaysmultiproc: bool = False,
292
+ fixdelay: bool = False,
293
+ initialdelayvalue: Union[float, NDArray] = 0.0,
294
+ showprogressbar: bool = True,
295
+ chunksize: int = 1000,
296
+ despeckle_thresh: float = 5.0,
297
+ initiallags: Optional[NDArray] = None,
298
+ rt_floattype: np.dtype = np.float64,
299
+ ) -> int:
300
+ """
301
+ Fit correlation data to extract lag parameters and related statistics for each voxel.
302
+
303
+ This function performs a fitting procedure on correlation data for each voxel,
304
+ extracting lag times, strengths, sigma values, Gaussian fits, window functions,
305
+ and R² values. It supports both single-threaded and multi-threaded processing.
306
+
307
+ Parameters
308
+ ----------
309
+ corrtimescale : ArrayLike
310
+ Time scale of the correlation data.
311
+ thefitter : Any
312
+ Fitter object used to perform the fitting. Must have methods like `setcorrtimeaxis`.
313
+ corrout : NDArray
314
+ Correlation data for all voxels, shape (n_voxels, n_timepoints).
315
+ lagmask : NDArray
316
+ Mask indicating valid lags for each voxel, shape (n_voxels,).
317
+ failimage : NDArray
318
+ Image to store failure flags for each voxel, shape (n_voxels,).
319
+ lagtimes : NDArray
320
+ Output array for lag times, shape (n_voxels,).
321
+ lagstrengths : NDArray
322
+ Output array for lag strengths, shape (n_voxels,).
323
+ lagsigma : NDArray
324
+ Output array for lag sigma values, shape (n_voxels,).
325
+ gaussout : NDArray
326
+ Output array for Gaussian fit parameters, shape (n_voxels, n_timepoints).
327
+ windowout : NDArray
328
+ Output array for window function values, shape (n_voxels, n_timepoints).
329
+ R2 : NDArray
330
+ Output array for R² values, shape (n_voxels,).
331
+ despeckling : bool, optional
332
+ If True, performs despeckling pass, only accepting successful fits, by default False.
333
+ peakdict : dict, optional
334
+ Dictionary of peak information, by default None.
335
+ nprocs : int, optional
336
+ Number of processes to use for multiprocessing, by default 1.
337
+ alwaysmultiproc : bool, optional
338
+ If True, always use multiprocessing even for single process, by default False.
339
+ fixdelay : bool, optional
340
+ If True, fix the delay value, by default False.
341
+ initialdelayvalue : Union[float, NDArray], optional
342
+ Initial delay value(s), by default 0.0.
343
+ showprogressbar : bool, optional
344
+ If True, show progress bar, by default True.
345
+ chunksize : int, optional
346
+ Size of chunks for multiprocessing, by default 1000.
347
+ despeckle_thresh : float, optional
348
+ Threshold for despeckling, by default 5.0.
349
+ initiallags : NDArray, optional
350
+ Initial lag values for each voxel, by default None.
351
+ rt_floattype : np.dtype, optional
352
+ Floating-point type for runtime, by default np.float64.
353
+
354
+ Returns
355
+ -------
356
+ int
357
+ Total number of voxels successfully processed.
358
+
359
+ Notes
360
+ -----
361
+ The function modifies the input arrays (`lagtimes`, `lagstrengths`, `lagsigma`,
362
+ `gaussout`, `windowout`, `R2`, `lagmask`, `failimage`) in-place.
363
+
364
+ Examples
365
+ --------
366
+ >>> fitcorr(
367
+ ... corrtimescale=timescale,
368
+ ... thefitter=fitter,
369
+ ... corrout=correlation_data,
370
+ ... lagmask=lag_mask,
371
+ ... failimage=fail_image,
372
+ ... lagtimes=lag_times,
373
+ ... lagstrengths=lag_strengths,
374
+ ... lagsigma=lag_sigma,
375
+ ... gaussout=gaussian_out,
376
+ ... windowout=window_out,
377
+ ... R2=r2_values,
378
+ ... nprocs=4,
379
+ ... despeckling=True,
380
+ ... )
381
+ 12345
382
+ """
181
383
  thefitter.setcorrtimeaxis(corrtimescale)
182
384
  inputshape = np.shape(corrout)
183
385
  if initiallags is None:
@@ -229,7 +431,6 @@ def fitcorr(
229
431
  initiallag=thislag,
230
432
  fixdelay=fixdelay,
231
433
  initialdelayvalue=thisinitialdelayvalue,
232
- rt_floatset=rt_floatset,
233
434
  rt_floattype=rt_floattype,
234
435
  )
235
436
  )
@@ -314,7 +515,6 @@ def fitcorr(
314
515
  initiallag=thislag,
315
516
  fixdelay=fixdelay,
316
517
  initialdelayvalue=thisinitialdelayvalue,
317
- rt_floatset=rt_floatset,
318
518
  rt_floattype=rt_floattype,
319
519
  )
320
520
  if (