rapidtide 3.0a11__py3-none-any.whl → 3.0a13__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.
- cloud/gmscalc-HCPYA +1 -1
- cloud/rapidtide-HCPYA +3 -3
- rapidtide/Colortables.py +10 -10
- rapidtide/DerivativeDelay.py +211 -0
- rapidtide/RegressorRefiner.py +464 -0
- rapidtide/__init__.py +2 -1
- rapidtide/_version.py +1 -1
- rapidtide/data/examples/src/test_mlregressallt.py +32 -17
- rapidtide/data/examples/src/testalign +1 -1
- rapidtide/data/examples/src/testboth +1 -1
- rapidtide/data/examples/src/testcifti +11 -0
- rapidtide/data/examples/src/testdelayvar +13 -0
- rapidtide/data/examples/src/testfmri +3 -124
- rapidtide/data/examples/src/testglmfilt +8 -6
- rapidtide/data/examples/src/testhappy +1 -1
- rapidtide/data/examples/src/testinitdelay +19 -0
- rapidtide/data/examples/src/testnewrefine +49 -0
- rapidtide/data/examples/src/testnoiseamp +2 -2
- rapidtide/data/examples/src/testrefineonly +22 -0
- rapidtide/data/examples/src/testretro +16 -7
- rapidtide/data/examples/src/testretrolagtcs +1 -1
- rapidtide/dlfilter.py +0 -1
- rapidtide/fit.py +41 -9
- rapidtide/happy_supportfuncs.py +5 -0
- rapidtide/io.py +13 -2
- rapidtide/{glmpass.py → linfitfiltpass.py} +29 -20
- rapidtide/refinedelay.py +133 -55
- rapidtide/refineregressor.py +38 -24
- rapidtide/resample.py +3 -0
- rapidtide/scripts/{retroglm.py → delayvar.py} +2 -2
- rapidtide/scripts/{glmfilt.py → linfitfilt.py} +2 -2
- rapidtide/scripts/retroregress.py +28 -0
- rapidtide/scripts/stupidramtricks.py +9 -7
- rapidtide/simfuncfit.py +1 -1
- rapidtide/tests/cleanposttest +21 -0
- rapidtide/tests/test_delayestimation.py +3 -3
- rapidtide/tests/test_fastresampler.py +1 -2
- rapidtide/tests/test_fullrunhappy_v1.py +1 -1
- rapidtide/tests/test_fullrunhappy_v2.py +1 -1
- rapidtide/tests/test_fullrunrapidtide_v1.py +2 -2
- rapidtide/tests/test_fullrunrapidtide_v3.py +1 -1
- rapidtide/tests/test_fullrunrapidtide_v5.py +1 -1
- rapidtide/tests/test_fullrunrapidtide_v6.py +11 -11
- rapidtide/tests/{test_glmpass.py → test_linfitfiltpass.py} +9 -9
- rapidtide/tests/test_motionregress.py +3 -3
- rapidtide/tests/test_refinedelay.py +12 -12
- rapidtide/tidepoolTemplate.py +1 -0
- rapidtide/tidepoolTemplate.ui +1 -0
- rapidtide/tidepoolTemplate_alt.py +5 -4
- rapidtide/tidepoolTemplate_alt.ui +3 -2
- rapidtide/tidepoolTemplate_alt_qt6.py +177 -49
- rapidtide/tidepoolTemplate_big.py +1 -0
- rapidtide/tidepoolTemplate_big.ui +1 -0
- rapidtide/tidepoolTemplate_big_qt6.py +197 -53
- rapidtide/tidepoolTemplate_qt6.py +151 -39
- rapidtide/workflows/delayvar.py +1048 -0
- rapidtide/workflows/happy.py +37 -11
- rapidtide/workflows/happy_parser.py +4 -4
- rapidtide/workflows/{glmfilt.py → linfitfilt.py} +4 -4
- rapidtide/workflows/parser_funcs.py +10 -2
- rapidtide/workflows/rapidtide.py +388 -452
- rapidtide/workflows/rapidtide_parser.py +129 -90
- rapidtide/workflows/{glmfrommaps.py → regressfrommaps.py} +28 -26
- rapidtide/workflows/retrolagtcs.py +12 -12
- rapidtide/workflows/{retroglm.py → retroregress.py} +243 -141
- rapidtide/workflows/tidepool.py +2 -2
- {rapidtide-3.0a11.dist-info → rapidtide-3.0a13.dist-info}/METADATA +3 -2
- {rapidtide-3.0a11.dist-info → rapidtide-3.0a13.dist-info}/RECORD +72 -63
- {rapidtide-3.0a11.dist-info → rapidtide-3.0a13.dist-info}/WHEEL +1 -1
- {rapidtide-3.0a11.dist-info → rapidtide-3.0a13.dist-info}/entry_points.txt +3 -2
- rapidtide/data/examples/src/testoutputsize +0 -45
- {rapidtide-3.0a11.dist-info → rapidtide-3.0a13.dist-info/licenses}/LICENSE +0 -0
- {rapidtide-3.0a11.dist-info → rapidtide-3.0a13.dist-info}/top_level.txt +0 -0
|
@@ -79,7 +79,8 @@ DEFAULT_PEAKFIT_TYPE = "gauss"
|
|
|
79
79
|
DEFAULT_REFINE_PRENORM = "var"
|
|
80
80
|
DEFAULT_REFINE_WEIGHTING = "None"
|
|
81
81
|
DEFAULT_REFINE_PCACOMPONENTS = 0.8
|
|
82
|
-
|
|
82
|
+
DEFAULT_REGRESSIONFILTDERIVS = 0
|
|
83
|
+
DEFAULT_REFINEREGRESSDERIVS = 1
|
|
83
84
|
|
|
84
85
|
DEFAULT_DENOISING_LAGMIN = -10.0
|
|
85
86
|
DEFAULT_DENOISING_LAGMAX = 10.0
|
|
@@ -159,7 +160,7 @@ def _get_parser():
|
|
|
159
160
|
f"sets searchrange=({DEFAULT_DENOISING_LAGMIN}, {DEFAULT_DENOISING_LAGMAX}), "
|
|
160
161
|
f"passes={DEFAULT_DENOISING_PASSES}, despeckle_passes={DEFAULT_DENOISING_DESPECKLE_PASSES}, "
|
|
161
162
|
f"refineoffset=True, peakfittype={DEFAULT_DENOISING_PEAKFITTYPE}, "
|
|
162
|
-
f"gausssigma={DEFAULT_DENOISING_SPATIALFILT}, nofitfilt=True,
|
|
163
|
+
f"gausssigma={DEFAULT_DENOISING_SPATIALFILT}, nofitfilt=True, dolinfitfilt=True. "
|
|
163
164
|
"Any of these options can be overridden with the appropriate "
|
|
164
165
|
"additional arguments."
|
|
165
166
|
),
|
|
@@ -175,7 +176,7 @@ def _get_parser():
|
|
|
175
176
|
f"passes={DEFAULT_DELAYMAPPING_PASSES}, despeckle_passes={DEFAULT_DELAYMAPPING_DESPECKLE_PASSES}, "
|
|
176
177
|
f"gausssigma={DEFAULT_DELAYMAPPING_SPATIALFILT}, "
|
|
177
178
|
"refineoffset=True, refinedelay=True, outputlevel='normal', "
|
|
178
|
-
"
|
|
179
|
+
"dolinfitfilt=False. "
|
|
179
180
|
"Any of these options can be overridden with the appropriate "
|
|
180
181
|
"additional arguments."
|
|
181
182
|
),
|
|
@@ -192,7 +193,7 @@ def _get_parser():
|
|
|
192
193
|
f"passes=1, despeckle_passes={DEFAULT_CVRMAPPING_DESPECKLE_PASSES}, "
|
|
193
194
|
f"searchrange=({DEFAULT_CVRMAPPING_LAGMIN}, {DEFAULT_CVRMAPPING_LAGMAX}), "
|
|
194
195
|
f"filterfreqs=({DEFAULT_CVRMAPPING_FILTER_LOWERPASS}, {DEFAULT_CVRMAPPING_FILTER_UPPERPASS}), "
|
|
195
|
-
"and calculates a voxelwise
|
|
196
|
+
"and calculates a voxelwise regression fit using the optimally delayed "
|
|
196
197
|
"input regressor and the percent normalized, demeaned BOLD data as inputs. This map is output as "
|
|
197
198
|
"(XXX_desc-CVR_map.nii.gz). If no input regressor is supplied, this will generate an error. "
|
|
198
199
|
"These options can be overridden with the appropriate additional arguments."
|
|
@@ -206,7 +207,7 @@ def _get_parser():
|
|
|
206
207
|
help=(
|
|
207
208
|
"Treat this run as an initial pass to locate good candidate voxels for global mean "
|
|
208
209
|
"regressor generation. This sets: passes=1, despecklepasses=0, "
|
|
209
|
-
"refinedespeckle=False, outputlevel='normal',
|
|
210
|
+
"refinedespeckle=False, outputlevel='normal', dolinfitfilt=False, saveintermediatemaps=False."
|
|
210
211
|
),
|
|
211
212
|
default=False,
|
|
212
213
|
)
|
|
@@ -309,7 +310,7 @@ def _get_parser():
|
|
|
309
310
|
dest="realtr",
|
|
310
311
|
action="store",
|
|
311
312
|
metavar="TSTEP",
|
|
312
|
-
type=lambda x: pf.is_float(parser, x),
|
|
313
|
+
type=lambda x: pf.is_float(parser, x, minval=0.0),
|
|
313
314
|
help=(
|
|
314
315
|
"Set the timestep of the data file to TSTEP. "
|
|
315
316
|
"This will override the TR in an "
|
|
@@ -395,7 +396,7 @@ def _get_parser():
|
|
|
395
396
|
"--detrendorder",
|
|
396
397
|
dest="detrendorder",
|
|
397
398
|
action="store",
|
|
398
|
-
type=
|
|
399
|
+
type=lambda x: pf.is_int(parser, x, minval=0),
|
|
399
400
|
metavar="ORDER",
|
|
400
401
|
help=(f"Set order of trend removal (0 to disable). Default is {DEFAULT_DETREND_ORDER}."),
|
|
401
402
|
default=DEFAULT_DETREND_ORDER,
|
|
@@ -514,7 +515,7 @@ def _get_parser():
|
|
|
514
515
|
"--confoundpowers",
|
|
515
516
|
dest="confound_power",
|
|
516
517
|
metavar="N",
|
|
517
|
-
type=
|
|
518
|
+
type=lambda x: pf.is_int(parser, x, minval=1),
|
|
518
519
|
help=(
|
|
519
520
|
"Include powers of each confound regressor up to order N. Default is 1 (no expansion). "
|
|
520
521
|
),
|
|
@@ -580,7 +581,7 @@ def _get_parser():
|
|
|
580
581
|
"--numskip",
|
|
581
582
|
dest="preprocskip",
|
|
582
583
|
action="store",
|
|
583
|
-
type=
|
|
584
|
+
type=lambda x: pf.is_int(parser, x, minval=0),
|
|
584
585
|
metavar="SKIP",
|
|
585
586
|
help=(
|
|
586
587
|
"SKIP TRs were previously deleted during "
|
|
@@ -672,7 +673,7 @@ def _get_parser():
|
|
|
672
673
|
"--regressorfreq",
|
|
673
674
|
dest="inputfreq",
|
|
674
675
|
action="store",
|
|
675
|
-
type=lambda x: pf.is_float(parser, x),
|
|
676
|
+
type=lambda x: pf.is_float(parser, x, minval=0.0),
|
|
676
677
|
metavar="FREQ",
|
|
677
678
|
help=(
|
|
678
679
|
"Probe regressor in file has sample "
|
|
@@ -888,7 +889,7 @@ def _get_parser():
|
|
|
888
889
|
"--despecklepasses",
|
|
889
890
|
dest="despeckle_passes",
|
|
890
891
|
action=pf.IndicateSpecifiedAction,
|
|
891
|
-
type=
|
|
892
|
+
type=lambda x: pf.is_int(parser, x, minval=0),
|
|
892
893
|
metavar="PASSES",
|
|
893
894
|
help=(
|
|
894
895
|
"Detect and refit suspect correlations to "
|
|
@@ -943,7 +944,7 @@ def _get_parser():
|
|
|
943
944
|
"--passes",
|
|
944
945
|
dest="passes",
|
|
945
946
|
action=pf.IndicateSpecifiedAction,
|
|
946
|
-
type=
|
|
947
|
+
type=lambda x: pf.is_int(parser, x, minval=1),
|
|
947
948
|
metavar="PASSES",
|
|
948
949
|
help=("Set the number of processing passes to PASSES. " f"Default is {DEFAULT_PASSES}."),
|
|
949
950
|
default=DEFAULT_PASSES,
|
|
@@ -1064,15 +1065,6 @@ def _get_parser():
|
|
|
1064
1065
|
help=("Disables selecting the leftmost delay peak when setting the refine offset."),
|
|
1065
1066
|
default=True,
|
|
1066
1067
|
)
|
|
1067
|
-
reg_ref.add_argument(
|
|
1068
|
-
"--pickleft",
|
|
1069
|
-
dest="dummy",
|
|
1070
|
-
action="store_true",
|
|
1071
|
-
help=(
|
|
1072
|
-
"DEPRECATED. pickleft is now on by default. Use 'nopickleft' to disable it instead."
|
|
1073
|
-
),
|
|
1074
|
-
default=True,
|
|
1075
|
-
)
|
|
1076
1068
|
reg_ref.add_argument(
|
|
1077
1069
|
"--pickleftthresh",
|
|
1078
1070
|
dest="pickleftthresh",
|
|
@@ -1157,7 +1149,7 @@ def _get_parser():
|
|
|
1157
1149
|
"--maxpasses",
|
|
1158
1150
|
dest="maxpasses",
|
|
1159
1151
|
action="store",
|
|
1160
|
-
type=
|
|
1152
|
+
type=lambda x: pf.is_int(parser, x, minval=1),
|
|
1161
1153
|
metavar="MAXPASSES",
|
|
1162
1154
|
help=(
|
|
1163
1155
|
"Terminate refinement after MAXPASSES passes, whether or not convergence has occurred. "
|
|
@@ -1166,22 +1158,22 @@ def _get_parser():
|
|
|
1166
1158
|
default=DEFAULT_MAXPASSES,
|
|
1167
1159
|
)
|
|
1168
1160
|
|
|
1169
|
-
#
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
"--
|
|
1173
|
-
dest="
|
|
1161
|
+
# sLFO noise removal options
|
|
1162
|
+
slfofilt = parser.add_argument_group("sLFO noise removal options")
|
|
1163
|
+
slfofilt.add_argument(
|
|
1164
|
+
"--nodenoise",
|
|
1165
|
+
dest="dolinfitfilt",
|
|
1174
1166
|
action="store_false",
|
|
1175
1167
|
help=(
|
|
1176
|
-
"Turn off
|
|
1168
|
+
"Turn off regression filtering to remove delayed "
|
|
1177
1169
|
"regressor from each voxel (disables output of "
|
|
1178
1170
|
"fitNorm)."
|
|
1179
1171
|
),
|
|
1180
1172
|
default=True,
|
|
1181
1173
|
)
|
|
1182
|
-
|
|
1183
|
-
"--
|
|
1184
|
-
dest="
|
|
1174
|
+
slfofilt.add_argument(
|
|
1175
|
+
"--denoisesourcefile",
|
|
1176
|
+
dest="denoisesourcefile",
|
|
1185
1177
|
action="store",
|
|
1186
1178
|
type=lambda x: pf.is_valid_file(parser, x),
|
|
1187
1179
|
metavar="FILE",
|
|
@@ -1192,46 +1184,39 @@ def _get_parser():
|
|
|
1192
1184
|
),
|
|
1193
1185
|
default=None,
|
|
1194
1186
|
)
|
|
1195
|
-
|
|
1187
|
+
slfofilt.add_argument(
|
|
1196
1188
|
"--preservefiltering",
|
|
1197
1189
|
dest="preservefiltering",
|
|
1198
1190
|
action="store_true",
|
|
1199
|
-
help="Don't reread data prior to performing
|
|
1191
|
+
help="Don't reread data prior to performing sLFO filtering.",
|
|
1200
1192
|
default=False,
|
|
1201
1193
|
)
|
|
1202
|
-
|
|
1203
|
-
"--
|
|
1204
|
-
dest="
|
|
1194
|
+
slfofilt.add_argument(
|
|
1195
|
+
"--regressderivs",
|
|
1196
|
+
dest="regressderivs",
|
|
1205
1197
|
action="store",
|
|
1206
|
-
type=
|
|
1198
|
+
type=lambda x: pf.is_int(parser, x, minval=0),
|
|
1207
1199
|
metavar="NDERIVS",
|
|
1208
1200
|
help=(
|
|
1209
|
-
f"When doing final
|
|
1201
|
+
f"When doing final sLFO filtering, include derivatives up to NDERIVS order. Default is {DEFAULT_REGRESSIONFILTDERIVS}"
|
|
1210
1202
|
),
|
|
1211
|
-
default=
|
|
1203
|
+
default=DEFAULT_REGRESSIONFILTDERIVS,
|
|
1212
1204
|
)
|
|
1213
|
-
|
|
1205
|
+
slfofilt.add_argument(
|
|
1214
1206
|
"--norefinedelay",
|
|
1215
1207
|
dest="refinedelay",
|
|
1216
1208
|
action="store_false",
|
|
1217
|
-
help=("Do not calculate a refined delay map using
|
|
1209
|
+
help=("Do not calculate a refined delay map using sLFO regression information."),
|
|
1218
1210
|
default=True,
|
|
1219
1211
|
)
|
|
1220
|
-
|
|
1221
|
-
"--refinedelay",
|
|
1222
|
-
dest="dummy",
|
|
1223
|
-
action="store_true",
|
|
1224
|
-
help=("Calculate a refined delay map using GLM information. ***DEPRECATED*** - this is now on by default."),
|
|
1225
|
-
default=True,
|
|
1226
|
-
)
|
|
1227
|
-
glm.add_argument(
|
|
1212
|
+
slfofilt.add_argument(
|
|
1228
1213
|
"--nofilterwithrefineddelay",
|
|
1229
1214
|
dest="filterwithrefineddelay",
|
|
1230
1215
|
action="store_false",
|
|
1231
|
-
help=("Do not use the refined delay in
|
|
1216
|
+
help=("Do not use the refined delay in sLFO filter."),
|
|
1232
1217
|
default=True,
|
|
1233
1218
|
)
|
|
1234
|
-
|
|
1219
|
+
slfofilt.add_argument(
|
|
1235
1220
|
"--delaypatchthresh",
|
|
1236
1221
|
dest="delaypatchthresh",
|
|
1237
1222
|
action="store",
|
|
@@ -1243,7 +1228,7 @@ def _get_parser():
|
|
|
1243
1228
|
),
|
|
1244
1229
|
default=DEFAULT_PATCHTHRESH,
|
|
1245
1230
|
)
|
|
1246
|
-
|
|
1231
|
+
slfofilt.add_argument(
|
|
1247
1232
|
"--delayoffsetspatialfilt",
|
|
1248
1233
|
dest="delayoffsetgausssigma",
|
|
1249
1234
|
action="store",
|
|
@@ -1268,7 +1253,7 @@ def _get_parser():
|
|
|
1268
1253
|
choices=["min", "less", "normal", "more", "max"],
|
|
1269
1254
|
help=(
|
|
1270
1255
|
"The level of file output produced. 'min' produces only absolutely essential files, 'less' adds in "
|
|
1271
|
-
"the
|
|
1256
|
+
"the sLFO filtered data (rather than just filter efficacy metrics), 'normal' saves what you "
|
|
1272
1257
|
"would typically want around for interactive data exploration, "
|
|
1273
1258
|
"'more' adds files that are sometimes useful, and 'max' outputs anything you might possibly want. "
|
|
1274
1259
|
"Selecting 'max' will produce ~3x your input datafile size as output. "
|
|
@@ -1276,16 +1261,6 @@ def _get_parser():
|
|
|
1276
1261
|
),
|
|
1277
1262
|
default=DEFAULT_OUTPUTLEVEL,
|
|
1278
1263
|
)
|
|
1279
|
-
output.add_argument(
|
|
1280
|
-
"--nolimitoutput",
|
|
1281
|
-
dest="limitoutput",
|
|
1282
|
-
action="store_false",
|
|
1283
|
-
help=(
|
|
1284
|
-
"Save some of the large and rarely used files. "
|
|
1285
|
-
"NB: THIS IS NOW DEPRECATED: Use '--outputlevel max' instead."
|
|
1286
|
-
),
|
|
1287
|
-
default=True,
|
|
1288
|
-
)
|
|
1289
1264
|
output.add_argument(
|
|
1290
1265
|
"--savelags",
|
|
1291
1266
|
dest="savecorrtimes",
|
|
@@ -1297,7 +1272,7 @@ def _get_parser():
|
|
|
1297
1272
|
"--histlen", # was -h
|
|
1298
1273
|
dest="histlen",
|
|
1299
1274
|
action="store",
|
|
1300
|
-
type=
|
|
1275
|
+
type=lambda x: pf.is_int(parser, x, minval=5),
|
|
1301
1276
|
metavar="HISTLEN",
|
|
1302
1277
|
help=(f"Change the histogram length to HISTLEN. Default is {DEFAULT_HISTLEN}."),
|
|
1303
1278
|
default=DEFAULT_HISTLEN,
|
|
@@ -1349,7 +1324,7 @@ def _get_parser():
|
|
|
1349
1324
|
"--mklthreads",
|
|
1350
1325
|
dest="mklthreads",
|
|
1351
1326
|
action="store",
|
|
1352
|
-
type=
|
|
1327
|
+
type=lambda x: pf.is_int(parser, x, minval=1),
|
|
1353
1328
|
metavar="MKLTHREADS",
|
|
1354
1329
|
help=(
|
|
1355
1330
|
"If mkl library is installed, use no more than MKLTHREADS worker "
|
|
@@ -1463,6 +1438,25 @@ def _get_parser():
|
|
|
1463
1438
|
experimental = parser.add_argument_group(
|
|
1464
1439
|
"Experimental options (not fully tested, or not tested at all, may not work). Beware!"
|
|
1465
1440
|
)
|
|
1441
|
+
experimental.add_argument(
|
|
1442
|
+
"--refineregressderivs",
|
|
1443
|
+
dest="refineregressderivs",
|
|
1444
|
+
action="store",
|
|
1445
|
+
type=lambda x: pf.is_int(parser, x, minval=1),
|
|
1446
|
+
metavar="NDERIVS",
|
|
1447
|
+
help=(
|
|
1448
|
+
f"When doing regression fit for delay refinement, include derivatives up to NDERIVS order. Must be 1 or more. "
|
|
1449
|
+
f"Default is {DEFAULT_REFINEREGRESSDERIVS}"
|
|
1450
|
+
),
|
|
1451
|
+
default=DEFAULT_REFINEREGRESSDERIVS,
|
|
1452
|
+
)
|
|
1453
|
+
experimental.add_argument(
|
|
1454
|
+
"--dofinalrefine",
|
|
1455
|
+
dest="dofinalrefine",
|
|
1456
|
+
action="store_true",
|
|
1457
|
+
help=("Do regressor refinement on the final pass."),
|
|
1458
|
+
default=False,
|
|
1459
|
+
)
|
|
1466
1460
|
experimental.add_argument(
|
|
1467
1461
|
"--territorymap",
|
|
1468
1462
|
dest="territorymap",
|
|
@@ -1542,7 +1536,7 @@ def _get_parser():
|
|
|
1542
1536
|
"--noisefreq",
|
|
1543
1537
|
dest="noisefreq",
|
|
1544
1538
|
action="store",
|
|
1545
|
-
type=lambda x: pf.is_float(parser, x),
|
|
1539
|
+
type=lambda x: pf.is_float(parser, x, minval=0.0),
|
|
1546
1540
|
metavar="FREQ",
|
|
1547
1541
|
help=(
|
|
1548
1542
|
"Noise timecourse in file has sample "
|
|
@@ -1648,6 +1642,51 @@ def _get_parser():
|
|
|
1648
1642
|
default=False,
|
|
1649
1643
|
)
|
|
1650
1644
|
|
|
1645
|
+
# Deprecated options
|
|
1646
|
+
deprecated = parser.add_argument_group(
|
|
1647
|
+
"Deprecated options. These options will go away in the indeterminate future. Don't use them."
|
|
1648
|
+
)
|
|
1649
|
+
deprecated.add_argument(
|
|
1650
|
+
"--refinedelay",
|
|
1651
|
+
dest="dummy",
|
|
1652
|
+
action="store_true",
|
|
1653
|
+
help=(
|
|
1654
|
+
"Calculate a refined delay map using regression coefficient information. ***DEPRECATED***: refinedelay is now on by default."
|
|
1655
|
+
),
|
|
1656
|
+
default=True,
|
|
1657
|
+
)
|
|
1658
|
+
deprecated.add_argument(
|
|
1659
|
+
"--nolimitoutput",
|
|
1660
|
+
dest="limitoutput",
|
|
1661
|
+
action="store_false",
|
|
1662
|
+
help=(
|
|
1663
|
+
"Save some of the large and rarely used files. "
|
|
1664
|
+
"***DEPRECATED***: Use '--outputlevel max' instead."
|
|
1665
|
+
),
|
|
1666
|
+
default=True,
|
|
1667
|
+
)
|
|
1668
|
+
deprecated.add_argument(
|
|
1669
|
+
"--pickleft",
|
|
1670
|
+
dest="dummy",
|
|
1671
|
+
action="store_true",
|
|
1672
|
+
help=(
|
|
1673
|
+
"***DEPRECATED***: pickleft is now on by default. Use 'nopickleft' to disable it instead."
|
|
1674
|
+
),
|
|
1675
|
+
default=True,
|
|
1676
|
+
)
|
|
1677
|
+
deprecated.add_argument(
|
|
1678
|
+
"--noglm",
|
|
1679
|
+
dest="dolinfitfilt",
|
|
1680
|
+
action="store_false",
|
|
1681
|
+
help=(
|
|
1682
|
+
"Turn off regression filtering to remove delayed "
|
|
1683
|
+
"regressor from each voxel (disables output of "
|
|
1684
|
+
"fitNorm)."
|
|
1685
|
+
"***DEPRECATED***: Use '--nodenoise' instead."
|
|
1686
|
+
),
|
|
1687
|
+
default=True,
|
|
1688
|
+
)
|
|
1689
|
+
|
|
1651
1690
|
# Debugging options
|
|
1652
1691
|
debugging = parser.add_argument_group(
|
|
1653
1692
|
"Debugging options. You probably don't want to use any of these unless I ask you to to help diagnose a problem"
|
|
@@ -1737,10 +1776,10 @@ def _get_parser():
|
|
|
1737
1776
|
default=False,
|
|
1738
1777
|
)
|
|
1739
1778
|
debugging.add_argument(
|
|
1740
|
-
"--
|
|
1741
|
-
dest="
|
|
1779
|
+
"--singleproc_regressionfilt",
|
|
1780
|
+
dest="singleproc_regressionfilt",
|
|
1742
1781
|
action="store_true",
|
|
1743
|
-
help=("Force single proc path for
|
|
1782
|
+
help=("Force single proc path for regression filtering."),
|
|
1744
1783
|
default=False,
|
|
1745
1784
|
)
|
|
1746
1785
|
debugging.add_argument(
|
|
@@ -2112,7 +2151,7 @@ def process_args(inputargs=None):
|
|
|
2112
2151
|
args["refineoffset"] = True
|
|
2113
2152
|
args["refinedelay"] = True
|
|
2114
2153
|
args["outputlevel"] = "normal"
|
|
2115
|
-
pf.setifnotset(args, "
|
|
2154
|
+
pf.setifnotset(args, "dolinfitfilt", True)
|
|
2116
2155
|
|
|
2117
2156
|
if args["denoising"]:
|
|
2118
2157
|
LGR.warning('Using "denoising" analysis mode. Overriding any affected arguments.')
|
|
@@ -2125,7 +2164,7 @@ def process_args(inputargs=None):
|
|
|
2125
2164
|
args["refineoffset"] = True
|
|
2126
2165
|
args["refinedelay"] = True
|
|
2127
2166
|
args["zerooutbadfit"] = False
|
|
2128
|
-
pf.setifnotset(args, "
|
|
2167
|
+
pf.setifnotset(args, "dolinfitfilt", True)
|
|
2129
2168
|
|
|
2130
2169
|
if args["docvrmap"]:
|
|
2131
2170
|
LGR.warning('Using "CVR" analysis mode. Overriding any affected arguments.')
|
|
@@ -2144,7 +2183,7 @@ def process_args(inputargs=None):
|
|
|
2144
2183
|
args["preservefiltering"] = True
|
|
2145
2184
|
args["passes"] = 1
|
|
2146
2185
|
args["outputlevel"] = "min"
|
|
2147
|
-
args["
|
|
2186
|
+
args["dolinfitfilt"] = False
|
|
2148
2187
|
|
|
2149
2188
|
if args["globalpreselect"]:
|
|
2150
2189
|
LGR.warning('Using "globalpreselect" analysis mode. Overriding any affected arguments.')
|
|
@@ -2152,7 +2191,7 @@ def process_args(inputargs=None):
|
|
|
2152
2191
|
args["despeckle_passes"] = 0
|
|
2153
2192
|
args["refinedespeckle"] = False
|
|
2154
2193
|
args["outputlevel"] = "normal"
|
|
2155
|
-
pf.setifnotset(args, "
|
|
2194
|
+
pf.setifnotset(args, "dolinfitfilt", False)
|
|
2156
2195
|
args["saveintermediatemaps"] = False
|
|
2157
2196
|
|
|
2158
2197
|
# configure the filter
|
|
@@ -2189,50 +2228,50 @@ def process_args(inputargs=None):
|
|
|
2189
2228
|
args["savecorrtimes"] = False
|
|
2190
2229
|
args["savelagregressors"] = False
|
|
2191
2230
|
args["savedespecklemasks"] = False
|
|
2192
|
-
args["
|
|
2193
|
-
args["
|
|
2231
|
+
args["saveminimumsLFOfiltfiles"] = False
|
|
2232
|
+
args["savenormalsLFOfiltfiles"] = False
|
|
2194
2233
|
args["savemovingsignal"] = False
|
|
2195
|
-
args["
|
|
2234
|
+
args["saveallsLFOfiltfiles"] = False
|
|
2196
2235
|
elif args["outputlevel"] == "less":
|
|
2197
2236
|
args["saveconfoundfiltered"] = False
|
|
2198
2237
|
args["savegaussout"] = False
|
|
2199
2238
|
args["savecorrtimes"] = False
|
|
2200
2239
|
args["savelagregressors"] = False
|
|
2201
2240
|
args["savedespecklemasks"] = False
|
|
2202
|
-
args["
|
|
2203
|
-
args["
|
|
2241
|
+
args["saveminimumsLFOfiltfiles"] = True
|
|
2242
|
+
args["savenormalsLFOfiltfiles"] = False
|
|
2204
2243
|
args["savemovingsignal"] = False
|
|
2205
|
-
args["
|
|
2244
|
+
args["saveallsLFOfiltfiles"] = False
|
|
2206
2245
|
elif args["outputlevel"] == "normal":
|
|
2207
2246
|
args["saveconfoundfiltered"] = False
|
|
2208
2247
|
args["savegaussout"] = False
|
|
2209
2248
|
args["savecorrtimes"] = False
|
|
2210
2249
|
args["savelagregressors"] = False
|
|
2211
2250
|
args["savedespecklemasks"] = False
|
|
2212
|
-
args["
|
|
2213
|
-
args["
|
|
2251
|
+
args["saveminimumsLFOfiltfiles"] = True
|
|
2252
|
+
args["savenormalsLFOfiltfiles"] = True
|
|
2214
2253
|
args["savemovingsignal"] = False
|
|
2215
|
-
args["
|
|
2254
|
+
args["saveallsLFOfiltfiles"] = False
|
|
2216
2255
|
elif args["outputlevel"] == "more":
|
|
2217
2256
|
args["saveconfoundfiltered"] = False
|
|
2218
2257
|
args["savegaussout"] = False
|
|
2219
2258
|
args["savecorrtimes"] = False
|
|
2220
2259
|
args["savelagregressors"] = True
|
|
2221
2260
|
args["savedespecklemasks"] = False
|
|
2222
|
-
args["
|
|
2223
|
-
args["
|
|
2261
|
+
args["saveminimumsLFOfiltfiles"] = True
|
|
2262
|
+
args["savenormalsLFOfiltfiles"] = True
|
|
2224
2263
|
args["savemovingsignal"] = True
|
|
2225
|
-
args["
|
|
2264
|
+
args["saveallsLFOfiltfiles"] = False
|
|
2226
2265
|
elif args["outputlevel"] == "max":
|
|
2227
2266
|
args["saveconfoundfiltered"] = True
|
|
2228
2267
|
args["savegaussout"] = True
|
|
2229
2268
|
args["savecorrtimes"] = True
|
|
2230
2269
|
args["savelagregressors"] = True
|
|
2231
2270
|
args["savedespecklemasks"] = True
|
|
2232
|
-
args["
|
|
2233
|
-
args["
|
|
2271
|
+
args["saveminimumsLFOfiltfiles"] = True
|
|
2272
|
+
args["savenormalsLFOfiltfiles"] = True
|
|
2234
2273
|
args["savemovingsignal"] = True
|
|
2235
|
-
args["
|
|
2274
|
+
args["saveallsLFOfiltfiles"] = True
|
|
2236
2275
|
else:
|
|
2237
2276
|
print(f"illegal output level {args['outputlevel']}")
|
|
2238
2277
|
sys.exit()
|
|
@@ -2264,8 +2303,8 @@ def process_args(inputargs=None):
|
|
|
2264
2303
|
args["territorymapname"] = None
|
|
2265
2304
|
args["territorymapincludevals"] = None
|
|
2266
2305
|
|
|
2267
|
-
# this is new enough to do retrospective
|
|
2268
|
-
args["
|
|
2306
|
+
# this is new enough to do retrospective regression filtering
|
|
2307
|
+
args["retroregresscompatible"] = True
|
|
2269
2308
|
|
|
2270
2309
|
LGR.debug("\nafter postprocessing\n{}".format(args))
|
|
2271
2310
|
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
|
|
20
20
|
import numpy as np
|
|
21
21
|
|
|
22
|
-
import rapidtide.glmpass as tide_glmpass
|
|
23
22
|
import rapidtide.io as tide_io
|
|
23
|
+
import rapidtide.linfitfiltpass as tide_linfitfiltpass
|
|
24
24
|
import rapidtide.makelaggedtcs as tide_makelagged
|
|
25
25
|
import rapidtide.util as tide_util
|
|
26
26
|
|
|
@@ -54,7 +54,7 @@ def addmemprofiling(thefunc, memprofile, themessage):
|
|
|
54
54
|
return thefunc
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
def
|
|
57
|
+
def regressfrommaps(
|
|
58
58
|
fmri_data_valid,
|
|
59
59
|
validvoxels,
|
|
60
60
|
initial_fmri_x,
|
|
@@ -64,7 +64,7 @@ def glmfrommaps(
|
|
|
64
64
|
mode,
|
|
65
65
|
outputname,
|
|
66
66
|
oversamptr,
|
|
67
|
-
|
|
67
|
+
sLFOfitmean,
|
|
68
68
|
rvalue,
|
|
69
69
|
r2value,
|
|
70
70
|
fitNorm,
|
|
@@ -74,11 +74,11 @@ def glmfrommaps(
|
|
|
74
74
|
filtereddata,
|
|
75
75
|
LGR,
|
|
76
76
|
TimingLGR,
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
regressfiltthreshval,
|
|
78
|
+
saveminimumsLFOfiltfiles,
|
|
79
79
|
nprocs_makelaggedtcs=1,
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
nprocs_regressionfilt=1,
|
|
81
|
+
regressderivs=0,
|
|
82
82
|
mp_chunksize=50000,
|
|
83
83
|
showprogressbar=True,
|
|
84
84
|
alwaysmultiproc=False,
|
|
@@ -86,10 +86,10 @@ def glmfrommaps(
|
|
|
86
86
|
debug=False,
|
|
87
87
|
):
|
|
88
88
|
if debug:
|
|
89
|
-
print("
|
|
89
|
+
print("regressfrommaps: Starting")
|
|
90
90
|
print(f"{nprocs_makelaggedtcs=}")
|
|
91
|
-
print(f"{
|
|
92
|
-
print(f"{
|
|
91
|
+
print(f"{nprocs_regressionfilt=}")
|
|
92
|
+
print(f"{regressderivs=}")
|
|
93
93
|
print(f"{mp_chunksize=}")
|
|
94
94
|
print(f"{showprogressbar=}")
|
|
95
95
|
print(f"{alwaysmultiproc=}")
|
|
@@ -97,7 +97,7 @@ def glmfrommaps(
|
|
|
97
97
|
print(f"{mode=}")
|
|
98
98
|
print(f"{outputname=}")
|
|
99
99
|
print(f"{oversamptr=}")
|
|
100
|
-
print(f"{
|
|
100
|
+
print(f"{regressfiltthreshval=}")
|
|
101
101
|
rt_floatset = np.float64
|
|
102
102
|
rt_floattype = "float64"
|
|
103
103
|
numvalidspatiallocs = np.shape(validvoxels)[0]
|
|
@@ -150,18 +150,20 @@ def glmfrommaps(
|
|
|
150
150
|
if TimingLGR is not None:
|
|
151
151
|
TimingLGR.info("Start filtering operation")
|
|
152
152
|
if memprofile:
|
|
153
|
-
|
|
153
|
+
linfitfiltpass_func = addmemprofiling(
|
|
154
|
+
tide_linfitfiltpass.linfitfiltpass, memprofile, "before linfitfiltpass"
|
|
155
|
+
)
|
|
154
156
|
else:
|
|
155
|
-
|
|
157
|
+
linfitfiltpass_func = tide_linfitfiltpass.linfitfiltpass
|
|
156
158
|
|
|
157
|
-
if
|
|
159
|
+
if regressderivs > 0:
|
|
158
160
|
if debug:
|
|
159
|
-
print(f"adding derivatives up to order {
|
|
160
|
-
regressorset =
|
|
161
|
+
print(f"adding derivatives up to order {regressderivs} prior to regression")
|
|
162
|
+
regressorset = tide_linfitfiltpass.makevoxelspecificderivs(lagtc, regressderivs)
|
|
161
163
|
baseev = rt_floatset(genlagtc.yfromx(initial_fmri_x))
|
|
162
|
-
evset =
|
|
163
|
-
(-1,
|
|
164
|
-
)
|
|
164
|
+
evset = tide_linfitfiltpass.makevoxelspecificderivs(
|
|
165
|
+
baseev.reshape((1, -1)), regressderivs
|
|
166
|
+
).reshape((-1, 2))
|
|
165
167
|
else:
|
|
166
168
|
if debug:
|
|
167
169
|
print(f"using raw lagged regressors for regression")
|
|
@@ -170,19 +172,19 @@ def glmfrommaps(
|
|
|
170
172
|
|
|
171
173
|
if debug:
|
|
172
174
|
print(f"{regressorset.shape=}")
|
|
173
|
-
|
|
175
|
+
voxelsprocessed_regressionfilt = linfitfiltpass_func(
|
|
174
176
|
numvalidspatiallocs,
|
|
175
177
|
fmri_data_valid,
|
|
176
|
-
|
|
178
|
+
regressfiltthreshval,
|
|
177
179
|
regressorset,
|
|
178
|
-
|
|
180
|
+
sLFOfitmean,
|
|
179
181
|
rvalue,
|
|
180
182
|
r2value,
|
|
181
183
|
fitcoeff,
|
|
182
184
|
fitNorm,
|
|
183
185
|
movingsignal,
|
|
184
186
|
filtereddata,
|
|
185
|
-
nprocs=
|
|
187
|
+
nprocs=nprocs_regressionfilt,
|
|
186
188
|
alwaysmultiproc=alwaysmultiproc,
|
|
187
189
|
showprogressbar=showprogressbar,
|
|
188
190
|
mp_chunksize=mp_chunksize,
|
|
@@ -197,7 +199,7 @@ def glmfrommaps(
|
|
|
197
199
|
# determine what was removed
|
|
198
200
|
removeddata = fmri_data_valid - filtereddata
|
|
199
201
|
noiseremoved = np.var(removeddata, axis=0)
|
|
200
|
-
if
|
|
202
|
+
if saveminimumsLFOfiltfiles:
|
|
201
203
|
tide_io.writebidstsv(
|
|
202
204
|
f"{outputname}_desc-lfofilterNoiseRemoved_timeseries",
|
|
203
205
|
noiseremoved,
|
|
@@ -205,9 +207,9 @@ def glmfrommaps(
|
|
|
205
207
|
starttime=0.0,
|
|
206
208
|
columns=[f"removedbyglm"],
|
|
207
209
|
extraheaderinfo={
|
|
208
|
-
"Description": "Variance over space of data removed by
|
|
210
|
+
"Description": "Variance over space of data removed by the sLFO filter at each timepoint"
|
|
209
211
|
},
|
|
210
212
|
append=False,
|
|
211
213
|
)
|
|
212
214
|
|
|
213
|
-
return
|
|
215
|
+
return voxelsprocessed_regressionfilt, regressorset, evset
|