From c313f5e759507d34245d7072ab7af73a205f6bc6 Mon Sep 17 00:00:00 2001 From: Gregory Ashton <gregory.ashton@ligo.org> Date: Mon, 28 May 2018 21:38:32 -0700 Subject: [PATCH] Update lalsimulation import If lalsim is not installed just add a warning rather than raising an error. Previously this did already exist in source.py, but we now also import lalsim in conversion.py as well --- tupak/conversion.py | 7 ++++++- tupak/source.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tupak/conversion.py b/tupak/conversion.py index b1b40dcc0..236f5b6ff 100644 --- a/tupak/conversion.py +++ b/tupak/conversion.py @@ -1,9 +1,14 @@ import tupak import numpy as np -import lalsimulation as lalsim import pandas as pd import logging +try: + import lalsimulation as lalsim +except ImportError: + logging.warning("You do not have lalsuite installed currently. You will " + " not be able to use some of the prebuilt functions.") + def convert_to_lal_binary_black_hole_parameters(parameters, search_keys, remove=True): """ diff --git a/tupak/source.py b/tupak/source.py index 1a1d1b064..9fb5327bd 100644 --- a/tupak/source.py +++ b/tupak/source.py @@ -5,8 +5,8 @@ import logging try: import lalsimulation as lalsim except ImportError: - logging.warning("You do not have lalsuite installed currently. You will not be able to use some of the " - "prebuilt functions.") + logging.warning("You do not have lalsuite installed currently. You will " + " not be able to use some of the prebuilt functions.") from . import utils -- GitLab