Skip to content

Commit b115290

Browse files
committed
update package tests
1 parent 19a7a1e commit b115290

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

exm/align/align.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from typing import Tuple, Optional, List
1313

1414
from exm.args import Args
15-
from exm.io.io import nd2ToVol , get_raw_volume
15+
from exm.io.io import nd2ToVol
1616
from exm.utils import chmod, subtract_background_rolling_ball, subtract_background_top_hat,downsample_volume, enhance_and_filter_volume
1717

1818
from exm.utils import configure_logger

tests/conftest.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,40 @@
44
import numpy as np
55

66
def setup_dataset():
7-
# Define the directories
8-
base_dir = os.path.join(os.environ.get("BASE_DIR"),'dataset')
7+
# Define the base directory
8+
base_dir = os.path.join(os.environ.get("BASE_DIR"), 'dataset')
99

10+
# Define the code directories
1011
dir_names = ["code0", "code1", "code2"]
1112

1213
# Create directories
1314
for dir_name in dir_names:
1415
os.makedirs(os.path.join(base_dir, dir_name), exist_ok=True)
1516

16-
1717
# Function to create the volume with a white center and optional shift
1818
def create_volume(shift_x=0, shift_y=0, shift_z=0):
1919
volume = np.zeros((10, 10, 10), dtype=np.uint16)
20-
volume[4+shift_x:7+shift_x, 4+shift_y:7+shift_y, 4+shift_z:7+shift_z] = 65535
20+
volume[4 + shift_x:7 + shift_x, 4 + shift_y:7 + shift_y, 4 + shift_z:7 + shift_z] = 65535
2121
return volume
2222

2323
# Create .h5 files with the modified properties
2424
shifts = [(0, 0, 0), (1, 0, 0), (0, 1, 0)] # No shift, shift in x, shift in y
25-
channels = ['640','594','561','488','405']
25+
channels = ['640', '594', '561', '488', '405']
26+
2627
for dir_index, dir_name in enumerate(dir_names):
27-
for i,channel in zip(list(range(5)),channels):
28-
file_path = os.path.join(base_dir, f"code{dir_index}/Channel{channel} SD_Seq000{i}.h5")
29-
30-
# Create the volume with the appropriate shift
31-
volume = create_volume(*shifts[dir_index])
32-
33-
# Save the volume in the .h5 file
28+
for fov_index in range(1): # Create 5 FOV files per code directory
29+
file_path = os.path.join(base_dir, f"{dir_name}/raw_fov{fov_index}.h5")
30+
31+
# Create an empty volume and populate it with channels
3432
with h5py.File(file_path, 'w') as f:
35-
dataset_name = f"{channel}"
36-
f.create_dataset(dataset_name, data=volume)
33+
for channel in channels:
34+
# Create the volume with the appropriate shift
35+
volume = create_volume(*shifts[dir_index])
36+
dataset_name = f"{channel}"
37+
f.create_dataset(dataset_name, data=volume)
3738

3839
def cleanup_dataset():
39-
base_dir = os.path.join(os.environ.get("BASE_DIR"),'dataset')
40+
base_dir = os.path.join(os.environ.get("BASE_DIR"), 'dataset')
4041
shutil.rmtree(base_dir, ignore_errors=True)
4142

4243
def pytest_sessionstart(session):

0 commit comments

Comments
 (0)