Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tomotools
tomoscan
Commits
7ebfcf6e
Commit
7ebfcf6e
authored
Nov 20, 2020
by
payno
Browse files
Merge branch 'revert-
adb08973
' into 'master'
Move to h5py 3.x See merge request
!31
parents
7e6792cd
80b6ddf7
Pipeline
#37574
canceled with stages
in 4 minutes and 50 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
7ebfcf6e
...
...
@@ -19,7 +19,6 @@ check_style:
before_script
:
-
pip install black
script
:
-
pip install -r requirements.txt
# run black
-
LC_ALL=C.UTF-8 black --check --safe .
...
...
@@ -34,12 +33,14 @@ 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
...
...
@@ -66,8 +67,10 @@ 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
:
...
...
@@ -95,6 +98,7 @@ 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
...
...
@@ -103,6 +107,7 @@ 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
...
...
ci/install_scripts.sh
0 → 100644
View file @
7ebfcf6e
#!/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)'
}
requirements.txt
View file @
7ebfcf6e
silx
>=0.
9
#
silx>=0.
14
lxml
numpy
\ No newline at end of file
setup.py
View file @
7ebfcf6e
...
...
@@ -321,7 +321,7 @@ def get_project_configuration(dry_run):
install_requires
=
[
# for the script launcher and pkg_resources
"setuptools"
,
"silx>=0.
9
"
,
"silx>=0.
14a
"
,
"lxml"
,
]
...
...
tomoscan/esrf/hdf5scan.py
View file @
7ebfcf6e
...
...
@@ -43,6 +43,7 @@ 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
...
...
@@ -455,7 +456,9 @@ 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
=
h5_file
[
self
.
_entry
][
self
.
_ROTATION_ANGLE_PATH
][()]
_rotation_angles
=
h5py_read_dataset
(
h5_file
[
self
.
_entry
][
self
.
_ROTATION_ANGLE_PATH
]
)
# cast in float
self
.
_rotation_angles
=
tuple
(
[
float
(
angle
)
for
angle
in
_rotation_angles
]
...
...
@@ -467,7 +470,9 @@ 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
=
h5_file
[
self
.
_entry
][
self
.
_IMG_KEY_PATH
][()]
self
.
_image_keys
=
h5py_read_dataset
(
h5_file
[
self
.
_entry
][
self
.
_IMG_KEY_PATH
]
)
return
self
.
_image_keys
@
property
...
...
@@ -476,9 +481,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
=
h5
_file
[
self
.
_entry
][
self
.
_IMG_KEY_CONTROL_PATH
][()]
self
.
_image_keys_control
=
h5
py_read_dataset
(
h5_file
[
self
.
_entry
][
self
.
_IMG_KEY_CONTROL_PATH
]
)
else
:
self
.
_image_keys_control
=
None
return
self
.
_image_keys_control
...
...
@@ -575,7 +580,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
=
h5_file
[
self
.
_entry
][
self
.
_FOV_PATH
]
[()]
fov
=
h5py_read_dataset
(
h5_file
[
self
.
_entry
][
self
.
_FOV_PATH
]
)
return
_FOV
.
from_value
(
fov
)
else
:
return
None
...
...
@@ -583,7 +588,9 @@ 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
=
h5_file
[
self
.
_entry
][
self
.
_ESTIMATED_COR_FRM_MOTOR_PATH
][()]
value
=
h5py_read_dataset
(
h5_file
[
self
.
_entry
][
self
.
_ESTIMATED_COR_FRM_MOTOR_PATH
]
)
return
float
(
value
)
else
:
return
None
...
...
@@ -788,7 +795,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
=
node
[()]
value
=
h5py_read_dataset
(
node
)
if
"unit"
in
node
.
attrs
:
unit
=
node
.
attrs
[
"unit"
]
elif
"units"
in
node
.
attrs
:
...
...
tomoscan/esrf/mock.py
View file @
7ebfcf6e
...
...
@@ -36,6 +36,7 @@ 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
:
...
...
@@ -293,7 +294,7 @@ class MockHDF5(_ScanMock):
# add data
if
"data"
in
detector_grp
:
# read and remove data
current_dataset
=
detector_grp
[
"data"
]
[()]
current_dataset
=
h5py_read_dataset
(
detector_grp
[
"data"
]
)
new_dataset
=
numpy
.
append
(
current_dataset
,
data_
)
del
detector_grp
[
"data"
]
shape
=
list
(
current_dataset
.
shape
)
...
...
@@ -304,7 +305,7 @@ class MockHDF5(_ScanMock):
# add rotation angle
if
"rotation_angle"
in
sample_grp
:
new_rot_angle
=
sample_grp
[
"rotation_angle"
]
[()]
new_rot_angle
=
h5py_read_dataset
(
sample_grp
[
"rotation_angle"
]
)
new_rot_angle
=
numpy
.
append
(
new_rot_angle
,
rotation_angle
)
del
sample_grp
[
"rotation_angle"
]
else
:
...
...
@@ -314,7 +315,7 @@ class MockHDF5(_ScanMock):
# add image_key
if
"image_key"
in
detector_grp
:
new_image_key
=
detector_grp
[
"image_key"
]
[()]
new_image_key
=
h5py_read_dataset
(
detector_grp
[
"image_key"
]
)
new_image_key
=
numpy
.
append
(
new_image_key
,
image_key
)
del
detector_grp
[
"image_key"
]
else
:
...
...
@@ -324,7 +325,9 @@ class MockHDF5(_ScanMock):
# add image_key_control
if
"image_key_control"
in
detector_grp
:
new_image_key_control
=
detector_grp
[
"image_key_control"
][()]
new_image_key_control
=
h5py_read_dataset
(
detector_grp
[
"image_key_control"
]
)
new_image_key_control
=
numpy
.
append
(
new_image_key_control
,
image_key_control
)
...
...
@@ -336,7 +339,7 @@ class MockHDF5(_ScanMock):
# add count_time
if
"count_time"
in
detector_grp
:
new_count_time
=
detector_grp
[
"count_time"
]
[()]
new_count_time
=
h5py_read_dataset
(
detector_grp
[
"count_time"
]
)
new_count_time
=
numpy
.
append
(
new_count_time
,
self
.
_PROJ_COUNT
)
del
detector_grp
[
"count_time"
]
else
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment