From 50396b4415b9e69699e86cd5ea7cc51b8251f5f6 Mon Sep 17 00:00:00 2001 From: Geoffrey Woollard Date: Tue, 25 Jun 2024 16:51:31 -0400 Subject: [PATCH] configs, test data --- .github/workflows/testing.yml | 2 ++ tests/config_files/test_config_preproc.yaml | 8 ++++++++ .../submission_x/submission_config.json | 16 ++++++++++++++++ tests/scripts/fetch_test_data.sh | 7 +++++-- tests/test_preprocessing.py | 7 +++++++ 5 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 tests/config_files/test_config_preproc.yaml create mode 100644 tests/data/unprocessed_dataset_2_submissions/submission_x/submission_config.json create mode 100644 tests/test_preprocessing.py diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 45538ae..130585c 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -55,5 +55,7 @@ jobs: - name: Test with pytest run: | + pytest tests/test_preprocess.py pytest tests/test_map_to_map.py pytest tests/test_distribution_to_distribution.py + diff --git a/tests/config_files/test_config_preproc.yaml b/tests/config_files/test_config_preproc.yaml new file mode 100644 index 0000000..0a27d7e --- /dev/null +++ b/tests/config_files/test_config_preproc.yaml @@ -0,0 +1,8 @@ +submission_config_file: tests/data/unprocessed_dataset_2_submissions/submission_x/submission_config.json +seed_flavor_assignment: 0 +thresh_percentile: 93.0 +BOT_box_size: 32 +BOT_loss: wemd +BOT_iter: 200 +BOT_refine: True +output_path: tests/results/preproccessed_submission_x/ diff --git a/tests/data/unprocessed_dataset_2_submissions/submission_x/submission_config.json b/tests/data/unprocessed_dataset_2_submissions/submission_x/submission_config.json new file mode 100644 index 0000000..87184aa --- /dev/null +++ b/tests/data/unprocessed_dataset_2_submissions/submission_x/submission_config.json @@ -0,0 +1,16 @@ +{ + "gt": { + "name": "gt", + "path": "tests/data/unprocessed_dataset_2_submissions/submission_x", + "box_size": 224, + "pixel_size": 2.146, + "ref_align_fname": "1.mrc" + }, + "0": { + "name": "raw_submission_in_testdata", + "align": 1, + "box_size": 244, + "pixel_size": 2.146, + "path": "tests/data/unprocessed_dataset_2_submissions/submission_x" + } +} \ No newline at end of file diff --git a/tests/scripts/fetch_test_data.sh b/tests/scripts/fetch_test_data.sh index 740d895..d90327e 100644 --- a/tests/scripts/fetch_test_data.sh +++ b/tests/scripts/fetch_test_data.sh @@ -1,5 +1,8 @@ -mkdir -p data/dataset_2_submissions tests/data/dataset_2_submissions tests/results +mkdir -p data/dataset_2_submissions tests/results tests/data/unprocessed_dataset_2_submissions/submission_x wget https://files.osf.io/v1/resources/8h6fz/providers/dropbox/dataset_2_submissions/test_submission_0_n8.pt?download=true -O tests/data/dataset_2_submissions/test_submission_0_n8.pt wget https://files.osf.io/v1/resources/8h6fz/providers/dropbox/Ground_truth/test_maps_gt_flat_10.pt?download=true -O tests/data/test_maps_gt_flat_10.pt wget https://files.osf.io/v1/resources/8h6fz/providers/dropbox/Ground_truth/test_metadata_10.csv?download=true -O tests/data/test_metadata_10.csv -wget https://files.osf.io/v1/resources/8h6fz/providers/dropbox/Ground_truth/mask_dilated_wide_224x224.mrc?download=true -O data/mask_dilated_wide_224x224.mrc \ No newline at end of file +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/tests/test_preprocessing.py b/tests/test_preprocessing.py new file mode 100644 index 0000000..cbf54e4 --- /dev/null +++ b/tests/test_preprocessing.py @@ -0,0 +1,7 @@ +from omegaconf import OmegaConf +from cryo_challenge._commands import run_preprocessing + + +def test_run_preprocessing(): + args = OmegaConf.create({'config': 'tests/config_files/test_config_preproc.yaml'}) + run_preprocessing.main(args) \ No newline at end of file