Cannot remove disabled counter from MG
Counters cannot be removed from measurement groups right away if they are disabled.
It is something desired ?
TEST_SESSION [2]: ACTIVE_MG.disable(diode)
TEST_SESSION [3]: ACTIVE_MG
Out [3]: MeasurementGroup: test_mg (state='default')
- Existing states : 'default'
Enabled Disabled
------- -------
diode
TEST_SESSION [4]: ACTIVE_MG.remove(diode)
TEST_SESSION [5]: ACTIVE_MG
Out [5]: MeasurementGroup: test_mg (state='default')
- Existing states : 'default'
Enabled Disabled
------- -------
diode
TEST_SESSION [6]: ACTIVE_MG.enable(diode)
TEST_SESSION [7]: ACTIVE_MG
Out [7]: MeasurementGroup: test_mg (state='default')
- Existing states : 'default'
Enabled Disabled
------- -------
TEST_SESSION [8]:
The implementation is:
def remove(self, *cnt_or_names):
"""
Remove counters from measurement group
"""
counters_names = [c if isinstance(c, str) else c.name for c in cnt_or_names]
for cnt in counters_names:
if cnt in self._available_counters:
self._available_counters.remove(cnt)
self.__config["counters"] = self._available_counters
self.__config.save()
I suggest to enable counters before removal self.enable(*counters_name)