Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
kmap
xsocs
Commits
9014ca1d
Commit
9014ca1d
authored
Jan 21, 2020
by
Thomas Vincent
Browse files
Merge branch 'h5py-compat' into 'master'
Add mode argument to call to h5py.File Closes
#80
See merge request
!121
parents
df6fcb62
58850f87
Pipeline
#19888
failed with stages
in 12 minutes and 3 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
9014ca1d
...
...
@@ -10,7 +10,7 @@ stages:
variables
:
PROJECT
:
xsocs
EXTRA_SETUP_PY_CMD_OPTIONS
:
"
build
--no-cython
--no-openmp"
MANYLINUX_PYTHON_VER
:
cp27-cp27m cp27-cp27mu cp34-cp34m cp35-cp35m cp36-cp36m cp37-cp37m cp38-cp38
# Build
...
...
xsocs/gui/project/Hdf5Nodes.py
View file @
9014ca1d
...
...
@@ -201,7 +201,7 @@ class H5Base(Node):
return
newChildren
def
_refreshNode
(
self
):
with
h5py
.
File
(
self
.
h5File
)
as
h5f
:
with
h5py
.
File
(
self
.
h5File
,
mode
=
"r"
)
as
h5f
:
thisItem
=
h5f
[
self
.
h5Path
]
try
:
keys
=
set
(
thisItem
.
keys
())
...
...
xsocs/gui/project/ProjectNodes.py
View file @
9014ca1d
...
...
@@ -544,7 +544,7 @@ class QSpaceItemNode(ProjectNode):
return
os
.
path
.
exists
(
qspaceFile
)
try
:
with
h5py
.
File
(
projectItem
.
filename
)
as
h5f
:
with
h5py
.
File
(
projectItem
.
filename
,
mode
=
"a"
)
as
h5f
:
del
h5f
[
self
.
h5Path
]
except
KeyError
:
pass
...
...
@@ -664,7 +664,7 @@ class FitItemNode(ProjectNode):
return
os
.
path
.
exists
(
fitFile
)
try
:
with
h5py
.
File
(
projectItem
.
filename
)
as
h5f
:
with
h5py
.
File
(
projectItem
.
filename
,
mode
=
"a"
)
as
h5f
:
del
h5f
[
self
.
h5Path
]
except
KeyError
:
pass
...
...
xsocs/process/shift/shift.py
View file @
9014ca1d
...
...
@@ -68,7 +68,7 @@ class ScanShift(object):
self
.
__init_tmp
()
def
__init_tmp
(
self
):
with
h5py
.
File
(
self
.
__tmp_file
)
as
tmp_h5
:
with
h5py
.
File
(
self
.
__tmp_file
,
mode
=
"a"
)
as
tmp_h5
:
ref_p0
,
ref_p1
=
_get_ref_positions
(
self
.
__xsocs_h5
)
tmp_h5
[
'ref_p0'
]
=
ref_p0
tmp_h5
[
'ref_p1'
]
=
ref_p1
...
...
@@ -174,7 +174,7 @@ class ScanShift(object):
if
not
self
.
__dirtyGrids
[
entry
]:
dsetPath
=
'/entries/{0}/grid_indices'
.
format
(
entry
)
with
h5py
.
File
(
self
.
__tmp_file
)
as
tmp_h5
:
with
h5py
.
File
(
self
.
__tmp_file
,
mode
=
"r"
)
as
tmp_h5
:
shifted_idx
=
tmp_h5
.
get
(
dsetPath
)[:]
else
:
with
xsocs_h5
:
...
...
@@ -222,7 +222,7 @@ class ScanShift(object):
+
col_idx
[
valid_idx
])
dsetPath
=
'/entries/{0}/grid_indices'
.
format
(
entry
)
with
h5py
.
File
(
self
.
__tmp_file
)
as
tmp_h5
:
with
h5py
.
File
(
self
.
__tmp_file
,
mode
=
"a"
)
as
tmp_h5
:
if
dsetPath
not
in
tmp_h5
:
tmp_h5
.
create_dataset
(
dsetPath
,
data
=
shifted_idx
)
else
:
...
...
@@ -248,14 +248,14 @@ class ScanShift(object):
dsetPath
=
'/entries/{0}/free_indices'
.
format
(
entry
)
if
not
self
.
__dirtyFrees
[
entry
]:
with
h5py
.
File
(
self
.
__tmp_file
)
as
tmp_h5
:
with
h5py
.
File
(
self
.
__tmp_file
,
mode
=
"r"
)
as
tmp_h5
:
shifted_idx
=
tmp_h5
.
get
(
dsetPath
)[:]
else
:
shifted_idx
=
_get_free_shifted_indices
(
entry
,
self
.
__xsocs_h5
,
self
.
__shifts
,
self
.
__tmp_file
)
with
h5py
.
File
(
self
.
__tmp_file
)
as
tmp_h5
:
with
h5py
.
File
(
self
.
__tmp_file
,
mode
=
"a"
)
as
tmp_h5
:
if
dsetPath
not
in
tmp_h5
:
tmp_h5
.
create_dataset
(
dsetPath
,
data
=
shifted_idx
)
else
:
...
...
@@ -361,7 +361,7 @@ def _get_free_shifted_indices(entry,
ref_p1
=
None
):
if
ref_p0
is
None
or
ref_p1
is
None
:
with
h5py
.
File
(
tmp_file
)
as
tmp_h5
:
with
h5py
.
File
(
tmp_file
,
mode
=
"r"
)
as
tmp_h5
:
if
ref_p0
is
None
:
ref_p0
=
tmp_h5
[
'ref_p0'
][:]
if
ref_p1
is
None
:
...
...
Write
Preview
Markdown
is supported
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