Compare commits
1 commit
master
...
feat/hadro
Author | SHA1 | Date | |
---|---|---|---|
|
d3511b77c8 |
1 changed files with 48 additions and 0 deletions
48
corrlib/input/hadrons.py
Normal file
48
corrlib/input/hadrons.py
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
import pyerrors.input.hadrons as input
|
||||||
|
import datalad.api as dl
|
||||||
|
import os
|
||||||
|
|
||||||
|
# same as in Grid/qcd/spin/Gamma.h
|
||||||
|
|
||||||
|
defd_gammas=[
|
||||||
|
'MinusGamma5', 'Gamma5',
|
||||||
|
'MinusGammaT', 'GammaT', 'MinusGammaTGamma5', 'GammaTGamma5',
|
||||||
|
'MinusGammaX', 'GammaX', 'MinusGammaXGamma5', 'GammaXGamma5',
|
||||||
|
'MinusGammaY', 'GammaY', 'MinusGammaYGamma5', 'GammaYGamma5',
|
||||||
|
'MinusGammaZ', 'GammaZ', 'MinusGammaZGamma5', 'GammaZGamma5',
|
||||||
|
'MinusIdentity', 'Identity',
|
||||||
|
'MinusSigmaXT', 'SigmaXT',
|
||||||
|
'MinusSigmaXY', 'SigmaXY',
|
||||||
|
'MinusSigmaXZ', 'SigmaXZ',
|
||||||
|
'MinusSigmaYT', 'SigmaYT',
|
||||||
|
'MinusSigmaYZ', 'SigmaYZ',
|
||||||
|
'MinusSigmaZT', 'SigmaZT'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def read_meson_hd5(path, project, dir_in_project, prefix, ensemble, gammas):
|
||||||
|
directory = os.path.join(path, "projects", project, dir_in_project)
|
||||||
|
measurements = {}
|
||||||
|
|
||||||
|
dl.get(directory, dataset=path)
|
||||||
|
|
||||||
|
if gammas == 'all':
|
||||||
|
for g1 in defd_gammas:
|
||||||
|
for g2 in defd_gammas:
|
||||||
|
try:
|
||||||
|
corr = input.read_meson_hd5(directory, prefix, ensemble, (g1, g2))
|
||||||
|
measurements[g1][g2] = corr
|
||||||
|
except Exception:
|
||||||
|
raise Exception("Combination (" + g1 + "," + g2 + ") not in data.")
|
||||||
|
else:
|
||||||
|
for gs in gammas:
|
||||||
|
if len(gs) == 2:
|
||||||
|
if gs[0] not in defd_gammas:
|
||||||
|
raise ValueError(gammas[0] + " is none of the defined gammas.")
|
||||||
|
if gs[1] not in defd_gammas:
|
||||||
|
raise ValueError(gammas[1] + " is none of the defined gammas.")
|
||||||
|
corr = input.read_meson_hd5(directory, prefix, ensemble, gs)
|
||||||
|
measurements[gs[0]][gs[1]] = corr
|
||||||
|
else:
|
||||||
|
raise Exception("Each element in 'gammas' has to have length 2.")
|
||||||
|
return measurements
|
Loading…
Add table
Add a link
Reference in a new issue