GitLab will be upgraded on June 23rd evening. During the upgrade the service will be unavailable, sorry for the inconvenience.

Commit c5ec1ac4 authored by payno's avatar payno

Merge branch 'check_python3.9' into 'master'

Check python3.9

Closes #18

See merge request !38
parents 25484efe cdc7f886
Pipeline #44242 passed with stages
in 15 minutes and 33 seconds
......@@ -70,6 +70,7 @@ doc:
- source ./ci/install_scripts.sh
- python -m pip install pip --upgrade
- python -m pip install setuptools --upgrade
- python -m pip install pytest==6.2.2
- python -m pip install pytest-cov
- install_silx
- python -m pip install -r requirements.txt
......@@ -83,6 +84,11 @@ test:python3.7_stretch_pyqt5:
<<: *test_linux_template
test:python3.9_stretch_pyqt5:
image: docker-registry.esrf.fr/dau/tomwer:python3.9_buster
<<: *test_linux_template
# test_notbooks
test:test-tomoscan-tutorials:
stage: test_notbooks
......
......@@ -265,7 +265,7 @@ class HDF5TomoScan(TomoScanBase):
if not os.path.isfile(file_path):
raise ValueError("given file path should be a file")
with HDF5File(file_path, "r", swmr=True) as h5f:
with HDF5File(file_path, "r") as h5f:
for root_node in h5f.keys():
node = h5f[root_node]
if HDF5TomoScan.node_is_nxtomo(node) is True:
......@@ -480,7 +480,7 @@ class HDF5TomoScan(TomoScanBase):
def rotation_angle(self) -> typing.Union[None, tuple]:
if self._rotation_angles is None:
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
with HDF5File(self.master_file, "r") as h5_file:
_rotation_angles = h5py_read_dataset(
h5_file[self._entry][self._ROTATION_ANGLE_PATH]
)
......@@ -494,7 +494,7 @@ class HDF5TomoScan(TomoScanBase):
def x_translation(self) -> typing.Union[None, tuple]:
if self._x_translations is None:
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
with HDF5File(self.master_file, "r") as h5_file:
entry = h5_file[self._entry]
if self._X_TRANS_PATH in entry:
translations = h5py_read_dataset(entry[self._X_TRANS_PATH])
......@@ -508,7 +508,7 @@ class HDF5TomoScan(TomoScanBase):
def y_translation(self) -> typing.Union[None, tuple]:
if self._y_translations is None:
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
with HDF5File(self.master_file, "r") as h5_file:
entry = h5_file[self._entry]
if self._Y_TRANS_PATH in entry:
translations = h5py_read_dataset(entry[self._Y_TRANS_PATH])
......@@ -522,7 +522,7 @@ class HDF5TomoScan(TomoScanBase):
def z_translation(self) -> typing.Union[None, tuple]:
if self._z_translations is None:
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
with HDF5File(self.master_file, "r") as h5_file:
entry = h5_file[self._entry]
if self._Z_TRANS_PATH in entry:
translations = h5py_read_dataset(entry[self._Z_TRANS_PATH])
......@@ -536,7 +536,7 @@ class HDF5TomoScan(TomoScanBase):
def image_key(self) -> typing.Union[list, None]:
if self._entry and self._image_keys is None:
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
with HDF5File(self.master_file, "r") as h5_file:
self._image_keys = h5py_read_dataset(
h5_file[self._entry][self._IMG_KEY_PATH]
)
......@@ -546,7 +546,7 @@ class HDF5TomoScan(TomoScanBase):
def image_key_control(self) -> typing.Union[list, None]:
if self._entry and self._image_keys_control is None:
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
with HDF5File(self.master_file, "r") as h5_file:
if self._IMG_KEY_CONTROL_PATH in h5_file[self._entry]:
self._image_keys_control = h5py_read_dataset(
h5_file[self._entry][self._IMG_KEY_CONTROL_PATH]
......@@ -629,7 +629,7 @@ class HDF5TomoScan(TomoScanBase):
def _get_x_y_pixel_values(self):
"""read x and y pixel values"""
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
with HDF5File(self.master_file, "r") as h5_file:
x_pixel_dataset = h5_file[self._entry][self._X_PIXEL_SIZE_PATH]
_x_pixel_size = self._get_value(x_pixel_dataset, default_unit="meter")
y_pixel_dataset = h5_file[self._entry][self._Y_PIXEL_SIZE_PATH]
......@@ -637,7 +637,7 @@ class HDF5TomoScan(TomoScanBase):
return _x_pixel_size, _y_pixel_size
def _get_x_y_magnified_pixel_values(self):
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
with HDF5File(self.master_file, "r") as h5_file:
x_m_pixel_dataset = h5_file[self._entry][self._X_PIXEL_MAG_SIZE_PATH]
_x_m_pixel_size = self._get_value(x_m_pixel_dataset, default_unit="meter")
y_m_pixel_dataset = h5_file[self._entry][self._Y_PIXEL_MAG_SIZE_PATH]
......@@ -718,7 +718,7 @@ class HDF5TomoScan(TomoScanBase):
and os.path.exists(self.master_file)
):
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
with HDF5File(self.master_file, "r") as h5_file:
distance_dataset = h5_file[self._entry][self._DISTANCE_PATH]
self._distance = self._get_value(distance_dataset, default_unit="m")
return self._distance
......@@ -750,7 +750,7 @@ class HDF5TomoScan(TomoScanBase):
and os.path.exists(self.master_file)
):
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
with HDF5File(self.master_file, "r") as h5_file:
energy_dataset = h5_file[self._entry][self._ENERGY_PATH]
self._energy = self._get_value(energy_dataset, default_unit="keV")
return self._energy
......@@ -759,7 +759,7 @@ class HDF5TomoScan(TomoScanBase):
def start_time(self):
if self._start_time is None and self.master_file and os.path.exists:
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
with HDF5File(self.master_file, "r") as h5_file:
if self._START_TIME_PATH in h5_file[self._entry]:
self._start_time = h5py_read_dataset(
h5_file[self._entry][self._START_TIME_PATH]
......@@ -770,7 +770,7 @@ class HDF5TomoScan(TomoScanBase):
def end_time(self):
if self._end_time is None and self.master_file and os.path.exists:
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
with HDF5File(self.master_file, "r") as h5_file:
if self._END_TIME_START in h5_file[self._entry]:
self._end_time = h5py_read_dataset(
h5_file[self._entry][self._END_TIME_START]
......@@ -990,7 +990,7 @@ class HDF5TomoScan(TomoScanBase):
raise ValueError("No master file provided")
if self.entry is None:
raise ValueError("No entry provided")
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
with HDF5File(self.master_file, "r") as h5_file:
if self._entry not in h5_file:
raise ValueError(
"Given entry %s is not in the master "
......
......@@ -285,7 +285,7 @@ class MockHDF5(_ScanMock):
def _append_frame(self, data_, rotation_angle, image_key, image_key_control):
with h5py.File(self.scan_master_file, "r+", swmr=True) as h5_file:
with h5py.File(self.scan_master_file, "a") as h5_file:
entry_one = h5_file.require_group(self.scan_entry)
instrument_grp = entry_one.require_group("instrument")
detector_grp = instrument_grp.require_group("detector")
......@@ -347,7 +347,7 @@ class MockHDF5(_ScanMock):
self._PROJ_COUNT,
]
with h5py.File(self.scan_master_file, "a", swmr=True) as h5_file:
with h5py.File(self.scan_master_file, "a") as h5_file:
entry_one = h5_file.require_group(self.scan_entry)
instrument_grp = entry_one.require_group("instrument")
if "NX_class" not in instrument_grp.attrs:
......@@ -367,7 +367,7 @@ class MockHDF5(_ScanMock):
sample_grp["rotation_angle"] = new_rot_angle
def write_metadata(self, n_radio, scan_range, ref_n, dark_n):
with h5py.File(self.scan_master_file, "a", swmr=True) as h5_file:
with h5py.File(self.scan_master_file, "a") as h5_file:
entry_one = h5_file.require_group(self.scan_entry)
instrument_grp = entry_one.require_group("instrument")
detector_grp = instrument_grp.require_group("detector")
......
......@@ -310,7 +310,7 @@ class TestGetSinogram(HDF5TestBaseClass):
self._normed_volume = numpy.array(normed_frames)
assert self._normed_volume.ndim == 3
self._normed_sinogram_12 = self._normed_volume[:, 12, :]
assert self._normed_sinogram_12.ndim is 2
assert self._normed_sinogram_12.ndim == 2
assert self._normed_sinogram_12.shape == (1500, 20)
def testGetSinogram1(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment