Exemplo n.º 1
0
 def test_stog_real_space_function_setter(self):
     stog = StoG()
     stog.real_space_function = "GK(r)"
     self.assertEqual(stog.real_space_function, "GK(r)")
     self.assertEqual(stog.gr_title, "GK(r) Merged")
     self.assertEqual(stog.real_space_function, "GK(r)")
     self.assertEqual(stog.gr_ft_title, "GK(r) FT")
     self.assertEqual(stog.gr_lorch_title, "GK(r) FT Lorched")
Exemplo n.º 2
0
 def test_stog_add_keen_gr_GKofR(self):
     stog = StoG(**self.kwargs_for_stog_input)
     stog.real_space_function = "GK(r)"
     stog.files = self.kwargs_for_files['Files']
     stog.read_all_data()
     stog.merge_data()
     stog.transform_merged()
     r = stog.df_gr_master[stog.gr_title].index.values
     gr = stog.df_gr_master[stog.gr_title].values
     stog._add_keen_gr(r, gr)
     self.assertTrue(stog.GKofR_title in stog.df_gr_master.columns)
Exemplo n.º 3
0
    def test_stog_transform_merged_for_nan_after_filter(self):
        # Load S(Q) for Argon from test data
        stog = StoG(**self.kwargs_for_stog_input)
        stog.files = self.kwargs_for_files['Files']
        stog.real_space_function = "GK(r)"
        stog.read_all_data()
        stog.merge_data()
        stog.transform_merged()

        self.assertFalse(
            np.isnan(stog.df_sq_master[stog.sq_title].values).any())
        self.assertFalse(
            np.isnan(stog.df_gr_master[stog.gr_title].values).any())
Exemplo n.º 4
0
    def test_stog_apply_lorch_GofR(self):
        # Number of decimal places for precision
        places = 5

        # Load S(Q) for Argon from test data
        stog = StoG(**self.kwargs_for_stog_input)
        stog.files = self.kwargs_for_files['Files']
        stog.plot_flag = False
        stog.real_space_function = "G(r)"
        stog.read_all_data()
        stog.merge_data()
        stog.transform_merged()
        q, sq, r, gr = stog.fourier_filter()
        stog.apply_lorch(q, sq, r)

        self.assertAlmostEqual(
            stog.df_gr_master.iloc[self.real_space_first][stog.gr_lorch_title],
            self.GofR_lorch_target[0],
            places=places)
Exemplo n.º 5
0
    def test_stog_transform_merged_GKofR(self):
        # Number of decimal places for precision
        places = 2

        # Load S(Q) for Argon from test data
        stog = StoG(**self.kwargs_for_stog_input)
        stog.files = self.kwargs_for_files['Files']
        stog.real_space_function = "GK(r)"
        stog.read_all_data()
        stog.merge_data()
        stog.transform_merged()

        # Check GK(r) data against targets
        self.assertAlmostEqual(
            stog.df_gr_master.iloc[self.real_space_first].name,
            self.real_xtarget,
            places=places)
        self.assertAlmostEqual(
            stog.df_gr_master.iloc[self.real_space_first][stog.gr_title],
            self.GKofR_target[0],
            places=places)
Exemplo n.º 6
0
 def test_stog_real_space_function_exception(self):
     stog = StoG()
     with self.assertRaises(ValueError):
         stog.real_space_function = "Dog"