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
Bliss
bliss
Commits
ee8fdb2a
Commit
ee8fdb2a
authored
Jun 03, 2021
by
Wout De Nolf
Browse files
writer: use the instrument instead of the institute for the NXinstrument title
parent
379164c9
Changes
4
Hide whitespace changes
Inline
Side-by-side
nexus_writer_service/subscribers/scan_writer_publish.py
View file @
ee8fdb2a
...
...
@@ -58,15 +58,7 @@ def fill_instrument_name(scan):
:param bliss.scanning.scan.Scan scan:
"""
logger
.
debug
(
"fill instrument name"
)
instrument
=
config_utils
.
institute
()
beamline
=
config_utils
.
beamline
()
beamline
=
config_utils
.
scan_saving_get
(
"beamline"
,
beamline
)
if
beamline
:
if
instrument
:
instrument
+=
": "
+
beamline
else
:
instrument
=
beamline
return
{
"instrument"
:
instrument
}
return
{
"instrument"
:
config_utils
.
instrument
()}
def
fill_technique_info
(
scan
):
...
...
nexus_writer_service/utils/config_utils.py
View file @
ee8fdb2a
...
...
@@ -143,3 +143,16 @@ def institute():
name
=
root
.
get
(
"laboratory"
,
name
)
name
=
root
.
get
(
"synchrotron"
,
name
)
return
name
def
instrument
():
"""
:returns str:
"""
root
=
static_root
()
name
=
""
name
=
root
.
get
(
"institute"
,
name
)
name
=
root
.
get
(
"laboratory"
,
name
)
name
=
root
.
get
(
"synchrotron"
,
name
)
name
=
root
.
get
(
"instrument"
,
name
)
return
name
tests/nexus_writer/helpers/nxw_test_data.py
View file @
ee8fdb2a
...
...
@@ -430,10 +430,12 @@ def validate_instrument(
softtimer
=
softtimer
,
positioners
=
positioners
,
)
# Positioners
pos_instrument
,
_
,
pos_positioners
=
expected_positioners
(
master_name
=
master_name
,
positioners
=
positioners
,
save_options
=
save_options
)
# Check all subgroups present
if
config
:
expected
=
{
"title"
}
...
...
@@ -450,6 +452,10 @@ def validate_instrument(
"transfocator_simulator"
,
}
assert_set_equal
(
set
(
instrument
.
keys
()),
expected
)
if
config
:
assert
instrument
[
"title"
][()]
==
"esrf-id00a"
# Validate content of positioner NXcollections
for
name
in
expected_posg
:
assert
instrument
[
name
].
attrs
[
"NX_class"
]
==
"NXcollection"
,
name
...
...
@@ -472,10 +478,12 @@ def validate_instrument(
if
name
==
"positioners"
:
expected
|=
set
(
pos_positioners
)
assert_set_equal
(
set
(
instrument
[
name
].
keys
()),
expected
)
# Validate content of NXpositioner groups
for
name
,
content
in
pos_instrument
.
items
():
assert
instrument
[
name
].
attrs
[
"NX_class"
]
==
"NXpositioner"
,
name
assert_set_equal
(
set
(
instrument
[
name
].
keys
()),
set
(
content
),
msg
=
name
)
# Validate content of NXdetector groups
variable_length
=
not
all
(
scan_shape
)
for
name
in
expected_dets
:
...
...
@@ -495,6 +503,7 @@ def validate_instrument(
save_options
,
variable_length
=
variable_length
,
)
# Validate content of other groups
content
=
dictdump
.
nxtodict
(
instrument
[
"beamstop"
],
asarray
=
False
)
assert
content
==
{
"@NX_class"
:
"NXbeam_stop"
,
"status"
:
"in"
}
...
...
tests/nexus_writer/test_writer_config.py
View file @
ee8fdb2a
...
...
@@ -17,6 +17,7 @@ def test_config_withoutpolicy(nexus_writer_config_nopolicy):
validate_writer_config
(
scan_writer_publish
.
writer_config
())
assert
config_utils
.
beamline
()
==
"id00"
assert
config_utils
.
institute
()
==
"ESRF"
assert
config_utils
.
instrument
()
==
"esrf-id00a"
assert
scan_writer_publish
.
default_technique
()
==
"none"
assert
scan_writer_publish
.
current_technique
()
==
"none"
filenames
=
scan_utils
.
session_filenames
(
config
=
True
)
...
...
@@ -30,6 +31,7 @@ def test_config_withpolicy(nexus_writer_config):
validate_writer_config
(
scan_writer_publish
.
writer_config
())
assert
config_utils
.
beamline
()
==
"id00"
assert
config_utils
.
institute
()
==
"ESRF"
assert
config_utils
.
instrument
()
==
"esrf-id00a"
assert
scan_writer_publish
.
default_technique
()
==
"none"
assert
scan_writer_publish
.
current_technique
()
==
"xrfxrd"
filenames
=
scan_utils
.
session_filenames
(
config
=
True
)
...
...
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