From 47a33424614d26cb1743b18bcbc667e3df61d65b Mon Sep 17 00:00:00 2001 From: Jeremy Kubica <104161096+jeremykubica@users.noreply.github.com> Date: Fri, 5 Jan 2024 08:34:02 -0500 Subject: [PATCH 1/2] Small improvement to getModuleRNG readability --- src/sorcha/modules/PPModuleRNG.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sorcha/modules/PPModuleRNG.py b/src/sorcha/modules/PPModuleRNG.py index 1c4855ff..0e1d5fab 100755 --- a/src/sorcha/modules/PPModuleRNG.py +++ b/src/sorcha/modules/PPModuleRNG.py @@ -36,7 +36,8 @@ def getModuleRNG(self, module_name): if module_name in self._rngs: return self._rngs[module_name] - seed_offset = int(hashlib.md5(module_name.encode("utf-8")).hexdigest(), 16) + hashed_name = hashlib.md5(module_name.encode()) + seed_offset = int(hashed_name.hexdigest(), base=16) module_seed = (self._base_seed + seed_offset) % (2**31) new_rng = np.random.default_rng(module_seed) self._rngs[module_name] = new_rng From 76ef5644efcc6028122c3d5127df43a9a7bf3131 Mon Sep 17 00:00:00 2001 From: Jeremy Kubica <104161096+jeremykubica@users.noreply.github.com> Date: Fri, 5 Jan 2024 08:36:58 -0500 Subject: [PATCH 2/2] Update test_bench.py Automated run of black --- demo/test_bench.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/test_bench.py b/demo/test_bench.py index bc45d256..320d270b 100644 --- a/demo/test_bench.py +++ b/demo/test_bench.py @@ -35,7 +35,7 @@ debug = False if debug: runLSSTSimulation(cmd_args_dict, configs) - else: # benchmark + else: # benchmark cProfile.run("runLSSTSimulation(cmd_args_dict, configs)", "./tests/out/restats") p = pstats.Stats("./tests/out/restats")