nltools 0.6.0.dev2__tar.gz → 0.6.0.dev3__tar.gz
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.
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/PKG-INFO +1 -1
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/alignment/procrustes.py +5 -3
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/signal.py +13 -9
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/designmatrix/regressors.py +4 -1
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/simulator/haxby.py +29 -4
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_procrustes.py +13 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_signal.py +9 -1
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/datasets/test_datasets.py +13 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/pyproject.toml +1 -1
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/.gitignore +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/LICENSE +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/README.md +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/alignment/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/alignment/srm.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/backends.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/corrections.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/decoding.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/inference/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/inference/bootstrap.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/inference/correlation.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/inference/intersubject.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/inference/isc.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/inference/matrix.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/inference/one_sample.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/inference/random.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/inference/timeseries.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/inference/two_sample.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/inference/utils.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/inference/validation.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/neighborhoods.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/outliers.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/regression.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/similarity.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/algorithms/validation.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/cross_validation.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/adjacency/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/adjacency/io.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/adjacency/modeling.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/adjacency/plotting.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/adjacency/state.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/adjacency/stats.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/adjacency/utils.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/atlases/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/atlases/labeling.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/atlases/loading.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/atlases/registry.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/atlases/reporting.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/braindata/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/braindata/analysis.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/braindata/bootstrap.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/braindata/io.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/braindata/modeling.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/braindata/plotting.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/braindata/prediction.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/braindata/utils.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/braindata/validation.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/braindata/viewer.js +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/braindata/viewer.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/combine.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/designmatrix/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/designmatrix/append.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/designmatrix/diagnostics.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/designmatrix/io.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/designmatrix/plotting.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/designmatrix/transforms.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/designmatrix/utils.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/ownership.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/results.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/results_io.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/roc/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/simulator/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/data/validation.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/datasets.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/io/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/io/events.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/io/h5.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/mask.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/models/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/models/glm.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/models/results.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/models/ridge.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/models/validation.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/plotting/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/plotting/adjacency.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/plotting/brain.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/plotting/decomposition.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/plotting/prediction.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/resources/covariates_example.csv +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/resources/onsets_example.csv +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/templates/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/templates/config.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/templates/fetch.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/templates/matching.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/templates/paths.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/templates/registry.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/conftest.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/conftest.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_corrections.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_decoding.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_intersubject.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_neighborhoods.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_outliers.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_regression.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_similarity.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_backends.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_bootstrap.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_cross_validation.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_gpu_policy.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_hyperalignment.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_api_conventions.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_correlation.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_cpu_parallelization.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_isc_group.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_isc_vocabulary.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_matrix.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_one_sample.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_progress_bar.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_tail_vocabulary.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_timeseries.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_two_sample.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_utils.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_isc.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_mask.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_srm.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_utils.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/datasets/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/io_tests/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/io_tests/test_file_reader.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/io_tests/test_h5.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/models/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/models/conftest.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/models/test_glm.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/models/test_glm_warnings.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/models/test_results.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/models/test_ridge.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/plotting/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/plotting/test_adjacency.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/plotting/test_f123_prediction.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/plotting/test_surface.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/pyodide/.gitignore +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/pyodide/test_runner.mjs +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/support/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/support/test_designation.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/support/test_scripts.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/templates/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/templates/test_brainspace.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/templates/test_fetch_pyodide.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/utils/__init__.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/utils/test_utils.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/utils.py +0 -0
- {nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: nltools
|
|
3
|
-
Version: 0.6.0.
|
|
3
|
+
Version: 0.6.0.dev3
|
|
4
4
|
Summary: A Python package to analyze neuroimaging data
|
|
5
5
|
Project-URL: Homepage, https://nltools.org
|
|
6
6
|
Author-email: "Luke J. Chang" <luke.j.chang@dartmouth.edu>, Eshin Jolly <eshin.jolly@gmail.com>
|
|
@@ -151,8 +151,10 @@ def align(
|
|
|
151
151
|
method (str): One of `'probabilistic_srm'`, `'deterministic_srm'`, or
|
|
152
152
|
`'procrustes'`. Defaults to `'deterministic_srm'`.
|
|
153
153
|
n_features (int | None): Number of features in the common space (SRM only).
|
|
154
|
-
None uses the
|
|
155
|
-
|
|
154
|
+
None uses the smallest subject's size along the aligned axis (voxels
|
|
155
|
+
for `axis=0`), the largest value every subject can support; an
|
|
156
|
+
explicit value may not exceed that size for any subject. Must be None
|
|
157
|
+
for `'procrustes'`.
|
|
156
158
|
axis (int): Axis to align on: 0 aligns timepoints (ISC computed per voxel),
|
|
157
159
|
1 aligns voxels (ISC computed per timepoint). Defaults to 0.
|
|
158
160
|
n_iter (int): Number of `_SRM`/`_DetSRM` iterations; ignored by
|
|
@@ -235,7 +237,7 @@ def align(
|
|
|
235
237
|
out = {}
|
|
236
238
|
if method in ["deterministic_srm", "probabilistic_srm"]:
|
|
237
239
|
if n_features is None:
|
|
238
|
-
n_features = int(
|
|
240
|
+
n_features = int(min(x.shape[0] for x in data))
|
|
239
241
|
if method == "deterministic_srm":
|
|
240
242
|
srm = _DetSRM(
|
|
241
243
|
n_features=n_features, n_iter=n_iter, random_state=random_state
|
|
@@ -214,7 +214,9 @@ def upsample(
|
|
|
214
214
|
return upsampled_df
|
|
215
215
|
|
|
216
216
|
|
|
217
|
-
def make_cosine_basis(
|
|
217
|
+
def make_cosine_basis(
|
|
218
|
+
nsamples, sampling_interval, filter_length, unit_scale=True, drop=0
|
|
219
|
+
):
|
|
218
220
|
"""Create basis functions for a discrete cosine transform.
|
|
219
221
|
|
|
220
222
|
Based on the implementation in ``spm_filter`` and ``spm_dctmtx`` because
|
|
@@ -224,11 +226,12 @@ def make_cosine_basis(nsamples, sampling_freq, filter_length, unit_scale=True, d
|
|
|
224
226
|
|
|
225
227
|
Args:
|
|
226
228
|
nsamples (int): Number of observations (e.g. TRs).
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
the constant. `DesignMatrix
|
|
231
|
-
`
|
|
229
|
+
sampling_interval (float): Seconds between observations (the TR), SPM's
|
|
230
|
+
`RT`. The number of bases is
|
|
231
|
+
`trunc(2 * nsamples * sampling_interval / filter_length + 1)`, minus
|
|
232
|
+
the constant. `DesignMatrix` stores a sampling frequency, so
|
|
233
|
+
`DesignMatrix.add_dct_basis` inverts it and passes
|
|
234
|
+
`1 / DesignMatrix.sampling_freq`.
|
|
232
235
|
filter_length (int): Filter length in seconds.
|
|
233
236
|
unit_scale (bool): Scale the basis functions to the range [-1, 1]. Defaults to True.
|
|
234
237
|
drop (int): Number of leading (slowest) bases to drop after the constant is
|
|
@@ -239,12 +242,13 @@ def make_cosine_basis(nsamples, sampling_freq, filter_length, unit_scale=True, d
|
|
|
239
242
|
np.ndarray: Basis matrix of shape (nsamples, n_bases).
|
|
240
243
|
|
|
241
244
|
Note:
|
|
242
|
-
The basis count follows `spm_dctmtx`'s `k = fix(2*(n*RT)/HParam + 1)
|
|
243
|
-
100 TRs of 2 s
|
|
245
|
+
The basis count follows `spm_dctmtx`'s `k = fix(2*(n*RT)/HParam + 1)` less
|
|
246
|
+
the constant that `spm_filter` drops, so 100 TRs of 2 s under a 128 s
|
|
247
|
+
filter give three bases, the same three SPM uses.
|
|
244
248
|
"""
|
|
245
249
|
|
|
246
250
|
# Figure out number of basis functions to create
|
|
247
|
-
order = int(np.trunc(2 * (nsamples *
|
|
251
|
+
order = int(np.trunc(2 * (nsamples * sampling_interval) / filter_length + 1))
|
|
248
252
|
|
|
249
253
|
n = np.arange(nsamples)
|
|
250
254
|
|
|
@@ -427,7 +427,10 @@ def _add_dct_basis(
|
|
|
427
427
|
|
|
428
428
|
# Create DCT basis matrix using stats function
|
|
429
429
|
basis_mat = make_cosine_basis(
|
|
430
|
-
dm.shape[0],
|
|
430
|
+
dm.shape[0],
|
|
431
|
+
sampling_interval=1.0 / dm.sampling_freq,
|
|
432
|
+
filter_length=duration,
|
|
433
|
+
drop=drop,
|
|
431
434
|
)
|
|
432
435
|
|
|
433
436
|
# Generate column names (.nl_cosine_1, .nl_cosine_2, ...)
|
|
@@ -186,7 +186,9 @@ def _simulate_run(dm, rois, n_voxels, rng):
|
|
|
186
186
|
return data
|
|
187
187
|
|
|
188
188
|
|
|
189
|
-
def load_haxby_example(
|
|
189
|
+
def load_haxby_example(
|
|
190
|
+
n_runs=1, *, space="mni", block_order="independent", random_state=42
|
|
191
|
+
):
|
|
190
192
|
"""Load a synthetic Haxby-like dataset on the MNI grid, entirely in-memory.
|
|
191
193
|
|
|
192
194
|
The quickest way to try nltools: nothing is downloaded beyond the MNI
|
|
@@ -204,7 +206,10 @@ def load_haxby_example(n_runs=1, *, space="mni", random_state=42):
|
|
|
204
206
|
fusiform cortex, and scrambled pictures in early visual cortex — with a 3%
|
|
205
207
|
peak response against 1% white noise. A condition also drives its
|
|
206
208
|
category-mates' spheres at a third of that, so the eight response patterns
|
|
207
|
-
carry an animate / man-made / scene / control similarity structure.
|
|
209
|
+
carry an animate / man-made / scene / control similarity structure. Each run
|
|
210
|
+
draws its own block order by default; pass `block_order='shared'` when the
|
|
211
|
+
runs have to line up TR by TR, as they do for intersubject correlation,
|
|
212
|
+
alignment and anything else that compares runs timepoint against timepoint.
|
|
208
213
|
|
|
209
214
|
Args:
|
|
210
215
|
n_runs (int): Number of runs to generate. Default 1.
|
|
@@ -213,6 +218,10 @@ def load_haxby_example(n_runs=1, *, space="mni", random_state=42):
|
|
|
213
218
|
`extract_roi` work on the result. `'grid'` is a 10 x 10 x 5
|
|
214
219
|
synthetic volume with random condition clusters, for tests that need
|
|
215
220
|
construction in milliseconds and never plot.
|
|
221
|
+
block_order (str): How the condition order varies across runs.
|
|
222
|
+
`'independent'` (default) draws a fresh order per run; `'shared'`
|
|
223
|
+
draws one order and gives it to every run, so the runs are
|
|
224
|
+
comparable TR by TR. Noise differs per run either way.
|
|
216
225
|
random_state (int | None): Seed for reproducible output. Default 42.
|
|
217
226
|
|
|
218
227
|
Returns:
|
|
@@ -223,7 +232,8 @@ def load_haxby_example(n_runs=1, *, space="mni", random_state=42):
|
|
|
223
232
|
`_c0` (HRF-convolved boxcars).
|
|
224
233
|
|
|
225
234
|
Raises:
|
|
226
|
-
ValueError: If `space` is not `'mni'` or `'grid'
|
|
235
|
+
ValueError: If `space` is not `'mni'` or `'grid'`, or `block_order` is not
|
|
236
|
+
`'independent'` or `'shared'`.
|
|
227
237
|
|
|
228
238
|
Examples:
|
|
229
239
|
```python
|
|
@@ -258,16 +268,31 @@ def load_haxby_example(n_runs=1, *, space="mni", random_state=42):
|
|
|
258
268
|
|
|
259
269
|
if space not in ("mni", "grid"):
|
|
260
270
|
raise ValueError(f"space must be 'mni' or 'grid', got {space!r}")
|
|
271
|
+
if block_order not in ("independent", "shared"):
|
|
272
|
+
raise ValueError(
|
|
273
|
+
f"block_order must be 'independent' or 'shared', got {block_order!r}"
|
|
274
|
+
)
|
|
261
275
|
|
|
262
276
|
rng = np.random.default_rng(random_state)
|
|
263
277
|
mask_img = _mask_image(space)
|
|
264
278
|
n_voxels = int((np.asarray(mask_img.dataobj) > 0).sum())
|
|
265
279
|
rois = _condition_rois(space, mask_img, rng)
|
|
266
280
|
|
|
281
|
+
# Drawn once so every run gets the same sequence; 'independent' draws inside
|
|
282
|
+
# the loop instead, leaving the default run's RNG stream untouched.
|
|
283
|
+
shared_order = (
|
|
284
|
+
list(rng.permutation(_HAXBY_CONDITIONS)) if block_order == "shared" else None
|
|
285
|
+
)
|
|
286
|
+
|
|
267
287
|
brain_data_list = []
|
|
268
288
|
design_matrix_list = []
|
|
269
289
|
for run in range(n_runs):
|
|
270
|
-
|
|
290
|
+
order = (
|
|
291
|
+
shared_order
|
|
292
|
+
if shared_order is not None
|
|
293
|
+
else list(rng.permutation(_HAXBY_CONDITIONS))
|
|
294
|
+
)
|
|
295
|
+
dm, labels = _run_design(order)
|
|
271
296
|
data = _simulate_run(dm, rois, n_voxels, rng)
|
|
272
297
|
labels_and_run = pl.DataFrame(
|
|
273
298
|
{
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_procrustes.py
RENAMED
|
@@ -64,6 +64,19 @@ class TestAlign:
|
|
|
64
64
|
with pytest.raises(TypeError):
|
|
65
65
|
align(data, method="deterministic_srm", bogus_kwarg=1)
|
|
66
66
|
|
|
67
|
+
def test_default_n_features_is_the_smallest_subjects_voxel_count(self):
|
|
68
|
+
"""Ragged subjects resolve `n_features=None` to the smallest voxel count.
|
|
69
|
+
|
|
70
|
+
The default read subject 0's voxel count, so a group whose first subject
|
|
71
|
+
was not the narrowest asked for more features than another subject had.
|
|
72
|
+
"""
|
|
73
|
+
rng = np.random.default_rng(0)
|
|
74
|
+
data = [rng.standard_normal((20, n_voxels)) for n_voxels in (6, 4, 5)]
|
|
75
|
+
|
|
76
|
+
out = align(data, method="deterministic_srm", n_features=None)
|
|
77
|
+
|
|
78
|
+
assert out["common_model"].shape[1] == 4
|
|
79
|
+
|
|
67
80
|
def test_isc_is_reported_for_a_single_aligned_unit(self):
|
|
68
81
|
"""One aligned unit is still a unit, not a scalar.
|
|
69
82
|
|
|
@@ -92,11 +92,19 @@ class TestMakeCosineBasis:
|
|
|
92
92
|
"""Cosine basis should return correct shape."""
|
|
93
93
|
n_timepoints = 100
|
|
94
94
|
basis = make_cosine_basis(
|
|
95
|
-
n_timepoints,
|
|
95
|
+
n_timepoints, sampling_interval=1, filter_length=128, drop=0
|
|
96
96
|
)
|
|
97
97
|
assert basis.shape[0] == n_timepoints
|
|
98
98
|
assert basis.shape[1] >= 1
|
|
99
99
|
|
|
100
|
+
def test_second_argument_is_the_sampling_interval(self):
|
|
101
|
+
"""100 TRs of 2 s under a 128 s filter give SPM's four bases less the constant."""
|
|
102
|
+
basis = make_cosine_basis(100, sampling_interval=2, filter_length=128)
|
|
103
|
+
assert basis.shape == (100, 3)
|
|
104
|
+
|
|
105
|
+
with pytest.raises(TypeError, match="sampling_freq"):
|
|
106
|
+
make_cosine_basis(100, sampling_freq=2, filter_length=128)
|
|
107
|
+
|
|
100
108
|
def test_drop_removes_leading_columns(self):
|
|
101
109
|
"""drop=k removes the k lowest-frequency bases, keeping the remainder."""
|
|
102
110
|
full = make_cosine_basis(128, 1, 32, drop=0)
|
|
@@ -175,6 +175,19 @@ class TestLoadHaxbyExample:
|
|
|
175
175
|
# `.convolve()` always suffixes `_c0`
|
|
176
176
|
assert f"{cond}_c0" in cols, f"missing condition {cond}_c0"
|
|
177
177
|
|
|
178
|
+
def test_shared_block_order_repeats_one_order_across_runs(self):
|
|
179
|
+
"""`block_order='shared'` gives every run the same condition sequence."""
|
|
180
|
+
from nltools.datasets import load_haxby_example
|
|
181
|
+
|
|
182
|
+
shared, _ = load_haxby_example(n_runs=2, space="grid", block_order="shared")
|
|
183
|
+
assert shared[0].Y["condition"].to_list() == shared[1].Y["condition"].to_list()
|
|
184
|
+
|
|
185
|
+
independent, _ = load_haxby_example(n_runs=2, space="grid")
|
|
186
|
+
assert (
|
|
187
|
+
independent[0].Y["condition"].to_list()
|
|
188
|
+
!= independent[1].Y["condition"].to_list()
|
|
189
|
+
)
|
|
190
|
+
|
|
178
191
|
def test_reproducible_with_seed(self):
|
|
179
192
|
import numpy as np
|
|
180
193
|
from nltools.datasets import load_haxby_example
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_corrections.py
RENAMED
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_decoding.py
RENAMED
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_intersubject.py
RENAMED
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_neighborhoods.py
RENAMED
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_outliers.py
RENAMED
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_regression.py
RENAMED
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_algorithms/test_similarity.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_api_conventions.py
RENAMED
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_correlation.py
RENAMED
|
File without changes
|
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_isc_group.py
RENAMED
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_isc_vocabulary.py
RENAMED
|
File without changes
|
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_one_sample.py
RENAMED
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_progress_bar.py
RENAMED
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_tail_vocabulary.py
RENAMED
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_timeseries.py
RENAMED
|
File without changes
|
{nltools-0.6.0.dev2 → nltools-0.6.0.dev3}/nltools/tests/core/test_inference/test_two_sample.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|