aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2017-03-03 20:33:00 +0800
committerAaron LI <aaronly.me@outlook.com>2017-03-03 20:33:00 +0800
commit4fecedac4f65e453df3d7acc93d940c192b2421b (patch)
treee1aa33a8a03d22430931c23bbf02f5bdbeba099d
parentba0ab2d5cd8f3fe2a4708094c7f897a8543b34dd (diff)
downloadchandra-acis-analysis-4fecedac4f65e453df3d7acc93d940c192b2421b.tar.bz2
acispy/spectrum.py: Add method "calc_flux()"
-rw-r--r--acispy/spectrum.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/acispy/spectrum.py b/acispy/spectrum.py
index 562e73e..6b4481c 100644
--- a/acispy/spectrum.py
+++ b/acispy/spectrum.py
@@ -27,18 +27,24 @@ class Spectrum:
self.EXPOSURE = self.header.get("EXPOSURE")
self.BACKSCAL = self.header.get("BACKSCAL")
- def calc_pb_flux(self, elow=9500, ehigh=12000):
+ def calc_flux(self, elow, ehigh):
"""
- Calculate the particle background flux:
+ Calculate the flux:
flux = counts / exposure / area
Parameters
----------
elow, ehigh : float, optional
- Lower and upper energy limit for the particle background.
+ Lower and upper energy limit to calculate the flux.
"""
chlow = ACIS.energy2channel(elow)
chhigh = ACIS.energy2channel(ehigh)
counts = self.counts[(chlow-1):chhigh].sum()
flux = counts / self.EXPOSURE / self.BACKSCAL
return flux
+
+ def calc_pb_flux(self, elow=9500, ehigh=12000):
+ """
+ Calculate the particle background (default: 9.5-12 keV) flux.
+ """
+ return self.calc_flux(elow=elow, ehigh=ehigh)