From a1d4cb4b6d637112aa97249b8150e8236002f09f Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 31 Oct 2017 16:31:41 +0800 Subject: bin/cosmo_calc.py: Add evolution factor -E/--evolution-factor --- acispy/cosmo.py | 7 +++++-- bin/cosmo_calc.py | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/acispy/cosmo.py b/acispy/cosmo.py index 62b9191..4840122 100644 --- a/acispy/cosmo.py +++ b/acispy/cosmo.py @@ -1,8 +1,8 @@ -# Copyright (c) 2017 Weitian LI +# Copyright (c) 2017 Weitian LI # MIT license """ -Cosmology calculator for Chandra ACIS. +Cosmology calculator with Chandra ACIS-specific quantities support. """ import math @@ -25,6 +25,9 @@ class Calculator: self.Ob0 = Ob0 self._cosmo = FlatLambdaCDM(H0=H0, Om0=Om0, Ob0=Ob0) + def evolution_factor(self, z): + return self._cosmo.efunc(z) + def luminosity_distance(self, z, unit="Mpc"): dist = self._cosmo.luminosity_distance(z) return dist.to(au.Unit(unit)).value diff --git a/bin/cosmo_calc.py b/bin/cosmo_calc.py index 3b7a71f..24e9cfa 100755 --- a/bin/cosmo_calc.py +++ b/bin/cosmo_calc.py @@ -48,6 +48,11 @@ QUANTITIES = OrderedDict([ "label": "norm (APEC)", "kwargs": ["z"], }), + ("evolution_factor", { + "unit": None, + "label": "Evolution factor", + "kwargs": ["z"], + }), ]) @@ -95,6 +100,10 @@ def main(): help="be brief") parser.add_argument("-u", "--unit", dest="unit", help="set the unit for output quantity if supported") + parser.add_argument("-E", "--evolution-factor", + dest="evolution_factor", + action="store_true", + help="calculate the redshift evolution factor E(z)") parser.add_argument("-L", "--luminosity-distance", dest="luminosity_distance", action="store_true", -- cgit v1.2.2