mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-15 03:53:41 +02:00
feat: The desired correlation function extracted with
input.hadrons.read_meson_hd5 can now also be specified via a tuple of strings indicating the desired source and sink gamma matrices.
This commit is contained in:
parent
658c2b30de
commit
46cc5dd792
1 changed files with 21 additions and 3 deletions
|
@ -55,8 +55,8 @@ def _get_files(path, filestem, idl):
|
||||||
return filtered_files, idx
|
return filtered_files, idx
|
||||||
|
|
||||||
|
|
||||||
def read_meson_hd5(path, filestem, ens_id, meson='meson_0', idl=None):
|
def read_meson_hd5(path, filestem, ens_id, meson='meson_0', idl=None, gammas=None):
|
||||||
"""Read hadrons meson hdf5 file and extract the meson labeled 'meson'
|
r'''Read hadrons meson hdf5 file and extract the meson labeled 'meson'
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
-----------------
|
-----------------
|
||||||
|
@ -69,13 +69,31 @@ def read_meson_hd5(path, filestem, ens_id, meson='meson_0', idl=None):
|
||||||
meson : str
|
meson : str
|
||||||
label of the meson to be extracted, standard value meson_0 which
|
label of the meson to be extracted, standard value meson_0 which
|
||||||
corresponds to the pseudoscalar pseudoscalar two-point function.
|
corresponds to the pseudoscalar pseudoscalar two-point function.
|
||||||
|
gammas : tuple of strings
|
||||||
|
Instrad of a meson label one can also provide a tuple of two strings
|
||||||
|
indicating the gamma matrices at source and sink.
|
||||||
|
("Gamma5", "Gamma5") corresponds to the pseudoscalar pseudoscalar
|
||||||
|
two-point function. The gammas argument dominateds over meson.
|
||||||
idl : range
|
idl : range
|
||||||
If specified only configurations in the given range are read in.
|
If specified only configurations in the given range are read in.
|
||||||
"""
|
'''
|
||||||
|
|
||||||
files, idx = _get_files(path, filestem, idl)
|
files, idx = _get_files(path, filestem, idl)
|
||||||
|
|
||||||
tree = meson.rsplit('_')[0]
|
tree = meson.rsplit('_')[0]
|
||||||
|
if gammas is not None:
|
||||||
|
h5file = h5py.File(path + '/' + files[0], "r")
|
||||||
|
found_meson = None
|
||||||
|
for key in h5file[tree].keys():
|
||||||
|
if gammas[0] == h5file[tree][key].attrs["gamma_snk"][0].decode() and h5file[tree][key].attrs["gamma_src"][0].decode() == gammas[1]:
|
||||||
|
found_meson = key
|
||||||
|
break
|
||||||
|
h5file.close()
|
||||||
|
if found_meson:
|
||||||
|
meson = found_meson
|
||||||
|
else:
|
||||||
|
raise Exception("Source Sink combination " + str(gammas) + " not found.")
|
||||||
|
|
||||||
corr_data = []
|
corr_data = []
|
||||||
infos = []
|
infos = []
|
||||||
for hd5_file in files:
|
for hd5_file in files:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue