@@ -204,6 +204,79 @@ def test_sensor_loaders(raw_path, sensor_type):
204204 with pytest .raises (TypeError ):
205205 sensor_type ([])
206206
207+ @pytest .mark .parametrize ('sensor_type' ,
208+ [android .AndroidRawMag ,
209+ android .AndroidRawGyro ,
210+ android .AndroidRawAccel ,
211+ android .AndroidRawOrientation ,
212+ ])
213+ @pytest .mark .parametrize ('raw_path' ,
214+ [
215+ lazy_fixture ("sensors_raw_path" ),
216+ ])
217+ def test_sensor_content (raw_path , sensor_type ):
218+ """Test that sensor loaders contain data.
219+
220+ Parameters
221+ ----------
222+ raw_path : pytest.fixture
223+ Path to Android Raw measurements text log file
224+ sensor_type : NavData
225+ Type of NavData object
226+
227+ """
228+
229+ test_navdata = sensor_type (input_path = raw_path )
230+
231+ if sensor_type == android .AndroidRawMag :
232+ uncalmag = test_navdata [["unix_millis" ,"mag_x_uncal_microt" ,
233+ "mag_y_uncal_microt" ,"mag_z_uncal_microt" ,
234+ "mag_bias_x_microt" ,"mag_bias_y_microt" ,
235+ "mag_bias_z_microt" ],0 ]
236+ uncalmag_expected = np .array ([1699400576748 ,- 54.1436 ,- 88.937996 ,
237+ - 147.3638 ,- 79.950134 ,- 76.57953 ,
238+ - 113.967804 ])
239+ np .testing .assert_array_equal (uncalmag ,uncalmag_expected )
240+ mag = test_navdata [["unix_millis" ,"mag_x_microt" ,
241+ "mag_y_microt" ,"mag_z_microt" ],1 ]
242+ mag_expected = np .array ([1699400576748 ,- 54.1436 ,- 88.937996 ,
243+ - 147.3638 ])
244+ np .testing .assert_array_equal (mag ,mag_expected )
245+ if sensor_type == android .AndroidRawGyro :
246+ uncalgyro = test_navdata [["unix_millis" ,"ang_vel_x_uncal_radps" ,
247+ "ang_vel_y_uncal_radps" ,"ang_vel_z_uncal_radps" ,
248+ "DriftXRadPerSec" ,"DriftYRadPerSec" ,
249+ "DriftZRadPerSec" ],0 ]
250+ uncalgyro_expected = np .array ([1699400576750 ,- 0.06261369 ,
251+ - 0.09315695 ,0.036651913 ,
252+ - 0.0020643917 ,- 0.0038384064 ,
253+ - 0.0013324362 ])
254+ np .testing .assert_array_equal (uncalgyro ,uncalgyro_expected )
255+ gyro = test_navdata [["unix_millis" ,"ang_vel_x_radps" ,
256+ "ang_vel_y_radps" ,
257+ "ang_vel_z_radps" ],1 ]
258+ gyro_expected = np .array ([1699400576750 ,- 0.06261369 ,- 0.09315695 ,0.036651913 ])
259+ np .testing .assert_array_equal (gyro ,gyro_expected )
260+ if sensor_type == android .AndroidRawAccel :
261+ uncalaccel = test_navdata [["unix_millis" ,"acc_x_uncal_mps2" ,
262+ "acc_y_uncal_mps2" ,"acc_z_uncal_mps2" ,
263+ "acc_bias_x_mps2" ,"acc_bias_y_mps2" ,
264+ "acc_bias_z_mps2" ],0 ]
265+ uncalaccel_expected = np .array ([1699400576750 ,0.17288144 ,
266+ 0.44925246 ,9.886545 ,0.065623306 ,
267+ 0.002461203 ,- 0.031848617 ])
268+ np .testing .assert_array_equal (uncalaccel ,uncalaccel_expected )
269+ accel = test_navdata [["unix_millis" ,"acc_x_mps2" ,
270+ "acc_y_mps2" ,"acc_z_mps2" ],1 ]
271+ accel_expected = np .array ([1699400576750 ,
272+ 0.17288144 ,0.44925246 ,9.886545 ])
273+ np .testing .assert_array_equal (accel ,accel_expected )
274+ if sensor_type == android .AndroidRawOrientation :
275+ deg = test_navdata [["unix_millis" ,"yaw_rx_deg" ,
276+ "roll_rx_deg" ,"pitch_rx_deg" ]]
277+ deg_expected = np .array ([1699400576750 ,245.0 ,0.0 ,- 2.0 ])
278+ np .testing .assert_array_equal (deg ,deg_expected )
279+
207280def test_fix_raw (android_raw_path ):
208281 """Test that AndroidRawFixes initialization
209282
0 commit comments