Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremykubica committed Oct 30, 2023
1 parent 2bfd388 commit 95a3a85
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/deepdisc/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,19 @@ def hsc_test_data_dir():
@pytest.fixture
def hsc_single_test_file(hsc_test_data_dir):
return path.join(hsc_test_data_dir, "single_test.json")

@pytest.fixture
def hsc_triple_test_file(hsc_test_data_dir):
return [
path.join(hsc_test_data_dir, "G-10054-0,2-c1_scarlet_img.fits"),
path.join(hsc_test_data_dir, "I-10054-0,2-c1_scarlet_img.fits"),
path.join(hsc_test_data_dir, "R-10054-0,2-c1_scarlet_img.fits"),
]

@pytest.fixture
def dc2_test_data_dir():
return path.join(TEST_DIR, "test_data/dc2")

@pytest.fixture
def dc2_single_test_file(dc2_test_data_dir):
return path.join(dc2_test_data_dir, "3828_2,2_12_images.npy")
21 changes: 21 additions & 0 deletions tests/deepdisc/data_format/test_image_readers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os
import pytest

from deepdisc.data_format.image_readers import DC2ImageReader, HSCImageReader

def test_read_hsc_data(hsc_triple_test_file):
"""Test that we can read the test DC2 data."""
ir = HSCImageReader(norm="raw")
img = ir(hsc_triple_test_file)
assert img.shape[0] == 1050
assert img.shape[1] == 1025
assert img.shape[2] == 3


def test_read_dc2_data(dc2_single_test_file):
"""Test that we can read the test DC2 data."""
ir = DC2ImageReader(norm="raw")
img = ir(dc2_single_test_file)
assert img.shape[0] == 525
assert img.shape[1] == 525
assert img.shape[2] == 6

0 comments on commit 95a3a85

Please sign in to comment.