本文整理汇总了Python中detector.Detector.stream方法的典型用法代码示例。如果您正苦于以下问题:Python Detector.stream方法的具体用法?Python Detector.stream怎么用?Python Detector.stream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类detector.Detector
的用法示例。
在下文中一共展示了Detector.stream方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Spectrometer
# 需要导入模块: from detector import Detector [as 别名]
# 或者: from detector.Detector import stream [as 别名]
class Spectrometer(object):
'''This class represents the whole spectrometer.
It bundles the detector and source in one object.
:params detector: the selected detector (0 - builtin, default)
:type detector: int
:params source: the selected light source ('blue' is default)
:type source: str
'''
def __init__(self, **kwargs):
self.init_components(**kwargs)
def init_components(self, **kwargs):
print('Setting up spectrometer')
source = kwargs.get('source', 'blue')
detector = kwargs.get('detector', 0)
assert isinstance(source, str)
assert isinstance(detector, int)
self.source = Source(source)
self.detector = Detector(detector)
def measure(self, num_frames, num_dropped_frames, kind, **kwargs):
'''Executes a measurment.
:params num_frames: number of captured frames
:type num_frames: int
:params num_dropped_frames: number of frames to drop before collecting spectrum frames
:type num_dropped_frames: int
:params kind: The type of measurment. Choices are: 'background', 'spectrum', 'stream'
:type kind: str
'''
if kind == 'spectrum':
#self.source_on()
self.detector.measure_spectrum(num_frames, num_dropped_frames, **kwargs)
#self.source_off()
elif kind == 'background':
#self.source_on()
self.detector.measure_background(num_frames, num_dropped_frames, **kwargs)
#self.source_off()
elif kind == 'stream':
#self.source_on()
self.detector.stream()
#self.source_off()
else:
sys.exit('Measurment type unknow.')