Commit 80f69a28 authored by payno's avatar payno
Browse files

Revert "Merge branch 'h5py_3_compatibility' into 'master'"

This reverts merge request !28
parent b44a4210
Pipeline #36689 passed with stages
in 3 minutes and 42 seconds
......@@ -19,6 +19,7 @@ check_style:
before_script:
- pip install black
script:
- pip install -r requirements.txt
# run black
- LC_ALL=C.UTF-8 black --check --safe .
......@@ -33,14 +34,12 @@ doc:
- arch
- which python
- python --version
- source ./ci/install_scripts.sh
- python -m pip install pip --upgrade
- python -m pip install setuptools --upgrade
- python -m pip install sphinx
- python -m pip install nbsphinx
- python -m pip install nbconvert
- python -m pip install pandoc
- install_silx
- python -m pip install -r requirements.txt
- rm -rf artifacts
- mkdir artifacts
......@@ -67,10 +66,8 @@ doc:
- export LD_LIBRARY_PATH=/lib/x86_64-linux-gnu/:${LD_LIBRARY_PATH}
- export ORANGE_WEB_LOG='False'
- python --version
- source ./ci/install_scripts.sh
- python -m pip install pip --upgrade
- python -m pip install setuptools --upgrade
- install_silx
- python -m pip install -r requirements.txt
- python -m pip install .
script:
......@@ -98,7 +95,6 @@ test:test-tomoscan-tutorials:
- export LD_LIBRARY_PATH=/lib/x86_64-linux-gnu/:${LD_LIBRARY_PATH}
- export ORANGE_WEB_LOG='False'
- python --version
- source ./ci/install_scripts.sh
- python -m pip install pip --upgrade
- python -m pip install setuptools --upgrade
- python -m pip install numpy --upgrade
......@@ -107,7 +103,6 @@ test:test-tomoscan-tutorials:
- python -m pip install nbconvert
- python -m pip install pandoc
- python -m pip install ipykernel
- install_silx
- python -m pip install -r requirements.txt
- python -m pip install fabio --upgrade --pre
- python -m pip install silx --upgrade --pre
......
#!/bin/bash
function install_silx(){
if [ "$2" = 'latest' ]; then
python -m install silx
else
python -m pip install git+https://github.com/silx-kit/silx.git
fi
}
function silx_version(){
python -c 'import silx; print(silx.version)'
}
# silx>=0.14
silx>=0.9
lxml
numpy
\ No newline at end of file
......@@ -321,7 +321,7 @@ def get_project_configuration(dry_run):
install_requires = [
# for the script launcher and pkg_resources
"setuptools",
"silx>=0.14a",
"silx>=0.9",
"lxml",
]
......
......@@ -43,7 +43,6 @@ from tomoscan.io import HDF5File
from silx.io.utils import get_data
from ..unitsystem import metricsystem
from .utils import get_compacted_dataslices
from silx.io.utils import h5py_read_dataset
import typing
import logging
......@@ -444,9 +443,7 @@ class HDF5TomoScan(TomoScanBase):
if self._rotation_angles is None:
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
_rotation_angles = h5py_read_dataset(
h5_file[self._entry][self._ROTATION_ANGLE_PATH]
)
_rotation_angles = h5_file[self._entry][self._ROTATION_ANGLE_PATH][()]
# cast in float
self._rotation_angles = tuple(
[float(angle) for angle in _rotation_angles]
......@@ -458,9 +455,7 @@ class HDF5TomoScan(TomoScanBase):
if self._entry and self._image_keys is None:
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
self._image_keys = h5py_read_dataset(
h5_file[self._entry][self._IMG_KEY_PATH]
)
self._image_keys = h5_file[self._entry][self._IMG_KEY_PATH][()]
return self._image_keys
@property
......@@ -469,9 +464,9 @@ class HDF5TomoScan(TomoScanBase):
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) 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]
)
self._image_keys_control = h5_file[self._entry][
self._IMG_KEY_CONTROL_PATH
][()]
else:
self._image_keys_control = None
return self._image_keys_control
......@@ -568,7 +563,7 @@ class HDF5TomoScan(TomoScanBase):
def _get_fov(self):
with HDF5File(self.master_file, "r", swmr=True, libver="latest") as h5_file:
if self._FOV_PATH in h5_file[self._entry]:
fov = h5py_read_dataset(h5_file[self._entry][self._FOV_PATH])
fov = h5_file[self._entry][self._FOV_PATH][()]
return _FOV.from_value(fov)
else:
return None
......@@ -576,9 +571,7 @@ class HDF5TomoScan(TomoScanBase):
def _get_estimated_cor_frm_motor(self):
with HDF5File(self.master_file, "r", swmr=True, libver="latest") as h5_file:
if self._ESTIMATED_COR_FRM_MOTOR_PATH in h5_file[self._entry]:
value = h5py_read_dataset(
h5_file[self._entry][self._ESTIMATED_COR_FRM_MOTOR_PATH]
)
value = h5_file[self._entry][self._ESTIMATED_COR_FRM_MOTOR_PATH][()]
return float(value)
else:
return None
......@@ -783,7 +776,7 @@ class HDF5TomoScan(TomoScanBase):
Unit can be defined in on of the group attributes. It it is the case
will pick this unit, otherwise will use the default unit
"""
value = h5py_read_dataset(node)
value = node[()]
if "unit" in node.attrs:
unit = node.attrs["unit"]
elif "units" in node.attrs:
......
......@@ -36,7 +36,6 @@ from xml.etree import cElementTree
import fabio
import fabio.edfimage
from .hdf5scan import ImageKey, HDF5TomoScan
from silx.io.utils import h5py_read_dataset
class _ScanMock:
......@@ -294,7 +293,7 @@ class MockHDF5(_ScanMock):
# add data
if "data" in detector_grp:
# read and remove data
current_dataset = h5py_read_dataset(detector_grp["data"])
current_dataset = detector_grp["data"][()]
new_dataset = numpy.append(current_dataset, data_)
del detector_grp["data"]
shape = list(current_dataset.shape)
......@@ -305,7 +304,7 @@ class MockHDF5(_ScanMock):
# add rotation angle
if "rotation_angle" in sample_grp:
new_rot_angle = h5py_read_dataset(sample_grp["rotation_angle"])
new_rot_angle = sample_grp["rotation_angle"][()]
new_rot_angle = numpy.append(new_rot_angle, rotation_angle)
del sample_grp["rotation_angle"]
else:
......@@ -315,7 +314,7 @@ class MockHDF5(_ScanMock):
# add image_key
if "image_key" in detector_grp:
new_image_key = h5py_read_dataset(detector_grp["image_key"])
new_image_key = detector_grp["image_key"][()]
new_image_key = numpy.append(new_image_key, image_key)
del detector_grp["image_key"]
else:
......@@ -325,9 +324,7 @@ class MockHDF5(_ScanMock):
# add image_key_control
if "image_key_control" in detector_grp:
new_image_key_control = h5py_read_dataset(
detector_grp["image_key_control"]
)
new_image_key_control = detector_grp["image_key_control"][()]
new_image_key_control = numpy.append(
new_image_key_control, image_key_control
)
......@@ -339,7 +336,7 @@ class MockHDF5(_ScanMock):
# add count_time
if "count_time" in detector_grp:
new_count_time = h5py_read_dataset(detector_grp["count_time"])
new_count_time = detector_grp["count_time"][()]
new_count_time = numpy.append(new_count_time, self._PROJ_COUNT)
del detector_grp["count_time"]
else:
......
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