rapidtide 3.0a10__py3-none-any.whl → 3.0a12__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/Colortables.py +45 -10
  2. rapidtide/RapidtideDataset.py +21 -3
  3. rapidtide/Refiner.py +464 -0
  4. rapidtide/__init__.py +1 -2
  5. rapidtide/_version.py +63 -93
  6. rapidtide/data/examples/src/testfmri +3 -119
  7. rapidtide/data/examples/src/testhappy +1 -6
  8. rapidtide/data/examples/src/testinitdelay +19 -0
  9. rapidtide/data/examples/src/testnewrefine +49 -0
  10. rapidtide/data/examples/src/testrefineonly +22 -0
  11. rapidtide/glmpass.py +8 -1
  12. rapidtide/refinedelay.py +72 -32
  13. rapidtide/refineregressor.py +38 -24
  14. rapidtide/tests/test_fastresampler.py +6 -2
  15. rapidtide/tests/test_fullrunhappy_v1.py +0 -1
  16. rapidtide/tests/test_fullrunhappy_v4.py +1 -0
  17. rapidtide/tests/test_runmisc.py +4 -4
  18. rapidtide/tidepoolTemplate.py +1 -0
  19. rapidtide/tidepoolTemplate.ui +1 -0
  20. rapidtide/tidepoolTemplate_alt.py +5 -4
  21. rapidtide/tidepoolTemplate_alt.ui +3 -2
  22. rapidtide/tidepoolTemplate_alt_qt6.py +5 -4
  23. rapidtide/tidepoolTemplate_big.py +1 -0
  24. rapidtide/tidepoolTemplate_big.ui +1 -0
  25. rapidtide/tidepoolTemplate_big_qt6.py +1 -0
  26. rapidtide/tidepoolTemplate_qt6.py +1 -0
  27. rapidtide/workflows/parser_funcs.py +10 -2
  28. rapidtide/workflows/rapidtide.py +197 -325
  29. rapidtide/workflows/rapidtide_parser.py +35 -13
  30. rapidtide/workflows/retroglm.py +145 -60
  31. rapidtide/workflows/tidepool.py +34 -15
  32. {rapidtide-3.0a10.dist-info → rapidtide-3.0a12.dist-info}/METADATA +1 -1
  33. {rapidtide-3.0a10.dist-info → rapidtide-3.0a12.dist-info}/RECORD +37 -33
  34. {rapidtide-3.0a10.dist-info → rapidtide-3.0a12.dist-info}/WHEEL +1 -1
  35. {rapidtide-3.0a10.dist-info → rapidtide-3.0a12.dist-info}/LICENSE +0 -0
  36. {rapidtide-3.0a10.dist-info → rapidtide-3.0a12.dist-info}/entry_points.txt +0 -0
  37. {rapidtide-3.0a10.dist-info → rapidtide-3.0a12.dist-info}/top_level.txt +0 -0
rapidtide/_version.py CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  # This file helps to compute a version number in source trees obtained from
2
3
  # git-archive tarball (such as those provided by githubs download-from-tag
3
4
  # feature). Distribution tarballs (built by setup.py sdist) and build
@@ -11,12 +12,12 @@
11
12
  """Git implementation of _version.py."""
12
13
 
13
14
  import errno
14
- import functools
15
15
  import os
16
16
  import re
17
17
  import subprocess
18
18
  import sys
19
19
  from typing import Any, Callable, Dict, List, Optional, Tuple
20
+ import functools
20
21
 
21
22
 
22
23
  def get_keywords() -> Dict[str, str]:
@@ -67,14 +68,12 @@ HANDLERS: Dict[str, Dict[str, Callable]] = {}
67
68
 
68
69
  def register_vcs_handler(vcs: str, method: str) -> Callable: # decorator
69
70
  """Create decorator to mark a method as the handler of a VCS."""
70
-
71
71
  def decorate(f: Callable) -> Callable:
72
72
  """Store f in HANDLERS[vcs][method]."""
73
73
  if vcs not in HANDLERS:
74
74
  HANDLERS[vcs] = {}
75
75
  HANDLERS[vcs][method] = f
76
76
  return f
77
-
78
77
  return decorate
79
78
 
80
79
 
@@ -101,14 +100,10 @@ def run_command(
101
100
  try:
102
101
  dispcmd = str([command] + args)
103
102
  # remember shell=False, so use git.cmd on windows, not just git
104
- process = subprocess.Popen(
105
- [command] + args,
106
- cwd=cwd,
107
- env=env,
108
- stdout=subprocess.PIPE,
109
- stderr=(subprocess.PIPE if hide_stderr else None),
110
- **popen_kwargs,
111
- )
103
+ process = subprocess.Popen([command] + args, cwd=cwd, env=env,
104
+ stdout=subprocess.PIPE,
105
+ stderr=(subprocess.PIPE if hide_stderr
106
+ else None), **popen_kwargs)
112
107
  break
113
108
  except OSError as e:
114
109
  if e.errno == errno.ENOENT:
@@ -146,21 +141,15 @@ def versions_from_parentdir(
146
141
  for _ in range(3):
147
142
  dirname = os.path.basename(root)
148
143
  if dirname.startswith(parentdir_prefix):
149
- return {
150
- "version": dirname[len(parentdir_prefix) :],
151
- "full-revisionid": None,
152
- "dirty": False,
153
- "error": None,
154
- "date": None,
155
- }
144
+ return {"version": dirname[len(parentdir_prefix):],
145
+ "full-revisionid": None,
146
+ "dirty": False, "error": None, "date": None}
156
147
  rootdirs.append(root)
157
148
  root = os.path.dirname(root) # up a level
158
149
 
159
150
  if verbose:
160
- print(
161
- "Tried directories %s but none started with prefix %s"
162
- % (str(rootdirs), parentdir_prefix)
163
- )
151
+ print("Tried directories %s but none started with prefix %s" %
152
+ (str(rootdirs), parentdir_prefix))
164
153
  raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
165
154
 
166
155
 
@@ -223,7 +212,7 @@ def git_versions_from_keywords(
223
212
  # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
224
213
  # just "foo-1.0". If we see a "tag: " prefix, prefer those.
225
214
  TAG = "tag: "
226
- tags = {r[len(TAG) :] for r in refs if r.startswith(TAG)}
215
+ tags = {r[len(TAG):] for r in refs if r.startswith(TAG)}
227
216
  if not tags:
228
217
  # Either we're using git < 1.8.3, or there really are no tags. We use
229
218
  # a heuristic: assume all version tags have a digit. The old git %d
@@ -232,7 +221,7 @@ def git_versions_from_keywords(
232
221
  # between branches and tags. By ignoring refnames without digits, we
233
222
  # filter out many common branch names like "release" and
234
223
  # "stabilization", as well as "HEAD" and "master".
235
- tags = {r for r in refs if re.search(r"\d", r)}
224
+ tags = {r for r in refs if re.search(r'\d', r)}
236
225
  if verbose:
237
226
  print("discarding '%s', no digits" % ",".join(refs - tags))
238
227
  if verbose:
@@ -240,36 +229,32 @@ def git_versions_from_keywords(
240
229
  for ref in sorted(tags):
241
230
  # sorting will prefer e.g. "2.0" over "2.0rc1"
242
231
  if ref.startswith(tag_prefix):
243
- r = ref[len(tag_prefix) :]
232
+ r = ref[len(tag_prefix):]
244
233
  # Filter out refs that exactly match prefix or that don't start
245
234
  # with a number once the prefix is stripped (mostly a concern
246
235
  # when prefix is '')
247
- if not re.match(r"\d", r):
236
+ if not re.match(r'\d', r):
248
237
  continue
249
238
  if verbose:
250
239
  print("picking %s" % r)
251
- return {
252
- "version": r,
253
- "full-revisionid": keywords["full"].strip(),
254
- "dirty": False,
255
- "error": None,
256
- "date": date,
257
- }
240
+ return {"version": r,
241
+ "full-revisionid": keywords["full"].strip(),
242
+ "dirty": False, "error": None,
243
+ "date": date}
258
244
  # no suitable tags, so version is "0+unknown", but full hex is still there
259
245
  if verbose:
260
246
  print("no suitable tags, using unknown + full revision id")
261
- return {
262
- "version": "0+unknown",
263
- "full-revisionid": keywords["full"].strip(),
264
- "dirty": False,
265
- "error": "no suitable tags",
266
- "date": None,
267
- }
247
+ return {"version": "0+unknown",
248
+ "full-revisionid": keywords["full"].strip(),
249
+ "dirty": False, "error": "no suitable tags", "date": None}
268
250
 
269
251
 
270
252
  @register_vcs_handler("git", "pieces_from_vcs")
271
253
  def git_pieces_from_vcs(
272
- tag_prefix: str, root: str, verbose: bool, runner: Callable = run_command
254
+ tag_prefix: str,
255
+ root: str,
256
+ verbose: bool,
257
+ runner: Callable = run_command
273
258
  ) -> Dict[str, Any]:
274
259
  """Get version from 'git describe' in the root of the source tree.
275
260
 
@@ -288,7 +273,8 @@ def git_pieces_from_vcs(
288
273
  env.pop("GIT_DIR", None)
289
274
  runner = functools.partial(runner, env=env)
290
275
 
291
- _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root, hide_stderr=not verbose)
276
+ _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root,
277
+ hide_stderr=not verbose)
292
278
  if rc != 0:
293
279
  if verbose:
294
280
  print("Directory %s not under git control" % root)
@@ -296,19 +282,10 @@ def git_pieces_from_vcs(
296
282
 
297
283
  # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
298
284
  # if there isn't one, this yields HEX[-dirty] (no NUM)
299
- describe_out, rc = runner(
300
- GITS,
301
- [
302
- "describe",
303
- "--tags",
304
- "--dirty",
305
- "--always",
306
- "--long",
307
- "--match",
308
- f"{tag_prefix}[[:digit:]]*",
309
- ],
310
- cwd=root,
311
- )
285
+ describe_out, rc = runner(GITS, [
286
+ "describe", "--tags", "--dirty", "--always", "--long",
287
+ "--match", f"{tag_prefix}[[:digit:]]*"
288
+ ], cwd=root)
312
289
  # --long was added in git-1.5.5
313
290
  if describe_out is None:
314
291
  raise NotThisMethod("'git describe' failed")
@@ -323,7 +300,8 @@ def git_pieces_from_vcs(
323
300
  pieces["short"] = full_out[:7] # maybe improved later
324
301
  pieces["error"] = None
325
302
 
326
- branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"], cwd=root)
303
+ branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"],
304
+ cwd=root)
327
305
  # --abbrev-ref was added in git-1.6.3
328
306
  if rc != 0 or branch_name is None:
329
307
  raise NotThisMethod("'git rev-parse --abbrev-ref' returned error")
@@ -363,16 +341,17 @@ def git_pieces_from_vcs(
363
341
  dirty = git_describe.endswith("-dirty")
364
342
  pieces["dirty"] = dirty
365
343
  if dirty:
366
- git_describe = git_describe[: git_describe.rindex("-dirty")]
344
+ git_describe = git_describe[:git_describe.rindex("-dirty")]
367
345
 
368
346
  # now we have TAG-NUM-gHEX or HEX
369
347
 
370
348
  if "-" in git_describe:
371
349
  # TAG-NUM-gHEX
372
- mo = re.search(r"^(.+)-(\d+)-g([0-9a-f]+)$", git_describe)
350
+ mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe)
373
351
  if not mo:
374
352
  # unparsable. Maybe git-describe is misbehaving?
375
- pieces["error"] = "unable to parse git-describe output: '%s'" % describe_out
353
+ pieces["error"] = ("unable to parse git-describe output: '%s'"
354
+ % describe_out)
376
355
  return pieces
377
356
 
378
357
  # tag
@@ -381,9 +360,10 @@ def git_pieces_from_vcs(
381
360
  if verbose:
382
361
  fmt = "tag '%s' doesn't start with prefix '%s'"
383
362
  print(fmt % (full_tag, tag_prefix))
384
- pieces["error"] = "tag '%s' doesn't start with prefix '%s'" % (full_tag, tag_prefix)
363
+ pieces["error"] = ("tag '%s' doesn't start with prefix '%s'"
364
+ % (full_tag, tag_prefix))
385
365
  return pieces
386
- pieces["closest-tag"] = full_tag[len(tag_prefix) :]
366
+ pieces["closest-tag"] = full_tag[len(tag_prefix):]
387
367
 
388
368
  # distance: number of commits since tag
389
369
  pieces["distance"] = int(mo.group(2))
@@ -432,7 +412,8 @@ def render_pep440(pieces: Dict[str, Any]) -> str:
432
412
  rendered += ".dirty"
433
413
  else:
434
414
  # exception #1
435
- rendered = "0+untagged.%d.g%s" % (pieces["distance"], pieces["short"])
415
+ rendered = "0+untagged.%d.g%s" % (pieces["distance"],
416
+ pieces["short"])
436
417
  if pieces["dirty"]:
437
418
  rendered += ".dirty"
438
419
  return rendered
@@ -461,7 +442,8 @@ def render_pep440_branch(pieces: Dict[str, Any]) -> str:
461
442
  rendered = "0"
462
443
  if pieces["branch"] != "master":
463
444
  rendered += ".dev0"
464
- rendered += "+untagged.%d.g%s" % (pieces["distance"], pieces["short"])
445
+ rendered += "+untagged.%d.g%s" % (pieces["distance"],
446
+ pieces["short"])
465
447
  if pieces["dirty"]:
466
448
  rendered += ".dirty"
467
449
  return rendered
@@ -622,13 +604,11 @@ def render_git_describe_long(pieces: Dict[str, Any]) -> str:
622
604
  def render(pieces: Dict[str, Any], style: str) -> Dict[str, Any]:
623
605
  """Render the given version pieces into the requested style."""
624
606
  if pieces["error"]:
625
- return {
626
- "version": "unknown",
627
- "full-revisionid": pieces.get("long"),
628
- "dirty": None,
629
- "error": pieces["error"],
630
- "date": None,
631
- }
607
+ return {"version": "unknown",
608
+ "full-revisionid": pieces.get("long"),
609
+ "dirty": None,
610
+ "error": pieces["error"],
611
+ "date": None}
632
612
 
633
613
  if not style or style == "default":
634
614
  style = "pep440" # the default
@@ -652,13 +632,9 @@ def render(pieces: Dict[str, Any], style: str) -> Dict[str, Any]:
652
632
  else:
653
633
  raise ValueError("unknown style '%s'" % style)
654
634
 
655
- return {
656
- "version": rendered,
657
- "full-revisionid": pieces["long"],
658
- "dirty": pieces["dirty"],
659
- "error": None,
660
- "date": pieces.get("date"),
661
- }
635
+ return {"version": rendered, "full-revisionid": pieces["long"],
636
+ "dirty": pieces["dirty"], "error": None,
637
+ "date": pieces.get("date")}
662
638
 
663
639
 
664
640
  def get_versions() -> Dict[str, Any]:
@@ -672,7 +648,8 @@ def get_versions() -> Dict[str, Any]:
672
648
  verbose = cfg.verbose
673
649
 
674
650
  try:
675
- return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, verbose)
651
+ return git_versions_from_keywords(get_keywords(), cfg.tag_prefix,
652
+ verbose)
676
653
  except NotThisMethod:
677
654
  pass
678
655
 
@@ -681,16 +658,13 @@ def get_versions() -> Dict[str, Any]:
681
658
  # versionfile_source is the relative path from the top of the source
682
659
  # tree (where the .git directory might live) to this file. Invert
683
660
  # this to find the root from __file__.
684
- for _ in cfg.versionfile_source.split("/"):
661
+ for _ in cfg.versionfile_source.split('/'):
685
662
  root = os.path.dirname(root)
686
663
  except NameError:
687
- return {
688
- "version": "0+unknown",
689
- "full-revisionid": None,
690
- "dirty": None,
691
- "error": "unable to find root of source tree",
692
- "date": None,
693
- }
664
+ return {"version": "0+unknown", "full-revisionid": None,
665
+ "dirty": None,
666
+ "error": "unable to find root of source tree",
667
+ "date": None}
694
668
 
695
669
  try:
696
670
  pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
@@ -704,10 +678,6 @@ def get_versions() -> Dict[str, Any]:
704
678
  except NotThisMethod:
705
679
  pass
706
680
 
707
- return {
708
- "version": "0+unknown",
709
- "full-revisionid": None,
710
- "dirty": None,
711
- "error": "unable to compute version",
712
- "date": None,
713
- }
681
+ return {"version": "0+unknown", "full-revisionid": None,
682
+ "dirty": None,
683
+ "error": "unable to compute version", "date": None}
@@ -1,126 +1,10 @@
1
1
  #!/bin/bash
2
2
 
3
- #rapidtide \
4
- # --spatialfilt 2 \
5
- # --nprocs -1 \
6
- # --simcalcrange 50 -1 \
7
- # --outputlevel max \
8
- # --glmderivs 1 \
9
- # sub-RAPIDTIDETEST.nii.gz \
10
- # ../dst/sub-RAPIDTIDETEST_norefine
11
-
12
- rapidtide \
13
- --spatialfilt 5 \
14
- --nprocs -1 \
15
- --searchrange -5 20 \
16
- --simcalcrange 50 -1 \
17
- --refinedelay \
18
- sub-RAPIDTIDETEST.nii.gz \
19
- ../dst/sub-RAPIDTIDETEST_filt
20
-
21
3
  rapidtide \
22
- --spatialfilt 0 \
4
+ --spatialfilt -1 \
23
5
  --nprocs -1 \
24
6
  --searchrange -5 20 \
25
7
  --simcalcrange 50 -1 \
26
- --refinedelay \
8
+ --outputlevel max \
27
9
  sub-RAPIDTIDETEST.nii.gz \
28
- ../dst/sub-RAPIDTIDETEST_nofilt
29
-
30
- #rapidtide \
31
- # --spatialfilt 5 \
32
- # --nprocs -1 \
33
- # --simcalcrange 50 -1 \
34
- # --outputlevel max \
35
- # --refinedelay \
36
- # sub-RAPIDTIDETEST.nii.gz \
37
- # ../dst/sub-RAPIDTIDETEST_corr
38
-
39
- #rapidtide \
40
- # --spatialfilt 2 \
41
- # --nprocs -1 \
42
- # --passes 50 \
43
- # --despecklepasses 50 \
44
- # --simcalcrange 50 -1 \
45
- # --outputlevel max \
46
- # sub-RAPIDTIDETEST.nii.gz \
47
- # ../dst/sub-RAPIDTIDETEST_spec
48
- #
49
- #rapidtide \
50
- # --spatialfilt 2 \
51
- # --nprocs -1 \
52
- # --denoising \
53
- # --passes 4 \
54
- # --despecklepasses 5 \
55
- # --simcalcrange 50 -1 \
56
- # --outputlevel max \
57
- # sub-RAPIDTIDETEST.nii.gz \
58
- # ../dst/sub-RAPIDTIDETEST_denoisingspec
59
- #
60
- #rapidtide \
61
- # --spatialfilt 2 \
62
- # --nprocs -1 \
63
- # --denoising \
64
- # --simcalcrange 50 -1 \
65
- # --outputlevel max \
66
- # sub-RAPIDTIDETEST.nii.gz \
67
- # ../dst/sub-RAPIDTIDETEST_denoisingnospec
68
- #rapidtide \
69
- #--spatialfilt 2 \
70
- #--nprocs -1 \
71
- #--passes 3 \
72
- #--simcalcrange 50 -1 \
73
- #--padtype constant \
74
- #--outputlevel max \
75
- #sub-RAPIDTIDETEST.nii.gz \
76
- #../dst/sub-RAPIDTIDETEST_constantpad
77
-
78
- #rapidtide \
79
- # --spatialfilt 2 \
80
- # --nprocs -1 \
81
- # --passes 3 \
82
- # --simcalcrange 50 -1 \
83
- # --memprofile \
84
- # sub-RAPIDTIDETEST.nii.gz \
85
- # ../dst/sub-RAPIDTIDETEST_memprofile
86
-
87
- #rapidtide \
88
- #--spatialfilt 2 \
89
- #--nprocs -1 \
90
- #--passes 3 \
91
- #--simcalcrange 50 -1 \
92
- #--texcludemask tmask3_exclude.txt \
93
- #sub-RAPIDTIDETEST.nii.gz \
94
- #../dst/sub-RAPIDTIDETEST_excludemask
95
- #
96
- #rapidtide \
97
- #--spatialfilt 2 \
98
- #--nprocs -1 \
99
- #--passes 3 \
100
- #--simcalcrange 50 -1 \
101
- #--tincludemask tmask3.txt \
102
- #--texcludemask tmask3_exclude.txt \
103
- #sub-RAPIDTIDETEST.nii.gz \
104
- #../dst/sub-RAPIDTIDETEST_bothmasks
105
-
106
- #for FILT in 1 2 4 8 16
107
- #do
108
- # rapidtide \
109
- # --spatialfilt ${FILT} \
110
- # --nprocs -1 \
111
- # --passes 3 \
112
- # --simcalcrange 50 -1 \
113
- # --outputlevel min \
114
- # sub-RAPIDTIDETEST.nii.gz \
115
- # ../dst/sub-RAPIDTIDETEST_${FILT}
116
- #done
117
- #
118
- #for MAP in maxtime maxcorr
119
- #do
120
- # fslmerge -t ../dst/all_${MAP} \
121
- # ../dst/sub-RAPIDTIDETEST_1_desc-${MAP}_map.nii.gz \
122
- # ../dst/sub-RAPIDTIDETEST_2_desc-${MAP}_map.nii.gz \
123
- # ../dst/sub-RAPIDTIDETEST_4_desc-${MAP}_map.nii.gz \
124
- # ../dst/sub-RAPIDTIDETEST_8_desc-${MAP}_map.nii.gz \
125
- # ../dst/sub-RAPIDTIDETEST_16_desc-${MAP}_map.nii.gz
126
- #done
10
+ ../dst/sub-RAPIDTIDETEST
@@ -65,10 +65,5 @@
65
65
  happy \
66
66
  sub-HAPPYTEST.nii.gz \
67
67
  sub-HAPPYTEST.json \
68
+ --spatialglm \
68
69
  ../dst/happy
69
-
70
- happy \
71
- sub-HAPPYTEST.nii.gz \
72
- sub-HAPPYTEST.json \
73
- ../dst/happy_aliasedcorrelation \
74
- --aliasedcorrelation
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+
3
+ rapidtide \
4
+ --spatialfilt -1 \
5
+ --nprocs -1 \
6
+ --searchrange -5 20 \
7
+ --simcalcrange 50 -1 \
8
+ sub-RAPIDTIDETEST.nii.gz \
9
+ ../dst/sub-RAPIDTIDETEST_defaultfilt
10
+
11
+ rapidtide \
12
+ --spatialfilt -1 \
13
+ --nprocs -1 \
14
+ --searchrange -5 20 \
15
+ --simcalcrange 50 -1 \
16
+ --regressor ../dst/sub-RAPIDTIDETEST_defaultfilt_desc-movingregressor_timeseries.json:pass3 \
17
+ --initialdelay ../dst/sub-RAPIDTIDETEST_defaultfilt_desc-maxtimerefined_map.nii.gz \
18
+ sub-RAPIDTIDETEST.nii.gz \
19
+ ../dst/sub-RAPIDTIDETEST_startfromlast
@@ -0,0 +1,49 @@
1
+ #!/bin/bash
2
+
3
+ rapidtide \
4
+ --spatialfilt -1 \
5
+ --nprocs -1 \
6
+ --searchrange -5 20 \
7
+ --simcalcrange 50 -1 \
8
+ --outputlevel max \
9
+ --refineglmderivs 1 \
10
+ sub-RAPIDTIDETEST.nii.gz \
11
+ ../dst/sub-RAPIDTIDETEST_1deriv
12
+
13
+ rapidtide \
14
+ --spatialfilt -1 \
15
+ --nprocs -1 \
16
+ --searchrange -5 20 \
17
+ --simcalcrange 50 -1 \
18
+ --outputlevel max \
19
+ --refineglmderivs 2 \
20
+ sub-RAPIDTIDETEST.nii.gz \
21
+ ../dst/sub-RAPIDTIDETEST_2deriv
22
+
23
+
24
+ retroglm \
25
+ sub-RAPIDTIDETEST.nii.gz \
26
+ ../dst/sub-RAPIDTIDETEST_1deriv \
27
+ --alternateoutput ../dst/retrotest_1to1 \
28
+ --nprocs -1 \
29
+ --glmderivs 0 \
30
+ --refineglmderivs 1 \
31
+ --outputlevel max
32
+
33
+ retroglm \
34
+ sub-RAPIDTIDETEST.nii.gz \
35
+ ../dst/sub-RAPIDTIDETEST_2deriv \
36
+ --alternateoutput ../dst/retrotest_2to1 \
37
+ --nprocs -1 \
38
+ --glmderivs 0 \
39
+ --refineglmderivs 1 \
40
+ --outputlevel max
41
+
42
+ retroglm \
43
+ sub-RAPIDTIDETEST.nii.gz \
44
+ ../dst/sub-RAPIDTIDETEST_1deriv \
45
+ --alternateoutput ../dst/retrotest_1to2 \
46
+ --nprocs -1 \
47
+ --glmderivs 0 \
48
+ --refineglmderivs 2 \
49
+ --outputlevel max
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+
3
+ rapidtide \
4
+ --spatialfilt -1 \
5
+ --nprocs -1 \
6
+ --passes 1 \
7
+ --nodelayfit \
8
+ --focaldebug \
9
+ --dofinalrefine \
10
+ sub-RAPIDTIDETEST.nii.gz \
11
+ ../dst/sub-RAPIDTIDETEST_firstpass
12
+
13
+ rapidtide \
14
+ --spatialfilt -1 \
15
+ --nprocs -1 \
16
+ --nodelayfit \
17
+ --regressor ../dst/sub-RAPIDTIDETEST_firstpass_desc-refinedmovingregressor_timeseries.json:filtered_pass1 \
18
+ --initialdelay ../dst/sub-RAPIDTIDETEST_firstpass_desc-maxtimerefined_map.nii.gz \
19
+ --dofinalrefine \
20
+ --passes 1 \
21
+ sub-RAPIDTIDETEST.nii.gz \
22
+ ../dst/sub-RAPIDTIDETEST_secondpass
rapidtide/glmpass.py CHANGED
@@ -17,6 +17,7 @@
17
17
  #
18
18
  #
19
19
  import numpy as np
20
+ from scipy.special import factorial
20
21
  from tqdm import tqdm
21
22
 
22
23
  import rapidtide.filter as tide_filt
@@ -350,11 +351,17 @@ def makevoxelspecificderivs(theevs, nderivs=1, debug=False):
350
351
  if nderivs == 0:
351
352
  thenewevs = theevs
352
353
  else:
354
+ taylorcoffs = np.zeros((nderivs + 1), dtype=np.float64)
355
+ taylorcoffs[0] = 1.0
353
356
  thenewevs = np.zeros((theevs.shape[0], theevs.shape[1], nderivs + 1), dtype=float)
357
+ for i in range(1, nderivs + 1):
358
+ taylorcoffs[i] = 1.0 / factorial(i)
354
359
  for thevoxel in range(0, theevs.shape[0]):
355
360
  thenewevs[thevoxel, :, 0] = theevs[thevoxel, :] * 1.0
356
361
  for i in range(1, nderivs + 1):
357
- thenewevs[thevoxel, :, i] = np.gradient(thenewevs[thevoxel, :, i - 1])
362
+ thenewevs[thevoxel, :, i] = taylorcoffs[i] * np.gradient(
363
+ thenewevs[thevoxel, :, i - 1]
364
+ )
358
365
  if debug:
359
366
  print(f"{nderivs=}")
360
367
  print(f"{thenewevs.shape=}")