Ejemplo n.º 1
0
 def test_compass(self):
     full_file_path = reference_file('test.lid')
     parameters = default_parameters()
     parameters['output_type'] = 'compass'
     dc = DataConverter(full_file_path, parameters)
     dc.convert()
     compare_files(reference_file('test_Heading.csv'),
                   reference_file('test_Heading_GS.txt'))
Ejemplo n.º 2
0
 def test_yaw_pitch_roll(self):
     full_file_path = reference_file('test.lid')
     parameters = default_parameters()
     parameters['output_type'] = 'ypr'
     dc = DataConverter(full_file_path, parameters)
     dc.convert()
     compare_files(reference_file('test_YawPitchRoll.csv'),
                   reference_file('test_ypr_GS.txt'))
Ejemplo n.º 3
0
 def test_specify_file_name(self):
     full_file_path = reference_file('test.lid')
     parameters = default_parameters()
     parameters['file_name'] = 'calley'
     dc = DataConverter(full_file_path, parameters)
     dc.convert()
     compare_files(reference_file('calley_AccelMag.csv'),
                   reference_file('test_AccelMag-posix.csv.expect'))
     compare_files(reference_file('calley_Temperature.csv'),
                   reference_file('test_Temperature-posix.csv.expect'))
Ejemplo n.º 4
0
 def test_set_userdata(self):
     with _name_patch():
         appdata_path = reference_file("appdata_dir/")
         environ["APPDATA"] = appdata_path
         filename = "appdata.test"
         set_userdata(filename, "field", "data")
         assert cmp(userdata_path(filename),
                    reference_file("appdata.test.expect"))
         assert "field" in get_userdata(filename)
         rmtree(appdata_path)
Ejemplo n.º 5
0
 def test_custom_calibration(self):
     full_file_path = reference_file('custom_cal/test.lid')
     cal_path = reference_file('custom_cal/hoststorage_default.txt')
     calibration = make_from_calibration_file(cal_path)
     parameters = default_parameters()
     parameters['calibration'] = calibration
     parameters['average'] = False
     dc = DataConverter(full_file_path, parameters)
     dc.convert()
     assert_compare_expected_file('custom_cal/test_AccelMag.csv')
     assert_compare_expected_file('custom_cal/test_Temperature.csv')
Ejemplo n.º 6
0
 def test_current(self):
     full_file_path = reference_file('test.lid')
     tilt_file_path = reference_file('tiltcurve/TCM-1, 1BalSalt.cal')
     tilt_curve = TiltCurve(tilt_file_path)
     parameters = default_parameters()
     parameters['output_type'] = 'current'
     parameters['tilt_curve'] = tilt_curve
     dc = DataConverter(full_file_path, parameters)
     dc.convert()
     assert_compare_expected_file('test_Current.csv')
     assert_compare_expected_file('test_Temperature.csv')
Ejemplo n.º 7
0
 def test_current_with_spike(self):
     full_file_path = reference_file('spike.lid')
     tilt_file_path = reference_file(
         'tiltcurve/TCM-3, Deep Water Meter.cal')
     tilt_curve = TiltCurve(tilt_file_path)
     parameters = default_parameters()
     parameters['output_type'] = 'current'
     parameters['tilt_curve'] = tilt_curve
     dc = DataConverter(full_file_path, parameters)
     dc.convert()
     assert_compare_expected_file('spike_Current.csv')
     assert_compare_expected_file('spike_Temperature.csv')
Ejemplo n.º 8
0
 def test_accel_mag_no_temp(self):
     full_file_path = reference_file('accel_mag_no_temp.lid')
     parameters = default_parameters()
     parameters['average'] = False
     dc = DataConverter(full_file_path, parameters)
     dc.convert()
     assert_compare_expected_file('accel_mag_no_temp_AccelMag.csv')
Ejemplo n.º 9
0
 def test_current_no_accel(self):
     full_file_path = reference_file('temp_mag_no_accel.lid')
     parameters = default_parameters()
     parameters['output_type'] = 'current'
     dc = DataConverter(full_file_path, parameters)
     with self.assertRaises(ValueError):
         dc.convert()
 def test_missing_hss_from_calibration(self):
     """
     HSE is present, but HSS is missing
     """
     with self.assertRaises(ValueError):
         data_file = load_data_file(reference_file('missing_hss.lid'))
         data_file.calibration()
Ejemplo n.º 11
0
 def test_header(self):
     expected_dict = {
         'ACL': True,
         'BAT': '0e5e',
         'BMN': 8,
         'BMR': 8,
         'CLK': '2018-05-25 08:27:07',
         'DFS': 32768,
         'DPL': 2,
         'ETM': '4096-01-01 00:00:00',
         'FWV': '1.8.32.5',
         'LED': True,
         'MGN': True,
         'ORI': 10,
         'PHD': False,
         'PRN': 4,
         'PRR': 4,
         'PRS': False,
         'PWC': '0001',
         'SER': '1805225',
         'STM': '1970-01-01 00:00:00',
         'STS': 1,
         'TMP': True,
         'TRI': 10,
     }
     h = header.header_factory(reference_file('test.lid'))
     h.parse_header()
     assert h._header == expected_dict
Ejemplo n.º 12
0
 def test_conversion(self):
     full_file_path = reference_file('test.lid')
     parameters = default_parameters()
     parameters['average'] = False
     converter = DataConverter(full_file_path, parameters)
     converter.convert()
     assert_compare_expected_file('test_AccelMag.csv')
     assert_compare_expected_file('test_Temperature.csv')
Ejemplo n.º 13
0
 def test_observer(self):
     full_file_path = reference_file('test.lid')
     parameters = default_parameters()
     parameters['average'] = False
     dc = DataConverter(full_file_path, parameters)
     dc.register_observer(lambda percent_done: None)
     dc.convert()
     assert_compare_expected_file('test_AccelMag.csv')
     assert_compare_expected_file('test_Temperature.csv')
Ejemplo n.º 14
0
 def test_load_tiltcurve(self):
     file = 'tiltcurve/TCM-1, No Ballast Washer, Salt Water.cal'
     curve = tiltcurve.TiltCurve(reference_file(file))
     curve.parse()
     assert curve.ballast == 0
     assert curve.salinity == 'Salt'
     assert curve.model == 'TCM-1'
     assert curve.speed_from_tilt(0) == 0
     assert curve.speed_from_tilt(90) == 120
Ejemplo n.º 15
0
 def test_convert_w_posix_time(self):
     full_file_path = reference_file('test.lid')
     parameters = default_parameters()
     parameters['time_format'] = 'posix'
     dc = DataConverter(full_file_path, parameters)
     dc.convert()
     assert_compare_expected_file('test_AccelMag.csv',
                                  'test_AccelMag-posix.csv.expect')
     assert_compare_expected_file('test_Temperature.csv',
                                  'test_Temperature-posix.csv.expect')
    def test_make_v3_serial_string(self):
        expected_str = 'RVN13TMO!!!!!TMR7N=YnTMA3g37`TMB3HeWDTMC1U\\q^' \
                       'AXX^3r#pAXY3o"WbAXZ]$(%<AXV]iUNrAXC371Q,AYX3lUq+' \
                       'AYY^5\'fKAYZ],&@5AYV]XanMAYC[l%)^AZX3pdq^AZY3sJ+' \
                       'AAZZ^5PmKAZV]dm-)AZC2WI`EMXX5EIA\'MXY41=3(MXZ]XM[/' \
                       'MXV`#NikMYX]FW\\@MYY5E\'\\6MYZ]H%>OMYV`8>F#' \
                       'MZX]F[-YMZY47Q=5MZZ5E,?gMZV`<)CMMRF6-$2o'

        file = reference_file('v3_calibration.txt')
        cal = make_from_calibration_file(file)
        serial_str = ''.join(cal.make_serial_string())
        assert serial_str == expected_str
 def test_make_v2_serial_string(self):
     expected_str = 'RVN12TMO30.0TMR710000.0TMAd0.00112381007' \
                    'TMBd0.00023494571TMC98.484e-08AXX6-0.243' \
                    'AXY6-0.006AXZ6-0.002AXV6-0.077AXC30.0AYX50.004' \
                    'AYY6-0.258AYZ4-0.0AYV50.014AYC4-0.0AZX30.0AZY4-0.0' \
                    'AZZ6-0.264AZV6-0.007AZC4-0.0MXX50.166MXY50.005' \
                    'MXZ6-0.001MXV63439.7MYX6-0.004MYY50.164MYZ6-0.008' \
                    'MYV5974.9MZX50.001MZY6-0.011MZZ50.155MZV6-287.3'
     file = reference_file('v2_calibration.txt')
     cal = make_from_calibration_file(file)
     serial_str = ''.join(cal.make_serial_string())
     assert serial_str == expected_str
 def test_load_v3_from_data_file(self):
     load_data_file(reference_file('test.lid'))
Ejemplo n.º 19
0
 def test_header_out_of_order(self):
     with self.assertRaises(ValueError):
         file = 'tiltcurve/out_of_order.cal'
         curve = tiltcurve.TiltCurve(reference_file(file))
         curve.parse()
 def test_calibration_missing_value(self):
     with self.assertRaises(ValueError):
         file = reference_file('v3_calibration_missing_value.txt')
         make_from_calibration_file(file)
 def test_missing_hse(self):
     with self.assertRaises(ValueError):
         sdf = load_data_file(reference_file('missing_hse.lid'))
         sdf.calibration()
Ejemplo n.º 22
0
 def test_temp_comp_magnetometer(self):
     full_file_path = reference_file('TCM1_Calibrate_(0).lid')
     dc = DataConverter(full_file_path, default_parameters())
     dc.convert()
     assert_compare_expected_file('TCM1_Calibrate_(0)_AccelMag.csv')
     assert_compare_expected_file('TCM1_Calibrate_(0)_Temperature.csv')
Ejemplo n.º 23
0
 def test_unsupported_format(self):
     full_file_path = reference_file('test.lid')
     parameters = default_parameters()
     parameters['output_format'] = 'unsupported'
     with self.assertRaises(ValueError):
         DataConverter(full_file_path, parameters).convert()
Ejemplo n.º 24
0
 def test_userdata_path_posix(self):
     with _name_patch(name="posix"):
         environ["HOME"] = reference_file("appdata_dir/")
         assert POSIX_SUBDIR in userdata_path()
Ejemplo n.º 25
0
 def test_extra_line(self):
     with self.assertRaises(ValueError):
         file = 'tiltcurve/extra_line.cal'
         curve = tiltcurve.TiltCurve(reference_file(file))
         curve.parse()
 def test_load_v2_from_data_file(self):
     load_data_file(reference_file('v2_datafile.lid'))
Ejemplo n.º 27
0
 def test_compare_avg_lid_files(self):
     file1 = reference_file('compare_data_files/test_accelmag1.csv')
     file2 = reference_file('compare_data_files/test_accelmag2.csv')
     compare_files(file1, file2)
Ejemplo n.º 28
0
 def test_compare_mlc_to_converter(self):
     file1 = reference_file('compare_data_files/test_accelmag.csv')
     file2 = reference_file('compare_data_files/test_MA.txt')
     compare_files(file1, file2)
 def test_empty_calibration(self):
     load_data_file(reference_file('empty_calibration.lid'))
Ejemplo n.º 30
0
 def test_data_converter_creation(self):
     full_file_path = reference_file("test.lid")
     parameters = default_parameters()
     parameters['output_format'] = 'csv'
     DataConverter(full_file_path, parameters)