Commit 6eda98a7 authored by Jameson Graef Rollins's avatar Jameson Graef Rollins
Browse files

fix ctype mapping for unknown ctypes

There are more ctypes in the wild than I realized, so we should have a
way to handle unknown ctypes.  The unknown ones all seem to not be
trend types, so falling back to "raw" should be sufficient.

closes #186
parent 0baaa8d7
......@@ -20,13 +20,14 @@ from . import nds
logger = logging.getLogger('DATA ')
_ctype_map = {
'online': 'raw',
'raw': 'raw',
'reduced': 'raw',
's-trend': 'sec',
'm-trend': 'min',
def _ctype_map(ctype):
return {
'online': 'raw',
'raw': 'raw',
'reduced': 'raw',
's-trend': 'sec',
'm-trend': 'min',
}.get(ctype, 'raw')
class DataBuffer(object):
......@@ -50,7 +51,7 @@ class DataBuffer(object):
def __init__(self, buf):
"""initialize with NDS-like Buffer object""", mod, self.ctype = nds.parse_channel(
self.trend = _ctype_map[self.ctype]
self.trend = _ctype_map(self.ctype)
# HACK: fix m-trend sample rate. The rate returned from NDS
# is not accurate, seemingly subject to round-off error:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment