hadrons input functions now construct Obs with correct idl

This commit is contained in:
Fabian Joswig 2021-11-10 16:26:20 +00:00
parent 4bf95da346
commit fc7d1ff078

View file

@ -38,7 +38,7 @@ def _get_files(path, filestem):
if not all(np.diff(cnfg_numbers) == np.diff(cnfg_numbers)[0]): if not all(np.diff(cnfg_numbers) == np.diff(cnfg_numbers)[0]):
raise Exception('Configurations are not evenly spaced.') raise Exception('Configurations are not evenly spaced.')
return files return files, cnfg_numbers
def read_meson_hd5(path, filestem, ens_id, meson='meson_0', tree='meson'): def read_meson_hd5(path, filestem, ens_id, meson='meson_0', tree='meson'):
@ -61,7 +61,7 @@ def read_meson_hd5(path, filestem, ens_id, meson='meson_0', tree='meson'):
from other modules with similar structures. from other modules with similar structures.
""" """
files = _get_files(path, filestem) files, cnfg_numbers = _get_files(path, filestem)
corr_data = [] corr_data = []
infos = [] infos = []
@ -78,7 +78,7 @@ def read_meson_hd5(path, filestem, ens_id, meson='meson_0', tree='meson'):
l_obs = [] l_obs = []
for c in corr_data.T: for c in corr_data.T:
l_obs.append(Obs([c], [ens_id])) l_obs.append(Obs([c], [ens_id], idl=[cnfg_numbers]))
corr = Corr(l_obs) corr = Corr(l_obs)
corr.tag = r", ".join(infos) corr.tag = r", ".join(infos)
@ -98,7 +98,7 @@ def read_ExternalLeg_hd5(path, filestem, ens_id, order='F'):
'C' for the last index changing fastest (16 3x3 matrices), 'C' for the last index changing fastest (16 3x3 matrices),
""" """
files = _get_files(path, filestem) files, cnfg_numbers = _get_files(path, filestem)
mom = None mom = None
@ -118,8 +118,8 @@ def read_ExternalLeg_hd5(path, filestem, ens_id, order='F'):
matrix = np.empty((rolled_array.shape[:-1]), dtype=object) matrix = np.empty((rolled_array.shape[:-1]), dtype=object)
for si, sj, ci, cj in np.ndindex(rolled_array.shape[:-1]): for si, sj, ci, cj in np.ndindex(rolled_array.shape[:-1]):
real = Obs([rolled_array[si, sj, ci, cj].real], [ens_id]) real = Obs([rolled_array[si, sj, ci, cj].real], [ens_id], idl=[cnfg_numbers])
imag = Obs([rolled_array[si, sj, ci, cj].imag], [ens_id]) imag = Obs([rolled_array[si, sj, ci, cj].imag], [ens_id], idl=[cnfg_numbers])
matrix[si, sj, ci, cj] = CObs(real, imag) matrix[si, sj, ci, cj] = CObs(real, imag)
matrix[si, sj, ci, cj].gamma_method() matrix[si, sj, ci, cj].gamma_method()
@ -139,7 +139,7 @@ def read_Bilinear_hd5(path, filestem, ens_id, order='F'):
'C' for the last index changing fastest (16 3x3 matrices), 'C' for the last index changing fastest (16 3x3 matrices),
""" """
files = _get_files(path, filestem) files, cnfg_numbers = _get_files(path, filestem)
mom_in = None mom_in = None
mom_out = None mom_out = None
@ -173,8 +173,8 @@ def read_Bilinear_hd5(path, filestem, ens_id, order='F'):
matrix = np.empty((rolled_array.shape[:-1]), dtype=object) matrix = np.empty((rolled_array.shape[:-1]), dtype=object)
for si, sj, ci, cj in np.ndindex(rolled_array.shape[:-1]): for si, sj, ci, cj in np.ndindex(rolled_array.shape[:-1]):
real = Obs([rolled_array[si, sj, ci, cj].real], [ens_id]) real = Obs([rolled_array[si, sj, ci, cj].real], [ens_id], idl=[cnfg_numbers])
imag = Obs([rolled_array[si, sj, ci, cj].imag], [ens_id]) imag = Obs([rolled_array[si, sj, ci, cj].imag], [ens_id], idl=[cnfg_numbers])
matrix[si, sj, ci, cj] = CObs(real, imag) matrix[si, sj, ci, cj] = CObs(real, imag)
matrix[si, sj, ci, cj].gamma_method() matrix[si, sj, ci, cj].gamma_method()