From 31def607d0e5a09c6aa7d8806071e3b649e053f9 Mon Sep 17 00:00:00 2001 From: Aymeric Galan Date: Wed, 6 Nov 2024 16:48:53 +0100 Subject: [PATCH] Print warning message instead of error when dPIE library are not available --- herculens/MassModel/Profiles/dpie.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/herculens/MassModel/Profiles/dpie.py b/herculens/MassModel/Profiles/dpie.py index 7774fdf..1ed57a7 100644 --- a/herculens/MassModel/Profiles/dpie.py +++ b/herculens/MassModel/Profiles/dpie.py @@ -13,18 +13,24 @@ from herculens.Util import util, param_util -try: - from herculens.MassModel.Profiles.glee.piemd_jax import Piemd_GPU -except ImportError: - raise ImportError("Please contact the author to use this dPIE profile " - "as it depends on non-public libraries.") - __all__ = [ 'DPIE_GLEE', 'DPIE_GLEE_STATIC', ] +try: + from herculens.MassModel.Profiles.glee.piemd_jax import Piemd_GPU +except ImportError: + print("WARNING: dPIE profile class cannot be loaded. " + "If you wish to use this profile, " + "please contact the author to use this dPIE profile " + "as it depends on non-public libraries.") + class DPIE_GLEE(object): + pass + class DPIE_GLEE_STATIC(object): + pass + class DPIE_GLEE(object): """