Skip to content

Commit d0ac76d

Browse files
authored
Merge pull request #2331 from NNPDF/separate_ekos_folder
Separate the ekos into its own folder
2 parents a091d88 + 88abb15 commit d0ac76d

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

validphys2/src/validphys/loader.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,13 @@ def _get_nnpdf_profile(profile_path=None):
186186
) from e
187187

188188
# Now read all paths and define them as relative to nnpdf_share (unless given as absolute)
189-
for var in ["results_path", "theories_path", "validphys_cache_path", "hyperscan_path"]:
189+
for var in [
190+
"results_path",
191+
"theories_path",
192+
"validphys_cache_path",
193+
"hyperscan_path",
194+
"ekos_path",
195+
]:
190196
# if there are any problems setting or getting these variable erroring out is more than justified
191197
absolute_var = nnpdf_share / pathlib.Path(profile_dict[var]).expanduser()
192198
profile_dict[var] = absolute_var.absolute().as_posix()
@@ -249,17 +255,20 @@ def __init__(self, profile=None):
249255
datapath = pathlib.Path(profile["data_path"])
250256
theories_path = pathlib.Path(profile["theories_path"])
251257
resultspath = pathlib.Path(profile["results_path"])
258+
ekos_path = pathlib.Path(profile["ekos_path"])
252259

253260
if not datapath.exists():
254261
raise LoaderError(f"The data path {datapath} does not exist.")
255262

256263
# Create the theories and results paths if they don't exist already
257264
theories_path.mkdir(exist_ok=True, parents=True)
265+
ekos_path.mkdir(exist_ok=True, parents=True)
258266
resultspath.mkdir(exist_ok=True, parents=True)
259267

260268
# And save them up
261269
self.datapath = datapath
262270
self._theories_path = theories_path
271+
self._ekos_path = ekos_path
263272
self.resultspath = resultspath
264273
self._extremely_old_fits = set()
265274
self.nnprofile = profile
@@ -466,9 +475,8 @@ def check_theoryID(self, theoryID):
466475

467476
@functools.lru_cache
468477
def check_eko(self, theoryID):
469-
"""Check the eko (and the parent theory) both exists and returns the path to it"""
470-
theory = self.check_theoryID(theoryID)
471-
eko_path = theory.path / "eko.tar"
478+
"""Check the eko exists and return the path to it"""
479+
eko_path = self._ekos_path / f"eko_{int(theoryID)}.tar"
472480
if not eko_path.exists():
473481
raise EkoNotFound(f"Could not find eko {eko_path} in theory: {theoryID}")
474482
return eko_path
@@ -1286,9 +1294,8 @@ def download_eko(self, thid):
12861294
if thid not in remote:
12871295
raise EkoNotFound(f"EKO for TheoryID {thid} is not available in the remote server")
12881296
# Check that we have the theory we need
1289-
theory = self.check_theoryID(thid)
1290-
target_path = theory.path / "eko.tar"
1291-
download_file(remote[thid], target_path, delete_on_failure=True)
1297+
target_path = self._ekos_path / f"eko_{int(thid)}.tar"
1298+
download_file(remote[thid], target_path)
12921299

12931300
def download_vp_output_file(self, filename, **kwargs):
12941301
try:

validphys2/src/validphys/nnprofile_default.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ results_path: results
2929
theories_path: theories
3030
hyperscan_path: hyperscan
3131
validphys_cache_path: vp-cache
32+
ekos_path: ekos
3233

3334
# Starting from nnpdf > 4.0.7 the data is bundled together with the vp installation
3435
# data_path: <be careful when filling in the data path with custom values>

0 commit comments

Comments
 (0)