Skip to content

Commit

Permalink
Incorporating more comments
Browse files Browse the repository at this point in the history
* Fixing the problem of argument parser for n_robust_runs.

* Removing unnecessary tests from the test_integration. There are 3
  tests for echo as before, but the ica_method is robustica for five and
three echos and fatsica for the four echo test.
  • Loading branch information
BahmanTahayori committed Mar 4, 2024
1 parent b7d08e9 commit a113423
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 52 deletions.
50 changes: 1 addition & 49 deletions tedana/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def test_integration_five_echo(skip_integration):
data=datalist,
tes=echo_times,
ica_method="robustica",
n_robust_runs=10,
n_robust_runs=6,
out_dir=out_dir,
tedpca=0.95,
fittype="curvefit",
Expand Down Expand Up @@ -383,54 +383,6 @@ def test_integration_three_echo(skip_integration):
check_integration_outputs(fn, out_dir)


def test_integration_robustica_three_echo(skip_integration):
"""Integration test of the full tedana workflow with robustica using three-echo test data."""

if skip_integration:
pytest.skip("Skipping three-echo integration test")

test_data_path, osf_id = data_for_testing_info("three-echo")
out_dir = os.path.abspath(os.path.join(test_data_path, "../../outputs/three-echo_robustica"))
out_dir_manual = f"{out_dir}-rerun"

if os.path.exists(out_dir):
shutil.rmtree(out_dir)

if os.path.exists(out_dir_manual):
shutil.rmtree(out_dir_manual)

# download data and run the test
download_test_data(osf_id, test_data_path)
tedana_cli.tedana_workflow(
data=f"{test_data_path}/three_echo_Cornell_zcat.nii.gz",
tes=[14.5, 38.5, 62.5],
ica_method="robustica",
out_dir=out_dir,
low_mem=True,
tedpca="aic",
)

# Test re-running, but use the CLI
args = [
"-d",
f"{test_data_path}/three_echo_Cornell_zcat.nii.gz",
"-e",
"14.5",
"38.5",
"62.5",
"--ica_method",
"robustica",
"--out-dir",
out_dir_manual,
"--debug",
"--verbose",
"-f",
"--mix",
os.path.join(out_dir, "desc-ICA_mixing.tsv"),
]
tedana_cli._main(args)


def test_integration_reclassify_insufficient_args(skip_integration):
if skip_integration:
pytest.skip("Skipping reclassify insufficient args")
Expand Down
9 changes: 6 additions & 3 deletions tedana/workflows/tedana.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
DEFAULT_SEED,
)
from tedana.stats import computefeats2
from tedana.workflows.parser_utils import check_tedpca_value, is_valid_file
from tedana.workflows.parser_utils import (
check_n_robust_runs_value,
check_tedpca_value,
is_valid_file,
)

LGR = logging.getLogger("GENERAL")
RepLGR = logging.getLogger("REPORT")
Expand Down Expand Up @@ -202,13 +206,12 @@ def _get_parser():
optional.add_argument(
"--n_robust_runs",
dest="n_robust_runs",
type=int,
type=check_n_robust_runs_value,
help=(
"The number of times robustica will run. "
"This is only effective when ica_method is "
"set to robustica."
),
choices=range(5, 500),
default=DEFAULT_N_ROBUST_RUNS,
)
optional.add_argument(
Expand Down

0 comments on commit a113423

Please sign in to comment.