rapidtide 3.0a13__py3-none-any.whl → 3.0a14__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 (31) hide show
  1. rapidtide/DerivativeDelay.py +3 -1
  2. rapidtide/data/examples/src/testdelayvar +2 -1
  3. rapidtide/linfitfiltpass.py +2 -0
  4. rapidtide/makelaggedtcs.py +8 -5
  5. rapidtide/multiproc.py +8 -11
  6. rapidtide/refinedelay.py +173 -86
  7. rapidtide/tests/test_fullrunhappy_v1.py +13 -5
  8. rapidtide/tests/test_fullrunhappy_v2.py +16 -8
  9. rapidtide/tests/test_fullrunhappy_v3.py +16 -8
  10. rapidtide/tests/test_fullrunhappy_v4.py +16 -8
  11. rapidtide/tests/test_fullrunhappy_v5.py +14 -6
  12. rapidtide/tests/test_fullrunrapidtide_v1.py +18 -10
  13. rapidtide/tests/test_fullrunrapidtide_v2.py +21 -13
  14. rapidtide/tests/test_fullrunrapidtide_v3.py +14 -6
  15. rapidtide/tests/test_fullrunrapidtide_v4.py +14 -7
  16. rapidtide/tests/test_fullrunrapidtide_v5.py +12 -4
  17. rapidtide/tests/test_fullrunrapidtide_v6.py +23 -15
  18. rapidtide/tests/test_refinedelay.py +3 -1
  19. rapidtide/workflows/atlasaverage.py +40 -12
  20. rapidtide/workflows/delayvar.py +121 -33
  21. rapidtide/workflows/rapidtide.py +12 -8
  22. rapidtide/workflows/rapidtide_parser.py +13 -15
  23. rapidtide/workflows/regressfrommaps.py +2 -0
  24. rapidtide/workflows/retrolagtcs.py +1 -0
  25. rapidtide/workflows/retroregress.py +25 -1
  26. {rapidtide-3.0a13.dist-info → rapidtide-3.0a14.dist-info}/METADATA +1 -1
  27. {rapidtide-3.0a13.dist-info → rapidtide-3.0a14.dist-info}/RECORD +31 -31
  28. {rapidtide-3.0a13.dist-info → rapidtide-3.0a14.dist-info}/WHEEL +0 -0
  29. {rapidtide-3.0a13.dist-info → rapidtide-3.0a14.dist-info}/entry_points.txt +0 -0
  30. {rapidtide-3.0a13.dist-info → rapidtide-3.0a14.dist-info}/licenses/LICENSE +0 -0
  31. {rapidtide-3.0a13.dist-info → rapidtide-3.0a14.dist-info}/top_level.txt +0 -0
@@ -27,6 +27,7 @@ from pathlib import Path
27
27
  import numpy as np
28
28
  from scipy.stats import pearsonr
29
29
  from sklearn.decomposition import PCA
30
+ from tf_keras.src.dtensor.integration_test_utils import train_step
30
31
 
31
32
  import rapidtide.filter as tide_filt
32
33
  import rapidtide.io as tide_io
@@ -61,7 +62,8 @@ DEFAULT_DELAYOFFSETSPATIALFILT = -1
61
62
  DEFAULT_WINDOWSIZE = 30.0
62
63
  DEFAULT_SYSTEMICFITTYPE = "pca"
63
64
  DEFAULT_PCACOMPONENTS = 1
64
- DEFAULT_TRAINWIDTH = 0.0
65
+ DEFAULT_LAGMIN = 0.0
66
+ DEFAULT_LAGMAX = 0.0
65
67
  DEFAULT_TRAINSTEP = 0.5
66
68
 
67
69
 
@@ -146,19 +148,19 @@ def _get_parser():
146
148
  default=True,
147
149
  )
148
150
  parser.add_argument(
149
- "--trainwidth",
150
- dest="trainwidth",
151
- action="store",
151
+ "--trainrange",
152
+ dest="lag_extrema",
153
+ action=pf.IndicateSpecifiedAction,
154
+ nargs=2,
152
155
  type=float,
153
- metavar="WIDTH",
156
+ metavar=("LAGMIN", "LAGMAX"),
154
157
  help=(
155
- "Train the ratio offset function over this range of central delays (in seconds). The derivative "
158
+ "Set the range of delay offset center frequencies to span LAGMIN to LAGMAX. The derivative "
156
159
  "ratio calculation only works over a narrow range, so if the static offset is large, "
157
160
  "you need to train the ratio calculation with a central delay close to that value. "
158
- "Set negative to select the width automatically. "
159
- f"Default is {DEFAULT_TRAINWIDTH}"
161
+ f"LAGMAX. Default is {DEFAULT_LAGMIN} to {DEFAULT_LAGMAX} seconds. "
160
162
  ),
161
- default=DEFAULT_TRAINWIDTH,
163
+ default=(DEFAULT_LAGMIN, DEFAULT_LAGMAX),
162
164
  )
163
165
  parser.add_argument(
164
166
  "--trainstep",
@@ -209,6 +211,13 @@ def _get_parser():
209
211
  help="Use NCOMP components for PCA fit of delay offset.",
210
212
  default=DEFAULT_PCACOMPONENTS,
211
213
  )
214
+ parser.add_argument(
215
+ "--verbose",
216
+ dest="verbose",
217
+ action="store_true",
218
+ help=("Be wicked chatty."),
219
+ default=False,
220
+ )
212
221
  parser.add_argument(
213
222
  "--debug",
214
223
  dest="debug",
@@ -259,6 +268,9 @@ def delayvar(args):
259
268
  # get the pid of the parent process
260
269
  args.pid = os.getpid()
261
270
 
271
+ args.lagmin = args.lag_extrema[0]
272
+ args.lagmax = args.lag_extrema[1]
273
+
262
274
  # specify the output name
263
275
  if args.alternateoutput is None:
264
276
  outputname = args.datafileroot
@@ -502,6 +514,16 @@ def delayvar(args):
502
514
  # windowed delay deviation estimation
503
515
  lagstouse_valid = lagtimes_valid
504
516
 
517
+ # find the robust range of the static delays
518
+ (
519
+ pct02,
520
+ pct98,
521
+ ) = tide_stats.getfracvals(lagstouse_valid, [0.02, 0.98], debug=args.debug)
522
+ if args.lagmin == -999:
523
+ args.lagmin = np.round(pct02 / args.trainstep, 0) * args.trainstep
524
+ if args.lagmax == -999:
525
+ args.lagmax = np.round(pct98 / args.trainstep, 0) * args.trainstep
526
+
505
527
  print("\n\nWindowed delay estimation")
506
528
  TimingLGR.info("Windowed delay estimation start")
507
529
  LGR.info("\n\nWindowed delay estimation")
@@ -537,7 +559,7 @@ def delayvar(args):
537
559
  thehpf.apply(genlagsamplerate, reference_y),
538
560
  padtime=thepadtime,
539
561
  )
540
- genlagtc.save(f"{outputname}_desc-lagtcgenerator_timeseries")
562
+ genlagtc.save(f"{outputname}_desc-hpflagtcgenerator_timeseries")
541
563
 
542
564
  # and filter the data if necessary
543
565
  if args.hpf:
@@ -582,7 +604,7 @@ def delayvar(args):
582
604
  numwins,
583
605
  )
584
606
  internalwinfmrishape = (numvalidspatiallocs, wintrs)
585
- if args.debug or args.focaldebug:
607
+ if args.debug:
586
608
  print(f"window space shape = {internalwinspaceshape}")
587
609
  print(f"internalwindowfmrishape shape = {internalwinfmrishape}")
588
610
 
@@ -591,6 +613,7 @@ def delayvar(args):
591
613
  windowedmedfiltregressderivratios = np.zeros(internalwinspaceshape, dtype=float)
592
614
  windowedfilteredregressderivratios = np.zeros(internalwinspaceshape, dtype=float)
593
615
  windoweddelayoffset = np.zeros(internalwinspaceshape, dtype=float)
616
+ windowedclosestoffset = np.zeros(internalwinspaceshape, dtype=float)
594
617
  if usesharedmem:
595
618
  if args.debug:
596
619
  print("allocating shared memory")
@@ -626,17 +649,30 @@ def delayvar(args):
626
649
  if args.debug:
627
650
  print(f"wintrs={wintrs}, winskip={winskip}, numtrs={numtrs}, numwins={numwins}")
628
651
  thewindowprocoptions = therunoptions
652
+ if args.verbose:
653
+ thewindowprocoptions["showprogressbar"] = True
654
+ else:
655
+ thewindowprocoptions["showprogressbar"] = False
629
656
  if args.focaldebug:
630
657
  thewindowprocoptions["saveminimumsLFOfiltfiles"] = True
631
658
  winoutputlevel = "max"
632
659
  else:
633
660
  thewindowprocoptions["saveminimumsLFOfiltfiles"] = False
634
661
  winoutputlevel = "min"
662
+
663
+ # Now get the derivative ratios the individual windows
664
+ print("Finding derivative ratios:")
635
665
  for thewin in range(numwins):
636
- print(f"Processing window {thewin + 1} of {numwins}")
666
+ print(f"\tProcessing window {thewin + 1} of {numwins}")
637
667
  starttr = thewin * winskip
638
668
  endtr = starttr + wintrs
639
669
  winlabel = f"_win-{str(thewin + 1).zfill(3)}"
670
+ if args.verbose:
671
+ thisLGR = LGR
672
+ thisTimingLGR = TimingLGR
673
+ else:
674
+ thisLGR = None
675
+ thisTimingLGR = None
640
676
 
641
677
  windowedregressderivratios[:, thewin], windowedregressrvalues[:, thewin] = (
642
678
  tide_refinedelay.getderivratios(
@@ -657,8 +693,8 @@ def delayvar(args):
657
693
  winmovingsignal,
658
694
  winlagtc,
659
695
  winfiltereddata,
660
- LGR,
661
- TimingLGR,
696
+ thisLGR,
697
+ thisTimingLGR,
662
698
  thewindowprocoptions,
663
699
  regressderivs=1,
664
700
  starttr=starttr,
@@ -666,7 +702,33 @@ def delayvar(args):
666
702
  debug=args.debug,
667
703
  )
668
704
  )
705
+ if args.focaldebug:
706
+ theheader = copy.deepcopy(fmri_header)
707
+ theheader["dim"][4] = wintrs
708
+ theheader["toffset"] = winwidth / 2.0
709
+ maplist = [
710
+ (
711
+ winlagtc,
712
+ "windowedlagtcs",
713
+ "bold",
714
+ None,
715
+ f"Lagtcs in each {winspace} second window",
716
+ ),
717
+ ]
718
+ tide_io.savemaplist(
719
+ outputname + winlabel,
720
+ maplist,
721
+ validvoxels,
722
+ (xsize, ysize, numslices, wintrs),
723
+ theheader,
724
+ bidsbasedict,
725
+ debug=args.debug,
726
+ )
669
727
 
728
+ # Filter the derivative ratios
729
+ print("Filtering derivative ratios:")
730
+ for thewin in range(numwins):
731
+ print(f"\tProcessing window {thewin + 1} of {numwins}")
670
732
  (
671
733
  windowedmedfiltregressderivratios[:, thewin],
672
734
  windowedfilteredregressderivratios[:, thewin],
@@ -681,34 +743,62 @@ def delayvar(args):
681
743
  fileiscifti=False,
682
744
  textio=False,
683
745
  rt_floattype=rt_floattype,
746
+ verbose=args.verbose,
684
747
  debug=args.debug,
685
748
  )
686
749
 
750
+ # Train the ratio offsets
751
+ print("Training ratio offsets:")
752
+ for thewin in range(numwins):
753
+ print(f"\tProcessing window {thewin + 1} of {numwins}")
754
+ starttr = thewin * winskip
755
+ endtr = starttr + wintrs
756
+ winlabel = f"_win-{str(thewin + 1).zfill(3)}"
687
757
  # find the mapping of glm ratios to delays
688
758
  tide_refinedelay.trainratiotooffset(
689
759
  genlagtc,
690
760
  initial_fmri_x[starttr:endtr],
691
761
  outputname + winlabel,
692
762
  winoutputlevel,
693
- trainwidth=args.trainwidth,
694
- trainstep=args.trainstep,
763
+ trainlagmin=args.lagmin,
764
+ trainlagmax=args.lagmax,
765
+ trainlagstep=args.trainstep,
695
766
  mindelay=args.mindelay,
696
767
  maxdelay=args.maxdelay,
697
768
  numpoints=args.numpoints,
698
- debug=args.debug,
769
+ verbose=args.verbose,
770
+ debug=args.focaldebug,
699
771
  )
700
772
  TimingLGR.info("Refinement calibration end")
701
773
 
702
- # now calculate the delay offsets
774
+ # now calculate the delay offsets
775
+ print("Calculating delay offsets:")
776
+ for thewin in range(numwins):
777
+ print(f"\tProcessing window {thewin + 1} of {numwins}")
778
+ winlabel = f"_win-{str(thewin + 1).zfill(3)}"
703
779
  TimingLGR.info("Calculating delay offsets")
704
- if args.focaldebug:
780
+ if args.debug:
705
781
  print(
706
782
  f"calculating delayoffsets for {windowedfilteredregressderivratios.shape[0]} voxels"
707
783
  )
708
784
  for i in range(windowedfilteredregressderivratios.shape[0]):
709
- windoweddelayoffset[i, thewin] = tide_refinedelay.ratiotodelay(
710
- windowedfilteredregressderivratios[i, thewin]
785
+ (windoweddelayoffset[i, thewin], windowedclosestoffset[i, thewin]) = (
786
+ tide_refinedelay.ratiotodelay(
787
+ windowedfilteredregressderivratios[i, thewin],
788
+ offset=lagstouse_valid[i],
789
+ debug=args.focaldebug,
790
+ )
711
791
  )
792
+ namesuffix = "_desc-delayoffset_hist"
793
+ tide_stats.makeandsavehistogram(
794
+ windoweddelayoffset[:, thewin],
795
+ therunoptions["histlen"],
796
+ 1,
797
+ outputname + winlabel + namesuffix,
798
+ displaytitle="Histogram of delay offsets calculated from GLM",
799
+ dictvarname="delayoffsethist",
800
+ thedict=None,
801
+ )
712
802
 
713
803
  # now see if there are common timecourses in the delay offsets
714
804
  themean = np.mean(windoweddelayoffset, axis=1)
@@ -749,7 +839,7 @@ def delayvar(args):
749
839
  # unscale the PCA cleaned data
750
840
  for vox in range(0, windoweddelayoffset.shape[0]):
751
841
  reduceddata[vox, :] = reduceddata[vox, :] * thevar[vox] + themean[vox]
752
- if args.focaldebug:
842
+ if args.debug:
753
843
  print("complex processing: reduceddata.shape =", scaledvoxels.shape)
754
844
  # pcadata = np.mean(reduceddata, axis=0)
755
845
  pcadata = thefit.components_[0]
@@ -850,22 +940,13 @@ def delayvar(args):
850
940
  nprocs_regressionfilt=args.nprocs,
851
941
  regressderivs=1,
852
942
  showprogressbar=args.showprogressbar,
853
- debug=args.focaldebug,
943
+ debug=args.debug,
854
944
  )
855
945
 
856
- namesuffix = f"_desc-delayoffsetwin{thewin}_hist"
857
- tide_stats.makeandsavehistogram(
858
- windoweddelayoffset[:, thewin],
859
- therunoptions["histlen"],
860
- 1,
861
- outputname + namesuffix,
862
- displaytitle="Histogram of delay offsets calculated from GLM",
863
- dictvarname="delayoffsethist",
864
- thedict=None,
865
- )
866
946
  theheader = copy.deepcopy(fmri_header)
867
947
  theheader["dim"][4] = numwins
868
948
  theheader["pixdim"][4] = winspace
949
+ theheader["toffset"] = winwidth / 2.0
869
950
  maplist = [
870
951
  (
871
952
  windoweddelayoffset,
@@ -874,6 +955,13 @@ def delayvar(args):
874
955
  None,
875
956
  f"Delay offsets in each {winspace} second window",
876
957
  ),
958
+ (
959
+ windowedclosestoffset,
960
+ "windowedclosestoffset",
961
+ "info",
962
+ None,
963
+ f"Closest delay offsets in each {winspace} second window",
964
+ ),
877
965
  (
878
966
  np.square(windowedregressrvalues),
879
967
  "windowedregressr2values",
@@ -607,14 +607,16 @@ def rapidtide_main(argparsingfunc):
607
607
  fmri_data = nim_data.reshape((numspatiallocs, timepoints))[:, validstart : validend + 1]
608
608
 
609
609
  # detect zero mean data
610
- optiondict["dataiszeromean"] = checkforzeromean(fmri_data)
610
+ if not optiondict["dataiszeromean"]:
611
+ # check anyway
612
+ optiondict["dataiszeromean"] = checkforzeromean(fmri_data)
613
+
611
614
  if optiondict["dataiszeromean"]:
612
615
  LGR.warning(
613
616
  "WARNING: dataset is zero mean - forcing variance masking and no refine prenormalization. "
614
617
  "Consider specifying a global mean and correlation mask."
615
618
  )
616
619
  optiondict["refineprenorm"] = "None"
617
- optiondict["globalmaskmethod"] = "variance"
618
620
 
619
621
  # reformat the brain mask, if it exists
620
622
  if brainmask is None:
@@ -716,18 +718,18 @@ def rapidtide_main(argparsingfunc):
716
718
  corrmask[np.where(datarange == 0)] = 0.0
717
719
  else:
718
720
  # check to see if the data has been demeaned
719
- meanim = np.mean(fmri_data, axis=1)
720
- stdim = np.std(fmri_data, axis=1)
721
- if fileiscifti:
721
+ if fileiscifti or optiondict["textio"]:
722
722
  corrmask = np.uint(nim_data[:, 0] * 0 + 1)
723
723
  else:
724
- if (np.mean(stdim) < np.mean(meanim)) and not optiondict["nirs"]:
724
+ if optiondict["dataiszeromean"]:
725
725
  LGR.verbose("generating correlation mask from mean image")
726
726
  corrmask = np.uint16(tide_mask.makeepimask(nim).dataobj.reshape(numspatiallocs))
727
727
  else:
728
728
  LGR.verbose("generating correlation mask from std image")
729
729
  corrmask = np.uint16(
730
- tide_stats.makemask(stdim, threshpct=optiondict["corrmaskthreshpct"])
730
+ tide_stats.makemask(
731
+ np.std(fmri_data, axis=1), threshpct=optiondict["corrmaskthreshpct"]
732
+ )
731
733
  )
732
734
  if internalbrainmask is not None:
733
735
  corrmask = internalbrainmask
@@ -3429,7 +3431,9 @@ def rapidtide_main(argparsingfunc):
3429
3431
  f"calculating delayoffsets for {filteredregressderivratios.shape[0]} voxels"
3430
3432
  )
3431
3433
  for i in range(filteredregressderivratios.shape[0]):
3432
- delayoffset[i] = tide_refinedelay.ratiotodelay(filteredregressderivratios[i])
3434
+ delayoffset[i], closestoffset = tide_refinedelay.ratiotodelay(
3435
+ filteredregressderivratios[i]
3436
+ )
3433
3437
  else:
3434
3438
  medfiltregressderivratios = np.zeros_like(regressderivratios)
3435
3439
  filteredregressderivratios = np.zeros_like(regressderivratios)
@@ -70,7 +70,6 @@ DEFAULT_MAXPASSES = 15
70
70
  DEFAULT_REFINE_TYPE = "pca"
71
71
  DEFAULT_INTERPTYPE = "univariate"
72
72
  DEFAULT_WINDOW_TYPE = "hamming"
73
- DEFAULT_GLOBALMASK_METHOD = "mean"
74
73
  DEFAULT_GLOBALSIGNAL_METHOD = "sum"
75
74
  DEFAULT_CORRWEIGHTING = "phat"
76
75
  DEFAULT_CORRTYPE = "linear"
@@ -240,7 +239,7 @@ def _get_parser():
240
239
  action="store_true",
241
240
  help=(
242
241
  "This is a NIRS analysis - this is a macro that "
243
- "sets nothresh, refineprenorm=var, ampthresh=0.7, and "
242
+ "sets nothresh, dataiszeromean=True, refineprenorm=var, ampthresh=0.7, and "
244
243
  "lagminthresh=0.1. "
245
244
  ),
246
245
  default=False,
@@ -382,6 +381,17 @@ def _get_parser():
382
381
  ),
383
382
  default=False,
384
383
  )
384
+ preproc.add_argument(
385
+ "--dataiszeromean",
386
+ dest="dataiszeromean",
387
+ action="store_true",
388
+ help=(
389
+ "Assume that the fMRI data is zero mean (this will be the case if you used AFNI for preprocessing). "
390
+ "This affects how masks are generated. Rapidtide will attempt to detect this, but set explicitly "
391
+ "if you know this is the case."
392
+ ),
393
+ default=False,
394
+ )
385
395
 
386
396
  # Add filter options
387
397
  pf.addfilteropts(parser, filtertarget="data and regressors", details=True)
@@ -444,19 +454,6 @@ def _get_parser():
444
454
  ),
445
455
  default=False,
446
456
  )
447
- preproc.add_argument(
448
- "--globalmaskmethod",
449
- dest="globalmaskmethod",
450
- action="store",
451
- type=str,
452
- choices=["mean", "variance"],
453
- help=(
454
- "Select whether to use timecourse mean or variance to "
455
- "mask voxels prior to generating global mean. "
456
- f'Default is "{DEFAULT_GLOBALMASK_METHOD}".'
457
- ),
458
- default=DEFAULT_GLOBALMASK_METHOD,
459
- )
460
457
  preproc.add_argument(
461
458
  "--globalmeaninclude",
462
459
  dest="globalmeanincludespec",
@@ -2211,6 +2208,7 @@ def process_args(inputargs=None):
2211
2208
  LGR.warning('Using "nirs" macro. Overriding any affected arguments.')
2212
2209
  args["nothresh"] = True
2213
2210
  pf.setifnotset(args, "preservefiltering", False)
2211
+ args["dataiszeromean"] = True
2214
2212
  args["refineprenorm"] = "var"
2215
2213
  args["ampthresh"] = 0.7
2216
2214
  args["ampthreshfromsig"] = False
@@ -121,6 +121,7 @@ def regressfrommaps(
121
121
  fitmask,
122
122
  lagtimes,
123
123
  lagtc,
124
+ LGR=LGR,
124
125
  nprocs=nprocs_makelaggedtcs,
125
126
  alwaysmultiproc=alwaysmultiproc,
126
127
  showprogressbar=showprogressbar,
@@ -187,6 +188,7 @@ def regressfrommaps(
187
188
  nprocs=nprocs_regressionfilt,
188
189
  alwaysmultiproc=alwaysmultiproc,
189
190
  showprogressbar=showprogressbar,
191
+ verbose=(LGR is not None),
190
192
  mp_chunksize=mp_chunksize,
191
193
  rt_floatset=rt_floatset,
192
194
  rt_floattype=rt_floattype,
@@ -257,6 +257,7 @@ def retrolagtcs(args):
257
257
  procmask_valid,
258
258
  lagtimes_valid,
259
259
  lagtc,
260
+ LGR=LGR,
260
261
  nprocs=args.nprocs,
261
262
  showprogressbar=args.showprogressbar,
262
263
  )
@@ -295,7 +295,29 @@ def retroregress(args):
295
295
  print(f"illegal output level {args['outputlevel']}")
296
296
  sys.exit()
297
297
 
298
+ # save the raw and formatted command lines
299
+ argstowrite = sys.argv
298
300
  thecommandline = " ".join(sys.argv[1:])
301
+ tide_io.writevec([thecommandline], f"{outputname}_retrocommandline.txt")
302
+ formattedcommandline = []
303
+ for thetoken in argstowrite[0:3]:
304
+ formattedcommandline.append(thetoken)
305
+ for thetoken in argstowrite[3:]:
306
+ if thetoken[0:2] == "--":
307
+ formattedcommandline.append(thetoken)
308
+ else:
309
+ formattedcommandline[-1] += " " + thetoken
310
+ for i in range(len(formattedcommandline)):
311
+ if i > 0:
312
+ prefix = " "
313
+ else:
314
+ prefix = ""
315
+ if i < len(formattedcommandline) - 1:
316
+ suffix = " \\"
317
+ else:
318
+ suffix = ""
319
+ formattedcommandline[i] = prefix + formattedcommandline[i] + suffix
320
+ tide_io.writevec(formattedcommandline, f"{outputname}_retroformattedcommandline.txt")
299
321
 
300
322
  if args.nprocs < 1:
301
323
  args.nprocs = tide_multiproc.maxcpus()
@@ -659,7 +681,9 @@ def retroregress(args):
659
681
  if args.debug:
660
682
  print(f"calculating delayoffsets for {filteredregressderivratios.shape[0]} voxels")
661
683
  for i in range(filteredregressderivratios.shape[0]):
662
- delayoffset[i] = tide_refinedelay.ratiotodelay(filteredregressderivratios[i])
684
+ delayoffset[i], closestoffset = tide_refinedelay.ratiotodelay(
685
+ filteredregressderivratios[i]
686
+ )
663
687
  """delayoffset[i] = tide_refinedelay.coffstodelay(
664
688
  np.asarray([filteredregressderivratios[i]]),
665
689
  mindelay=args.mindelay,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rapidtide
3
- Version: 3.0a13
3
+ Version: 3.0a14
4
4
  Summary: Tools for performing correlation analysis on fMRI data.
5
5
  Author: Taylor Salo, Daniel M. Drucker, Ph.D., Jeffrey N Stout, Yaroslav O. Halchenko, Derek Monroe
6
6
  Author-email: "Blaise deB. Frederick" <blaise.frederick@gmail.com>
@@ -7,7 +7,7 @@ cloud/rapidtide-HCPYA,sha256=kqW8ENbOQhvVqZGz-HqiVbrbzHy4cfyy1rk8ejpJor0,963
7
7
  cloud/rapidtide-cloud-test,sha256=SATOwGo4QYLvt-6hE0e3wyK9JjuDU5XzfLrfMoybvcY,466
8
8
  cloud/simple-cp-test,sha256=5ef8wmLfcKdny59BV6_DnAPj7O_mi0rOHdFZVN2iiLA,421
9
9
  rapidtide/Colortables.py,sha256=Qok5h6-U6sVl0zhITI8D0Uxtp3zmyQv4OCiU-6sNTnM,5814
10
- rapidtide/DerivativeDelay.py,sha256=ODMwsY3of7rfH0IIqKgCxntTQGeNNSNoGMjKpIluHTg,7200
10
+ rapidtide/DerivativeDelay.py,sha256=OtLUFE3wfGz9y5GuVszUtYYqPXxTzYW2UP_leNRS6ac,7253
11
11
  rapidtide/OrthoImageItem.py,sha256=uN-fMX4vVB00-AFoUnfOXXq1qjLXruzOqYttNJYpIpM,21669
12
12
  rapidtide/RapidtideDataset.py,sha256=BEGznVDvLzL1Cd9TtuwicCYXcVug8hX1t-6qnEjMEDg,52239
13
13
  rapidtide/RegressorRefiner.py,sha256=Cp5hGsEO_KYiTxbtZCLBTsgi5gjKd3xoP_A3TaQtF_E,17232
@@ -26,15 +26,15 @@ rapidtide/fit.py,sha256=GA7v2fuQnSztsUCFdqEbAzdXRyLUXI-aQw_E31WvsOs,68081
26
26
  rapidtide/happy_supportfuncs.py,sha256=z9VTliXvZoQEjU6FSaPk6etYUB7KSFCQbdzMIAVx6ik,47937
27
27
  rapidtide/helper_classes.py,sha256=jMS1SIU8YFZrZ10s3kOwbT0139CtTG3DLkJoyuDiiNQ,51401
28
28
  rapidtide/io.py,sha256=tEw1E1Gsxu-_A1spMz1wU98d9R5xZof06qiGvYr2sEQ,74789
29
- rapidtide/linfitfiltpass.py,sha256=mzG-sOVtBR0nx3M8nknNUm9yRv2dqPukIqQXW8D3sLc,16095
30
- rapidtide/makelaggedtcs.py,sha256=GsJ3svPSRJIHzJ9F5ZpT0eW3k6rIUCGXgq4o-sK4R-E,3889
29
+ rapidtide/linfitfiltpass.py,sha256=fXUhCvT9Yd1qmwokHxpK_UBeUA55-FlDkhG10JHGl7o,16142
30
+ rapidtide/makelaggedtcs.py,sha256=FFqnCuTYRBhcpFgJVffvOaiz7j5FjDtwYZ6Pip2U7AE,3998
31
31
  rapidtide/maskutil.py,sha256=noqFZzAvyAy0ZzEa1nmEIGzWA0zaPoNSIP3ck1cFKcE,6089
32
32
  rapidtide/miscmath.py,sha256=Wj3GXNkXbvGlsdxYGUMTZ3H5a3a1uhfTWZV73XtUYx4,14044
33
- rapidtide/multiproc.py,sha256=Ri40ebUkxofKwqIKuZ0_FuQvp4uWFPE8yWMOau3TJ78,6238
33
+ rapidtide/multiproc.py,sha256=dMFUZHhtRkNCKQhNdqvO1Eq285DGMdQW13UxyszfuDA,6068
34
34
  rapidtide/patchmatch.py,sha256=ZhGuJSwd_UBBJERuABLWzE-HvHLtMgP_Ep4-jq3q1rI,20643
35
35
  rapidtide/peakeval.py,sha256=4wboYOtGX1q9p2LmAX_eXcw1YsDWhzlGd-hMVQaso9Y,5198
36
36
  rapidtide/qualitycheck.py,sha256=VL4vA4IRoTPZ4fJHwKrYXsJDmsEs4qUV9xvxjvKpchA,11917
37
- rapidtide/refinedelay.py,sha256=ZHINjXS352WDwFMW79m4YHC_mto8m8-bVOO08EQXEtM,13053
37
+ rapidtide/refinedelay.py,sha256=shx6KyPawJc_hYtfm17Jmk162Zg5AfToyzYEs8FJIWc,16436
38
38
  rapidtide/refineregressor.py,sha256=50CXj57k5gccTqfn6tugLM1UxSvr_ImPDch9YwMkL5o,22950
39
39
  rapidtide/resample.py,sha256=RA9Rf9Z0jl1nhz4aV5LOlJCm_PVannuBdYZNe3jwECU,30592
40
40
  rapidtide/simfuncfit.py,sha256=ypGBraJCk5ParOc-ll9-iVDQHh9OYXqGd3SaN9AoU5Y,11837
@@ -63,7 +63,7 @@ rapidtide/data/examples/src/testboth,sha256=ITAqA3XOC9duFRoBtZgGL9pLnh7Po43i8qjU
63
63
  rapidtide/data/examples/src/testcifti,sha256=Nw4UMzkh1oFdW4FuAznuOR9hAr2KJuPF86gZnqqJylU,265
64
64
  rapidtide/data/examples/src/testcomplex,sha256=PFY_d30eqYBx5K8cPP_WxsP2YPlYuawo8u1hDhYT-_U,2271
65
65
  rapidtide/data/examples/src/testdecomp,sha256=xxxr510aOBjtpJy4aQNAFTyEFZD6QdHp6-Aa_esYalY,269
66
- rapidtide/data/examples/src/testdelayvar,sha256=x2-miMKk3AAYPC16C4gelWrLyc3p5oDA6m884NzRVAE,301
66
+ rapidtide/data/examples/src/testdelayvar,sha256=tMn1k8IfvBL7MKhgGC6EGcSkChtXWKp1bENOGG4SagI,330
67
67
  rapidtide/data/examples/src/testfileorfloat,sha256=9r4mz7pBV_8iFZya9kmtfbnTRS3-94Cx9Q63Ni3mkZs,815
68
68
  rapidtide/data/examples/src/testfingerprint,sha256=RlAIC1lMDWMGzZKxY24DJRuaUEL0BenSFBey0gL5dqU,402
69
69
  rapidtide/data/examples/src/testfmri,sha256=7gdvJYU2ee0rz4k2PG52JQs-17-T5HyixdLEMeqlzEI,237
@@ -223,17 +223,17 @@ rapidtide/tests/test_doresample.py,sha256=ILQxH6UXtHZ9OwgTpbZE_bek_QKYGmmA6D70r6
223
223
  rapidtide/tests/test_fastresampler.py,sha256=xOTyaVPanCnSOd2Lp4RdUF06zhxm7J_bubMCiAtaIbE,3861
224
224
  rapidtide/tests/test_filter.py,sha256=_xhk3rbYFtuKgrDdgrrrlITtmQhOUUi5EhFcnxVUioA,10891
225
225
  rapidtide/tests/test_findmaxlag.py,sha256=x9mKQ8TmWW4jq8CrlfrX8zwO3n4pYa7aPgF3F1e0aPc,11551
226
- rapidtide/tests/test_fullrunhappy_v1.py,sha256=BdmYf8dydEccfKTryLTjCHSRNhiWjj29DK3g0BxVz40,1477
227
- rapidtide/tests/test_fullrunhappy_v2.py,sha256=jp0-cVPkYQQn3iRmFsoIJ9BLHu85uWMgUu1K9FHHJ1U,1942
228
- rapidtide/tests/test_fullrunhappy_v3.py,sha256=sEWV-Qf_13gJ9BnUmgIu-JtMAh1Jp0Qn8EhTEBU4YmU,1743
229
- rapidtide/tests/test_fullrunhappy_v4.py,sha256=YL6FWWAL2eeNg-EdaOhdq6r4-84lF_f36hQoGYBl0f4,1753
230
- rapidtide/tests/test_fullrunhappy_v5.py,sha256=1otOjGN7PADurvB3PUqHq_FxCpd5vr3Q1KD8FrPGXlU,1721
231
- rapidtide/tests/test_fullrunrapidtide_v1.py,sha256=_NNdHUXIPQW9pFC9NmqaXvauytvv0LqmBOn3UjZvbNQ,2872
232
- rapidtide/tests/test_fullrunrapidtide_v2.py,sha256=RsMCrq-A4WzVzQxFnyvuotKCT4ipfyepM1RxGBpmMys,2881
233
- rapidtide/tests/test_fullrunrapidtide_v3.py,sha256=D-CG9SUyr-XTUVXnKZWCEfCVAlHKBOZXMlnCjoXXueQ,2227
234
- rapidtide/tests/test_fullrunrapidtide_v4.py,sha256=NO1oFSCl2POYluFNGqiYWVk5G2RSSX6hC-jH_RqdvRA,1913
235
- rapidtide/tests/test_fullrunrapidtide_v5.py,sha256=oXYITl2fKyZR-vT4JLod17Mx0Z68IXissu7yUEiHQPI,1544
236
- rapidtide/tests/test_fullrunrapidtide_v6.py,sha256=bBiIf6IS6k09KU7U-Q7n2EsDktM-29GWI2bX6uv8Cck,4239
226
+ rapidtide/tests/test_fullrunhappy_v1.py,sha256=C1AFVFM07pNnsRU8z_aKFHdfYTL9kSGBQ7HO5EiQ8TE,1704
227
+ rapidtide/tests/test_fullrunhappy_v2.py,sha256=lrb6hLpbl4b0xWtZTnVHS2JdOSgQlBx1Bi3B5gZ7nFY,2145
228
+ rapidtide/tests/test_fullrunhappy_v3.py,sha256=qmmV-_bjsInZ7Tl8NSVhE8H7DXFARbYqGegGfd9_a7E,1946
229
+ rapidtide/tests/test_fullrunhappy_v4.py,sha256=U3s4j7Cm_S1WcsVbm3LtITHJYlo8SsuVZHwnKPab4WA,1956
230
+ rapidtide/tests/test_fullrunhappy_v5.py,sha256=exckNLj0s-th3KilJ6D_OOWm8--7FSE4u8vkbQ8SjV8,1940
231
+ rapidtide/tests/test_fullrunrapidtide_v1.py,sha256=5FH36vaS786pyZlZvNzrsm9wM_flug8zKRvOujdA-GY,3059
232
+ rapidtide/tests/test_fullrunrapidtide_v2.py,sha256=NNrcveMUMOBqSrNCKvd-L_WBynrtw1MUZf6YsGUh08M,3044
233
+ rapidtide/tests/test_fullrunrapidtide_v3.py,sha256=JARWkh9xgb1xR6hXIY4mlEZ76hTPb3fDIFVwDBDL1Bc,2446
234
+ rapidtide/tests/test_fullrunrapidtide_v4.py,sha256=S_mblVZsrF05rzsDfU4VUR2ugdfHRMcJZpGt98TtX9M,2118
235
+ rapidtide/tests/test_fullrunrapidtide_v5.py,sha256=Z_D7JhGDqNqAIPKs1C5Aj78liAJlT8Qq-lp0d3sGgzM,1779
236
+ rapidtide/tests/test_fullrunrapidtide_v6.py,sha256=VbudxT-yBG9sA1c-WldRMWNWqqTqHGI7EL_wcBKj3j4,4386
237
237
  rapidtide/tests/test_io.py,sha256=7BgGhluNPtLJJpATraGHB-kyDkpkcxH9fGv0vnPnfZI,15806
238
238
  rapidtide/tests/test_linfitfiltpass.py,sha256=KQSMKgKbBzF0--sw-yqiTtXvaI9pWoAA0jVvHjbia9g,5554
239
239
  rapidtide/tests/test_mi.py,sha256=GHqOVn699yNq0m_ZhCrBORc8sjycrUI67AS1UjhRHlU,2272
@@ -243,7 +243,7 @@ rapidtide/tests/test_nullcorr.py,sha256=6257xJHRSPL7HLKnTy1CHphbXH_Ppl4SSexhCmAr
243
243
  rapidtide/tests/test_padvec.py,sha256=UKALfQyS9v87QiThxSu51Md3eXkChTpTfm-C0KdXcR0,6728
244
244
  rapidtide/tests/test_phaseanalysis.py,sha256=DMzB19c9rz3c5PSwXO4QYOEqNLR85YZLra4wV33O6uI,2150
245
245
  rapidtide/tests/test_rapidtideparser.py,sha256=HBoZdmS5UEGDFvlpueNhYXvVbq-pWrhNDCofkc2Tp98,5555
246
- rapidtide/tests/test_refinedelay.py,sha256=MTz-ad_hhsMBR6rMKQuQfAxdXY9mVMFJ-Y84uzsdhEs,8539
246
+ rapidtide/tests/test_refinedelay.py,sha256=hqnUqf2RHvcxc9HNyiJ9gg9axtnUmD4GZDX7KuOpGMU,8576
247
247
  rapidtide/tests/test_runmisc.py,sha256=rrhn_kAnid2c26WgCGr3Va3SfPo14m_bN2p9MOafUH8,2855
248
248
  rapidtide/tests/test_sharedmem.py,sha256=Yp5WuYMdKABfqYKvuayq5253pvOC05V_oUK-povjGV8,2026
249
249
  rapidtide/tests/test_simulate.py,sha256=m8oGp8qrxQv-FtxX6P3t_nu8bvSizWSZXIij5rtWB6k,3325
@@ -280,11 +280,11 @@ rapidtide/workflows/__init__.py,sha256=2VWpHoQGC8zOLj88k9EtXOsY4cmKzkVG9Og6wracg
280
280
  rapidtide/workflows/adjustoffset.py,sha256=2ddMEY-ojhPf-LnzF1jT-NMUhxvkjL9cCm2sfZUBfx8,8440
281
281
  rapidtide/workflows/aligntcs.py,sha256=kvTBZWdpvb8_S7b3DcQojrNWPUwFNFXJ58fixWch98M,5348
282
282
  rapidtide/workflows/applydlfilter.py,sha256=2b8DJcseZbQrYpv-LBJQsTGQF4iLCxp_Pljpx3yBINA,6785
283
- rapidtide/workflows/atlasaverage.py,sha256=BErlsUJZl9beHvGULdeD3EZZmfxl4cPXGFXjJkL739E,16462
283
+ rapidtide/workflows/atlasaverage.py,sha256=-zYbDNRHSS2aXZvKg69foKH3-zd7T88hdYeY7aOuV9Q,17478
284
284
  rapidtide/workflows/atlastool.py,sha256=MWNSyxa6W0AzUWV5T8-nD-kDpOSUWrr_VvTnEh1YOfY,16076
285
285
  rapidtide/workflows/calctexticc.py,sha256=zBchAkNcH1Qd3uL6IDonxSnn8_b5t_pX1S40ZGaZRx4,10486
286
286
  rapidtide/workflows/ccorrica.py,sha256=rzcz8ljU3xeB_5p6nAP2-QhvsaobuRDhM1klw45EPUQ,10504
287
- rapidtide/workflows/delayvar.py,sha256=YEnSCu7wugFw-vAudTkM4DfPLJZS3MXYK0gDm5vCrUU,37660
287
+ rapidtide/workflows/delayvar.py,sha256=lyjnAcZcO9ynBNNDFtcnUBgjDU0QCAoAgwmKGNwMyns,40767
288
288
  rapidtide/workflows/diffrois.py,sha256=B9HVgKtTWnSaD1z4_UcqKPP0oBPpWVcsCDhEB7wdMOo,5451
289
289
  rapidtide/workflows/endtidalproc.py,sha256=6dnk9coq8HsR5QLm7Zqo8bL8njcvy5l1l64JaUQ5DDA,4923
290
290
  rapidtide/workflows/fdica.py,sha256=MZkCnTtd9VAZNIOI55-ZQqaf_N5e9_4wxMw6EY46rSg,14954
@@ -311,14 +311,14 @@ rapidtide/workflows/plethquality.py,sha256=ZNkMS6cGkM2UG796KwCrhiCC7mzEmFt62Nxy1
311
311
  rapidtide/workflows/polyfitim.py,sha256=18pCkdk176_hyWdCgRe-B4AEP0wjHheWdPq25SsKy6w,10184
312
312
  rapidtide/workflows/proj2flow.py,sha256=MWtf0eTyQ7MfIbWRup4s6TLuk-vKbYgWkSZC9BOBYcM,7290
313
313
  rapidtide/workflows/rankimage.py,sha256=twZsGJaVd0raffzKlI0Tupy4DJxHyhBv8WqIUNEtiNM,3482
314
- rapidtide/workflows/rapidtide.py,sha256=_kAAMIaOS8kpU0AI9ynWQdZ3eN-R7Ad0TSQo8yfhbxU,174391
314
+ rapidtide/workflows/rapidtide.py,sha256=RQaqe6DYO9uG3mMwERBF0hBPkwx1grXWsUdMdWaVtwE,174440
315
315
  rapidtide/workflows/rapidtide2std.py,sha256=wGNwyAPnaI3sCG14ORWmlFQRgXmNn6uVVlPirwk1URg,10413
316
- rapidtide/workflows/rapidtide_parser.py,sha256=k42DInCaHsIkmulZdryVd0xkVrfK2_pJrfVtAdfNcpI,79435
317
- rapidtide/workflows/regressfrommaps.py,sha256=UvzvfsXUjtLLVpSvjhww5U1zkFPI-POQ2Wkc1YuEsb0,6246
316
+ rapidtide/workflows/rapidtide_parser.py,sha256=Ybsl6bQe1pQBCKT1IyBpvfXNSdLmkKIDoOGjlG8uMlA,79470
317
+ rapidtide/workflows/regressfrommaps.py,sha256=Xz5SQCbasBPzJtXBa7q0-U3Lo4zs-a1JZrfHU1kCUZ8,6298
318
318
  rapidtide/workflows/resamplenifti.py,sha256=48vf0JT0C4gjPty_R0RDMRd6opilUQ3stevzAvdKInc,4717
319
319
  rapidtide/workflows/resampletc.py,sha256=OZJOHnQAaN371pFt_qb8hY8JQ12WggHK6ZP7Q84rvOk,3959
320
- rapidtide/workflows/retrolagtcs.py,sha256=bniS1bDLvnvX6gKNCLGvBl26uas0dt5BaXf5An83HdQ,10830
321
- rapidtide/workflows/retroregress.py,sha256=tM0O0MYKiFP72QlpBp3Ex6cHEjOaUq4rAaAcMjYzids,42466
320
+ rapidtide/workflows/retrolagtcs.py,sha256=b810u7kTzmIM2OubOz_hILlB01ATYQ3s0wPbFROthHc,10847
321
+ rapidtide/workflows/retroregress.py,sha256=DFqEiGz6u7mXIgrPP2Np8KVJ-hjL-I6zLPrMKz61uv0,43382
322
322
  rapidtide/workflows/roisummarize.py,sha256=hFYkkYV7fL3gNpAu6Diu1KhOUwLm0cNjWX7V2UNhy4M,6710
323
323
  rapidtide/workflows/runqualitycheck.py,sha256=zFjyhfh_9A5U5GIFIIkITuYa8XlwiEM_1dYg7IJgF6w,2434
324
324
  rapidtide/workflows/showarbcorr.py,sha256=D6Te4fKQaKZC5GFGNlhFkq--NypJ6msApXjqIuGlGMs,13606
@@ -337,9 +337,9 @@ rapidtide/workflows/tcfrom3col.py,sha256=6tV2lGEtXpI4dn_8kcTCVzZxpJzmopuDwpXvOIE
337
337
  rapidtide/workflows/tidepool.py,sha256=1nYPa_-Z-nYZR-fZNo_8dY9LoO_vl7kwiRC_reM2044,86395
338
338
  rapidtide/workflows/utils.py,sha256=k2m2F1-tWxhcUYvk5geO1yl-c5bKcDX7Jv7ohvJZaOk,5379
339
339
  rapidtide/workflows/variabilityizer.py,sha256=yQFDTBcGehxW44R_FQHeeKrTpeYrrh96xcW1uWbPtYo,3167
340
- rapidtide-3.0a13.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
341
- rapidtide-3.0a13.dist-info/METADATA,sha256=v9yyxgws4tP-Q2TDofxJi8ZKbTAuBz2m4SqLmxWPsac,15646
342
- rapidtide-3.0a13.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
343
- rapidtide-3.0a13.dist-info/entry_points.txt,sha256=9NVvZpIx9U6lTWlTFF2ev-wuPAHJxcXI_901_EcGRYA,3323
344
- rapidtide-3.0a13.dist-info/top_level.txt,sha256=MnNXGfbrIBc9RnAqzBHOWd3GQO-aIUDnRTz4_5VjH5g,16
345
- rapidtide-3.0a13.dist-info/RECORD,,
340
+ rapidtide-3.0a14.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
341
+ rapidtide-3.0a14.dist-info/METADATA,sha256=f3r6Gm863KmFDEr_XN684SsUZ8wboLVet1Bu9GQSGCo,15646
342
+ rapidtide-3.0a14.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
343
+ rapidtide-3.0a14.dist-info/entry_points.txt,sha256=9NVvZpIx9U6lTWlTFF2ev-wuPAHJxcXI_901_EcGRYA,3323
344
+ rapidtide-3.0a14.dist-info/top_level.txt,sha256=MnNXGfbrIBc9RnAqzBHOWd3GQO-aIUDnRTz4_5VjH5g,16
345
+ rapidtide-3.0a14.dist-info/RECORD,,