Skip to content

Commit

Permalink
InstallableLikelihood: early install check
Browse files Browse the repository at this point in the history
  • Loading branch information
JesusTorrado committed May 7, 2022
1 parent 2b86cb0 commit 15ec0d0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cobaya/likelihoods/base_classes/InstallableLikelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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):
"""
Expand Down

0 comments on commit 15ec0d0

Please sign in to comment.