diff options
| author | Aaron LI <aaronly.me@outlook.com> | 2017-03-04 17:30:04 +0800 | 
|---|---|---|
| committer | Aaron LI <aaronly.me@outlook.com> | 2017-03-04 17:30:04 +0800 | 
| commit | 6ce0d5aa7c3d9280bde5e5b35606b3b9a56cafc3 (patch) | |
| tree | 29043d40d84317249eb76757317050c63b0c95dc | |
| parent | 0dd39d4d94d75341bfeb5184a4032f037dc7175f (diff) | |
| download | chandra-acis-analysis-6ce0d5aa7c3d9280bde5e5b35606b3b9a56cafc3.tar.bz2 | |
acispy/spectrum.py: Add "verbose" parameter
| -rw-r--r-- | acispy/spectrum.py | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/acispy/spectrum.py b/acispy/spectrum.py index 6b4481c..3fa0216 100644 --- a/acispy/spectrum.py +++ b/acispy/spectrum.py @@ -27,7 +27,7 @@ class Spectrum:          self.EXPOSURE = self.header.get("EXPOSURE")          self.BACKSCAL = self.header.get("BACKSCAL") -    def calc_flux(self, elow, ehigh): +    def calc_flux(self, elow, ehigh, verbose=False):          """          Calculate the flux:              flux = counts / exposure / area @@ -40,11 +40,14 @@ class Spectrum:          chlow = ACIS.energy2channel(elow)          chhigh = ACIS.energy2channel(ehigh)          counts = self.counts[(chlow-1):chhigh].sum() +        if verbose: +            print("counts / exposure / backscale :: %d / %.1f / %.5g" % +                  (counts, self.EXPOSURE, self.BACKSCAL))          flux = counts / self.EXPOSURE / self.BACKSCAL          return flux -    def calc_pb_flux(self, elow=9500, ehigh=12000): +    def calc_pb_flux(self, elow=9500, ehigh=12000, verbose=False):          """          Calculate the particle background (default: 9.5-12 keV) flux.          """ -        return self.calc_flux(elow=elow, ehigh=ehigh) +        return self.calc_flux(elow=elow, ehigh=ehigh, verbose=verbose) | 
