Skip to content

Commit 53192d3

Browse files
committed
typehints for hadron read functions
1 parent dddaaa4 commit 53192d3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pyerrors/input/hadrons.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def read_hd5(filestem: str, ens_id: str, group: str, attrs: Optional[Union[dict,
142142
return corr
143143

144144

145-
def read_meson_hd5(path, filestem, ens_id, meson='meson_0', idl=None, gammas=None):
145+
def read_meson_hd5(path: str, filestem: str, ens_id: str, meson: str='meson_0', idl: Optional[range]=None, gammas: Optional[tuple[str, ...]]=None):
146146
r'''Read hadrons meson hdf5 file and extract the meson labeled 'meson'
147147
148148
Parameters
@@ -156,7 +156,7 @@ def read_meson_hd5(path, filestem, ens_id, meson='meson_0', idl=None, gammas=Non
156156
meson : str
157157
label of the meson to be extracted, standard value meson_0 which
158158
corresponds to the pseudoscalar pseudoscalar two-point function.
159-
gammas : tuple of strings
159+
gammas : tuple[str]
160160
Instrad of a meson label one can also provide a tuple of two strings
161161
indicating the gamma matrices at sink and source (gamma_snk, gamma_src).
162162
("Gamma5", "Gamma5") corresponds to the pseudoscalar pseudoscalar
@@ -181,7 +181,7 @@ def read_meson_hd5(path, filestem, ens_id, meson='meson_0', idl=None, gammas=Non
181181
part="real")
182182

183183

184-
def _extract_real_arrays(path, files, tree, keys):
184+
def _extract_real_arrays(path: str, files: list[str], tree: str, keys: list[str]):
185185
corr_data = {}
186186
for key in keys:
187187
corr_data[key] = []
@@ -199,7 +199,7 @@ def _extract_real_arrays(path, files, tree, keys):
199199
return corr_data
200200

201201

202-
def extract_t0_hd5(path, filestem, ens_id, obs='Clover energy density', fit_range=5, idl=None, **kwargs):
202+
def extract_t0_hd5(path: str, filestem: str, ens_id: str, obs='Clover energy density', fit_range: int=5, idl: Optional[range]=None, **kwargs):
203203
r'''Read hadrons FlowObservables hdf5 file and extract t0
204204
205205
Parameters
@@ -247,7 +247,7 @@ def extract_t0_hd5(path, filestem, ens_id, obs='Clover energy density', fit_rang
247247
return fit_t0(t2E_dict, fit_range, plot_fit=kwargs.get('plot_fit'))
248248

249249

250-
def read_DistillationContraction_hd5(path, ens_id, diagrams=["direct"], idl=None):
250+
def read_DistillationContraction_hd5(path: str, ens_id: str, diagrams: list[str]=["direct"], idl: Optional[range]=None):
251251
"""Read hadrons DistillationContraction hdf5 files in given directory structure
252252
253253
Parameters
@@ -256,7 +256,7 @@ def read_DistillationContraction_hd5(path, ens_id, diagrams=["direct"], idl=None
256256
path to the directories to read
257257
ens_id : str
258258
name of the ensemble, required for internal bookkeeping
259-
diagrams : list
259+
diagrams : list[str]
260260
List of strings of the diagrams to extract, e.g. ["direct", "box", "cross"].
261261
idl : range
262262
If specified only configurations in the given range are read in.
@@ -384,7 +384,7 @@ def __array_finalize__(self, obj):
384384
self.mom_out = getattr(obj, 'mom_out', None)
385385

386386

387-
def read_ExternalLeg_hd5(path, filestem, ens_id, idl=None):
387+
def read_ExternalLeg_hd5(path: str, filestem: str, ens_id: str, idl: Optional[range]=None):
388388
"""Read hadrons ExternalLeg hdf5 file and output an array of CObs
389389
390390
Parameters
@@ -429,7 +429,7 @@ def read_ExternalLeg_hd5(path, filestem, ens_id, idl=None):
429429
return Npr_matrix(matrix, mom_in=mom)
430430

431431

432-
def read_Bilinear_hd5(path, filestem, ens_id, idl=None):
432+
def read_Bilinear_hd5(path: str, filestem: str, ens_id: str, idl: Optional[range]=None):
433433
"""Read hadrons Bilinear hdf5 file and output an array of CObs
434434
435435
Parameters
@@ -488,7 +488,7 @@ def read_Bilinear_hd5(path, filestem, ens_id, idl=None):
488488
return result_dict
489489

490490

491-
def read_Fourquark_hd5(path, filestem, ens_id, idl=None, vertices=["VA", "AV"]):
491+
def read_Fourquark_hd5(path: str, filestem: str, ens_id: str, idl: Optional[range]=None, vertices: list[str]=["VA", "AV"]):
492492
"""Read hadrons FourquarkFullyConnected hdf5 file and output an array of CObs
493493
494494
Parameters
@@ -574,7 +574,7 @@ def read_Fourquark_hd5(path, filestem, ens_id, idl=None, vertices=["VA", "AV"]):
574574
return result_dict
575575

576576

577-
def _get_lorentz_names(name):
577+
def _get_lorentz_names(name: str):
578578
lorentz_index = ['X', 'Y', 'Z', 'T']
579579

580580
res = []

0 commit comments

Comments
 (0)