From 3229bb181ad23370b0ca24c84873d0189083baef Mon Sep 17 00:00:00 2001 From: Leo Yan Date: Tue, 5 Jan 2016 15:01:18 +0800 Subject: [PATCH] Instrument: Add channel with ordered sequence When add channel for power meter with specific order, it also imply the order with corresponding fields in captured data. So later need read back the index for channel and use it to reference power data. So need use ordered dictionary object for channel. Signed-off-by: Leo Yan --- devlib/instrument/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/devlib/instrument/__init__.py b/devlib/instrument/__init__.py index 398e880..981dd7b 100644 --- a/devlib/instrument/__init__.py +++ b/devlib/instrument/__init__.py @@ -14,6 +14,7 @@ # import csv import logging +import collections from devlib.utils.types import numeric @@ -167,7 +168,7 @@ class Instrument(object): def __init__(self, target): self.target = target self.logger = logging.getLogger(self.__class__.__name__) - self.channels = {} + self.channels = collections.OrderedDict() self.active_channels = [] # channel management