Skip to content

Commit

Permalink
Issue 135: fix ndim value (#136)
Browse files Browse the repository at this point in the history
* set ndim correctly

* update tests

* update Changelog
  • Loading branch information
jkotan authored Feb 6, 2025
1 parent d4590c4 commit e91b5bd
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 106 deletions.
5 changes: 3 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
2024-07-19 Jan Kotanski <[email protected]>
* add support for value_ref_enabled flag (#131)
2025-02-06 Jan Kotanski <[email protected]>
* add support for value_ref_enabled flag and value_ref_pattern (#134)
* fix ndim value (#136)
* tagged as v3.41.0

2024-07-19 Jan Kotanski <[email protected]>
Expand Down
10 changes: 8 additions & 2 deletions nxsrecconfig/ProfileManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,6 @@ def __addChannel(cls, cnf, ctrl, device, fullname, dontdisplay, index,
dct['instrument'] = None
dct['label'] = Utils.tostr(device)
dct['name'] = Utils.tostr(device)
dct['ndim'] = 0
dct['nexus_path'] = u''
dct['normalization'] = 0
dct['output'] = True
Expand All @@ -1510,15 +1509,19 @@ def __addChannel(cls, cnf, ctrl, device, fullname, dontdisplay, index,
if device in dontdisplay:
dct['plot_axes'] = []
dct['plot_type'] = 0
dct['ndim'] = len(dct['shape'] or [])
elif dct['shape'] and len(dct['shape']) == 1:
dct['plot_axes'] = ['<idx>']
dct['plot_type'] = 1
dct['ndim'] = 1
elif dct['shape'] and len(dct['shape']) == 2:
dct['plot_axes'] = ['<idx>', '<idx>']
dct['plot_type'] = 2
dct['ndim'] = 2
else:
dct['plot_axes'] = ['<mov>']
dct['plot_type'] = 1
dct['ndim'] = 0

if valuerefenabled is not None:
dct['value_ref_enabled'] = valuerefenabled
Expand Down Expand Up @@ -1578,7 +1581,6 @@ def __addTangoChannel(cls, cnf, ctrl, device, record, dontdisplay, index):
dct['instrument'] = None
dct['label'] = Utils.tostr(label)
dct['name'] = Utils.tostr(device)
dct['ndim'] = 0
dct['nexus_path'] = u''
dct['normalization'] = 0
dct['output'] = True
Expand All @@ -1587,15 +1589,19 @@ def __addTangoChannel(cls, cnf, ctrl, device, record, dontdisplay, index):
if device in dontdisplay:
dct['plot_axes'] = []
dct['plot_type'] = 0
dct['ndim'] = len(dct['shape'] or [])
elif dct['shape'] and len(dct['shape']) == 1:
dct['plot_axes'] = ['<idx>']
dct['plot_type'] = 1
dct['ndim'] = 1
elif dct['shape'] and len(dct['shape']) == 2:
dct['plot_axes'] = ['<idx>', '<idx>']
dct['plot_type'] = 2
dct['ndim'] = 2
else:
dct['plot_axes'] = ['<mov>']
dct['plot_type'] = 1
dct['ndim'] = 0

dct['source'] = Utils.tostr(source)
ctrlChannels[fullname] = dct
Expand Down
16 changes: 8 additions & 8 deletions test/BasicSettings2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12824,7 +12824,7 @@ def test_updateMntGrp_components_nopool_tango(self):
for i, ds in enumerate(chds):
cnt = self.smychs[str(ds)]
try:
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -13089,7 +13089,7 @@ def test_updateMntGrp_components_nopool_tango_unplottedcomponents(self):
for i, ds in enumerate(chds):
cnt = self.smychs[str(ds)]
try:
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -13391,7 +13391,7 @@ def test_updateMntGrp_components_pool_tango(self):
if i < idmax:
idmax = i
ttdv = tdv
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -13725,7 +13725,7 @@ def test_updateMntGrp_components_pool_tango_unplottedcomponents(self):
if i < idmax:
idmax = i
ttdv = tdv
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -14075,7 +14075,7 @@ def test_updateMntGrp_components_mixed_tango_unplottedcomponents(self):
if i < idmax:
idmax = i
ttdv = tdv
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -14115,7 +14115,7 @@ def test_updateMntGrp_components_mixed_tango_unplottedcomponents(self):
i = chds.index(str(ds))
# print "INDEX", i, ds
try:
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -14489,7 +14489,7 @@ def test_updateMntGrp_components_mixed_tango_orderedchannels(self):
if i < idmax:
idmax = i
ttdv = tdv
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -14529,7 +14529,7 @@ def test_updateMntGrp_components_mixed_tango_orderedchannels(self):
i = chds.index(str(ds))
# print "INDEX", i, ds
try:
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down
16 changes: 8 additions & 8 deletions test/BasicSettings3_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12822,7 +12822,7 @@ def test_updateMntGrp_components_nopool_tango(self):
i = 0
cnt = self.smychs[str(ds)]
try:
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -13091,7 +13091,7 @@ def test_updateMntGrp_components_nopool_tango_unplottedcomponents(self):
i = 0
cnt = self.smychs[str(ds)]
try:
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -13401,7 +13401,7 @@ def test_updateMntGrp_components_pool_tango(self):
if i < idmax:
idmax = i
ttdv = tdv
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -13740,7 +13740,7 @@ def test_updateMntGrp_components_pool_tango_unplottedcomponents(self):
if i < idmax:
idmax = i
ttdv = tdv
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -14095,7 +14095,7 @@ def test_updateMntGrp_components_mixed_tango_unplottedcomponents(self):
if i < idmax:
idmax = i
ttdv = tdv
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -14140,7 +14140,7 @@ def test_updateMntGrp_components_mixed_tango_unplottedcomponents(self):
if i > cri:
i = i + 1
try:
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -14518,7 +14518,7 @@ def test_updateMntGrp_components_mixed_tango_orderedchannels(self):
if i < idmax:
idmax = i
ttdv = tdv
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -14564,7 +14564,7 @@ def test_updateMntGrp_components_mixed_tango_orderedchannels(self):
i = i + 1
# print "INDEX", i, ds
try:
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down
19 changes: 9 additions & 10 deletions test/BasicSettings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12822,7 +12822,7 @@ def test_updateMntGrp_components_nopool_tango_masterfirst(self):
i = 0
cnt = self.smychs[str(ds)]
try:
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -13054,7 +13054,7 @@ def test_updateMntGrp_components_nopool_tango(self):
for i, ds in enumerate(chds):
cnt = self.smychs[str(ds)]
try:
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -13323,7 +13323,7 @@ def test_updateMntGrp_components_nopool_tango_unplottedcomponents(self):
for i, ds in enumerate(chds):
cnt = self.smychs[str(ds)]
try:
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -13629,7 +13629,7 @@ def test_updateMntGrp_components_pool_tango(self):
if i < idmax:
idmax = i
ttdv = tdv
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -13965,7 +13965,7 @@ def test_updateMntGrp_components_pool_tango_unplottedcomponents(self):
if i < idmax:
idmax = i
ttdv = tdv
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -14318,7 +14318,7 @@ def test_updateMntGrp_components_mixed_tango_unplottedcomponents(self):
if i < idmax:
idmax = i
ttdv = tdv
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -14360,7 +14360,7 @@ def test_updateMntGrp_components_mixed_tango_unplottedcomponents(self):
i = chds.index(str(ds))
# print "INDEX", i, ds
try:
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -14736,7 +14736,7 @@ def test_updateMntGrp_components_mixed_tango_orderedchannels(self):
if i < idmax:
idmax = i
ttdv = tdv
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -14778,7 +14778,7 @@ def test_updateMntGrp_components_mixed_tango_orderedchannels(self):
i = chds.index(str(ds))
# print "INDEX", i, ds
try:
chn = {'ndim': 0,
chn = {'ndim': len(cnt['shape']),
'index': i,
'name': str(ds),
'data_type': cnt['data_type'],
Expand Down Expand Up @@ -14820,7 +14820,6 @@ def test_updateMntGrp_components_mixed_tango_orderedchannels(self):
"description": "Measurement Group",
"timer": "%s" % dv,
"label": "mg2"}
# print "SMG", smg
self.myAssertDict(smg, pcnf)
self.myAssertDict(pcnf, cnf)
rs.mntGrp = "nxsmntgrp"
Expand Down
Loading

0 comments on commit e91b5bd

Please sign in to comment.