Skip to content

Commit

Permalink
Issue 708: add support for secop meaning dictionary (#709)
Browse files Browse the repository at this point in the history
* add support for secop meaning dict

* fix checks

* add tests

* update manpages
  • Loading branch information
jkotan authored Sep 5, 2024
1 parent dcbd826 commit f3c8ceb
Show file tree
Hide file tree
Showing 12 changed files with 1,932 additions and 108 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2024-08-08 Jan Kotanski <jankotan@gmail.com>
* add support for secop meaning dictionary (#709)
* tagged as v4.14.0

2024-08-08 Jan Kotanski <jankotan@gmail.com>
* fix typo in for device_name in nxsetup (#706)
* tagged as v4.13.1
Expand Down
2 changes: 1 addition & 1 deletion man/nxscollect.1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "NXSCOLLECT" "1" "Jul 18, 2024" "4.13" "NXSTools"
.TH "NXSCOLLECT" "1" "Sep 05, 2024" "4.14" "NXSTools"
.SH NAME
nxscollect \- upload external images into NeXus/HDF5 file
.SH DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion man/nxsconfig.1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "NXSCONFIG" "1" "Jul 18, 2024" "4.13" "NXSTools"
.TH "NXSCONFIG" "1" "Sep 05, 2024" "4.14" "NXSTools"
.SH NAME
nxsconfig \- read NeXus Configuration Server settings
.SH DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion man/nxscreate.1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "NXSCREATE" "1" "Jul 18, 2024" "4.13" "NXSTools"
.TH "NXSCREATE" "1" "Sep 05, 2024" "4.14" "NXSTools"
.SH NAME
nxscreate \- create NeXus Configuration component
.SH DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion man/nxsdata.1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "NXSDATA" "1" "Jul 18, 2024" "4.13" "NXSTools"
.TH "NXSDATA" "1" "Sep 05, 2024" "4.14" "NXSTools"
.SH NAME
nxsdata \- run NeXus Data Writer
.SH DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion man/nxsetup.1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "NXSETUP" "1" "Jul 18, 2024" "4.13" "NXSTools"
.TH "NXSETUP" "1" "Sep 05, 2024" "4.14" "NXSTools"
.SH NAME
nxsetup \- set NeXDaTaS Tango Server environment up
.SH DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion man/nxsfileinfo.1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "NXSFILEINFO" "1" "Jul 18, 2024" "4.13" "NXSTools"
.TH "NXSFILEINFO" "1" "Sep 05, 2024" "4.14" "NXSTools"
.SH NAME
nxsfileinfo \- show metadata of the NeXus file
.SH DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion man/nxstools.1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "NXSTOOLS" "1" "Jul 18, 2024" "4.13" "NXSTools"
.TH "NXSTOOLS" "1" "Sep 05, 2024" "4.14" "NXSTools"
.SH NAME
nxstools \- nxstools Documentation
.sp
Expand Down
51 changes: 43 additions & 8 deletions nxstools/nxscreator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1893,12 +1893,25 @@ def __createSECoPTree(self, df, name, conf, samplename=None,
for mname, mconf in modules.items():
if mname and (not senv or not seenv):
if not modulenames or mname in modulenames:
if not senv and "meaning" in mconf.keys():
senv = NGroup(sample, name or "environment",
"NXenvironment")
if not seenv and "meaning" not in mconf.keys():
seenv = NGroup(sampleenv, name or "environment",
"NXenvironment")
if "meaning" in mconf.keys() and \
isinstance(mconf["meaning"], dict):
if "belongs_to" in mconf["meaning"].keys() and \
mconf["meaning"]["belongs_to"] == "sample":
if not senv:
senv = NGroup(sample, name or "environment",
"NXenvironment")
else:
if not seenv:
seenv = NGroup(sampleenv,
name or "environment",
"NXenvironment")
else:
if not senv and "meaning" in mconf.keys():
senv = NGroup(sample, name or "environment",
"NXenvironment")
if not seenv and "meaning" not in mconf.keys():
seenv = NGroup(sampleenv, name or "environment",
"NXenvironment")
envs = [senv, seenv]
for env in envs:
if env:
Expand Down Expand Up @@ -2047,8 +2060,21 @@ def __createSECoPSensor(self, senv, seenv, name, conf, nodename,
"""
if 'meaning' in conf.keys():
meaning = conf['meaning']
env = senv
basename = samplename
if isinstance(meaning, dict):
mdict = meaning
env = seenv
meaning = None
basename = sampleenvname

if "belongs_to" in mdict.keys() and \
mdict["belongs_to"] == "sample":
env = senv
basename = samplename
if "function" in mdict.keys():
meaning = mdict["function"]
else:
env = senv
basename = samplename
else:
meaning = None
env = seenv
Expand All @@ -2074,6 +2100,15 @@ def __createSECoPSensor(self, senv, seenv, name, conf, nodename,
importance = None
if len(meaning) > 0:
meaning = meaning[0]
if isinstance(meaning, dict):
try:
importance = int(meaning["importance"])
except Exception:
importance = None
try:
meaning = int(meaning["function"])
except Exception:
meaning = None
if meaning in mnTme.keys():
meaning = mnTme[meaning]
field = NField(mgr, 'measurement', 'NX_CHAR')
Expand Down
2 changes: 1 addition & 1 deletion nxstools/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
""" NXS tools release version"""

#: (:obj:`str`) package version
__version__ = "4.13.1"
__version__ = "4.14.0"
Loading

0 comments on commit f3c8ceb

Please sign in to comment.