From b9f85d41e6a0bb63bd2436cbe1e7e11aa94c4f3d Mon Sep 17 00:00:00 2001 From: Gregory Ashton <gregory.ashton@ligo.org> Date: Thu, 4 May 2017 21:20:56 +0200 Subject: [PATCH] Alert user (without failing) if astropy is not installed --- pyfstat/injection_helper_functions.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pyfstat/injection_helper_functions.py b/pyfstat/injection_helper_functions.py index 04d854f..972115c 100644 --- a/pyfstat/injection_helper_functions.py +++ b/pyfstat/injection_helper_functions.py @@ -4,9 +4,13 @@ """ import numpy as np -from astropy import units as u -from astropy.coordinates import SkyCoord -from astropy.time import Time +import logging +try: + from astropy import units as u + from astropy.coordinates import SkyCoord + from astropy.time import Time +except ImportError: + logging.warning('Python module astropy not installed') # Assume Earth goes around Sun in a non-wobbling circle at constant speed; # Still take the zero longitude to be the Earth's position during the March -- GitLab