rapidtide 3.0.8__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.
@@ -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-26T14:50:59-0400",
11
+ "date": "2025-07-03T10:21:49-0400",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "d9a8fd9ab24057e4a74e43dccdc1117e3c6875a2",
15
- "version": "3.0.8"
14
+ "full-revisionid": "292e93bbd0a9c13e2d62a00746e14522b0783156",
15
+ "version": "3.0.9"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -1,25 +1,9 @@
1
1
  #!/bin/bash
2
2
 
3
- #rapidtide \
4
- # --spatialfilt -1 \
5
- # --nprocs -1 \
6
- # --searchrange -5 20 \
7
- # --simcalcrange 50 -1 \
8
- # --outputlevel more \
9
- # --graymattermask sub-RAPIDTIDETEST_synthseg.nii.gz:SSEG_GRAY \
10
- # --brainmask sub-RAPIDTIDETEST_brainmask.nii.gz \
11
- # --whitemattermask sub-RAPIDTIDETEST_synthseg.nii.gz:SSEG_WHITE \
12
- # --csfmask sub-RAPIDTIDETEST_synthseg.nii.gz:SSEG_CSF \
13
- # --cleanrefined \
14
- # --nofitfilt \
15
- # --similaritymetric correlation \
16
- # sub-RAPIDTIDETEST.nii.gz \
17
- # ../dst/sub-RAPIDTIDETEST
18
-
19
3
  rapidtide \
20
- --spatialfilt 3 \
4
+ --spatialfilt 2.5 \
21
5
  --nprocs -1 \
22
- --searchrange -5 20 \
6
+ --searchrange -7.5 30 \
23
7
  --simcalcrange 50 -1 \
24
8
  --outputlevel more \
25
9
  --graymattermask sub-RAPIDTIDETEST_synthseg.nii.gz:SSEG_GRAY \
@@ -31,6 +15,28 @@ rapidtide \
31
15
  --refinedelayeachpass \
32
16
  --similaritymetric correlation \
33
17
  sub-RAPIDTIDETEST.nii.gz \
34
- ../dst/sub-RAPIDTIDETEST_passrefine
18
+ ../dst/sub-RAPIDTIDETEST_simfunc
19
+
20
+ rapidtide \
21
+ --spatialfilt 2.5 \
22
+ --nprocs -1 \
23
+ --searchrange -7.5 30 \
24
+ --simcalcrange 50 -1 \
25
+ --outputlevel more \
26
+ --graymattermask sub-RAPIDTIDETEST_synthseg.nii.gz:SSEG_GRAY \
27
+ --brainmask sub-RAPIDTIDETEST_brainmask.nii.gz \
28
+ --whitemattermask sub-RAPIDTIDETEST_synthseg.nii.gz:SSEG_WHITE \
29
+ --csfmask sub-RAPIDTIDETEST_synthseg.nii.gz:SSEG_CSF \
30
+ --cleanrefined \
31
+ --nofitfilt \
32
+ --refinedelayeachpass \
33
+ --similaritymetric riptide \
34
+ --riptidestep 1.5 \
35
+ --ampthresh 0.0 \
36
+ --numnull 0 \
37
+ sub-RAPIDTIDETEST.nii.gz \
38
+ ../dst/sub-RAPIDTIDETEST_riptide
35
39
 
36
- tidepool --uistyle big --dataset ../dst/sub-RAPIDTIDETEST_ ../dst/sub-RAPIDTIDETEST_passrefine_
40
+ tidepool --uistyle big --dataset \
41
+ ../dst/sub-RAPIDTIDETEST_simfunc_ \
42
+ ../dst/sub-RAPIDTIDETEST_riptide_ &
@@ -91,11 +91,12 @@ def linfitfiltpass(
91
91
  filtereddata,
92
92
  nprocs=1,
93
93
  alwaysmultiproc=False,
94
+ voxelspecific=True,
94
95
  confoundregress=False,
95
- ratiosonly=False,
96
+ coefficientsonly=False,
96
97
  procbyvoxel=True,
97
98
  showprogressbar=True,
98
- mp_chunksize=1000,
99
+ chunksize=1000,
99
100
  rt_floatset=np.float64,
100
101
  rt_floattype="float64",
101
102
  verbose=True,
@@ -142,7 +143,7 @@ def linfitfiltpass(
142
143
 
143
144
  # process and send the data
144
145
  if procbyvoxel:
145
- if confoundregress:
146
+ if confoundregress or (not voxelspecific):
146
147
  outQ.put(
147
148
  _procOneRegressionFitItem(
148
149
  val,
@@ -163,7 +164,7 @@ def linfitfiltpass(
163
164
  )
164
165
  )
165
166
  else:
166
- if confoundregress:
167
+ if confoundregress or (not voxelspecific):
167
168
  outQ.put(
168
169
  _procOneRegressionFitItem(
169
170
  val,
@@ -197,7 +198,7 @@ def linfitfiltpass(
197
198
  indexaxis=indexaxis,
198
199
  procunit=procunit,
199
200
  showprogressbar=showprogressbar,
200
- chunksize=mp_chunksize,
201
+ chunksize=chunksize,
201
202
  )
202
203
 
203
204
  # unpack the data
@@ -208,7 +209,7 @@ def linfitfiltpass(
208
209
  r2value[voxel[0]] = voxel[3]
209
210
  filtereddata[voxel[0], :] = voxel[7]
210
211
  itemstotal += 1
211
- elif ratiosonly:
212
+ elif coefficientsonly:
212
213
  for voxel in data_out:
213
214
  meanvalue[voxel[0]] = voxel[1]
214
215
  rvalue[voxel[0]] = voxel[2]
@@ -240,7 +241,7 @@ def linfitfiltpass(
240
241
  r2value[timepoint[0]] = timepoint[3]
241
242
  filtereddata[:, timepoint[0]] = timepoint[7]
242
243
  itemstotal += 1
243
- elif ratiosonly:
244
+ elif coefficientsonly:
244
245
  for timepoint in data_out:
245
246
  meanvalue[timepoint[0]] = timepoint[1]
246
247
  rvalue[timepoint[0]] = timepoint[2]
@@ -296,23 +297,41 @@ def linfitfiltpass(
296
297
  rt_floatset=rt_floatset,
297
298
  rt_floattype=rt_floattype,
298
299
  )
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
- )
300
+ elif coefficientsonly:
301
+ if voxelspecific:
302
+ (
303
+ dummy,
304
+ meanvalue[vox],
305
+ rvalue[vox],
306
+ r2value[vox],
307
+ fitcoeff[vox],
308
+ fitNorm[vox],
309
+ dummy,
310
+ dummy,
311
+ ) = _procOneRegressionFitItem(
312
+ vox,
313
+ theevs[vox, :],
314
+ thedata,
315
+ rt_floatset=rt_floatset,
316
+ rt_floattype=rt_floattype,
317
+ )
318
+ else:
319
+ (
320
+ dummy,
321
+ meanvalue[vox],
322
+ rvalue[vox],
323
+ r2value[vox],
324
+ fitcoeff[vox],
325
+ fitNorm[vox],
326
+ dummy,
327
+ dummy,
328
+ ) = _procOneRegressionFitItem(
329
+ vox,
330
+ theevs,
331
+ thedata,
332
+ rt_floatset=rt_floatset,
333
+ rt_floattype=rt_floattype,
334
+ )
316
335
  else:
317
336
  (
318
337
  dummy,
@@ -357,7 +376,7 @@ def linfitfiltpass(
357
376
  rt_floatset=rt_floatset,
358
377
  rt_floattype=rt_floattype,
359
378
  )
360
- elif ratiosonly:
379
+ elif coefficientsonly:
361
380
  (
362
381
  dummy,
363
382
  meanvalue[timepoint],
rapidtide/refinedelay.py CHANGED
@@ -391,10 +391,10 @@ def getderivratios(
391
391
  nprocs_makelaggedtcs=optiondict["nprocs_makelaggedtcs"],
392
392
  nprocs_regressionfilt=optiondict["nprocs_regressionfilt"],
393
393
  regressderivs=regressderivs,
394
- mp_chunksize=optiondict["mp_chunksize"],
394
+ chunksize=optiondict["mp_chunksize"],
395
395
  showprogressbar=optiondict["showprogressbar"],
396
396
  alwaysmultiproc=optiondict["alwaysmultiproc"],
397
- ratiosonly=True,
397
+ coefficientsonly=True,
398
398
  debug=debug,
399
399
  )
400
400
 
@@ -590,7 +590,7 @@ def dorefine(
590
590
  sys.exit()
591
591
  LGR.info(
592
592
  f"Using {len(thefit.components_)} component(s), accounting for "
593
- + f"{100.0 * np.cumsum(thefit.explained_variance_ratio_)[len(thefit.components_) - 1]}% of the variance"
593
+ + f"{100.0 * np.cumsum(thefit.explained_variance_ratio_)[len(thefit.components_) - 1]:.2f}% of the variance"
594
594
  )
595
595
  reduceddata = thefit.inverse_transform(thefit.transform(refinevoxels))
596
596
  if debug:
rapidtide/resample.py CHANGED
@@ -597,7 +597,7 @@ def arbresample(
597
597
  return resampled
598
598
 
599
599
 
600
- def upsample(inputdata, Fs_init, Fs_higher, method="univariate", intfac=False, debug=False):
600
+ def upsample(inputdata, Fs_init, Fs_higher, method="univariate", intfac=False, dofilt=True, debug=False):
601
601
  starttime = time.time()
602
602
  if Fs_higher <= Fs_init:
603
603
  print("upsample: target frequency must be higher than initial frequency")
@@ -607,19 +607,19 @@ def upsample(inputdata, Fs_init, Fs_higher, method="univariate", intfac=False, d
607
607
  orig_x = np.linspace(0.0, (1.0 / Fs_init) * len(inputdata), num=len(inputdata), endpoint=False)
608
608
  endpoint = orig_x[-1] - orig_x[0]
609
609
  ts_higher = 1.0 / Fs_higher
610
- numresamppts = int(endpoint // ts_higher + 1)
611
610
  if intfac:
612
611
  numresamppts = int(Fs_higher // Fs_init) * len(inputdata)
613
612
  else:
614
613
  numresamppts = int(endpoint // ts_higher + 1)
615
614
  upsampled_x = np.arange(0.0, ts_higher * numresamppts, ts_higher)
616
615
  upsampled_y = doresample(orig_x, inputdata, upsampled_x, method=method)
617
- initfilter = tide_filt.NoncausalFilter(
618
- filtertype="arb", transferfunc="trapezoidal", debug=debug
619
- )
620
- stopfreq = np.min([1.1 * Fs_init / 2.0, Fs_higher / 2.0])
621
- initfilter.setfreqs(0.0, 0.0, Fs_init / 2.0, stopfreq)
622
- upsampled_y = initfilter.apply(Fs_higher, upsampled_y)
616
+ if dofilt:
617
+ initfilter = tide_filt.NoncausalFilter(
618
+ filtertype="arb", transferfunc="trapezoidal", debug=debug
619
+ )
620
+ stopfreq = np.min([1.1 * Fs_init / 2.0, Fs_higher / 2.0])
621
+ initfilter.setfreqs(0.0, 0.0, Fs_init / 2.0, stopfreq)
622
+ upsampled_y = initfilter.apply(Fs_higher, upsampled_y)
623
623
  if debug:
624
624
  print("upsampling took", time.time() - starttime, "seconds")
625
625
  return upsampled_y
@@ -350,7 +350,7 @@ def test_delayestimation(displayplots=False, debug=False):
350
350
  nprocs=nprocs,
351
351
  alwaysmultiproc=False,
352
352
  showprogressbar=False,
353
- mp_chunksize=chunksize,
353
+ chunksize=chunksize,
354
354
  )
355
355
 
356
356
  if nprocs == 1:
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ # Copyright 2016-2025 Blaise Frederick
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ #
19
+ import os
20
+
21
+ import matplotlib as mpl
22
+
23
+ import rapidtide.qualitycheck as rapidtide_quality
24
+ import rapidtide.workflows.rapidtide as rapidtide_workflow
25
+ import rapidtide.workflows.rapidtide_parser as rapidtide_parser
26
+ from rapidtide.tests.utils import get_examples_path, get_test_temp_path
27
+
28
+
29
+ def test_fullrunrapidtide_v8(debug=False, local=False, displayplots=False):
30
+ # set input and output directories
31
+ if local:
32
+ exampleroot = "../data/examples/src"
33
+ testtemproot = "./tmp"
34
+ else:
35
+ exampleroot = get_examples_path()
36
+ testtemproot = get_test_temp_path()
37
+
38
+ # run rapidtide
39
+ inputargs = [
40
+ os.path.join(exampleroot, "sub-RAPIDTIDETEST.nii.gz"),
41
+ os.path.join(testtemproot, "sub-RAPIDTIDETEST8"),
42
+ "--spatialfilt",
43
+ "2",
44
+ "--simcalcrange",
45
+ "4",
46
+ "-1",
47
+ "--searchrange",
48
+ "-5",
49
+ "10",
50
+ "--nprocs",
51
+ "-1",
52
+ "--passes",
53
+ "1",
54
+ "--despecklepasses",
55
+ "3",
56
+ "--similaritymetric",
57
+ "riptide",
58
+ "--riptidestep",
59
+ "1.5",
60
+ ]
61
+ rapidtide_workflow.rapidtide_main(rapidtide_parser.process_args(inputargs=inputargs))
62
+
63
+
64
+ if __name__ == "__main__":
65
+ mpl.use("TkAgg")
66
+ test_fullrunrapidtide_v8(debug=True, local=True, displayplots=True)
@@ -0,0 +1,271 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ # Copyright 2016-2025 Blaise Frederick
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ #
19
+ import numpy as np
20
+
21
+ import rapidtide.calcsimfunc as tide_calcsimfunc
22
+ import rapidtide.io as tide_io
23
+ import rapidtide.linfitfiltpass as tide_linfitfiltpass
24
+ import rapidtide.makelaggedtcs as tide_makelagged
25
+ import rapidtide.stats as tide_stats
26
+ import rapidtide.util as tide_util
27
+
28
+
29
+ def makeRIPTiDeRegressors(
30
+ initial_fmri_x,
31
+ lagmin,
32
+ lagmax,
33
+ lagtcgenerator,
34
+ LGR,
35
+ nprocs=1,
36
+ alwaysmultiproc=False,
37
+ showprogressbar=True,
38
+ chunksize=1000,
39
+ targetstep=2.5,
40
+ edgepad=0,
41
+ rt_floatset=np.float64,
42
+ rt_floattype="float64",
43
+ debug=False,
44
+ ):
45
+ # make the RIPTiDe evs
46
+ numdelays = int(np.round((lagmax - lagmin) / targetstep, 0))
47
+ numregressors = numdelays + 2 * edgepad
48
+ delaystep = (lagmax - lagmin) / numdelays
49
+ delaystouse = np.linspace(
50
+ lagmin - edgepad * delaystep,
51
+ lagmax + edgepad * delaystep,
52
+ numdelays + 2 * edgepad,
53
+ endpoint=True,
54
+ )
55
+ if debug:
56
+ print(f"{lagmin=}")
57
+ print(f"{lagmax=}")
58
+ print(f"{numdelays=}")
59
+ print(f"{edgepad=}")
60
+ print(f"{numregressors=}")
61
+ print(f"{delaystep=}")
62
+ print(f"{delaystouse=}, {len(delaystouse)}")
63
+ print(f"{len(initial_fmri_x)}")
64
+
65
+ regressorset = np.zeros((len(delaystouse), len(initial_fmri_x)), dtype=rt_floatset)
66
+
67
+ dummy = tide_makelagged.makelaggedtcs(
68
+ lagtcgenerator,
69
+ initial_fmri_x,
70
+ np.ones_like(delaystouse, dtype=np.float64),
71
+ delaystouse,
72
+ regressorset,
73
+ LGR=LGR,
74
+ nprocs=nprocs,
75
+ alwaysmultiproc=alwaysmultiproc,
76
+ showprogressbar=showprogressbar,
77
+ chunksize=chunksize,
78
+ rt_floatset=rt_floatset,
79
+ rt_floattype=rt_floattype,
80
+ debug=debug,
81
+ )
82
+
83
+ if debug:
84
+ print(regressorset)
85
+
86
+ return regressorset, delaystouse
87
+
88
+
89
+ def calcSimFunc(
90
+ numvalidspatiallocs,
91
+ fmri_data_valid,
92
+ validsimcalcstart,
93
+ validsimcalcend,
94
+ osvalidsimcalcstart,
95
+ osvalidsimcalcend,
96
+ initial_fmri_x,
97
+ os_fmri_x,
98
+ theCorrelator,
99
+ theMutualInformationator,
100
+ cleaned_referencetc,
101
+ corrout,
102
+ regressorset,
103
+ delayvals,
104
+ sLFOfitmean,
105
+ r2value,
106
+ fitcoeff,
107
+ fitNorm,
108
+ meanval,
109
+ corrscale,
110
+ outputname,
111
+ outcorrarray,
112
+ validvoxels,
113
+ nativecorrshape,
114
+ theinputdata,
115
+ theheader,
116
+ lagmininpts,
117
+ lagmaxinpts,
118
+ thepass,
119
+ optiondict,
120
+ LGR,
121
+ TimingLGR,
122
+ similaritymetric="correlation",
123
+ simcalcoffset=0,
124
+ echocancel=False,
125
+ checkpoint=False,
126
+ nprocs=1,
127
+ alwaysmultiproc=False,
128
+ oversampfactor=2,
129
+ interptype="univariate",
130
+ showprogressbar=True,
131
+ chunksize=1000,
132
+ rt_floatset=np.float64,
133
+ rt_floattype="float64",
134
+ mklthreads=1,
135
+ threaddebug=False,
136
+ debug=False,
137
+ ):
138
+ # Step 1 - Correlation step
139
+ if similaritymetric == "mutualinfo":
140
+ similaritytype = "Mutual information"
141
+ elif similaritymetric == "correlation":
142
+ similaritytype = "Correlation"
143
+ elif similaritymetric == "riptide":
144
+ similaritytype = "RIPTiDe"
145
+ else:
146
+ similaritytype = "MI enhanced correlation"
147
+ LGR.info(f"\n\n{similaritytype} calculation, pass {thepass}")
148
+ TimingLGR.info(f"{similaritytype} calculation start, pass {thepass}")
149
+
150
+ tide_util.disablemkl(nprocs, debug=threaddebug)
151
+ if similaritymetric == "mutualinfo":
152
+ theMutualInformationator.setlimits(lagmininpts, lagmaxinpts)
153
+ (
154
+ voxelsprocessed_cp,
155
+ theglobalmaxlist,
156
+ trimmedcorrscale,
157
+ ) = tide_calcsimfunc.correlationpass(
158
+ fmri_data_valid[:, validsimcalcstart : validsimcalcend + 1],
159
+ cleaned_referencetc,
160
+ theMutualInformationator,
161
+ initial_fmri_x[validsimcalcstart : validsimcalcend + 1],
162
+ os_fmri_x[osvalidsimcalcstart : osvalidsimcalcend + 1],
163
+ lagmininpts,
164
+ lagmaxinpts,
165
+ corrout,
166
+ meanval,
167
+ nprocs=nprocs,
168
+ alwaysmultiproc=alwaysmultiproc,
169
+ oversampfactor=oversampfactor,
170
+ interptype=interptype,
171
+ showprogressbar=showprogressbar,
172
+ chunksize=chunksize,
173
+ rt_floatset=rt_floatset,
174
+ rt_floattype=rt_floattype,
175
+ debug=debug,
176
+ )
177
+ elif (similaritymetric == "correlation") or (similaritymetric == "hybrid"):
178
+ (
179
+ voxelsprocessed_cp,
180
+ theglobalmaxlist,
181
+ trimmedcorrscale,
182
+ ) = tide_calcsimfunc.correlationpass(
183
+ fmri_data_valid[:, validsimcalcstart : validsimcalcend + 1],
184
+ cleaned_referencetc,
185
+ theCorrelator,
186
+ initial_fmri_x[validsimcalcstart : validsimcalcend + 1],
187
+ os_fmri_x[osvalidsimcalcstart : osvalidsimcalcend + 1],
188
+ lagmininpts,
189
+ lagmaxinpts,
190
+ corrout,
191
+ meanval,
192
+ nprocs=nprocs,
193
+ alwaysmultiproc=alwaysmultiproc,
194
+ oversampfactor=oversampfactor,
195
+ interptype=interptype,
196
+ showprogressbar=showprogressbar,
197
+ chunksize=chunksize,
198
+ rt_floatset=rt_floatset,
199
+ rt_floattype=rt_floattype,
200
+ debug=debug,
201
+ )
202
+ elif similaritymetric == "riptide":
203
+ # do the linear fit to the comb of delayed regressors
204
+ for thedelay in range(len(delayvals)):
205
+ print(f"Fitting delay {delayvals[thedelay]:.2f}")
206
+ voxelsprocessed_cp = tide_linfitfiltpass.linfitfiltpass(
207
+ numvalidspatiallocs,
208
+ fmri_data_valid[:, validsimcalcstart : validsimcalcend + 1],
209
+ 0.0,
210
+ regressorset[thedelay, validsimcalcstart : validsimcalcend + 1],
211
+ sLFOfitmean,
212
+ corrout[:, thedelay],
213
+ r2value,
214
+ fitcoeff,
215
+ fitNorm,
216
+ None,
217
+ None,
218
+ coefficientsonly=True,
219
+ voxelspecific=False,
220
+ nprocs=nprocs,
221
+ alwaysmultiproc=alwaysmultiproc,
222
+ showprogressbar=showprogressbar,
223
+ verbose=(LGR is not None),
224
+ chunksize=chunksize,
225
+ rt_floatset=rt_floatset,
226
+ rt_floattype=rt_floattype,
227
+ debug=debug,
228
+ )
229
+ else:
230
+ print("illegal similarity metric")
231
+
232
+ tide_util.enablemkl(mklthreads, debug=threaddebug)
233
+
234
+ if similaritymetric != "riptide":
235
+ for i in range(len(theglobalmaxlist)):
236
+ theglobalmaxlist[i] = corrscale[theglobalmaxlist[i]] - simcalcoffset
237
+ namesuffix = "_desc-globallag_hist"
238
+ tide_stats.makeandsavehistogram(
239
+ np.asarray(theglobalmaxlist),
240
+ len(corrscale),
241
+ 0,
242
+ outputname + namesuffix,
243
+ displaytitle="Histogram of lag times from global lag calculation",
244
+ therange=(corrscale[0], corrscale[-1]),
245
+ refine=False,
246
+ dictvarname="globallaghist_pass" + str(thepass),
247
+ append=(echocancel or (thepass > 1)),
248
+ thedict=optiondict,
249
+ )
250
+
251
+ if checkpoint:
252
+ outcorrarray[:, :] = 0.0
253
+ outcorrarray[validvoxels, :] = corrout[:, :]
254
+ if theinputdata.filetype == "text":
255
+ tide_io.writenpvecs(
256
+ outcorrarray.reshape(nativecorrshape),
257
+ f"{outputname}_corrout_prefit_pass" + str(thepass) + ".txt",
258
+ )
259
+ else:
260
+ savename = f"{outputname}_desc-corroutprefit_pass-" + str(thepass)
261
+ tide_io.savetonifti(outcorrarray.reshape(nativecorrshape), theheader, savename)
262
+
263
+ TimingLGR.info(
264
+ f"{similaritytype} calculation end, pass {thepass}",
265
+ {
266
+ "message2": voxelsprocessed_cp,
267
+ "message3": "voxels",
268
+ },
269
+ )
270
+
271
+ return similaritytype
@@ -825,7 +825,7 @@ def delayvar(args):
825
825
  sys.exit()
826
826
  print(
827
827
  f"Using {len(thefit.components_)} component(s), accounting for "
828
- + f"{100.0 * np.cumsum(thefit.explained_variance_ratio_)[len(thefit.components_) - 1]}% of the variance"
828
+ + f"{100.0 * np.cumsum(thefit.explained_variance_ratio_)[len(thefit.components_) - 1]:.2f}% of the variance"
829
829
  )
830
830
  reduceddata = thefit.inverse_transform(thefit.transform(scaledvoxels))
831
831
  # unscale the PCA cleaned data