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)
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])
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)
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)
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)
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])
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)
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)
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)
def setUp(self): self.time_extent = 64 self.fit_func = lambda t, m, c: pp_flat(t, m, c, self.time_extent)
def setUp(self): self.time_extent = 64 self.fit_func = lambda t, m, c: pp_flat(t, m, c, self.time_extent)
def chi_sq(m, c): ff = pp_flat(fit_range, m, c) return sum((data - ff)**2 / errors**2) / len(fit_range)
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.)
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()
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))
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')