rapidtide 3.0.7.1__py3-none-any.whl → 3.0.8__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 (50) hide show
  1. rapidtide/_version.py +3 -3
  2. rapidtide/calcnullsimfunc.py +1 -3
  3. rapidtide/data/examples/src/test_findmaxlag.py +1 -1
  4. rapidtide/data/examples/src/testfmri +22 -16
  5. rapidtide/data/examples/src/testnewrefine +0 -23
  6. rapidtide/fMRIData_class.py +29 -52
  7. rapidtide/fit.py +4 -4
  8. rapidtide/happy_supportfuncs.py +1 -1
  9. rapidtide/helper_classes.py +0 -1099
  10. rapidtide/linfitfiltpass.py +59 -0
  11. rapidtide/makelaggedtcs.py +10 -0
  12. rapidtide/refinedelay.py +10 -19
  13. rapidtide/simFuncClasses.py +1132 -0
  14. rapidtide/simfuncfit.py +30 -30
  15. rapidtide/stats.py +5 -2
  16. rapidtide/tests/.coveragerc +6 -0
  17. rapidtide/tests/cleanposttest +1 -1
  18. rapidtide/tests/runlocaltest +2 -2
  19. rapidtide/tests/test_cleanregressor.py +3 -3
  20. rapidtide/tests/test_congrid.py +1 -1
  21. rapidtide/tests/test_corrpass.py +3 -3
  22. rapidtide/tests/test_delayestimation.py +8 -7
  23. rapidtide/tests/test_findmaxlag.py +2 -2
  24. rapidtide/tests/test_fullrunrapidtide_v3.py +2 -1
  25. rapidtide/tests/test_getparsers.py +14 -6
  26. rapidtide/tests/test_io.py +2 -6
  27. rapidtide/tests/test_nullcorr.py +3 -3
  28. rapidtide/tests/test_refinedelay.py +20 -5
  29. rapidtide/tidepoolTemplate_alt.py +1 -1
  30. rapidtide/util.py +7 -0
  31. rapidtide/voxelData.py +3 -6
  32. rapidtide/workflows/cleanregressor.py +2 -2
  33. rapidtide/workflows/delayvar.py +44 -58
  34. rapidtide/workflows/{delayestimation.py → estimateDelayMap.py} +84 -31
  35. rapidtide/workflows/rapidtide.py +349 -859
  36. rapidtide/workflows/rapidtide_parser.py +5 -38
  37. rapidtide/workflows/refineDelayMap.py +138 -0
  38. rapidtide/{RegressorRefiner.py → workflows/refineRegressor.py} +200 -28
  39. rapidtide/workflows/regressfrommaps.py +35 -27
  40. rapidtide/workflows/retrolagtcs.py +5 -6
  41. rapidtide/workflows/retroregress.py +73 -191
  42. rapidtide/workflows/showarbcorr.py +2 -2
  43. rapidtide/workflows/showxcorrx.py +5 -5
  44. rapidtide/workflows/tidepool.py +5 -5
  45. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.8.dist-info}/METADATA +2 -2
  46. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.8.dist-info}/RECORD +50 -48
  47. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.8.dist-info}/WHEEL +0 -0
  48. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.8.dist-info}/entry_points.txt +0 -0
  49. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.8.dist-info}/licenses/LICENSE +0 -0
  50. {rapidtide-3.0.7.1.dist-info → rapidtide-3.0.8.dist-info}/top_level.txt +0 -0
@@ -92,6 +92,7 @@ def linfitfiltpass(
92
92
  nprocs=1,
93
93
  alwaysmultiproc=False,
94
94
  confoundregress=False,
95
+ ratiosonly=False,
95
96
  procbyvoxel=True,
96
97
  showprogressbar=True,
97
98
  mp_chunksize=1000,
@@ -207,6 +208,18 @@ def linfitfiltpass(
207
208
  r2value[voxel[0]] = voxel[3]
208
209
  filtereddata[voxel[0], :] = voxel[7]
209
210
  itemstotal += 1
211
+ elif ratiosonly:
212
+ for voxel in data_out:
213
+ meanvalue[voxel[0]] = voxel[1]
214
+ rvalue[voxel[0]] = voxel[2]
215
+ r2value[voxel[0]] = voxel[3]
216
+ if theevs.ndim > 1:
217
+ fitcoeff[voxel[0], :] = voxel[4]
218
+ fitNorm[voxel[0], :] = voxel[5]
219
+ else:
220
+ fitcoeff[voxel[0]] = voxel[4]
221
+ fitNorm[voxel[0]] = voxel[5]
222
+ itemstotal += 1
210
223
  else:
211
224
  for voxel in data_out:
212
225
  meanvalue[voxel[0]] = voxel[1]
@@ -227,6 +240,18 @@ def linfitfiltpass(
227
240
  r2value[timepoint[0]] = timepoint[3]
228
241
  filtereddata[:, timepoint[0]] = timepoint[7]
229
242
  itemstotal += 1
243
+ elif ratiosonly:
244
+ for timepoint in data_out:
245
+ meanvalue[timepoint[0]] = timepoint[1]
246
+ rvalue[timepoint[0]] = timepoint[2]
247
+ r2value[timepoint[0]] = timepoint[3]
248
+ if theevs.ndim > 1:
249
+ fitcoeff[:, timepoint[0]] = timepoint[4]
250
+ fitNorm[:, timepoint[0]] = timepoint[5]
251
+ else:
252
+ fitcoeff[timepoint[0]] = timepoint[4]
253
+ fitNorm[timepoint[0]] = timepoint[5]
254
+ itemstotal += 1
230
255
  else:
231
256
  for timepoint in data_out:
232
257
  meanvalue[timepoint[0]] = timepoint[1]
@@ -271,6 +296,23 @@ def linfitfiltpass(
271
296
  rt_floatset=rt_floatset,
272
297
  rt_floattype=rt_floattype,
273
298
  )
299
+ elif ratiosonly:
300
+ (
301
+ dummy,
302
+ meanvalue[vox],
303
+ rvalue[vox],
304
+ r2value[vox],
305
+ fitcoeff[vox],
306
+ fitNorm[vox],
307
+ dummy,
308
+ dummy,
309
+ ) = _procOneRegressionFitItem(
310
+ vox,
311
+ theevs[vox, :],
312
+ thedata,
313
+ rt_floatset=rt_floatset,
314
+ rt_floattype=rt_floattype,
315
+ )
274
316
  else:
275
317
  (
276
318
  dummy,
@@ -315,6 +357,23 @@ def linfitfiltpass(
315
357
  rt_floatset=rt_floatset,
316
358
  rt_floattype=rt_floattype,
317
359
  )
360
+ elif ratiosonly:
361
+ (
362
+ dummy,
363
+ meanvalue[timepoint],
364
+ rvalue[timepoint],
365
+ r2value[timepoint],
366
+ fitcoeff[timepoint],
367
+ fitNorm[timepoint],
368
+ dummy,
369
+ dummy,
370
+ ) = _procOneRegressionFitItem(
371
+ timepoint,
372
+ theevs[:, timepoint],
373
+ thedata,
374
+ rt_floatset=rt_floatset,
375
+ rt_floattype=rt_floattype,
376
+ )
318
377
  else:
319
378
  (
320
379
  dummy,
@@ -71,7 +71,14 @@ def makelaggedtcs(
71
71
  chunksize=1000,
72
72
  rt_floatset=np.float64,
73
73
  rt_floattype="float64",
74
+ debug=False,
74
75
  ):
76
+ if debug:
77
+ print("makelaggedtcs: Starting")
78
+ print(f"\t{lagtc.shape=}")
79
+ print(f"\t{lagtimes.shape=}")
80
+ print(f"\t{timeaxis.shape=}")
81
+
75
82
  inputshape = lagtc.shape
76
83
  voxelargs = [
77
84
  lagtcgenerator,
@@ -110,4 +117,7 @@ def makelaggedtcs(
110
117
  if LGR is not None:
111
118
  LGR.info("garbage collected")
112
119
 
120
+ if debug:
121
+ print("makelaggedtcs: End\n\n")
122
+
113
123
  return volumetotal
rapidtide/refinedelay.py CHANGED
@@ -282,18 +282,6 @@ def ratiotodelay(theratio, offset=0.0, debug=False):
282
282
  closestindex = offsetindex
283
283
  closestoffset = funcoffsets[closestindex]
284
284
  distance = np.fabs(funcoffsets[closestindex] - offset)
285
- """if (maplimits[0] < theratio < maplimits[1]) and (
286
- distance < (funcoffsets[1] - funcoffsets[0]) / 2
287
- ):
288
- return (
289
- ratiotooffsetfunc[closestindex](theratio) + (offset - closestoffset),
290
- closestoffset,
291
- )
292
- else:
293
- return (
294
- 0.0,
295
- closestoffset,
296
- )"""
297
285
 
298
286
  if theratio < maplimits[0]:
299
287
  return (
@@ -302,7 +290,7 @@ def ratiotodelay(theratio, offset=0.0, debug=False):
302
290
  )
303
291
  elif theratio > maplimits[1]:
304
292
  return (
305
- ratiotooffsetfunc[closestindex](maplimits[1]),
293
+ ratiotooffsetfunc[closestindex](maplimits[1]) - (offset - closestoffset),
306
294
  closestoffset,
307
295
  )
308
296
  else:
@@ -371,12 +359,12 @@ def getderivratios(
371
359
  if endtr is None:
372
360
  endtr = fmri_data_valid.shape[1]
373
361
  if debug:
374
- print("getderivratios")
375
- print(f"{fitNorm.shape=}")
376
- print(f"{fitcoeff.shape=}")
377
- print(f"{regressderivs=}")
378
- print(f"{starttr=}")
379
- print(f"{endtr=}")
362
+ print("getderivratios: Starting")
363
+ print(f"\t{fitNorm.shape=}")
364
+ print(f"\t{fitcoeff.shape=}")
365
+ print(f"\t{regressderivs=}")
366
+ print(f"\t{starttr=}")
367
+ print(f"\t{endtr=}")
380
368
 
381
369
  voxelsprocessed_regressionfilt, regressorset, evset = tide_regressfrommaps.regressfrommaps(
382
370
  fmri_data_valid[:, starttr:endtr],
@@ -406,6 +394,7 @@ def getderivratios(
406
394
  mp_chunksize=optiondict["mp_chunksize"],
407
395
  showprogressbar=optiondict["showprogressbar"],
408
396
  alwaysmultiproc=optiondict["alwaysmultiproc"],
397
+ ratiosonly=True,
409
398
  debug=debug,
410
399
  )
411
400
 
@@ -418,6 +407,8 @@ def getderivratios(
418
407
  for i in range(regressderivs):
419
408
  regressderivratios[i, :] = np.nan_to_num(fitcoeff[:, i + 1] / fitcoeff[:, 0])
420
409
 
410
+ if debug:
411
+ print("getderivratios: End\n\n")
421
412
  return regressderivratios, rvalue
422
413
 
423
414