def test_sio_magic_success_with_wd(self): options = {} dir_path = os.path.join('data_files', 'Measurement_Import', 'sio_magic') options['mag_file'] = os.path.join('sio_af_example.dat') options['meas_file'] = os.path.join('sio_af_example.magic') options['dir_path'] = dir_path program_ran, file_name = sio_magic.convert(**options) self.assertTrue(program_ran) self.assertEqual(os.path.realpath(file_name), os.path.realpath(os.path.join(dir_path, options['meas_file'])))
def test_sio_magic_fail_with_coil(self): options = {} options['mag_file'] = os.path.join(WD, 'data_files', 'Measurement_Import', 'sio_magic', 'sio_af_example.dat') meas_file = os.path.join(WD, 'data_files', 'Measurement_Import', 'sio_magic', 'sio_af_example.magic') options['meas_file'] = meas_file options['coil'] = 4 program_ran, error_message = sio_magic.convert(**options) self.assertFalse(program_ran) self.assertEqual(error_message, '4 is not a valid coil specification')
def test_sio_magic_succeed_option4(self): options = {} options['mag_file'] = os.path.join(WD, 'data_files', 'Measurement_Import', 'sio_magic', 'sio_af_example.dat') meas_file = os.path.join(WD, 'data_files', 'Measurement_Import', 'sio_magic', 'sio_af_example.magic') options['meas_file'] = meas_file options['samp_con'] = '4-2' program_ran, file_name = sio_magic.convert(**options) self.assertTrue(program_ran) self.assertEqual(file_name, meas_file)
def test_sio_magic_fail_option4(self): options = {} options['mag_file'] = os.path.join(WD, 'data_files', 'Measurement_Import', 'sio_magic', 'sio_af_example.dat') meas_file = os.path.join(WD, 'data_files', 'Measurement_Import', 'sio_magic', 'sio_af_example.magic') options['meas_file'] = meas_file options['samp_con'] = '4' program_ran, error_message = sio_magic.convert(**options) self.assertFalse(program_ran) self.assertEqual(error_message, "naming convention option [4] must be in form 4-Z where Z is an integer")
def test_sio_magic_success_with_wd(self): options = {} dir_path = os.path.join('data_files', 'Measurement_Import', 'sio_magic') options['mag_file'] = os.path.join('sio_af_example.dat') options['meas_file'] = os.path.join('sio_af_example.magic') options['dir_path'] = dir_path program_ran, file_name = sio_magic.convert(**options) self.assertTrue(program_ran) self.assertEqual( os.path.realpath(file_name), os.path.realpath(os.path.join(dir_path, options['meas_file'])))
def test_sio_magic_success(self): options = {} dir_path = os.path.join('data_files', 'Measurement_Import', 'sio_magic') options['mag_file'] = os.path.join(dir_path, 'sio_af_example.dat') options['meas_file'] = os.path.join(dir_path, 'sio_af_example.magic') program_ran, file_name = sio_magic.convert(**options) self.assertTrue(program_ran) self.assertEqual(os.path.realpath(file_name), os.path.realpath(options['meas_file'])) meas_df = nb.MagicDataFrame(options['meas_file']) self.assertIn('sequence', meas_df.df.columns) self.assertEqual(0, meas_df.df.iloc[0]['sequence'])
def test_sio_magic_fail_option4(self): options = {} options['mag_file'] = os.path.join(WD, 'data_files', 'Measurement_Import', 'sio_magic', 'sio_af_example.dat') meas_file = os.path.join(WD, 'data_files', 'Measurement_Import', 'sio_magic', 'sio_af_example.magic') options['meas_file'] = meas_file options['samp_con'] = '4' program_ran, error_message = sio_magic.convert(**options) self.assertFalse(program_ran) self.assertEqual( error_message, "naming convention option [4] must be in form 4-Z where Z is an integer" )
def test_sio_magic_no_files(self): program_ran, error_message = sio_magic.convert() self.assertFalse(program_ran) self.assertEqual(error_message, 'mag_file field is required option')