pyALF 2.6.post33__tar.gz → 2.6.post35__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyalf-2.6.post33/pyALF.egg-info → pyalf-2.6.post35}/PKG-INFO +1 -1
- {pyalf-2.6.post33 → pyalf-2.6.post35/pyALF.egg-info}/PKG-INFO +1 -1
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/simulation.py +62 -4
- {pyalf-2.6.post33 → pyalf-2.6.post35}/LICENSE +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/MANIFEST.in +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/README.md +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/pyALF.egg-info/SOURCES.txt +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/pyALF.egg-info/dependency_links.txt +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/pyALF.egg-info/entry_points.txt +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/pyALF.egg-info/requires.txt +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/pyALF.egg-info/top_level.txt +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/__init__.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/alf_source.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/ana.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/analysis.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/check_common.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/check_rebin_ipy.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/check_rebin_tk.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/check_warmup_ipy.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/check_warmup_tk.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/cli/__init__.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/cli/alf_bin_count.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/cli/alf_del_bins.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/cli/alf_postprocess.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/cli/alf_run.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/cli/alf_show_obs.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/cli/alf_test_branch.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/cli/minimal_ALF_run.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/exceptions.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/init_layout.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/lattice.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/lattices_armv8.4-a.so +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/lattices_x86-64.so +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/py_alf/utils.py +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/pyproject.toml +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/setup.cfg +0 -0
- {pyalf-2.6.post33 → pyalf-2.6.post35}/tests/test_lattice_init.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyALF
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.post35
|
|
4
4
|
Summary: Python interface for ALF, plus scripts and Jupyter notebooks.
|
|
5
5
|
Author-email: ALF Collaboration <alf@physik.uni-wuerzburg.de>, Jonas Schwab <jonas.schwab@uni-wuerzburg.de>
|
|
6
6
|
License-Expression: GPL-2.0-or-later
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyALF
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.post35
|
|
4
4
|
Summary: Python interface for ALF, plus scripts and Jupyter notebooks.
|
|
5
5
|
Author-email: ALF Collaboration <alf@physik.uni-wuerzburg.de>, Jonas Schwab <jonas.schwab@uni-wuerzburg.de>
|
|
6
6
|
License-Expression: GPL-2.0-or-later
|
|
@@ -6,6 +6,8 @@ __author__ = "Jonas Schwab"
|
|
|
6
6
|
__copyright__ = "Copyright 2020-2022, The ALF Project"
|
|
7
7
|
__license__ = "GPL"
|
|
8
8
|
|
|
9
|
+
import hashlib
|
|
10
|
+
import json
|
|
9
11
|
import os
|
|
10
12
|
import re
|
|
11
13
|
import shutil
|
|
@@ -44,11 +46,18 @@ class Simulation:
|
|
|
44
46
|
ham_name : str
|
|
45
47
|
Name of the Hamiltonian.
|
|
46
48
|
sim_dict : dict or list of dicts
|
|
47
|
-
Dictionary
|
|
49
|
+
Dictionary specifying parameters overwriting defaults.
|
|
48
50
|
Can be a list of dictionaries to enable parallel tempering.
|
|
49
51
|
sim_dir : path-like object, optional
|
|
50
52
|
Directory in which the Monte Carlo will be run.
|
|
51
53
|
If not specified, sim_dir is generated from sim_dict.
|
|
54
|
+
sim_dir_hash : bool, default=False
|
|
55
|
+
Whether to use a hash of the parameters for the directory name.
|
|
56
|
+
This is an experimental feature to get shorter directory names
|
|
57
|
+
that take into account all simulation parameters except for
|
|
58
|
+
Nbin and CPU_MAX. It is not fully supported and may lead to
|
|
59
|
+
issues with reproducibility if parameters are changed without
|
|
60
|
+
changing the directory name. Use with caution.
|
|
52
61
|
sim_root : path-like object, default="ALF_data"
|
|
53
62
|
Directory to prepend to sim_dir.
|
|
54
63
|
mpi : bool, default=False
|
|
@@ -90,10 +99,18 @@ class Simulation:
|
|
|
90
99
|
self.alf_src = alf_src
|
|
91
100
|
self.ham_name = ham_name
|
|
92
101
|
self.sim_dict = sim_dict
|
|
102
|
+
sim_root = kwargs.pop("sim_root", "ALF_data")
|
|
103
|
+
sim_dir_hash = kwargs.pop("sim_dir_hash", False)
|
|
104
|
+
explicit_sim_dir = kwargs.pop("sim_dir", None)
|
|
105
|
+
if explicit_sim_dir is not None:
|
|
106
|
+
# Explicitly provided sim_dir takes precedence over hash-based naming
|
|
107
|
+
dir_component = explicit_sim_dir
|
|
108
|
+
elif sim_dir_hash:
|
|
109
|
+
dir_component = directory_name_hash(alf_src, ham_name, sim_dict)
|
|
110
|
+
else:
|
|
111
|
+
dir_component = directory_name(alf_src, ham_name, sim_dict)
|
|
93
112
|
self.sim_dir = os.path.abspath(os.path.expanduser(os.path.join(
|
|
94
|
-
|
|
95
|
-
kwargs.pop("sim_dir",
|
|
96
|
-
directory_name(alf_src, ham_name, sim_dict)))))
|
|
113
|
+
sim_root, dir_component)))
|
|
97
114
|
self.mpi = kwargs.pop("mpi", False)
|
|
98
115
|
self.parallel_params = kwargs.pop("parallel_params", False)
|
|
99
116
|
self.n_mpi = kwargs.pop("n_mpi", 2)
|
|
@@ -408,6 +425,47 @@ def directory_name(alf_src, ham_name, sim_dict):
|
|
|
408
425
|
return dirname[:-1]
|
|
409
426
|
|
|
410
427
|
|
|
428
|
+
def get_hashable_parameters(parameters):
|
|
429
|
+
"""Build a deterministic, JSON-serializable subset of parameters for hashing.
|
|
430
|
+
|
|
431
|
+
This helper removes non-essential or run-dependent fields (such as post-
|
|
432
|
+
processing namespaces and certain QMC controls) and keeps only the raw
|
|
433
|
+
parameter values. The returned nested dictionary is intended to be
|
|
434
|
+
serialized (for example with ``json.dumps``) and then hashed; this
|
|
435
|
+
function itself does not perform any serialization or hashing.
|
|
436
|
+
"""
|
|
437
|
+
# Use only the parameter values for hashing.
|
|
438
|
+
parameters_hashable = {}
|
|
439
|
+
for namespace in parameters:
|
|
440
|
+
if namespace in ['VAR_errors', 'VAR_Max_Stoch']:
|
|
441
|
+
# Exclude postprocessing parameters from hash.
|
|
442
|
+
continue
|
|
443
|
+
parameters_hashable[namespace] = {}
|
|
444
|
+
for var in parameters[namespace]:
|
|
445
|
+
if namespace == 'VAR_QMC' and var in ['Nbin', 'CPU_MAX']:
|
|
446
|
+
# Exclude Nbin and CPU_MAX from hash.
|
|
447
|
+
continue
|
|
448
|
+
parameters_hashable[namespace][var] = parameters[namespace][var]['value']
|
|
449
|
+
return parameters_hashable
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
def directory_name_hash(alf_src, ham_name, sim_dict):
|
|
453
|
+
"""Return name of directory for simulations, given a set of simulation
|
|
454
|
+
parameters. The name is a hash of the parameters, so that it is short
|
|
455
|
+
and does not contain any special characters."""
|
|
456
|
+
if isinstance(sim_dict, list):
|
|
457
|
+
# For tempering / parallel parameters, incorporate all parameter sets
|
|
458
|
+
to_hash = [
|
|
459
|
+
get_hashable_parameters(
|
|
460
|
+
set_param(alf_src, ham_name, sim_dict_single))
|
|
461
|
+
for sim_dict_single in sim_dict
|
|
462
|
+
]
|
|
463
|
+
else:
|
|
464
|
+
to_hash = get_hashable_parameters(set_param(alf_src, ham_name, sim_dict))
|
|
465
|
+
dump = json.dumps(to_hash, sort_keys=True, separators=(",", ":"))
|
|
466
|
+
return hashlib.sha1(dump.encode("utf-8")).hexdigest()[:15]
|
|
467
|
+
|
|
468
|
+
|
|
411
469
|
def _update_var(params, var, value):
|
|
412
470
|
"""Try to update value of parameter called var in params."""
|
|
413
471
|
for name in params:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|