119 KiB
import numpy as np
import matplotlib.pyplot as plt
import pyerrors as pe
plt.style.use('./base_style.mplstyle')
plt.rc('text', usetex=True)
We can load data from preprocessed pickle files which contain a list of pyerror
Obs
:
correlator_data = pe.load_object('./data/correlator_test.p')
With this list a Corr
object can be initialised
my_correlator = pe.correlators.Corr(correlator_data)
my_correlator.print([8, 14])
The show
method can display the correlator
my_correlator.show()
Manipulating correlators¶
Corr
objects can be shifted
shifted_correlator = my_correlator.roll(20)
shifted_correlator.tag = r'Correlator shifted by $x_0/a=20$'
Or symmetrised
symmetrised_correlator = my_correlator.symmetric()
symmetrised_correlator.tag = 'Symmetrised correlator'
And we can compare different Corr
objects by passing comp
to the show
method
shifted_correlator.show(comp=symmetrised_correlator, logscale=True)
Effective mass¶
The effective mass of the correlator can be obtained by calling the m_eff
method
m_eff = symmetrised_correlator.m_eff()
m_eff.tag = 'Effective mass'
We can also use the priodicity of the lattice in order to obtain the cosh effective mass
periodic_m_eff = symmetrised_correlator.m_eff('periodic')
periodic_m_eff.tag = 'Cosh effective mass'
We can compare the two and see how the standard effective mass deviates form the plateau at the center of the lattice
periodic_m_eff.show([4,47], comp=m_eff, ylabel=r'$am_\mathrm{eff}$')
Arithmetic operations and mathematical functions are also overloaded for the Corr
class. We can compute the difference between the two variants of the effective mass as follows.
difference_m_eff = np.abs(periodic_m_eff - m_eff)
difference_m_eff.show([0, 47], logscale=True)
Derivatives¶
We can obtain derivatives of correlators in the following way
first_derivative = symmetrised_correlator.deriv()
first_derivative.tag = 'First derivative'
second_derivative = symmetrised_correlator.second_deriv()
second_derivative.tag = 'Second derivative'
symmetrised_correlator.show([5, 20], comp=[first_derivative, second_derivative], y_range=[-500, 1300])