irrad_control/gui/widgets/plot_widgets.py
def update_period(self, period):
        """Update the period of time for which the data is displayed in seconds"""

        # Update attribute
        self._period = period

        # Create new data and time
        shape = int(round(self._drate) * self._period + 1)
        new_data = OrderedDict([(ch, np.zeros(shape=shape)) for i, ch in enumerate(self.channels)])
        new_time = np.zeros(shape=shape)

        # Check whether new time and data hold more or less indices
        decreased = True if self._time.shape[0] >= shape else False

        if decreased:
            # Cut time axis
            new_time = self._time[:shape]

            # If filled before, go to 0, else go to 0 if currnt index is bigger than new shape
            if self._filled:
                self._idx = 0
            else:
                self._idx = 0 if self._idx >= shape else self._idx

            # Set wheter the array is now filled
            self._filled = True if self._idx == 0 else False

        else:
            # Extend time axis
            new_time[:self._time.shape[0]] = self._time

            # If array was filled before, go to last time, set it as offset and start from last timestamp
            if self._filled:
                self._idx = self._time.shape[0]
                self._start = self._timestamp
                self._offset = self._time[-1]

            self._filled = False

        # Set new time and data
        for ch in self.channels:
            if decreased:
                new_data[ch] = self._data[ch][:shape]
            else:
                new_data[ch][:self._data[ch].shape[0]] = self._data[ch]

        # Update
        self._time = new_time
        self._data = new_data
Update the period of time for which the data is displayed in seconds
Update the period of time for which the data is displayed in seconds
Update the period of time for which the data is displayed in seconds
def update_period(self, period):
        self._period = period
        shape = int(round(self._drate) * self._period + 1)
        new_data = OrderedDict([(ch, np.zeros(shape=shape)) for i, ch in enumerate(self.channels)])
        new_time = np.zeros(shape=shape)
        decreased = True if self._time.shape[0] >= shape else False
        if decreased:
            new_time = self._time[:shape]
            if self._filled:
                self._idx = 0
            else:
                self._idx = 0 if self._idx >= shape else self._idx
            self._filled = True if self._idx == 0 else False
        else:
            new_time[:self._time.shape[0]] = self._time
            if self._filled:
                self._idx = self._time.shape[0]
                self._start = self._timestamp
                self._offset = self._time[-1]
            self._filled = False
        for ch in self.channels:
            if decreased:
                new_data[ch] = self._data[ch][:shape]
            else:
                new_data[ch][:self._data[ch].shape[0]] = self._data[ch]
        self._time = new_time
        self._data = new_data
def update_period ( self , period ) : self . _period = period shape = int ( round ( self . _drate ) * self . _period + 1 ) new_data = OrderedDict ( [ ( ch , np . zeros ( shape = shape ) ) for i , ch in enumerate ( self . channels ) ] ) new_time = np . zeros ( shape = shape ) decreased = True if self . _time . shape [ 0 ] >= shape else False if decreased : new_time = self . _time [ : shape ] if self . _filled : self . _idx = 0 else : self . _idx = 0 if self . _idx >= shape else self . _idx self . _filled = True if self . _idx == 0 else False else : new_time [ : self . _time . shape [ 0 ] ] = self . _time if self . _filled : self . _idx = self . _time . shape [ 0 ] self . _start = self . _timestamp self . _offset = self . _time [ - 1 ] self . _filled = False for ch in self . channels : if decreased : new_data [ ch ] = self . _data [ ch ] [ : shape ] else : new_data [ ch ] [ : self . _data [ ch ] . shape [ 0 ] ] = self . _data [ ch ] self . _time = new_time self . _data = new_data
Update the period of time for which the data is displayed in seconds
Update the period of time for which the data is displayed in seconds
"""Update the period of time for which the data is displayed in seconds""" # Update attribute # Create new data and time # Check whether new time and data hold more or less indices # Cut time axis # If filled before, go to 0, else go to 0 if currnt index is bigger than new shape # Set wheter the array is now filled # Extend time axis # If array was filled before, go to last time, set it as offset and start from last timestamp # Set new time and data # Update
self
period