def next_command(self, delta): samples = self.signal.acquire() self.calls += 1 if samples and samples > 0: matrix = self.signal.getdata(samples) raw_command = RawSignalCommand(delta, matrix, samples/self.signal.channels(), self.signal.channels(), self.timer) raw_command.matrix = matrix raw_command.data_matrix = matrix[:, :-RawSignalCommand.TriggerCount] else: raise EOFError("FileSignalReceiver: FileSignal complete; calls = "+str(self.calls)) assert raw_command return raw_command
def next_command(self, delta): samples = self.signal.acquire() if samples and samples > 0: c_data = self.signal.getdata(samples) raw_data_vector = np.array(c_data) assert raw_data_vector.size % self.signal.channels() == 0 assert raw_data_vector[-1] == 0 raw_data_vector[-1] = self.timer.elapsedMicroSecs() raw_command = RawSignalCommand(delta, raw_data_vector, samples/self.signal.channels(), self.signal.channels(), self.timer) else: raw_command = RawSignalCommand(delta, np.array([]), 1, self.signal.channels(), self.timer) if raw_command.is_valid(): raw_command.make_matrix() assert raw_command return raw_command
def create_raw_command(delta, data, samples, channels, timer): return RawSignalCommand(delta, data, samples, channels, timer)