mirror of
https://github.com/Findus23/halo_comparison.git
synced 2024-09-19 16:03:50 +02:00
add missing util function
This commit is contained in:
parent
7d7fc65283
commit
bc441fc2ad
1 changed files with 9 additions and 0 deletions
9
utils.py
9
utils.py
|
@ -29,3 +29,12 @@ def create_figure() -> Tuple[Figure, Axes]:
|
|||
def read_swift_config(dir: Path):
|
||||
with (dir / "used_parameters.yml").open() as f:
|
||||
return yaml.safe_load(f)
|
||||
|
||||
|
||||
def print_wall_time(dir: Path):
|
||||
with(dir / "swift.log").open() as f:
|
||||
last_line = f.readlines()[-1]
|
||||
print(last_line)
|
||||
assert "main: done. Bye." in last_line
|
||||
seconds = float(last_line[1:].split("]")[0])
|
||||
print(f"Runtime: {seconds / 60 / 60:.2f} hours")
|
||||
|
|
Loading…
Reference in a new issue