def test_normalisation_case_A(self): lib = sqio.Standards(fp=self.tmp_dir) lib.set_active_standards(['Ti', 'Ni']) lib.set_spectrum_range(400.0, 1000.0) lib.normalise(logscale=False)
def test_load(self): # loads a test directory which contains Cu, Ni, Ti and V lib = sqio.Standards(fp=self.tmp_dir) expected = ['Cu', 'Ni', 'Ti', 'V'] actual = list(lib.data.keys()) actual.sort() assert expected == actual
def test_MLLSmodel_point(self): lib = sqio.Standards(fp=self.ref_dir) SI = sqio.Data(fp=os.path.join(self.dat_dir, 'deconv.dm3')) SI.set_data_range(400.0, 500.0) tofit = [ 'Ti', ] lib.set_spectrum_range(400.0, 500.0) model = sqq.MLLSmodel(SI, lib)
def test_active(self): lib = sqio.Standards(fp=self.tmp_dir) lib.set_active_standards(['Ti', 'V']) expected = [False, False, True, True] actual = [] for item in ['Cu', 'Ni', 'Ti', 'V']: actual.append(lib.active[item]) assert expected == actual
def test_MLLSmodel_creation(self): lib = sqio.Standards(fp=self.ref_dir) SI = sqio.Data(fp=os.path.join(self.dat_dir, 'deconv.dm3')) model = sqq.MLLSmodel(SI, lib)
def test_model_creation(self): lib = sqio.Standards(fp=self.ref_dir) SI = sqio.Data(fp=os.path.join(self.dat_dir, 'deconv.dm3')) model = sqb.BayesModel(SI, lib, ['Ti'], (400.0, 480.0))
def test_range_crop_case_D(self): # crop when both limits are beyond data range lib = sqio.Standards(fp=self.tmp_dir) lib.set_active_standards(['Ti']) lib.set_spectrum_range(300.0, 1500.0)
def test_range_crop_case_C(self): # crop when right limit is beyond data range lib = sqio.Standards(fp=self.tmp_dir) lib.set_active_standards(['Ti']) lib.set_spectrum_range(500.0, 1500.0)
def test_range_crop_case_A(self): # crop when both limits are within data range lib = sqio.Standards(fp=self.tmp_dir) lib.set_active_standards(['Ti']) lib.set_spectrum_range(500.0, 600.0)