diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7540267..0000000 --- a/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -*.ipynb linguist-vendored -*.mrc filter=lfs diff=lfs merge=lfs -text -*.pt filter=lfs diff=lfs merge=lfs -text -*.npy filter=lfs diff=lfs merge=lfs -text diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index ffc2fc8..413047d 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -26,22 +26,30 @@ jobs: python-version: ${{ matrix.python-version }} cache: 'pip' # caching pip dependencies - - name: Install Git LFS - run: | - sudo apt-get update - sudo apt-get install git-lfs - git lfs install - - name: Pull LFS Files - run: git lfs pull + - name: Cache test data + id: cache_test_data + uses: actions/cache@v3 + with: + path: | + tests/data + data + key: venv-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/tests/scripts/fetch_test_data.sh') }} + - name: Install dependencies run: | python -m pip install --upgrade pip pip install . pip install pytest omegaconf - + + - name: Get test data from OSF + if: ${{ steps.cache_test_data.outputs.cache-hit != 'true' }} + run: | + sh tests/scripts/fetch_test_data.sh + - name: Test with pytest run: | pytest tests/test_preprocessing.py pytest tests/test_svd.py pytest tests/test_map_to_map.py pytest tests/test_distribution_to_distribution.py + diff --git a/.gitignore b/.gitignore index 659f92a..5ede44a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ data/dataset_1_submissions data/dataset_2_ground_truth # data for testing and resulting outputs +tests/data/Ground_truth +tests/data/dataset_2_submissions/ +tests/data/unprocessed_dataset_2_submissions/submission_x/ tests/results/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2d1bb35..e3c79b8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,6 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - - id: check-added-large-files - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. rev: v0.3.4 diff --git a/tests/scripts/fetch_test_data.sh b/tests/scripts/fetch_test_data.sh new file mode 100644 index 0000000..0541c45 --- /dev/null +++ b/tests/scripts/fetch_test_data.sh @@ -0,0 +1,12 @@ +mkdir -p tests/data/dataset_2_submissions tests/data/dataset_2_submissions tests/results tests/data/unprocessed_dataset_2_submissions/submission_x tests/data/Ground_truth/ tests/data/Ground_truth +wget https://files.osf.io/v1/resources/8h6fz/providers/dropbox/tests/dataset_2_submissions/test_submission_0_n8.pt?download=true -O tests/data/dataset_2_submissions/test_submission_0_n8.pt +ADIR=$(pwd) +ln -s $ADIR/tests/data/dataset_2_submissions/test_submission_0_n8.pt $ADIR/tests/data/dataset_2_submissions/submission_0.pt # symlink for svd which needs submission_0.pt for filename +wget https://files.osf.io/v1/resources/8h6fz/providers/dropbox/tests/Ground_truth/test_maps_gt_flat_10.pt?download=true -O tests/data/Ground_truth/test_maps_gt_flat_10.pt +wget https://files.osf.io/v1/resources/8h6fz/providers/dropbox/tests/Ground_truth/test_metadata_10.csv?download=true -O tests/data/Ground_truth/test_metadata_10.csv +wget https://files.osf.io/v1/resources/8h6fz/providers/dropbox/tests/Ground_truth/1.mrc?download=true -O tests/data/Ground_truth/1.mrc +wget https://files.osf.io/v1/resources/8h6fz/providers/dropbox/Ground_truth/mask_dilated_wide_224x224.mrc?download=true -O tests/data/Ground_truth/mask_dilated_wide_224x224.mrc +for FILE in 1.mrc 2.mrc 3.mrc 4.mrc populations.txt +do + wget https://files.osf.io/v1/resources/8h6fz/providers/dropbox/tests/unprocessed_dataset_2_submissions/submission_x/${FILE}?download=true -O tests/data/unprocessed_dataset_2_submissions/submission_x/${FILE} +done \ No newline at end of file diff --git a/tutorials/1_tutorial_preprocessing.ipynb b/tutorials/1_tutorial_preprocessing.ipynb index b2063ca..f04b511 100644 --- a/tutorials/1_tutorial_preprocessing.ipynb +++ b/tutorials/1_tutorial_preprocessing.ipynb @@ -242,7 +242,7 @@ "# Select path to Config file\n", "# An example of this file is available in the path ../config_files/config_preproc.yaml\n", "config_preproc_path = FileChooser(os.path.expanduser(\"~\"))\n", - "config_preproc_path.filter_pattern = \"*.yaml\"\n", + "config_preproc_path.filter_pattern = '*.yaml'\n", "display(config_preproc_path)" ] }, @@ -265,7 +265,7 @@ "if os.path.isabs(output_path):\n", " full_output_path = output_path\n", "else:\n", - " full_output_path = os.path.join(os.getcwd(), \"..\", output_path)" + " full_output_path = os.path.join(os.getcwd(), '..', output_path)" ] }, {