Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/httomolibgpu_tests_run_iris.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ jobs:
- name: Checkout repository code
uses: actions/checkout@v4

- name: Set up CUDA environment
run: |
echo "LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV

- name: Create conda environment
uses: mamba-org/setup-micromamba@v1
with:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/main-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up CUDA environment
run: |
echo "LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV

- name: Create conda environment
uses: mamba-org/setup-micromamba@v1
with:
Expand Down
24 changes: 13 additions & 11 deletions .scripts/download_zenodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,30 @@ def calculate_md5(filename):

def download_zenodo_files(output_dir: Path):
"""
Download all files from Zenodo record 14338424 and verify their checksums.
Download all files from Zenodo record 14627503 and verify their checksums.

Args:
output_dir: Directory where files should be downloaded
"""
try:
print("Fetching files from Zenodo record 14338424...")
with urllib.request.urlopen("https://zenodo.org/api/records/14338424") as response:
print("Fetching files from Zenodo record 14627503...")
with urllib.request.urlopen(
"https://zenodo.org/api/records/14627503"
) as response:
data = json.loads(response.read())

# Create output directory if it doesn't exist
output_dir.mkdir(parents=True, exist_ok=True)

# Now 'files' is a list, not a dictionary
for file_info in data["files"]:
filename = file_info["key"] # The 'key' is the filename
output_file = output_dir / filename
print(f"Downloading {filename}...")
url = file_info["links"]["self"] # The link to download the file

expected_md5 = file_info["checksum"].split(":")[1] # Extract MD5 hash

# Download the file
urllib.request.urlretrieve(url, output_file)

Expand All @@ -53,9 +55,9 @@ def download_zenodo_files(output_dir: Path):
print(f"Expected: {expected_md5}")
print(f"Got: {actual_md5}")
sys.exit(1)

print("\nAll files downloaded and verified successfully!")

except Exception as e:
print(f"Error: {str(e)}", file=sys.stderr)
sys.exit(1)
Expand All @@ -65,6 +67,6 @@ def download_zenodo_files(output_dir: Path):
if len(sys.argv) != 2:
print("Usage: download_zenodo.py <output_directory>")
sys.exit(1)

output_dir = Path(sys.argv[1])
download_zenodo_files(output_dir)
53 changes: 27 additions & 26 deletions zenodo-tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,50 @@ def test_data_path():


@pytest.fixture(scope="session")
def data_i12LFOV_file(test_data_path):
in_file = os.path.join(test_data_path, "i12LFOV.npz")
def i12_dataset1_file(test_data_path):
in_file = os.path.join(test_data_path, "i12_dataset1.npz")
return np.load(in_file)


@pytest.fixture(scope="session")
def data_i12_sandstone_file(test_data_path):
in_file = os.path.join(test_data_path, "i12_sandstone_50sinoslices.npz")
return np.load(in_file)
@pytest.fixture
def i12_dataset1(i12_dataset1_file):
return (
cp.asarray(i12_dataset1_file["projdata"]),
i12_dataset1_file["angles"],
cp.asarray(i12_dataset1_file["flats"]),
cp.asarray(i12_dataset1_file["darks"]),
)


@pytest.fixture(scope="session")
def data_geant4sim_file(test_data_path):
in_file = os.path.join(test_data_path, "geant4_640_540_proj360.npz")
def i12_dataset2_file(test_data_path):
in_file = os.path.join(test_data_path, "i12_dataset2.npz")
return np.load(in_file)


@pytest.fixture
def i12LFOV_data(data_i12LFOV_file):
def i12_dataset2(i12_dataset2_file):
return (
cp.asarray(data_i12LFOV_file["projdata"]),
data_i12LFOV_file["angles"],
cp.asarray(data_i12LFOV_file["flats"]),
cp.asarray(data_i12LFOV_file["darks"]),
cp.asarray(i12_dataset2_file["projdata"]),
i12_dataset2_file["angles"],
cp.asarray(i12_dataset2_file["flats"]),
cp.asarray(i12_dataset2_file["darks"]),
)


@pytest.fixture
def i12sandstone_data(data_i12_sandstone_file):
return (
cp.asarray(data_i12_sandstone_file["projdata"]),
data_i12_sandstone_file["angles"],
cp.asarray(data_i12_sandstone_file["flats"]),
cp.asarray(data_i12_sandstone_file["darks"]),
)
@pytest.fixture(scope="session")
def geant4_dataset1_file(test_data_path):
in_file = os.path.join(test_data_path, "geant4_dataset1.npz")
return np.load(in_file)


@pytest.fixture
def geantsim_data(data_geant4sim_file):
def geant4_dataset1(geant4_dataset1_file):
return (
cp.asarray(data_geant4sim_file["projdata"]),
data_geant4sim_file["angles"],
cp.asarray(data_geant4sim_file["flats"]),
cp.asarray(data_geant4sim_file["darks"]),
cp.asarray(geant4_dataset1_file["projdata"]),
geant4_dataset1_file["angles"],
cp.asarray(geant4_dataset1_file["flats"]),
cp.asarray(geant4_dataset1_file["darks"]),
)


Expand Down
40 changes: 20 additions & 20 deletions zenodo-tests/test_recon/test_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from httomolibgpu.recon.rotation import find_center_vo


def test_center_vo_i12LFOV(i12LFOV_data, ensure_clean_memory):
projdata = i12LFOV_data[0]
flats = i12LFOV_data[2]
darks = i12LFOV_data[3]
del i12LFOV_data
def test_center_vo_i12_dataset2(i12_dataset2, ensure_clean_memory):
projdata = i12_dataset2[0]
flats = i12_dataset2[2]
darks = i12_dataset2[3]
del i12_dataset2

data_normalised = normalize(projdata, flats, darks, minus_log=False)
del flats, darks, projdata
Expand All @@ -22,11 +22,11 @@ def test_center_vo_i12LFOV(i12LFOV_data, ensure_clean_memory):
assert cor.dtype == np.float32


def test_center_vo_average_i12LFOV(i12LFOV_data, ensure_clean_memory):
projdata = i12LFOV_data[0]
flats = i12LFOV_data[2]
darks = i12LFOV_data[3]
del i12LFOV_data
def test_center_vo_average_i12_dataset2(i12_dataset2, ensure_clean_memory):
projdata = i12_dataset2[0]
flats = i12_dataset2[2]
darks = i12_dataset2[3]
del i12_dataset2

data_normalised = normalize(projdata, flats, darks, minus_log=False)
del flats, darks, projdata
Expand All @@ -37,11 +37,11 @@ def test_center_vo_average_i12LFOV(i12LFOV_data, ensure_clean_memory):
assert cor.dtype == np.float32


def test_center_vo_i12_sandstone(i12sandstone_data, ensure_clean_memory):
projdata = i12sandstone_data[0]
flats = i12sandstone_data[2]
darks = i12sandstone_data[3]
del i12sandstone_data
def test_center_vo_i12_dataset1(i12_dataset1, ensure_clean_memory):
projdata = i12_dataset1[0]
flats = i12_dataset1[2]
darks = i12_dataset1[3]
del i12_dataset1

data_normalised = normalize(projdata, flats, darks, minus_log=True)
del flats, darks, projdata
Expand All @@ -53,11 +53,11 @@ def test_center_vo_i12_sandstone(i12sandstone_data, ensure_clean_memory):
assert cor.dtype == np.float32


def test_center_vo_i12_geantsim(geantsim_data, ensure_clean_memory):
projdata = geantsim_data[0]
flats = geantsim_data[2]
darks = geantsim_data[3]
del geantsim_data
def test_center_vo_geant4_dataset1(geant4_dataset1, ensure_clean_memory):
projdata = geant4_dataset1[0]
flats = geant4_dataset1[2]
darks = geant4_dataset1[3]
del geant4_dataset1

data_normalised = normalize(projdata, flats, darks, minus_log=True)
del flats, darks, projdata
Expand Down
Loading