From c4b40d23940e39edd8837b42a42f1a3412c724e5 Mon Sep 17 00:00:00 2001 From: Dhananjhay Date: Tue, 1 Apr 2025 15:24:06 -0400 Subject: [PATCH 1/8] fix dry run testing --- .github/workflows/python-testing.yml | 63 ++++++++++++++++++++++++++++ .github/workflows/test.yml | 37 ---------------- pyproject.toml | 8 ---- 3 files changed, 63 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/python-testing.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/python-testing.yml b/.github/workflows/python-testing.yml new file mode 100644 index 0000000..c35ccef --- /dev/null +++ b/.github/workflows/python-testing.yml @@ -0,0 +1,63 @@ +--- +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Lint and test workflow +on: + push: + workflow_dispatch: + +jobs: + quality: + name: Lint code + runs-on: ubuntu-latest + + steps: + - name: Install non-python dependencies + run: | + sudo apt-get install -y graphviz-dev + + - name: Setup Python environment + uses: khanlab/actions/.github/actions/action-setup_task-installPyProject@v0.3.6 + with: + python-version: "3.10" + + - name: yamlfix + run: poetry run poe yamlfix-check + + - name: ruff + run: poetry run poe ruff-lint-check + + - name: snakefmt + run: poetry run poe snakefmt-check + + test: + runs-on: ubuntu-latest + needs: ["quality"] + strategy: + matrix: + python-version: ["3.9", "3.10"] + + steps: + - name: Install non-python dependencies + run: | + sudo apt-get install -y graphviz-dev + + - name: Set up Python ${{ matrix.python-version }} + uses: khanlab/actions/.github/actions/action-setup_task-installPyProject@v0.3.6 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Python environments + uses: khanlab/actions/.github/actions/action-setup_task-installPyProject@v0.3.6 + with: + python-version: ${{ matrix.python-version }} + install-library: true + + - name: Setup env for autoafids + run: | + echo "AUTOAFIDS_CACHE_DIR=`pwd`/test_data/autoafids_cache_dir" >> $GITHUB_ENV + + - name: Test single T1w bids + run: | + poetry run hippunfold tests/data/ test_out participant -np \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 8291578..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- -name: Lint and test workflow -on: - push: - branches: ['*', '!push-action/*'] - pull_request: - branches: ['*', '!push-action/*'] -jobs: - quality: - name: Lint code - if: github.event.pull_request.merged == false - runs-on: ubuntu-latest - steps: - - name: Setup Python environment - uses: khanlab/actions/.github/actions/action-setup_task-installPyProject@v0.3.6 - with: - python-version: '3.10' - - name: yamlfix - run: poetry run poe yamlfix-check - - name: ruff - run: poetry run poe ruff-lint-check - - name: snakefmt - run: poetry run poe snakefmt-check - test: - runs-on: ubuntu-latest - needs: [quality] - strategy: - matrix: - python-version: ['3.9', '3.10'] - steps: - - name: Setup python environments - uses: khanlab/actions/.github/actions/action-setup_task-installPyProject@v0.3.6 - with: - python-version: ${{ matrix.python-version }} - install-library: true - - name: Test minimum input - run: poetry run poe test_base diff --git a/pyproject.toml b/pyproject.toml index 2cc4d8e..1744ae2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,15 +57,7 @@ snakefmt = "snakefmt autoafids" snakefmt-check = "snakefmt --check autoafids" quality = ["yamlfix", "ruff-lint", "snakefmt"] quality-check = ["yamlfix-check", "ruff-lint-check", "snakefmt-check"] -test = [ - "test_base" -] -[tool.poe.tasks.test_base] -shell = """ -python ./autoafids/run.py ./tests/data/ ./tests/data/derivatives/ participant \ - -np --force-output -""" [tool.poe.tasks.yamlfix] shell = """ From bd4f5a001a6bc6bb9bc2f70fda31e23ec8a5ebb3 Mon Sep 17 00:00:00 2001 From: Dhananjhay Date: Tue, 1 Apr 2025 15:27:44 -0400 Subject: [PATCH 2/8] replace hipp with autoafids --- .github/workflows/python-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-testing.yml b/.github/workflows/python-testing.yml index c35ccef..7d3bbe8 100644 --- a/.github/workflows/python-testing.yml +++ b/.github/workflows/python-testing.yml @@ -60,4 +60,4 @@ jobs: - name: Test single T1w bids run: | - poetry run hippunfold tests/data/ test_out participant -np \ No newline at end of file + poetry run autoafids tests/data/ test_out participant -np \ No newline at end of file From b529abfaaa1a42a761202199053c733bf6b63eff Mon Sep 17 00:00:00 2001 From: Dhananjhay Date: Tue, 1 Apr 2025 15:41:58 -0400 Subject: [PATCH 3/8] make dry run tests more extensive --- .github/workflows/python-testing.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-testing.yml b/.github/workflows/python-testing.yml index 7d3bbe8..9877195 100644 --- a/.github/workflows/python-testing.yml +++ b/.github/workflows/python-testing.yml @@ -58,6 +58,23 @@ jobs: run: | echo "AUTOAFIDS_CACHE_DIR=`pwd`/test_data/autoafids_cache_dir" >> $GITHUB_ENV - - name: Test single T1w bids + - name: Test T1w modality run: | - poetry run autoafids tests/data/ test_out participant -np \ No newline at end of file + poetry run autoafids tests/data/ test_out participant -np + + - name: Test T2w modality + run: | + poetry run autoafids tests/data/ test_out participant --modality T2w -np + + - name: Test CT modality + run: | + poetry run autoafids tests/data/ test_out participant --modality ct -np + + - name: Test stereotaxy feature + run: | + poetry run autoafids tests/data/ test_out participant --stereotaxy STN -np + + - name: Test fidqc feature + run: | + poetry run autoafids tests/data/ test_out participant --fidqc -np + From 3aec9b588ff1e02c3461118d08c4bf35a02b510e Mon Sep 17 00:00:00 2001 From: Dhananjhay Date: Tue, 1 Apr 2025 15:54:04 -0400 Subject: [PATCH 4/8] configure dry run testing for different modalities --- .github/workflows/python-testing.yml | 16 ++++++++++------ .../{data => bids_T1w}/dataset_description.json | 0 .../sub-001/anat/sub-001_T1w.nii.gz | 0 .../func/sub-001_task-rest_run-1_bold.nii.gz | 0 .../func/sub-001_task-rest_run-2_bold.nii.gz | 0 tests/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz | 0 tests/bids_ct/sub-001/anat/sub-001_ct.nii.gz | 0 7 files changed, 10 insertions(+), 6 deletions(-) rename tests/{data => bids_T1w}/dataset_description.json (100%) rename tests/{data => bids_T1w}/sub-001/anat/sub-001_T1w.nii.gz (100%) rename tests/{data => bids_T1w}/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz (100%) rename tests/{data => bids_T1w}/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz (100%) create mode 100644 tests/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz create mode 100644 tests/bids_ct/sub-001/anat/sub-001_ct.nii.gz diff --git a/.github/workflows/python-testing.yml b/.github/workflows/python-testing.yml index 9877195..53b3ab4 100644 --- a/.github/workflows/python-testing.yml +++ b/.github/workflows/python-testing.yml @@ -60,21 +60,25 @@ jobs: - name: Test T1w modality run: | - poetry run autoafids tests/data/ test_out participant -np + poetry run autoafids tests/data/bids_T1w test_out participant -np - name: Test T2w modality run: | - poetry run autoafids tests/data/ test_out participant --modality T2w -np + poetry run autoafids tests/data/bids_T2w test_out participant --modality T2w -np - name: Test CT modality run: | - poetry run autoafids tests/data/ test_out participant --modality ct -np + poetry run autoafids tests/data/bids_ct test_out participant --modality ct -np - - name: Test stereotaxy feature + - name: Test stereotaxy feature with T1w modality run: | - poetry run autoafids tests/data/ test_out participant --stereotaxy STN -np + poetry run autoafids tests/data/bids_T1w test_out participant --stereotaxy STN -np + + - name: Test stereotaxy feature with T2w modality + run: | + poetry run autoafids tests/data/bids_T2w test_out participant --stereotaxy STN --modality T2w -np - name: Test fidqc feature run: | - poetry run autoafids tests/data/ test_out participant --fidqc -np + poetry run autoafids tests/data/bids_T1w test_out participant --fidqc -np diff --git a/tests/data/dataset_description.json b/tests/bids_T1w/dataset_description.json similarity index 100% rename from tests/data/dataset_description.json rename to tests/bids_T1w/dataset_description.json diff --git a/tests/data/sub-001/anat/sub-001_T1w.nii.gz b/tests/bids_T1w/sub-001/anat/sub-001_T1w.nii.gz similarity index 100% rename from tests/data/sub-001/anat/sub-001_T1w.nii.gz rename to tests/bids_T1w/sub-001/anat/sub-001_T1w.nii.gz diff --git a/tests/data/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz b/tests/bids_T1w/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz similarity index 100% rename from tests/data/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz rename to tests/bids_T1w/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz diff --git a/tests/data/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz b/tests/bids_T1w/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz similarity index 100% rename from tests/data/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz rename to tests/bids_T1w/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz diff --git a/tests/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz b/tests/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz new file mode 100644 index 0000000..e69de29 diff --git a/tests/bids_ct/sub-001/anat/sub-001_ct.nii.gz b/tests/bids_ct/sub-001/anat/sub-001_ct.nii.gz new file mode 100644 index 0000000..e69de29 From 0af78014b091c007186365f365a291d890a052ef Mon Sep 17 00:00:00 2001 From: Dhananjhay Date: Tue, 1 Apr 2025 15:57:47 -0400 Subject: [PATCH 5/8] rename tests/data to test_data --- .github/workflows/python-testing.yml | 12 ++++++------ .../bids_T1w/dataset_description.json | 0 .../bids_T1w/sub-001/anat/sub-001_T1w.nii.gz | 0 .../sub-001/func/sub-001_task-rest_run-1_bold.nii.gz | 0 .../sub-001/func/sub-001_task-rest_run-2_bold.nii.gz | 0 .../bids_T2w/sub-001/anat/sub-001_T2w.nii.gz | 0 .../bids_ct/sub-001/anat/sub-001_ct.nii.gz | 0 7 files changed, 6 insertions(+), 6 deletions(-) rename {tests => tests_data}/bids_T1w/dataset_description.json (100%) rename {tests => tests_data}/bids_T1w/sub-001/anat/sub-001_T1w.nii.gz (100%) rename {tests => tests_data}/bids_T1w/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz (100%) rename {tests => tests_data}/bids_T1w/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz (100%) rename {tests => tests_data}/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz (100%) rename {tests => tests_data}/bids_ct/sub-001/anat/sub-001_ct.nii.gz (100%) diff --git a/.github/workflows/python-testing.yml b/.github/workflows/python-testing.yml index 53b3ab4..1fa72de 100644 --- a/.github/workflows/python-testing.yml +++ b/.github/workflows/python-testing.yml @@ -60,25 +60,25 @@ jobs: - name: Test T1w modality run: | - poetry run autoafids tests/data/bids_T1w test_out participant -np + poetry run autoafids test_data/bids_T1w test_out participant -np - name: Test T2w modality run: | - poetry run autoafids tests/data/bids_T2w test_out participant --modality T2w -np + poetry run autoafids test_data/bids_T2w test_out participant --modality T2w -np - name: Test CT modality run: | - poetry run autoafids tests/data/bids_ct test_out participant --modality ct -np + poetry run autoafids test_data/bids_ct test_out participant --modality ct -np - name: Test stereotaxy feature with T1w modality run: | - poetry run autoafids tests/data/bids_T1w test_out participant --stereotaxy STN -np + poetry run autoafids test_data/bids_T1w test_out participant --stereotaxy STN -np - name: Test stereotaxy feature with T2w modality run: | - poetry run autoafids tests/data/bids_T2w test_out participant --stereotaxy STN --modality T2w -np + poetry run autoafids test_data/bids_T2w test_out participant --stereotaxy STN --modality T2w -np - name: Test fidqc feature run: | - poetry run autoafids tests/data/bids_T1w test_out participant --fidqc -np + poetry run autoafids test_data/bids_T1w test_out participant --fidqc -np diff --git a/tests/bids_T1w/dataset_description.json b/tests_data/bids_T1w/dataset_description.json similarity index 100% rename from tests/bids_T1w/dataset_description.json rename to tests_data/bids_T1w/dataset_description.json diff --git a/tests/bids_T1w/sub-001/anat/sub-001_T1w.nii.gz b/tests_data/bids_T1w/sub-001/anat/sub-001_T1w.nii.gz similarity index 100% rename from tests/bids_T1w/sub-001/anat/sub-001_T1w.nii.gz rename to tests_data/bids_T1w/sub-001/anat/sub-001_T1w.nii.gz diff --git a/tests/bids_T1w/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz b/tests_data/bids_T1w/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz similarity index 100% rename from tests/bids_T1w/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz rename to tests_data/bids_T1w/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz diff --git a/tests/bids_T1w/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz b/tests_data/bids_T1w/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz similarity index 100% rename from tests/bids_T1w/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz rename to tests_data/bids_T1w/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz diff --git a/tests/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz b/tests_data/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz similarity index 100% rename from tests/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz rename to tests_data/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz diff --git a/tests/bids_ct/sub-001/anat/sub-001_ct.nii.gz b/tests_data/bids_ct/sub-001/anat/sub-001_ct.nii.gz similarity index 100% rename from tests/bids_ct/sub-001/anat/sub-001_ct.nii.gz rename to tests_data/bids_ct/sub-001/anat/sub-001_ct.nii.gz From e804a3ba7e5458ef7d781b2eeb8382746d18eb4a Mon Sep 17 00:00:00 2001 From: Dhananjhay Date: Tue, 1 Apr 2025 16:03:12 -0400 Subject: [PATCH 6/8] rename tests_data to test_data --- {tests_data => test_data}/bids_T1w/dataset_description.json | 0 .../bids_T1w/sub-001/anat/sub-001_T1w.nii.gz | 0 .../bids_T1w/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz | 0 .../bids_T1w/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz | 0 .../bids_T2w/sub-001/anat/sub-001_T2w.nii.gz | 0 {tests_data => test_data}/bids_ct/sub-001/anat/sub-001_ct.nii.gz | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename {tests_data => test_data}/bids_T1w/dataset_description.json (100%) rename {tests_data => test_data}/bids_T1w/sub-001/anat/sub-001_T1w.nii.gz (100%) rename {tests_data => test_data}/bids_T1w/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz (100%) rename {tests_data => test_data}/bids_T1w/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz (100%) rename {tests_data => test_data}/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz (100%) rename {tests_data => test_data}/bids_ct/sub-001/anat/sub-001_ct.nii.gz (100%) diff --git a/tests_data/bids_T1w/dataset_description.json b/test_data/bids_T1w/dataset_description.json similarity index 100% rename from tests_data/bids_T1w/dataset_description.json rename to test_data/bids_T1w/dataset_description.json diff --git a/tests_data/bids_T1w/sub-001/anat/sub-001_T1w.nii.gz b/test_data/bids_T1w/sub-001/anat/sub-001_T1w.nii.gz similarity index 100% rename from tests_data/bids_T1w/sub-001/anat/sub-001_T1w.nii.gz rename to test_data/bids_T1w/sub-001/anat/sub-001_T1w.nii.gz diff --git a/tests_data/bids_T1w/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz b/test_data/bids_T1w/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz similarity index 100% rename from tests_data/bids_T1w/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz rename to test_data/bids_T1w/sub-001/func/sub-001_task-rest_run-1_bold.nii.gz diff --git a/tests_data/bids_T1w/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz b/test_data/bids_T1w/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz similarity index 100% rename from tests_data/bids_T1w/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz rename to test_data/bids_T1w/sub-001/func/sub-001_task-rest_run-2_bold.nii.gz diff --git a/tests_data/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz b/test_data/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz similarity index 100% rename from tests_data/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz rename to test_data/bids_T2w/sub-001/anat/sub-001_T2w.nii.gz diff --git a/tests_data/bids_ct/sub-001/anat/sub-001_ct.nii.gz b/test_data/bids_ct/sub-001/anat/sub-001_ct.nii.gz similarity index 100% rename from tests_data/bids_ct/sub-001/anat/sub-001_ct.nii.gz rename to test_data/bids_ct/sub-001/anat/sub-001_ct.nii.gz From 2c29b660934ca130437b8cc43ff2d6cf725d79f9 Mon Sep 17 00:00:00 2001 From: Dhananjhay Date: Tue, 1 Apr 2025 16:06:58 -0400 Subject: [PATCH 7/8] change ct to CT --- .github/workflows/python-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-testing.yml b/.github/workflows/python-testing.yml index 1fa72de..acd0caa 100644 --- a/.github/workflows/python-testing.yml +++ b/.github/workflows/python-testing.yml @@ -68,7 +68,7 @@ jobs: - name: Test CT modality run: | - poetry run autoafids test_data/bids_ct test_out participant --modality ct -np + poetry run autoafids test_data/bids_ct test_out participant --modality CT -np - name: Test stereotaxy feature with T1w modality run: | From df7f82d5da68e8b560eb43b1557c42d1252e5d9a Mon Sep 17 00:00:00 2001 From: Dhananjhay Date: Tue, 1 Apr 2025 16:09:39 -0400 Subject: [PATCH 8/8] change CT to ct --- .github/workflows/python-testing.yml | 2 +- autoafids/config/snakebids.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-testing.yml b/.github/workflows/python-testing.yml index acd0caa..1fa72de 100644 --- a/.github/workflows/python-testing.yml +++ b/.github/workflows/python-testing.yml @@ -68,7 +68,7 @@ jobs: - name: Test CT modality run: | - poetry run autoafids test_data/bids_ct test_out participant --modality CT -np + poetry run autoafids test_data/bids_ct test_out participant --modality ct -np - name: Test stereotaxy feature with T1w modality run: | diff --git a/autoafids/config/snakebids.yml b/autoafids/config/snakebids.yml index 7ee9a0e..518855a 100644 --- a/autoafids/config/snakebids.yml +++ b/autoafids/config/snakebids.yml @@ -51,7 +51,7 @@ pybids_inputs: - reconstruction - run - CT: + ct: filters: suffix: ct extension: .nii.gz