From b86e3c4a26ca93bca00f02a00b24e4fca8877b03 Mon Sep 17 00:00:00 2001 From: fjosw Date: Thu, 18 Nov 2021 15:15:48 +0000 Subject: [PATCH] Documentation updated --- docs/pyerrors/input/hadrons.html | 41 ++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/docs/pyerrors/input/hadrons.html b/docs/pyerrors/input/hadrons.html index 4876fb3e..e3beab27 100644 --- a/docs/pyerrors/input/hadrons.html +++ b/docs/pyerrors/input/hadrons.html @@ -106,10 +106,15 @@ for line in files: cnfg_numbers.append(get_cnfg_number(line)) - if not all(np.diff(cnfg_numbers) == np.diff(cnfg_numbers)[0]): + dc = np.unique(np.diff(cnfg_numbers)) + if np.any(dc < 0): + raise Exception("Unsorted files") + if len(dc) == 1: + idx = range(cnfg_numbers[0], cnfg_numbers[-1] + dc[0], dc[0]) + else: raise Exception('Configurations are not evenly spaced.') - return files, cnfg_numbers + return files, idx def read_meson_hd5(path, filestem, ens_id, meson='meson_0', tree='meson'): @@ -132,7 +137,7 @@ from other modules with similar structures. """ - files, cnfg_numbers = _get_files(path, filestem) + files, idx = _get_files(path, filestem) corr_data = [] infos = [] @@ -149,7 +154,7 @@ l_obs = [] for c in corr_data.T: - l_obs.append(Obs([c], [ens_id], idl=[cnfg_numbers])) + l_obs.append(Obs([c], [ens_id], idl=[idx])) corr = Corr(l_obs) corr.tag = r", ".join(infos) @@ -169,7 +174,7 @@ 'C' for the last index changing fastest (16 3x3 matrices), """ - files, cnfg_numbers = _get_files(path, filestem) + files, idx = _get_files(path, filestem) mom = None @@ -187,8 +192,8 @@ matrix = np.empty((rolled_array.shape[:-1]), dtype=object) for si, sj, ci, cj in np.ndindex(rolled_array.shape[:-1]): - 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], idl=[cnfg_numbers]) + real = Obs([rolled_array[si, sj, ci, cj].real], [ens_id], idl=[idx]) + imag = Obs([rolled_array[si, sj, ci, cj].imag], [ens_id], idl=[idx]) matrix[si, sj, ci, cj] = CObs(real, imag) return Npr_matrix(matrix.swapaxes(1, 2).reshape((12, 12), order=order), mom_in=mom) @@ -207,7 +212,7 @@ 'C' for the last index changing fastest (16 3x3 matrices), """ - files, cnfg_numbers = _get_files(path, filestem) + files, idx = _get_files(path, filestem) mom_in = None mom_out = None @@ -237,8 +242,8 @@ matrix = np.empty((rolled_array.shape[:-1]), dtype=object) for si, sj, ci, cj in np.ndindex(rolled_array.shape[:-1]): - 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], idl=[cnfg_numbers]) + real = Obs([rolled_array[si, sj, ci, cj].real], [ens_id], idl=[idx]) + imag = Obs([rolled_array[si, sj, ci, cj].imag], [ens_id], idl=[idx]) matrix[si, sj, ci, cj] = CObs(real, imag) result_dict[key] = Npr_matrix(matrix.swapaxes(1, 2).reshape((12, 12), order=order), mom_in=mom_in, mom_out=mom_out) @@ -279,7 +284,7 @@ from other modules with similar structures. """ - files, cnfg_numbers = _get_files(path, filestem) + files, idx = _get_files(path, filestem) corr_data = [] infos = [] @@ -296,7 +301,7 @@ l_obs = [] for c in corr_data.T: - l_obs.append(Obs([c], [ens_id], idl=[cnfg_numbers])) + l_obs.append(Obs([c], [ens_id], idl=[idx])) corr = Corr(l_obs) corr.tag = r", ".join(infos) @@ -351,7 +356,7 @@ from other modules with similar structures. 'C' for the last index changing fastest (16 3x3 matrices), """ - files, cnfg_numbers = _get_files(path, filestem) + files, idx = _get_files(path, filestem) mom = None @@ -369,8 +374,8 @@ from other modules with similar structures. matrix = np.empty((rolled_array.shape[:-1]), dtype=object) for si, sj, ci, cj in np.ndindex(rolled_array.shape[:-1]): - 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], idl=[cnfg_numbers]) + real = Obs([rolled_array[si, sj, ci, cj].real], [ens_id], idl=[idx]) + imag = Obs([rolled_array[si, sj, ci, cj].imag], [ens_id], idl=[idx]) matrix[si, sj, ci, cj] = CObs(real, imag) return Npr_matrix(matrix.swapaxes(1, 2).reshape((12, 12), order=order), mom_in=mom) @@ -416,7 +421,7 @@ from other modules with similar structures. 'C' for the last index changing fastest (16 3x3 matrices), """ - files, cnfg_numbers = _get_files(path, filestem) + files, idx = _get_files(path, filestem) mom_in = None mom_out = None @@ -446,8 +451,8 @@ from other modules with similar structures. matrix = np.empty((rolled_array.shape[:-1]), dtype=object) for si, sj, ci, cj in np.ndindex(rolled_array.shape[:-1]): - 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], idl=[cnfg_numbers]) + real = Obs([rolled_array[si, sj, ci, cj].real], [ens_id], idl=[idx]) + imag = Obs([rolled_array[si, sj, ci, cj].imag], [ens_id], idl=[idx]) matrix[si, sj, ci, cj] = CObs(real, imag) result_dict[key] = Npr_matrix(matrix.swapaxes(1, 2).reshape((12, 12), order=order), mom_in=mom_in, mom_out=mom_out)