Пример #1
0
 def setUp(self):
     """
     Using (0.03, 0.03), (-1, -1) from 0.004 32c
     """
     self.time_extent = 64
     self.corr = [pp_flat(t, 1.0, 1.0, self.time_extent) for t in range(self.time_extent)]
     self.corrs = [[pp_flat(t, 1.0, 1.0, self.time_extent) + random.normal(scale=1e-6)
                    for t in range(self.time_extent)] for _ in range(200)]
     self.iwasaki_folder = os.path.join('testfiles', 'parse', 'f1')
     self.fit_func = lambda t, m, c: pp_flat(t, m, c, self.time_extent)
Пример #2
0
 def test_serialize_json(self):
     data = [[pp_flat(t, 1.0, 1.0, self.time_extent) + random.normal(scale=1e-4)
              for t in range(self.time_extent)] for _ in range(50)]
     had = PseudoscalarMeson(data, masses=(0.01, 0.01))
     j = had.json()
     had2 = PseudoscalarMeson.from_json(j)
     self.assertEqual(had2.masses, [0.01, 0.01])
Пример #3
0
 def __init__(self, data=None, config_numbers=None, masses=None,
              charges=None, **kwargs):
     super(PseudoscalarChargedMeson, self).__init__(data, config_numbers,
                                                    masses, **kwargs)
     self.charges = charges
     self.fit_func = lambda t, c, m: pp_flat(t, c, m,
                                             self.time_extent)
Пример #4
0
 def test_fit_hadron(self):
     data = [[pp_flat(t, 1.0, 1.0, self.time_extent) + random.normal(scale=1e-4)
              for t in range(self.time_extent)] for _ in range(50)]
     had = PseudoscalarMeson(data, masses=(0.01, 0.01))
     fp = fit_hadron(had, fit_range=range(1, 32+1),
                     initial_value=[0.8, 1.5], covariant=False)
     self.assertAlmostEqual(fp.average_params['m'], 1.0, 2)
Пример #5
0
 def chi_sq(m, c):
     ff = pp_flat(fit_range, m, c)
     # pared_data = np.array([data[t] for t in fit_range])
     v = np.array(ff - data)
     m = np.array(inverse_covariance)
     r = np.dot(m, v)
     c2 = np.dot(v, r)
     return c2 / len(fit_range)
Пример #6
0
 def test_serialize_json(self):
     data = [[
         pp_flat(t, 1.0, 1.0, self.time_extent) + random.normal(scale=1e-4)
         for t in range(self.time_extent)
     ] for _ in range(50)]
     had = PseudoscalarMeson(data, masses=(0.01, 0.01))
     j = had.json()
     had2 = PseudoscalarMeson.from_json(j)
     self.assertEqual(had2.masses, [0.01, 0.01])
Пример #7
0
 def __init__(self,
              data=None,
              config_numbers=None,
              masses=None,
              charges=None,
              **kwargs):
     super(PseudoscalarChargedMeson, self).__init__(data, config_numbers,
                                                    masses, **kwargs)
     self.charges = charges
     self.fit_func = lambda t, c, m: pp_flat(t, c, m, self.time_extent)
Пример #8
0
    def __init__(self, data=None, config_numbers=None, masses=None, **kwargs):
        """
        Creates an uncharged pseudoscalar meson.

        :param data: The measurements of the correlation functions.
        :type data: list of floats
        :param masses: The bare masses of the quarks of the meson.
        :type masses: tuple of floats e.g. (0.01, 0.005)
        """
        super(PseudoscalarMeson, self).__init__(data, config_numbers, masses,
                                                **kwargs)
        self.fit_func = lambda t, c, m: pp_flat(t, c, m, self.time_extent)
Пример #9
0
    def __init__(self, data=None, config_numbers=None, masses=None, **kwargs):
        """
        Creates an uncharged pseudoscalar meson.

        :param data: The measurements of the correlation functions.
        :type data: list of floats
        :param masses: The bare masses of the quarks of the meson.
        :type masses: tuple of floats e.g. (0.01, 0.005)
        """
        super(PseudoscalarMeson, self).__init__(data, config_numbers, masses,
                                                **kwargs)
        self.fit_func = lambda t, c, m: pp_flat(t, c, m,
                                                self.time_extent)
Пример #10
0
 def setUp(self):
     self.time_extent = 64
     self.fit_func = lambda t, m, c: pp_flat(t, m, c, self.time_extent)
Пример #11
0
 def setUp(self):
     self.time_extent = 64
     self.fit_func = lambda t, m, c: pp_flat(t, m, c, self.time_extent)
Пример #12
0
 def chi_sq(m, c):
     ff = pp_flat(fit_range, m, c)
     return sum((data - ff)**2 / errors**2) / len(fit_range)
Пример #13
0
 def test_make_correlator(self):
     corr = [pp_flat(t, 1.0, 1.0, self.time_extent) for t in range(self.time_extent)]
     self.failUnlessEqual(corr[0], 1.)
     self.failIfEqual(corr[0], 2.)
Пример #14
0
 def test_eff_mass_hadron(self):
     data = [[pp_flat(t, 1.0, 1.0, self.time_extent) + random.normal(scale=1e-9)
              for t in range(self.time_extent)] for _ in range(10)]
     had = PseudoscalarMeson(data, masses=(0.01, 0.01))
     plt = plot_hadron(had, effective_mass=True)
     plt.show()
Пример #15
0
 def test_make_hadron(self):
     data = [[pp_flat(t, 1.0, 1.0, self.time_extent) + random.normal(scale=1e-4)
              for t in range(self.time_extent)] for _ in range(10)]
     had = PseudoscalarMeson(data, masses=(0.01, 0.01))
     self.failUnlessEqual(had.data[0][0], data[0][0])
     self.failUnlessEqual(had.masses, (0.01, 0.01))
Пример #16
0
 def setUp(self):
     self.time_extent = 64
     self.fit_func = lambda t, m, c: pp_flat(t, m, c, self.time_extent)
     self.iwasaki_folder = os.path.join('testfiles', 'parse', 'f1')