def _read_output_options(self): parameters = default_parameters() app_data = self.settings.value('output_options', {}, type=dict) parameters['output_directory'] = self._get_output_directory() parameters['time_format'] = app_data.get('time_format', 'iso8601') parameters['average'] = app_data.get('average_bursts', True) custom_cal_path = app_data.get('custom_cal', None) if custom_cal_path: try: custom_cal = make_from_calibration_file(custom_cal_path) parameters['calibration'] = custom_cal except: pass split_size = app_data.get('split', 'Do not split output files') if split_size != 'Do not split output files': parameters['split'] = int(split_size.split(' ')[0]) if self.comboBox_output_type.currentText() == 'Current': parameters['output_type'] = 'current' parameters['tilt_curve'] = \ self.comboBox_tilt_tables.currentData() else: output_type = OUTPUT_TYPE.get( self.comboBox_output_type.currentText(), 'discrete') parameters['output_type'] = output_type parameters['output_format'] = app_data.get('output_format', 'csv') parameters['declination'] = self.dec_model.declination_value() return parameters
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')
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_calibration_missing_value(self): with self.assertRaises(ValueError): file = reference_file('v3_calibration_missing_value.txt') make_from_calibration_file(file)
def calibration_from_file(file_name): file = reference_file(file_name) return make_from_calibration_file(file)