From 15ec0d069c37ae91b94532b761dd11666333aed3 Mon Sep 17 00:00:00 2001 From: torradocacho Date: Sat, 5 Mar 2022 17:28:06 +0100 Subject: [PATCH] InstallableLikelihood: early install check --- cobaya/likelihoods/base_classes/InstallableLikelihood.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cobaya/likelihoods/base_classes/InstallableLikelihood.py b/cobaya/likelihoods/base_classes/InstallableLikelihood.py index 872418132..3c8ddcb9c 100644 --- a/cobaya/likelihoods/base_classes/InstallableLikelihood.py +++ b/cobaya/likelihoods/base_classes/InstallableLikelihood.py @@ -14,7 +14,7 @@ from cobaya.likelihood import Likelihood from cobaya.typing import InfoDict from cobaya.log import get_logger -from cobaya.install import _version_filename +from cobaya.install import _version_filename, NotInstalledError from cobaya.tools import VersionCheckError @@ -25,6 +25,13 @@ class InstallableLikelihood(Likelihood): install_options: InfoDict = {} + def __init__(self, *args, **kwargs): + # Ensure check for install and version errors + if not self.is_installed(path=kwargs["packages_path"]): + raise NotInstalledError( + "The data for this likelihood has not been correctly installed.") + super().__init__(*args, **kwargs) + @classmethod def get_install_options(cls): """