Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 104: add DefaultNeXusType property #105

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2023-09-05 Jan Kotanski <[email protected]>
* add DefaultNeXusType property (#105)
* tagged as v3.34.0

2023-08-10 Jan Kotanski <[email protected]>
* dont change order of channels in the MG configuration (#101)
* tagged as v3.33.0
Expand Down
7 changes: 6 additions & 1 deletion NXSRecSelector.xmi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<classes name="NXSRecSelector" pogoRevision="9.7">
<description description="Tango server with Sardana Recorder settings&#xA;&#xA;Source code: https://github.com/nexdatas/nxsrecselector&#xA;Web page: https://nexdatas.github.io/nxsrecselector&#xA;NexDaTaS Web page: https://nexdatas.github.io&#xA;" title="Selector Server for NeXus Sardana Recorder" sourcePath="/home/jkotan/ndts/nexdatas.recselector" language="Python" filestogenerate="XMI file,Code files,Protected Regions,html Pages" license="GPL" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false" descriptionHtmlExists="false">
<description description="Tango server with Sardana Recorder settings&#xA;&#xA;Source code: https://github.com/nexdatas/nxsrecselector&#xA;Web page: https://nexdatas.github.io/nxsrecselector&#xA;NexDaTaS Web page: https://nexdatas.github.io&#xA;" title="Selector Server for NeXus Sardana Recorder" sourcePath="/home/jkotan/ndts/nexdatas.recselector" language="Python" filestogenerate="XMI file,Protected Regions,html Pages" license="GPL" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false" descriptionHtmlExists="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<identification contact="at desy.de - jan.kotanski" author="jan.kotanski" emailDomain="desy.de" classFamily="Acquisition" siteSpecific="" platform="All Platforms" bus="Not Applicable" manufacturer="DESY" reference=""/>
</description>
Expand Down Expand Up @@ -93,6 +93,11 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<DefaultPropValue>False</DefaultPropValue>
</deviceProperties>
<deviceProperties name="DefaultNeXusType" description="default dynamic component NeXus type">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<DefaultPropValue>NX_CHAR</DefaultPropValue>
</deviceProperties>
<commands name="AvailableComponents" description="Return a list of available component names" execMethod="available_components" displayLevel="OPERATOR" polledPeriod="0">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
Expand Down
6 changes: 6 additions & 0 deletions doc_html/FullDocument.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@
<td> boolean </td>
<td> False <br> </td>
</tr>
<tr>
<td> DefaultNeXusType </td>
<td> default dynamic component NeXus type </td>
<td> String </td>
<td> NX_CHAR <br> </td>
</tr>
</table>
<br><br>
<hr>
Expand Down
6 changes: 6 additions & 0 deletions doc_html/Properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@
<td> boolean </td>
<td> False <br> </td>
</tr>
<tr>
<td> DefaultNeXusType </td>
<td> default dynamic component NeXus type </td>
<td> String </td>
<td> NX_CHAR <br> </td>
</tr>
</table>
</body>
</html>
9 changes: 6 additions & 3 deletions nxsrecconfig/DynamicComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class DynamicComponent(object):

def __init__(self, nexusconfig_device,
defaultpath="/$var.entryname#'scan'$var.serialno:NXentry/"
"NXinstrument/collection"):
"NXinstrument/collection",
defaulttype="NX_CHAR"):
""" constructor

:param nexusconfig_device: configserver configuration server
Expand Down Expand Up @@ -93,6 +94,8 @@ def __init__(self, nexusconfig_device,
self.__links = True
#: (:obj:`bool`) standard dynamic link flag for INIT strategy
self.__ilinks = False
#: (:obj:`str`) default data type
self.__defaulttype = defaulttype

#: (:obj:`dict` <:obj:`str` , :obj:`str`> ) \
#: map of numpy types : NEXUS
Expand Down Expand Up @@ -285,7 +288,7 @@ def __createNonSardanaNodes(self, created, avds, definition,
definition, path, link)
created.append(ds)

shape, nxtype = None, 'NX_CHAR'
shape, nxtype = None, self.__defaulttype
if ds in avds:
dsource = TangoUtils.command(
self.__nexusconfig_device, "dataSources",
Expand All @@ -302,7 +305,7 @@ def __createNonSardanaNodes(self, created, avds, definition,
if dss and shape is None:
shape, nxtype = self.__shapeFromTango(dss[0])
if not nxtype:
nxtype = 'NX_CHAR'
nxtype = self.__defaulttype

nxtype = self.__getProp(
self.__nexustypes, self.__nexuslabels, ds, nxtype)
Expand Down
7 changes: 6 additions & 1 deletion nxsrecconfig/NXSConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ def init_device(self):
defaultpath = self.DefaultNeXusPath or None
defaultzone = self.DefaultTimeZone or None
defaultmntgrp = self.DefaultMntGrp or None
defaultnexustype = self.DefaultNeXusType or None
syncsnapshot = bool(self.SyncSnapshot)
writepoolmotorpositions = bool(self.WritePoolMotorPositions)
self.__stg = STG(self, numberofthreads, defaultpath,
defaultzone, defaultmntgrp, syncsnapshot,
writepoolmotorpositions)
writepoolmotorpositions, defaultnexustype)
self.set_state(tango.DevState.ON)
self.__stg.poolBlacklist = self.PoolBlacklist or []
self.__stg.timerFilters = self.TimerFilters or [
Expand Down Expand Up @@ -1844,6 +1845,10 @@ class NXSRecSelectorClass(tango.DeviceClass):
"default NeXus path",
["/$var.entryname#'scan'$var.serialno:NXentry/"
"NXinstrument/collection"]],
'DefaultNeXusType':
[tango.DevString,
"default dynamic component NeXus data type",
["NX_CHAR"]],
'DefaultTimeZone':
[tango.DevString,
"default Time Zone",
Expand Down
2 changes: 1 addition & 1 deletion nxsrecconfig/Release.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
""" NeXus Sardana Recorder Settings - Release """

#: (:obj:`str`) package version
__version__ = "3.33.0"
__version__ = "3.34.0"
10 changes: 8 additions & 2 deletions nxsrecconfig/Settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class Settings(object):
def __init__(self, server=None, numberofthreads=None,
defaultnexuspath=None,
defaulttimezone=None, defaultmntgrp=None,
syncsnapshot=False, writepoolmotorpositions=False):
syncsnapshot=False, writepoolmotorpositions=False,
defaultnexustype=None):
""" contructor

:param server: NXSRecSelector server
Expand All @@ -68,6 +69,8 @@ def __init__(self, server=None, numberofthreads=None,
:param writepoolmotorpositions: add dynamic components
for all pool motor positions
:type writepoolmotorpositions: :obj:`bool`
:param defaultnexustype: default dynamic component nexus type
:type defaultnexustype: :obj:`str`
"""
#: (:class:`nxsrecconfig.NXSConfig.NXSRecSelector`) Tango server
self.__server = server
Expand All @@ -82,6 +85,9 @@ def __init__(self, server=None, numberofthreads=None,
"/$var.entryname#'scan'$var.serialno:NXentry/" \
"NXinstrument/collection"

#: (:obj:`str`) default NeXus type
self.defaultNeXusType = defaultnexustype or "NX_CHAR"

#: (:obj:`list` <:obj:`str`>) default CanFail DataSources
self.defaultCanFailDataSources = []

Expand Down Expand Up @@ -1322,7 +1328,7 @@ def createDynamicComponent(self, params):
"""
nexusconfig_device = self.__selector.setConfigInstance()
dcpcreator = DynamicComponent(
nexusconfig_device, self.defaultNeXusPath)
nexusconfig_device, self.defaultNeXusPath, self.defaultNeXusType)
if isinstance(params, (list, tuple)):
if len(params) > 0 and params[0]:
dcpcreator.setStepDSources(
Expand Down
Loading