From 86447fb24353fa6ac02b3396c99d82dd66f8e64d Mon Sep 17 00:00:00 2001 From: londumas Date: Sat, 23 Mar 2019 10:29:05 -0700 Subject: [PATCH] Change definition of speed of light --- py/desitarget/QA.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/py/desitarget/QA.py b/py/desitarget/QA.py index 9d9780e21..ebddaaf21 100644 --- a/py/desitarget/QA.py +++ b/py/desitarget/QA.py @@ -37,6 +37,12 @@ matplotlib.use('Agg') import matplotlib.pyplot as plt # noqa: E402 +try: + from scipy import constants + C_LIGHT = constants.c/1000.0 +except TypeError: # This can happen during documentation builds. + C_LIGHT = 299792458.0/1000.0 + # ADM set up the default logger from desiutil log = get_logger() @@ -1053,7 +1059,7 @@ def mock_qanz(cat, objtype, qadir='.', area=1.0, dndz=None, nobjscut=1000, zmax = truez.max()*1.1 if 'STD' in objtype or 'MWS' in objtype or 'WD' in objtype: - truez *= 2.99e5 # [km/s] + truez *= C_LIGHT # [km/s] zlabel = 'True Radial Velocity (km/s)' else: zlabel = r'True Redshift $z$'