rapidtide 3.0a12__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/{Refiner.py → RegressorRefiner.py} +1 -1
- 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 +1 -0
- rapidtide/data/examples/src/testglmfilt +8 -6
- rapidtide/data/examples/src/testhappy +1 -1
- rapidtide/data/examples/src/testnewrefine +11 -11
- rapidtide/data/examples/src/testnoiseamp +2 -2
- 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} +21 -19
- rapidtide/refinedelay.py +96 -58
- 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_alt_qt6.py +172 -45
- rapidtide/tidepoolTemplate_big_qt6.py +196 -53
- rapidtide/tidepoolTemplate_qt6.py +150 -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/rapidtide.py +235 -171
- rapidtide/workflows/rapidtide_parser.py +103 -86
- rapidtide/workflows/{glmfrommaps.py → regressfrommaps.py} +28 -26
- rapidtide/workflows/retrolagtcs.py +12 -12
- rapidtide/workflows/{retroglm.py → retroregress.py} +158 -141
- {rapidtide-3.0a12.dist-info → rapidtide-3.0a13.dist-info}/METADATA +3 -2
- {rapidtide-3.0a12.dist-info → rapidtide-3.0a13.dist-info}/RECORD +61 -56
- {rapidtide-3.0a12.dist-info → rapidtide-3.0a13.dist-info}/WHEEL +1 -1
- {rapidtide-3.0a12.dist-info → rapidtide-3.0a13.dist-info}/entry_points.txt +3 -2
- rapidtide/data/examples/src/testoutputsize +0 -45
- {rapidtide-3.0a12.dist-info → rapidtide-3.0a13.dist-info/licenses}/LICENSE +0 -0
- {rapidtide-3.0a12.dist-info → rapidtide-3.0a13.dist-info}/top_level.txt +0 -0
|
@@ -79,8 +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
|
-
|
|
83
|
-
|
|
82
|
+
DEFAULT_REGRESSIONFILTDERIVS = 0
|
|
83
|
+
DEFAULT_REFINEREGRESSDERIVS = 1
|
|
84
84
|
|
|
85
85
|
DEFAULT_DENOISING_LAGMIN = -10.0
|
|
86
86
|
DEFAULT_DENOISING_LAGMAX = 10.0
|
|
@@ -160,7 +160,7 @@ def _get_parser():
|
|
|
160
160
|
f"sets searchrange=({DEFAULT_DENOISING_LAGMIN}, {DEFAULT_DENOISING_LAGMAX}), "
|
|
161
161
|
f"passes={DEFAULT_DENOISING_PASSES}, despeckle_passes={DEFAULT_DENOISING_DESPECKLE_PASSES}, "
|
|
162
162
|
f"refineoffset=True, peakfittype={DEFAULT_DENOISING_PEAKFITTYPE}, "
|
|
163
|
-
f"gausssigma={DEFAULT_DENOISING_SPATIALFILT}, nofitfilt=True,
|
|
163
|
+
f"gausssigma={DEFAULT_DENOISING_SPATIALFILT}, nofitfilt=True, dolinfitfilt=True. "
|
|
164
164
|
"Any of these options can be overridden with the appropriate "
|
|
165
165
|
"additional arguments."
|
|
166
166
|
),
|
|
@@ -176,7 +176,7 @@ def _get_parser():
|
|
|
176
176
|
f"passes={DEFAULT_DELAYMAPPING_PASSES}, despeckle_passes={DEFAULT_DELAYMAPPING_DESPECKLE_PASSES}, "
|
|
177
177
|
f"gausssigma={DEFAULT_DELAYMAPPING_SPATIALFILT}, "
|
|
178
178
|
"refineoffset=True, refinedelay=True, outputlevel='normal', "
|
|
179
|
-
"
|
|
179
|
+
"dolinfitfilt=False. "
|
|
180
180
|
"Any of these options can be overridden with the appropriate "
|
|
181
181
|
"additional arguments."
|
|
182
182
|
),
|
|
@@ -193,7 +193,7 @@ def _get_parser():
|
|
|
193
193
|
f"passes=1, despeckle_passes={DEFAULT_CVRMAPPING_DESPECKLE_PASSES}, "
|
|
194
194
|
f"searchrange=({DEFAULT_CVRMAPPING_LAGMIN}, {DEFAULT_CVRMAPPING_LAGMAX}), "
|
|
195
195
|
f"filterfreqs=({DEFAULT_CVRMAPPING_FILTER_LOWERPASS}, {DEFAULT_CVRMAPPING_FILTER_UPPERPASS}), "
|
|
196
|
-
"and calculates a voxelwise
|
|
196
|
+
"and calculates a voxelwise regression fit using the optimally delayed "
|
|
197
197
|
"input regressor and the percent normalized, demeaned BOLD data as inputs. This map is output as "
|
|
198
198
|
"(XXX_desc-CVR_map.nii.gz). If no input regressor is supplied, this will generate an error. "
|
|
199
199
|
"These options can be overridden with the appropriate additional arguments."
|
|
@@ -207,7 +207,7 @@ def _get_parser():
|
|
|
207
207
|
help=(
|
|
208
208
|
"Treat this run as an initial pass to locate good candidate voxels for global mean "
|
|
209
209
|
"regressor generation. This sets: passes=1, despecklepasses=0, "
|
|
210
|
-
"refinedespeckle=False, outputlevel='normal',
|
|
210
|
+
"refinedespeckle=False, outputlevel='normal', dolinfitfilt=False, saveintermediatemaps=False."
|
|
211
211
|
),
|
|
212
212
|
default=False,
|
|
213
213
|
)
|
|
@@ -1065,15 +1065,6 @@ def _get_parser():
|
|
|
1065
1065
|
help=("Disables selecting the leftmost delay peak when setting the refine offset."),
|
|
1066
1066
|
default=True,
|
|
1067
1067
|
)
|
|
1068
|
-
reg_ref.add_argument(
|
|
1069
|
-
"--pickleft",
|
|
1070
|
-
dest="dummy",
|
|
1071
|
-
action="store_true",
|
|
1072
|
-
help=(
|
|
1073
|
-
"DEPRECATED. pickleft is now on by default. Use 'nopickleft' to disable it instead."
|
|
1074
|
-
),
|
|
1075
|
-
default=True,
|
|
1076
|
-
)
|
|
1077
1068
|
reg_ref.add_argument(
|
|
1078
1069
|
"--pickleftthresh",
|
|
1079
1070
|
dest="pickleftthresh",
|
|
@@ -1167,22 +1158,22 @@ def _get_parser():
|
|
|
1167
1158
|
default=DEFAULT_MAXPASSES,
|
|
1168
1159
|
)
|
|
1169
1160
|
|
|
1170
|
-
#
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
"--
|
|
1174
|
-
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",
|
|
1175
1166
|
action="store_false",
|
|
1176
1167
|
help=(
|
|
1177
|
-
"Turn off
|
|
1168
|
+
"Turn off regression filtering to remove delayed "
|
|
1178
1169
|
"regressor from each voxel (disables output of "
|
|
1179
1170
|
"fitNorm)."
|
|
1180
1171
|
),
|
|
1181
1172
|
default=True,
|
|
1182
1173
|
)
|
|
1183
|
-
|
|
1184
|
-
"--
|
|
1185
|
-
dest="
|
|
1174
|
+
slfofilt.add_argument(
|
|
1175
|
+
"--denoisesourcefile",
|
|
1176
|
+
dest="denoisesourcefile",
|
|
1186
1177
|
action="store",
|
|
1187
1178
|
type=lambda x: pf.is_valid_file(parser, x),
|
|
1188
1179
|
metavar="FILE",
|
|
@@ -1193,48 +1184,39 @@ def _get_parser():
|
|
|
1193
1184
|
),
|
|
1194
1185
|
default=None,
|
|
1195
1186
|
)
|
|
1196
|
-
|
|
1187
|
+
slfofilt.add_argument(
|
|
1197
1188
|
"--preservefiltering",
|
|
1198
1189
|
dest="preservefiltering",
|
|
1199
1190
|
action="store_true",
|
|
1200
|
-
help="Don't reread data prior to performing
|
|
1191
|
+
help="Don't reread data prior to performing sLFO filtering.",
|
|
1201
1192
|
default=False,
|
|
1202
1193
|
)
|
|
1203
|
-
|
|
1204
|
-
"--
|
|
1205
|
-
dest="
|
|
1194
|
+
slfofilt.add_argument(
|
|
1195
|
+
"--regressderivs",
|
|
1196
|
+
dest="regressderivs",
|
|
1206
1197
|
action="store",
|
|
1207
1198
|
type=lambda x: pf.is_int(parser, x, minval=0),
|
|
1208
1199
|
metavar="NDERIVS",
|
|
1209
1200
|
help=(
|
|
1210
|
-
f"When doing final
|
|
1201
|
+
f"When doing final sLFO filtering, include derivatives up to NDERIVS order. Default is {DEFAULT_REGRESSIONFILTDERIVS}"
|
|
1211
1202
|
),
|
|
1212
|
-
default=
|
|
1203
|
+
default=DEFAULT_REGRESSIONFILTDERIVS,
|
|
1213
1204
|
)
|
|
1214
|
-
|
|
1205
|
+
slfofilt.add_argument(
|
|
1215
1206
|
"--norefinedelay",
|
|
1216
1207
|
dest="refinedelay",
|
|
1217
1208
|
action="store_false",
|
|
1218
|
-
help=("Do not calculate a refined delay map using
|
|
1209
|
+
help=("Do not calculate a refined delay map using sLFO regression information."),
|
|
1219
1210
|
default=True,
|
|
1220
1211
|
)
|
|
1221
|
-
|
|
1222
|
-
"--refinedelay",
|
|
1223
|
-
dest="dummy",
|
|
1224
|
-
action="store_true",
|
|
1225
|
-
help=(
|
|
1226
|
-
"Calculate a refined delay map using GLM information. ***DEPRECATED*** - this is now on by default."
|
|
1227
|
-
),
|
|
1228
|
-
default=True,
|
|
1229
|
-
)
|
|
1230
|
-
glm.add_argument(
|
|
1212
|
+
slfofilt.add_argument(
|
|
1231
1213
|
"--nofilterwithrefineddelay",
|
|
1232
1214
|
dest="filterwithrefineddelay",
|
|
1233
1215
|
action="store_false",
|
|
1234
|
-
help=("Do not use the refined delay in
|
|
1216
|
+
help=("Do not use the refined delay in sLFO filter."),
|
|
1235
1217
|
default=True,
|
|
1236
1218
|
)
|
|
1237
|
-
|
|
1219
|
+
slfofilt.add_argument(
|
|
1238
1220
|
"--delaypatchthresh",
|
|
1239
1221
|
dest="delaypatchthresh",
|
|
1240
1222
|
action="store",
|
|
@@ -1246,7 +1228,7 @@ def _get_parser():
|
|
|
1246
1228
|
),
|
|
1247
1229
|
default=DEFAULT_PATCHTHRESH,
|
|
1248
1230
|
)
|
|
1249
|
-
|
|
1231
|
+
slfofilt.add_argument(
|
|
1250
1232
|
"--delayoffsetspatialfilt",
|
|
1251
1233
|
dest="delayoffsetgausssigma",
|
|
1252
1234
|
action="store",
|
|
@@ -1271,7 +1253,7 @@ def _get_parser():
|
|
|
1271
1253
|
choices=["min", "less", "normal", "more", "max"],
|
|
1272
1254
|
help=(
|
|
1273
1255
|
"The level of file output produced. 'min' produces only absolutely essential files, 'less' adds in "
|
|
1274
|
-
"the
|
|
1256
|
+
"the sLFO filtered data (rather than just filter efficacy metrics), 'normal' saves what you "
|
|
1275
1257
|
"would typically want around for interactive data exploration, "
|
|
1276
1258
|
"'more' adds files that are sometimes useful, and 'max' outputs anything you might possibly want. "
|
|
1277
1259
|
"Selecting 'max' will produce ~3x your input datafile size as output. "
|
|
@@ -1279,16 +1261,6 @@ def _get_parser():
|
|
|
1279
1261
|
),
|
|
1280
1262
|
default=DEFAULT_OUTPUTLEVEL,
|
|
1281
1263
|
)
|
|
1282
|
-
output.add_argument(
|
|
1283
|
-
"--nolimitoutput",
|
|
1284
|
-
dest="limitoutput",
|
|
1285
|
-
action="store_false",
|
|
1286
|
-
help=(
|
|
1287
|
-
"Save some of the large and rarely used files. "
|
|
1288
|
-
"NB: THIS IS NOW DEPRECATED: Use '--outputlevel max' instead."
|
|
1289
|
-
),
|
|
1290
|
-
default=True,
|
|
1291
|
-
)
|
|
1292
1264
|
output.add_argument(
|
|
1293
1265
|
"--savelags",
|
|
1294
1266
|
dest="savecorrtimes",
|
|
@@ -1467,16 +1439,16 @@ def _get_parser():
|
|
|
1467
1439
|
"Experimental options (not fully tested, or not tested at all, may not work). Beware!"
|
|
1468
1440
|
)
|
|
1469
1441
|
experimental.add_argument(
|
|
1470
|
-
"--
|
|
1471
|
-
dest="
|
|
1442
|
+
"--refineregressderivs",
|
|
1443
|
+
dest="refineregressderivs",
|
|
1472
1444
|
action="store",
|
|
1473
1445
|
type=lambda x: pf.is_int(parser, x, minval=1),
|
|
1474
1446
|
metavar="NDERIVS",
|
|
1475
1447
|
help=(
|
|
1476
|
-
f"When doing
|
|
1477
|
-
f"Default is {
|
|
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}"
|
|
1478
1450
|
),
|
|
1479
|
-
default=
|
|
1451
|
+
default=DEFAULT_REFINEREGRESSDERIVS,
|
|
1480
1452
|
)
|
|
1481
1453
|
experimental.add_argument(
|
|
1482
1454
|
"--dofinalrefine",
|
|
@@ -1670,6 +1642,51 @@ def _get_parser():
|
|
|
1670
1642
|
default=False,
|
|
1671
1643
|
)
|
|
1672
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
|
+
|
|
1673
1690
|
# Debugging options
|
|
1674
1691
|
debugging = parser.add_argument_group(
|
|
1675
1692
|
"Debugging options. You probably don't want to use any of these unless I ask you to to help diagnose a problem"
|
|
@@ -1759,10 +1776,10 @@ def _get_parser():
|
|
|
1759
1776
|
default=False,
|
|
1760
1777
|
)
|
|
1761
1778
|
debugging.add_argument(
|
|
1762
|
-
"--
|
|
1763
|
-
dest="
|
|
1779
|
+
"--singleproc_regressionfilt",
|
|
1780
|
+
dest="singleproc_regressionfilt",
|
|
1764
1781
|
action="store_true",
|
|
1765
|
-
help=("Force single proc path for
|
|
1782
|
+
help=("Force single proc path for regression filtering."),
|
|
1766
1783
|
default=False,
|
|
1767
1784
|
)
|
|
1768
1785
|
debugging.add_argument(
|
|
@@ -2134,7 +2151,7 @@ def process_args(inputargs=None):
|
|
|
2134
2151
|
args["refineoffset"] = True
|
|
2135
2152
|
args["refinedelay"] = True
|
|
2136
2153
|
args["outputlevel"] = "normal"
|
|
2137
|
-
pf.setifnotset(args, "
|
|
2154
|
+
pf.setifnotset(args, "dolinfitfilt", True)
|
|
2138
2155
|
|
|
2139
2156
|
if args["denoising"]:
|
|
2140
2157
|
LGR.warning('Using "denoising" analysis mode. Overriding any affected arguments.')
|
|
@@ -2147,7 +2164,7 @@ def process_args(inputargs=None):
|
|
|
2147
2164
|
args["refineoffset"] = True
|
|
2148
2165
|
args["refinedelay"] = True
|
|
2149
2166
|
args["zerooutbadfit"] = False
|
|
2150
|
-
pf.setifnotset(args, "
|
|
2167
|
+
pf.setifnotset(args, "dolinfitfilt", True)
|
|
2151
2168
|
|
|
2152
2169
|
if args["docvrmap"]:
|
|
2153
2170
|
LGR.warning('Using "CVR" analysis mode. Overriding any affected arguments.')
|
|
@@ -2166,7 +2183,7 @@ def process_args(inputargs=None):
|
|
|
2166
2183
|
args["preservefiltering"] = True
|
|
2167
2184
|
args["passes"] = 1
|
|
2168
2185
|
args["outputlevel"] = "min"
|
|
2169
|
-
args["
|
|
2186
|
+
args["dolinfitfilt"] = False
|
|
2170
2187
|
|
|
2171
2188
|
if args["globalpreselect"]:
|
|
2172
2189
|
LGR.warning('Using "globalpreselect" analysis mode. Overriding any affected arguments.')
|
|
@@ -2174,7 +2191,7 @@ def process_args(inputargs=None):
|
|
|
2174
2191
|
args["despeckle_passes"] = 0
|
|
2175
2192
|
args["refinedespeckle"] = False
|
|
2176
2193
|
args["outputlevel"] = "normal"
|
|
2177
|
-
pf.setifnotset(args, "
|
|
2194
|
+
pf.setifnotset(args, "dolinfitfilt", False)
|
|
2178
2195
|
args["saveintermediatemaps"] = False
|
|
2179
2196
|
|
|
2180
2197
|
# configure the filter
|
|
@@ -2211,50 +2228,50 @@ def process_args(inputargs=None):
|
|
|
2211
2228
|
args["savecorrtimes"] = False
|
|
2212
2229
|
args["savelagregressors"] = False
|
|
2213
2230
|
args["savedespecklemasks"] = False
|
|
2214
|
-
args["
|
|
2215
|
-
args["
|
|
2231
|
+
args["saveminimumsLFOfiltfiles"] = False
|
|
2232
|
+
args["savenormalsLFOfiltfiles"] = False
|
|
2216
2233
|
args["savemovingsignal"] = False
|
|
2217
|
-
args["
|
|
2234
|
+
args["saveallsLFOfiltfiles"] = False
|
|
2218
2235
|
elif args["outputlevel"] == "less":
|
|
2219
2236
|
args["saveconfoundfiltered"] = False
|
|
2220
2237
|
args["savegaussout"] = False
|
|
2221
2238
|
args["savecorrtimes"] = False
|
|
2222
2239
|
args["savelagregressors"] = False
|
|
2223
2240
|
args["savedespecklemasks"] = False
|
|
2224
|
-
args["
|
|
2225
|
-
args["
|
|
2241
|
+
args["saveminimumsLFOfiltfiles"] = True
|
|
2242
|
+
args["savenormalsLFOfiltfiles"] = False
|
|
2226
2243
|
args["savemovingsignal"] = False
|
|
2227
|
-
args["
|
|
2244
|
+
args["saveallsLFOfiltfiles"] = False
|
|
2228
2245
|
elif args["outputlevel"] == "normal":
|
|
2229
2246
|
args["saveconfoundfiltered"] = False
|
|
2230
2247
|
args["savegaussout"] = False
|
|
2231
2248
|
args["savecorrtimes"] = False
|
|
2232
2249
|
args["savelagregressors"] = False
|
|
2233
2250
|
args["savedespecklemasks"] = False
|
|
2234
|
-
args["
|
|
2235
|
-
args["
|
|
2251
|
+
args["saveminimumsLFOfiltfiles"] = True
|
|
2252
|
+
args["savenormalsLFOfiltfiles"] = True
|
|
2236
2253
|
args["savemovingsignal"] = False
|
|
2237
|
-
args["
|
|
2254
|
+
args["saveallsLFOfiltfiles"] = False
|
|
2238
2255
|
elif args["outputlevel"] == "more":
|
|
2239
2256
|
args["saveconfoundfiltered"] = False
|
|
2240
2257
|
args["savegaussout"] = False
|
|
2241
2258
|
args["savecorrtimes"] = False
|
|
2242
2259
|
args["savelagregressors"] = True
|
|
2243
2260
|
args["savedespecklemasks"] = False
|
|
2244
|
-
args["
|
|
2245
|
-
args["
|
|
2261
|
+
args["saveminimumsLFOfiltfiles"] = True
|
|
2262
|
+
args["savenormalsLFOfiltfiles"] = True
|
|
2246
2263
|
args["savemovingsignal"] = True
|
|
2247
|
-
args["
|
|
2264
|
+
args["saveallsLFOfiltfiles"] = False
|
|
2248
2265
|
elif args["outputlevel"] == "max":
|
|
2249
2266
|
args["saveconfoundfiltered"] = True
|
|
2250
2267
|
args["savegaussout"] = True
|
|
2251
2268
|
args["savecorrtimes"] = True
|
|
2252
2269
|
args["savelagregressors"] = True
|
|
2253
2270
|
args["savedespecklemasks"] = True
|
|
2254
|
-
args["
|
|
2255
|
-
args["
|
|
2271
|
+
args["saveminimumsLFOfiltfiles"] = True
|
|
2272
|
+
args["savenormalsLFOfiltfiles"] = True
|
|
2256
2273
|
args["savemovingsignal"] = True
|
|
2257
|
-
args["
|
|
2274
|
+
args["saveallsLFOfiltfiles"] = True
|
|
2258
2275
|
else:
|
|
2259
2276
|
print(f"illegal output level {args['outputlevel']}")
|
|
2260
2277
|
sys.exit()
|
|
@@ -2286,8 +2303,8 @@ def process_args(inputargs=None):
|
|
|
2286
2303
|
args["territorymapname"] = None
|
|
2287
2304
|
args["territorymapincludevals"] = None
|
|
2288
2305
|
|
|
2289
|
-
# this is new enough to do retrospective
|
|
2290
|
-
args["
|
|
2306
|
+
# this is new enough to do retrospective regression filtering
|
|
2307
|
+
args["retroregresscompatible"] = True
|
|
2291
2308
|
|
|
2292
2309
|
LGR.debug("\nafter postprocessing\n{}".format(args))
|
|
2293
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
|
|
@@ -24,8 +24,8 @@ import sys
|
|
|
24
24
|
|
|
25
25
|
import numpy as np
|
|
26
26
|
|
|
27
|
-
import rapidtide.glmpass as tide_glmpass
|
|
28
27
|
import rapidtide.io as tide_io
|
|
28
|
+
import rapidtide.linfitfiltpass as tide_linfitfiltpass
|
|
29
29
|
import rapidtide.makelaggedtcs as tide_makelagged
|
|
30
30
|
import rapidtide.multiproc as tide_multiproc
|
|
31
31
|
import rapidtide.resample as tide_resample
|
|
@@ -36,7 +36,7 @@ LGR = logging.getLogger("GENERAL")
|
|
|
36
36
|
ErrorLGR = logging.getLogger("ERROR")
|
|
37
37
|
TimingLGR = logging.getLogger("TIMING")
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
DEFAULT_REGRESSIONFILTDERIVS = 0
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
def _get_parser():
|
|
@@ -76,15 +76,15 @@ def _get_parser():
|
|
|
76
76
|
help="Output root.",
|
|
77
77
|
)
|
|
78
78
|
parser.add_argument(
|
|
79
|
-
"--
|
|
80
|
-
dest="
|
|
79
|
+
"--regressderivs",
|
|
80
|
+
dest="regressderivs",
|
|
81
81
|
action="store",
|
|
82
82
|
type=int,
|
|
83
83
|
metavar="NDERIVS",
|
|
84
84
|
help=(
|
|
85
|
-
f"When doing final GLM, include derivatives up to NDERIVS order. Default is {
|
|
85
|
+
f"When doing final GLM, include derivatives up to NDERIVS order. Default is {DEFAULT_REGRESSIONFILTDERIVS}"
|
|
86
86
|
),
|
|
87
|
-
default=
|
|
87
|
+
default=DEFAULT_REGRESSIONFILTDERIVS,
|
|
88
88
|
)
|
|
89
89
|
parser.add_argument(
|
|
90
90
|
"--nprocs",
|
|
@@ -209,7 +209,7 @@ def retrolagtcs(args):
|
|
|
209
209
|
internalvalidspaceshape = numvalidspatiallocs
|
|
210
210
|
internalvalidspaceshapederivs = (
|
|
211
211
|
internalvalidspaceshape,
|
|
212
|
-
args.
|
|
212
|
+
args.regressderivs + 1,
|
|
213
213
|
)
|
|
214
214
|
internalvalidfmrishape = (numvalidspatiallocs, np.shape(initial_fmri_x)[0])
|
|
215
215
|
if args.debug:
|
|
@@ -250,7 +250,7 @@ def retrolagtcs(args):
|
|
|
250
250
|
"CommandLineArgs": thecommandline,
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
print("calling
|
|
253
|
+
print("calling makelaggedtcs")
|
|
254
254
|
voxelsprocessed_makelagged = tide_makelagged.makelaggedtcs(
|
|
255
255
|
genlagtc,
|
|
256
256
|
initial_fmri_x,
|
|
@@ -293,10 +293,10 @@ def retrolagtcs(args):
|
|
|
293
293
|
theheader = copy.deepcopy(fmri_header)
|
|
294
294
|
maplist = []
|
|
295
295
|
|
|
296
|
-
if args.
|
|
296
|
+
if args.regressderivs > 0:
|
|
297
297
|
if args.debug:
|
|
298
|
-
print(f"adding derivatives up to order {args.
|
|
299
|
-
regressorset =
|
|
298
|
+
print(f"adding derivatives up to order {args.regressderivs} prior to regression")
|
|
299
|
+
regressorset = tide_linfitfiltpass.makevoxelspecificderivs(lagtc, args.regressderivs)
|
|
300
300
|
|
|
301
301
|
if args.debug:
|
|
302
302
|
print("going down the multiple EV path")
|
|
@@ -310,7 +310,7 @@ def retrolagtcs(args):
|
|
|
310
310
|
"Shifted sLFO regressor to filter",
|
|
311
311
|
),
|
|
312
312
|
]
|
|
313
|
-
for thederiv in range(1, args.
|
|
313
|
+
for thederiv in range(1, args.regressderivs + 1):
|
|
314
314
|
if args.debug:
|
|
315
315
|
print(f"{regressorset[:, :, thederiv].shape=}")
|
|
316
316
|
maplist += [
|