From bda6d81710755ea4d5c9f7e3dc37f49e306c2889 Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Fri, 24 Nov 2023 17:35:38 +0100 Subject: [PATCH] add scenario1 as yaml. --- src/conf/reconstructors/zero_filled.yaml | 2 +- src/conf/{experiments => }/scenario1.yaml | 13 ++++++++----- src/simfmri/analysis/stats.py | 4 ++-- src/simfmri/cli/main.py | 1 + 4 files changed, 12 insertions(+), 8 deletions(-) rename src/conf/{experiments => }/scenario1.yaml (85%) diff --git a/src/conf/reconstructors/zero_filled.yaml b/src/conf/reconstructors/zero_filled.yaml index b273c9a..5fa4367 100644 --- a/src/conf/reconstructors/zero_filled.yaml +++ b/src/conf/reconstructors/zero_filled.yaml @@ -1 +1 @@ -- adjoint: {} +adjoint: {} diff --git a/src/conf/experiments/scenario1.yaml b/src/conf/scenario1.yaml similarity index 85% rename from src/conf/experiments/scenario1.yaml rename to src/conf/scenario1.yaml index e938dbb..c03019a 100644 --- a/src/conf/experiments/scenario1.yaml +++ b/src/conf/scenario1.yaml @@ -1,7 +1,7 @@ -# @package _global -# # This files contains the configuration to reproduce the scenario 1 of the Simfmri paper. +force_sim: false + simulation: sim_params: sim_tr: 0.1 @@ -14,7 +14,7 @@ simulation: handlers: phantom-brainweb: subject_id: 5 - bbox: [0.225,-0.07, 0.06, -0.055, None, None] + bbox: [0.225,-0.07, 0.06, -0.055, null, null] activation-block: event_name: block_on block_on: 20 @@ -25,15 +25,18 @@ simulation: snr: 100 acquisition-vds: shot_time_ms: 50 - acs: 0.125 + acs: 1 accel: 1 - accel_axis: 1 + accel_axis: 0 constant: true direction: top-down + smaps: false reconstructors: adjoint: {} +stats: + contrast_name: block_on hydra: diff --git a/src/simfmri/analysis/stats.py b/src/simfmri/analysis/stats.py index e2f300b..3d6dd00 100644 --- a/src/simfmri/analysis/stats.py +++ b/src/simfmri/analysis/stats.py @@ -56,8 +56,8 @@ def contrast_zscore( drift_model=sim.extra_infos.get("drift_model", None), ) # Create a mask from reference data (not ideal, but best) - mask = sim.data_ref[0] > 0 - image_ = abs(image)[:, mask] + mask = sim.static_vol > 0 + image_ = abs(image)[..., mask].squeeze() logger.debug(f"image_={image_.shape}, design matrix={design_matrix.shape}") labels, results = run_glm(image_, design_matrix.values) # Translate formulas to vectors diff --git a/src/simfmri/cli/main.py b/src/simfmri/cli/main.py index f0d38d4..ffbe416 100644 --- a/src/simfmri/cli/main.py +++ b/src/simfmri/cli/main.py @@ -41,6 +41,7 @@ def main_app(cfg: DictConfig) -> None: simulator, sim = HandlerChain.from_conf(cfg.simulation) sim = simulator(sim) del simulator + os.makedirs(cache_dir, exist_ok=True) with open(sim_file, "wb") as f: pickle.dump(sim, f)