def test_experiment_chisq_filesigma(self): from itcsimlib.itc_experiment import ITCExperiment from itcsimlib.mass_spec import MSExperiment E = MSExperiment(get_test_data('massspec_2.txt'),sigma=None) Q = np.zeros(shape=(E.npoints/E.npops,E.npops)) self.assertEqual(round(E.get_chisq(Q),1), 282.0) self.assertEqual(round(E.sigma,2), 0.01)
def test_experiment_chisq_filesigma(self): from itcsimlib.itc_experiment import ITCExperiment from itcsimlib.mass_spec import MSExperiment E = MSExperiment(get_test_data('massspec_2.txt'), sigma=None) Q = np.zeros(shape=(int(E.npoints / E.npops), E.npops)) self.assertEqual(round(E.get_chisq(Q), 1), 282.0) self.assertEqual(round(E.sigma, 2), 0.01)
def test_experiment_plot(self): from itcsimlib.mass_spec import MSExperiment E = MSExperiment(get_test_data('massspec_1.txt')) E.make_plot(hardcopy=True, hardcopydir=self.test_dir, hardcopytype="png") self.assertTrue( os.path.isfile(os.path.join(self.test_dir, "massspec_1.png")))
def test_converted_model(self): from itcsimlib.mass_spec import MSExperiment self.sim.remove_all_experiments() self.sim.add_experiment( MSExperiment(get_test_data('massspec_1.txt')) ) self.assertEqual(round(self.sim.run(),1), 43.9) self.sim.set_model_params(dGX=-27000,dGY=-25000,dGZ=-30000) self.assertEqual(round(self.sim.run(),1), 135.5)
def test_converted_model(self): from itcsimlib.mass_spec import MSExperiment self.sim.remove_all_experiments() self.sim.add_experiment(MSExperiment(get_test_data('massspec_1.txt'))) self.assertEqual(round(self.sim.run(), 1), 43.9) self.sim.set_model_params(dGX=-27000, dGY=-25000, dGZ=-30000) self.assertEqual(round(self.sim.run(), 1), 135.5)
def test_experiment_chisq_fixedsigma(self): from itcsimlib.itc_experiment import ITCExperiment from itcsimlib.mass_spec import MSExperiment E = MSExperiment(get_test_data('massspec_1.txt'),sigma=0.05) Q = np.zeros(shape=(E.npoints/E.npops,E.npops)) self.assertEqual(round(E.get_chisq(Q),1), 292.8)
def test_experiment_export(self): from itcsimlib.mass_spec import MSExperiment E = MSExperiment(get_test_data('massspec_1.txt')) E.export_to_file(path=self.getFilePath(new=True)) self.assertTrue( os.path.isfile(self.getFilePath()) )
def test_experiment_plot(self): from itcsimlib.mass_spec import MSExperiment E = MSExperiment(get_test_data('massspec_1.txt')) E.make_plot(hardcopy=True, hardcopydir=self.test_dir, hardcopytype="png") self.assertTrue( os.path.isfile(os.path.join(self.test_dir,"massspec_1.png")) )
def test_experiment_file(self): from itcsimlib.mass_spec import MSExperiment E = MSExperiment(get_test_data('massspec_1.txt')) self.assertIsNotNone( E )
def test_rw_experiment_file(self): E1 = read_itcsimlib_exp(get_test_data("utilities_1.txt")) write_itcsimlib_pickle( self.getFilePath(True), E1 ) E2 = read_itcsimlib_pickle( self.getFilePath() ) self.assertEqual( E1.npoints, E2.npoints )
def test_savitsky_golay_filter(self): data = pickle.load(open(get_test_data("utilities_1.test"))) spl = savitzky_golay( data[1][1], window_size=7, order=1 ) self.assertEqual( round(sum(spl),2), -28.66 )
def test_experiment_chisq_fixedsigma(self): from itcsimlib.itc_experiment import ITCExperiment from itcsimlib.mass_spec import MSExperiment E = MSExperiment(get_test_data('massspec_1.txt'), sigma=0.05) Q = np.zeros(shape=(int(E.npoints / E.npops), E.npops)) self.assertEqual(round(E.get_chisq(Q), 1), 292.8)
def test_experiment_export(self): from itcsimlib.mass_spec import MSExperiment E = MSExperiment(get_test_data('massspec_1.txt')) E.export_to_file(path=self.getFilePath(new=True)) self.assertTrue(os.path.isfile(self.getFilePath()))
def test_read_nitpic(self): E = read_nitpic_exp(get_test_data("utilities_2.nitpkl")) self.assertEqual( round(sum(E.dQ_exp),1), -831.3 )
def test_experiment_file(self): from itcsimlib.mass_spec import MSExperiment E = MSExperiment(get_test_data('massspec_1.txt')) self.assertIsNotNone(E)