def setUp(self): self.data_path = os.path.join(pc.__path__[0], 'data') self.file_path = os.path.join(self.data_path, 'serpentine_dry.txt') self.file_path2 = os.path.join(self.data_path, 'rexolite_PAL.txt') self.fake_path = os.path.join(self.data_path, 'fake.txt') self.dataset1 = pc.run_default(airline_name='VAL', file_path=self.file_path) self.dataset2 = pc.run_default(airline_name='VAL', file_path=self.file_path2, corr=True, freq_cutoff=None) self.dataset3 = pc.run_default(airline_name='VAL', file_path=self.file_path, nrw=True) self.dataset4 = pc.run_default(airline_name='VAL', file_path=self.file_path, nrw=True, corr=True) self.normdataset = pc.AirlineData(*pc.get_METAS_data( airline='VAL', file_path=self.file_path), bulk_density=1.6, name='Serpentine', normalize_density=True) self.normdataset2 = pc.AirlineData(*pc.get_METAS_data(airline='VAL',file_path=self.file_path),\ bulk_density=1.6,name='Serpentine',normalize_density=True,\ norm_eqn='LLL',corr=True,date='date',temperature=25)
def setUp(self): import permittivitycalc as pc self.data_path = os.path.join(pc.__path__[0], 'data') self.file_path = os.path.join(self.data_path, 'serpentine_dry.txt') self.file_path2 = os.path.join(self.data_path, 'rexolite_PAL.txt') self.fake_path = os.path.join(self.data_path, 'fake.txt') self.dataset1 = pc.run_default(airline_name='VAL', file_path=self.file_path) self.dataset2 = pc.run_default(airline_name='VAL', file_path=self.file_path2) self.nonedataset = pc.AirlineData(*pc.get_METAS_data( airline='VAL', file_path=self.file_path2), bulk_density=1.6, name='Serpentine', normalize_density=True, freq_cutoff=None) self.cutdataset = pc.AirlineData(*pc.get_METAS_data( airline='VAL', file_path=self.file_path2), bulk_density=1.6, name='Serpentine', normalize_density=True, freq_cutoff=2e8) self.normdataset = pc.AirlineData(*pc.get_METAS_data( airline='VAL', file_path=self.file_path2), bulk_density=1.6, name='Serpentine', normalize_density=True) self.corrdataset = pc.AirlineData(*pc.get_METAS_data( airline='VAL', file_path=self.file_path2), bulk_density=1.6, name='Serpentine', corr=True)
def test_normalize_density_number(self): """Test density normalization using a value""" print(sys._getframe().f_code.co_name) test = pc.AirlineData\ (*pc.get_METAS_data(airline='VAL',file_path=self.file_path)\ ,bulk_density=3.5,normalize_density=5.8) self.assertIsNotNone(test.norm_dielec) self.assertIsNotNone(test.norm_losstan) with self.assertRaises(Exception): pc.AirlineData(*pc.get_METAS_data(airline='VAL',\ file_path=self.file_path),normalize_density=5.8)
def test_str(self): print(sys._getframe().f_code.co_name) self.assertIsNotNone(self.normdataset2.__str__()) self.assertIsNotNone(self.normdataset.__str__()) self.assertIsNotNone(pc.AirlineData(*pc.get_METAS_data(airline='VAL',\ file_path=self.file_path),normalize_density=5.8\ ,bulk_density=3.5))
def test_normalize_density_value(self): """Test density normalization with value""" print(sys._getframe().f_code.co_name) test = pc.AirlineData\ (*pc.get_METAS_data(airline='VAL',file_path=self.file_path)\ ,normalize_density=1.2,bulk_density=3.5) self.assertIsNotNone(test.norm_dielec) self.assertIsNotNone(test.norm_losstan)
def test_air_gap_correction_corr(self): """test air gab correction with de-embeded data""" print(sys._getframe().f_code.co_name) test = pc.AirlineData\ (*pc.get_METAS_data(airline='VAL',file_path=self.file_path)\ ,particle_diameter=0.01,corr=True) D2 = test.airline_dimensions['D2'] D3 = test.airline_dimensions['D3'] self.assertIsNotNone(test._air_gap_correction(D2, D3))
def test_dims_gal(self): """Test that the proper number of airline dimentions are calculated""" print(sys._getframe().f_code.co_name) self.assertIsNotNone(self.dataset1.airline_dimensions) assert len(self.dataset1.airline_dimensions) == 2 test = pc.AirlineData\ (*pc.get_METAS_data(airline='GAL',file_path=self.file_path)\ ,particle_diameter=0.01) assert len(test.airline_dimensions) == 4
def test_boundary_correct_corr(self): """Test boundary correction with de-embeded date""" print(sys._getframe().f_code.co_name) test = pc.AirlineData\ (*pc.get_METAS_data(airline='VAL',file_path=self.file_path)\ ,normalize_density=True,bulk_density=3.5,solid_dielec=9\ ,particle_diameter=0.01,particle_density=3,corr=True) self.assertIsNotNone(test.bcorr_dielec) self.assertIsNotNone(test.bcorr_losstan)
def test_corr_nrw_1washer_value(self): """Test corr and nrw with 1 washer value""" print(sys._getframe().f_code.co_name) test = pc.AirlineData\ (*pc.get_METAS_data(airline='VAL',file_path=self.file_path),nrw=True,corr=0.12) self.assertIsNotNone(test) self.assertIsNotNone(test.corr_avg_mu_real) self.assertIsNotNone(test.corr_avg_mu_imag) self.assertIsNotNone(test.corr_avg_dielec) self.assertIsNotNone(test.corr_avg_losstan)
def test_nrw(self): """Test nrw""" print(sys._getframe().f_code.co_name) test = pc.AirlineData\ (*pc.get_METAS_data(airline='VAL',file_path=self.file_path),nrw=True) self.assertIsNotNone(test) self.assertIsNotNone(test.avg_mu_real) self.assertIsNotNone(test.avg_mu_imag) self.assertIsNotNone(test.avg_dielec) self.assertIsNotNone(test.avg_losstan)
def test_file_import(self): """Test file import""" print(sys._getframe().f_code.co_name) self.assertIsNotNone(pc.AirlineData\ (*pc.get_METAS_data(airline='VAL',file_path=self.file_path)))
def test_shorted(self): """Test fail to locate shorted sample""" print(sys._getframe().f_code.co_name) with self.assertRaises(Exception): pc.AirlineData(*pc.get_METAS_data(airline='VAL',\ file_path=self.file_path),shorted=True)