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
Benoit Rousselle
bliss
Commits
b66a30f7
Commit
b66a30f7
authored
May 16, 2019
by
Linus Pithan
Committed by
Matias Guijarro
May 21, 2019
Browse files
fixed bug in _get_filenames, added related tests
parent
a576bc07
Changes
2
Hide whitespace changes
Inline
Side-by-side
bliss/data/lima.py
View file @
b66a30f7
...
...
@@ -223,11 +223,11 @@ class LimaImageChannelDataNode(DataNode):
raise
RuntimeError
(
"Image %d was not saved"
%
image_nb
)
image_index_in_file
=
image_nb
%
nb_image_per_file
file_nb
=
first_file_number
+
image_
index_in
_file
file_nb
=
first_file_number
+
image_
nb
//
nb_image_per
_file
file_path
=
path_format
%
file_nb
if
file_format
==
"HDF5"
:
returned_params
.
append
(
(
file_path
,
"/entry_%04d"
%
1
,
image_index_in_file
,
file_format
)
(
file_path
,
"/entry_%04d"
%
0
,
image_index_in_file
,
file_format
)
)
else
:
returned_params
.
append
(
...
...
tests/controllers_sw/test_lima_data_node.py
0 → 100644
View file @
b66a30f7
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2015-2019 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
import
pytest
import
numpy
import
glob
from
bliss.common.scans
import
loopscan
,
DEFAULT_CHAIN
def
lima_data_view_test_helper
(
scan
):
scan
.
run
()
for
node
in
scan
.
node
.
iterator
.
walk
(
wait
=
False
,
filter
=
"lima"
):
image_node
=
node
lima_data_view
=
image_node
.
get
(
0
)
lima_data_view
.
_update
()
ref_data
=
scan
.
scan_info
[
"instrument"
][
"lima_simulator"
][
"lima_parameters"
]
lima_files
=
numpy
.
array
(
lima_data_view
.
_get_filenames
(
ref_data
,
*
range
(
0
,
scan
.
scan_info
[
"npoints"
]))
)
filesystem_files
=
sorted
(
glob
.
glob
(
ref_data
[
"saving_directory"
]
+
"/*"
))
return
lima_files
,
filesystem_files
def
lima_data_view_test_assets
(
lima_files
,
filesystem_files
):
for
f
in
filesystem_files
:
assert
f
in
lima_files
[:,
0
]
for
f
in
set
(
lima_files
[:,
0
]):
assert
f
in
filesystem_files
def
test_LimaDataView_edf_1_frame_per_edf
(
beacon
,
lima_simulator
):
simulator
=
beacon
.
get
(
"lima_simulator"
)
scan
=
loopscan
(
5
,
0.1
,
simulator
,
save
=
True
,
run
=
False
)
def
test_LimaDataView_edf_2_frames_per_edf
(
beacon
,
lima_simulator
):
simulator
=
beacon
.
get
(
"lima_simulator"
)
scan
=
loopscan
(
5
,
0.1
,
simulator
,
save
=
True
,
run
=
False
)
sim_params
=
scan
.
acq_chain
.
nodes_list
[
1
].
parameters
sim_params
[
"saving_frame_per_file"
]
=
2
lima_files
,
filesystem_files
=
lima_data_view_test_helper
(
scan
)
lima_data_view_test_assets
(
lima_files
,
filesystem_files
)
def
test_LimaDataView_edf_1_frame_per_hdf5
(
beacon
,
lima_simulator
):
simulator
=
beacon
.
get
(
"lima_simulator"
)
scan
=
loopscan
(
5
,
0.1
,
simulator
,
save
=
True
,
run
=
False
)
sim_params
=
scan
.
acq_chain
.
nodes_list
[
1
].
parameters
sim_params
[
"saving_format"
]
=
"HDF5"
sim_params
[
"saving_suffix"
]
=
".h5"
lima_data_view_test_assets
(
*
lima_data_view_test_helper
(
scan
))
def
test_LimaDataView_edf_2_frames_per_hdf5
(
beacon
,
lima_simulator
):
simulator
=
beacon
.
get
(
"lima_simulator"
)
scan
=
loopscan
(
5
,
0.1
,
simulator
,
save
=
True
,
run
=
False
)
sim_params
=
scan
.
acq_chain
.
nodes_list
[
1
].
parameters
sim_params
[
"saving_format"
]
=
"HDF5"
sim_params
[
"saving_frame_per_file"
]
=
2
sim_params
[
"saving_suffix"
]
=
".h5"
lima_files
,
filesystem_files
=
lima_data_view_test_helper
(
scan
)
lima_data_view_test_assets
(
lima_files
,
filesystem_files
)
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