Ejemplo n.º 1
0
    def measure_spectrum(self, num_frames, num_dropped_frames, **kwargs):
        '''Measures a spectrum.

        :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 show: If true show last grabbed frame
        :type show: bool
        :params name: The spectrum name
        :type name: str
        :returns: spectrum_avg (ndarry): the averaged spectrum
        :raises: AssertionError

        '''
        show = kwargs.get('show', False)
        name = kwargs.get('name', None)
        assert isinstance(show, bool), 'show must be of type bool.'
        assert isinstance(name, str), 'name must be of type str.'

        spectrum = Spectrum(kind='spectrum', name=name)
        spectrum.add_data(
            self._measure(num_frames,
                          num_dropped_frames,
                          kind='spectrum',
                          show=show))
        spectrum.num_frames = num_frames
        return spectrum
Ejemplo n.º 2
0
    def measure_background(self, num_frames, num_dropped_frames, **kwargs):
        '''Measures and returns the background and writes an image file to disk.

        :params num_frames: number of captured frames
        :type num_frames: int
        :params num_dropped_frames: number of dropped frames before collecting background spectrum
        :type num_dropped_frames: int
        :params show: If true show last grabbed frame
        :type show: bool
        :params name: The spectrum name
        :type name: str
        :returns: background_avg (ndarry): the averaged background spectrum

        '''
        show = kwargs.get('show', False)
        name = kwargs.get('name')
        assert isinstance(show, bool), 'show must be of type bool.'
        assert isinstance(name, str), 'name must be of type str.'

        background = Spectrum(kind='background', name=name)
        background.add_data(
            self._measure(num_frames,
                          num_dropped_frames,
                          kind='background',
                          show=show))
        background.num_frames = num_frames
        return background
Ejemplo n.º 3
0
    def measure_background(self, num_frames, num_dropped_frames, **kwargs):
        '''Measures and returns the background and writes an image file to disk.

        :params num_frames: number of captured frames
        :type num_frames: int
        :params num_dropped_frames: number of dropped frames before collecting background spectrum
        :type num_dropped_frames: int
        :params show: If true show last grabbed frame
        :type show: bool
        :params name: The spectrum name
        :type name: str
        :returns: background_avg (ndarry): the averaged background spectrum

        '''
        show = kwargs.get('show', False)
        name = kwargs.get('name')
        assert isinstance(show, bool), 'show must be of type bool.'
        assert isinstance(name, str), 'name must be of type str.'

        background = Spectrum(kind='background', name=name)
        background.add_data(self._measure(num_frames, num_dropped_frames, kind='background', show=show))
        background.num_frames = num_frames
        return background
Ejemplo n.º 4
0
    def measure_spectrum(self, num_frames, num_dropped_frames, **kwargs):
        '''Measures a spectrum.

        :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 show: If true show last grabbed frame
        :type show: bool
        :params name: The spectrum name
        :type name: str
        :returns: spectrum_avg (ndarry): the averaged spectrum
        :raises: AssertionError

        '''
        show = kwargs.get('show', False)
        name = kwargs.get('name', None)
        assert isinstance(show, bool), 'show must be of type bool.'
        assert isinstance(name, str), 'name must be of type str.'

        spectrum = Spectrum(kind='spectrum', name=name)
        spectrum.add_data(self._measure(num_frames, num_dropped_frames, kind='spectrum', show=show))
        spectrum.num_frames = num_frames
        return spectrum