diff --git a/asv.conf.json b/asv.conf.json index 235171c5480..6833cfb0682 100644 --- a/asv.conf.json +++ b/asv.conf.json @@ -3,18 +3,30 @@ "project": "tardis", "project_url": "https://tardis-sn.github.io/tardis", "repo": ".", - "install_command": ["in-dir={env_dir} python -mpip install {wheel_file}"], - "uninstall_command": ["return-code=any python -mpip uninstall -y {project}"], + "install_command": [ + "in-dir={env_dir} python -mpip install {wheel_file}" + ], + "uninstall_command": [ + "return-code=any python -mpip uninstall -y {project}" + ], "build_command": [ "python setup.py build", "PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}" ], - "branches": ["origin/master", "HEAD"], + "branches": [ + "origin/master", + "HEAD" + ], "environment_type": "mamba", "show_commit_url": "https://github.com/tardis-sn/tardis/commit/", "conda_environment_file": "tardis_env3.yml", "benchmark_dir": "benchmarks", "env_dir": ".asv/env", "results_dir": ".asv/results", - "html_dir": ".asv/html" -} + "html_dir": ".asv/html", + "matrix": { + "env": { + "TARDIS_REF_PATH": "tardis-refdata/atom_data" + } + } +} \ No newline at end of file diff --git a/benchmarks/benchmark_base.py b/benchmarks/benchmark_base.py index e64743a1f08..e6b509b7c34 100644 --- a/benchmarks/benchmark_base.py +++ b/benchmarks/benchmark_base.py @@ -1,6 +1,6 @@ import functools +from os import environ as env from copy import deepcopy -from os.path import dirname, join, realpath from pathlib import Path import numpy as np @@ -26,14 +26,13 @@ class BenchmarkBase: timeout = 600 @staticmethod - def get_relative_path(partial_path: str): - path = dirname(realpath(__file__)) - targets = Path(partial_path).parts + def get_relative_path(partial_path: str) -> str: + path = Path(__file__).resolve().parent - for target in targets: - path = join(path, target) + for target in Path(partial_path).parts: + path = path / target - return path + return str(path) def get_absolute_path(self, partial_path): partial_path = "../" + partial_path @@ -61,7 +60,8 @@ def config_rpacket_tracking(self): @functools.cached_property def tardis_ref_path(self): ref_data_path = Path( - Path(__file__).parent.parent, "tardis-refdata" + Path(__file__).parent.parent, + env.get("TARDIS_REF_PATH") ).resolve() return ref_data_path @@ -78,7 +78,7 @@ def atomic_dataset(self) -> AtomData: @functools.cached_property def atomic_data_fname(self): atomic_data_fname = ( - f"{self.tardis_ref_path}/atom_data/kurucz_cd23_chianti_H_He.h5" + f"{self.tardis_ref_path}/kurucz_cd23_chianti_H_He.h5" ) if not Path(atomic_data_fname).exists():