diff --git a/pygedm/ne2001_wrapper.py b/pygedm/ne2001_wrapper.py index 211b755..974a253 100644 --- a/pygedm/ne2001_wrapper.py +++ b/pygedm/ne2001_wrapper.py @@ -99,11 +99,12 @@ def dm_to_dist(l, b, dm, nu=1.0, full_output=False): return 0.0 * u.pc, 0.0 * u.s else: d = ne21c.dm_to_dist(l_rad, b_rad, dm) + tau_sc = TAUISS(float(d['dist']), d['smtau'], nu=nu) if not full_output: - tau_sc = TAUISS(float(d['dist']), d['smtau'], nu=nu) return (float(d['dist']) * u.kpc).to('pc'), tau_sc * u.s else: + d['tau_sc'] = tau_sc return d @@ -128,11 +129,12 @@ def dist_to_dm(l, b, dist, nu=1.0, full_output=False): return 0.0 * u.pc / u.cm**3, 0.0 * u.s else: d = ne21c.dist_to_dm(l_rad, b_rad, dist) + tau_sc = TAUISS(float(dist), d['smtau'], nu=nu) if not full_output: - tau_sc = TAUISS(float(dist), d['smtau'], nu=nu) return float(d['dm']) * u.pc / u.cm**3, tau_sc * u.s else: + d['tau_sc'] = tau_sc return d @run_from_pkgdir diff --git a/tests/test_basic_ne2001.py b/tests/test_basic_ne2001.py index 6a931a4..7fdd91a 100644 --- a/tests/test_basic_ne2001.py +++ b/tests/test_basic_ne2001.py @@ -113,7 +113,7 @@ def test_dm_wrapper_b0353(): assert np.isclose(dist.to('kpc').value, 2.746, atol=0.01, rtol=0) assert np.isclose(tau_sc.to('us').value, 6.57, atol=0.01, rtol=0) -test_full_output(): +def test_full_output(): """ Make sure full_output arg works """ a = pygedm.ne2001_wrapper.dist_to_dm(0, 0, 0.1, full_output=True) b = pygedm.ne2001_wrapper.dm_to_dist(0, 0, 10, full_output=True) @@ -128,3 +128,4 @@ def test_dm_wrapper_b0353(): test_igm() test_dm_wrapper() test_dm_wrapper_b0353() + test_full_output()