Пример #1
0
 def test_to_time_series(self):
     sensordata = SensorData()
     sensordata.id_sensor_data = 1
     recordset = Recordset()
     sensordata.recordset = recordset
     sensor = Sensor()
     sensor.sampling_rate = 5
     sensor.data_rate = 1
     sensordata.sensor = sensor
     channel = Channel()
     sensordata.channel = channel
     sensordata.start_timestamp = datetime.datetime.fromtimestamp(0)
     sensordata.stop_timestamp = datetime.datetime.fromtimestamp(0)
     sensordata.data = np.array([1, 2, 3, 4, 5], dtype=float)
     print(sensordata.to_time_series())
     print(sensordata)
Пример #2
0
    def test_properties(self):
        sensordata = SensorData()
        sensordata.id_sensor_data = 1
        recordset = Recordset()
        sensordata.recordset = recordset
        sensor = Sensor()
        sensordata.sensor = sensor
        channel = Channel()
        sensordata.channel = channel
        sensordata.data_timestamp = 10
        sensordata.data = [1, 2, 3, 4, 5]

        self.assertEqual(sensordata.id_sensor_data, 1)
        self.assertEqual(sensordata.recordset, recordset)
        self.assertEqual(sensordata.sensor, sensor)
        self.assertEqual(sensordata.channel, channel)
        self.assertEqual(sensordata.data_timestamp, 10)
        self.assertEqual(sensordata.data, [1, 2, 3, 4, 5])
Пример #3
0
    def test_to_time_series(self):
        sensordata = SensorData()
        sensordata.id_sensor_data = 1
        recordset = Recordset()
        sensordata.recordset = recordset
        sensor = Sensor()
        sensor.sampling_rate = 5
        sensor.data_rate = 1
        sensordata.sensor = sensor
        channel = Channel()
        sensordata.channel = channel

        sensordata.data = np.array([1, 2, 3, 4, 5], dtype=float)

        sensordata.timestamps = SensorTimestamps()
        sensordata.timestamps.timestamps = np.array([0, 1, 2, 3, 4],
                                                    dtype=np.float64)
        sensordata.timestamps.update_timestamps()

        print(sensordata.to_time_series())
        print(sensordata)