aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-04-02 13:06:08 +0800
committerAaron LI <aaronly.me@outlook.com>2016-04-02 13:06:08 +0800
commitc7b96a8712c91c0d00b4facaaf52554d267d5f51 (patch)
treec9b7c79a9b57b576b722c35dcf45d1b1876aa638 /python
parentc1362d46a2ad60c42fd7b2c94a0aba026d54c7db (diff)
downloadatoolbox-c7b96a8712c91c0d00b4facaaf52554d267d5f51.tar.bz2
correct_crosstalk.py: fix Spectrum spec_dtype and spec_fits_format
Diffstat (limited to 'python')
-rwxr-xr-xpython/correct_crosstalk.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/python/correct_crosstalk.py b/python/correct_crosstalk.py
index c3e9815..e4d956e 100755
--- a/python/correct_crosstalk.py
+++ b/python/correct_crosstalk.py
@@ -361,20 +361,17 @@ class Spectrum: # {{{
self.header = ext_spec.header.copy(strip=True)
colnames = ext_spec.columns.names
if "COUNTS" in colnames:
- self.spec_type = "COUNTS"
- self.spec_unit = "count"
- self.spec_dtype = np.int32
- self.spec_fits_format = "J"
+ self.spec_type = "COUNTS"
elif "RATE" in colnames:
- self.spec_type = "RATE"
- self.spec_unit = "count/s"
- self.spec_dtype = np.float32
- self.spec_fits_format = "E"
+ self.spec_type = "RATE"
else:
raise ValueError("Invalid spectrum file")
- self.channel = ext_spec.data["CHANNEL"].copy()
- self.spec_data = ext_spec.data.field(self.spec_type)\
- .astype(self.spec_dtype)
+ self.channel = ext_spec.data.columns["CHANNEL"].array
+ col_spec_data = ext_spec.data.columns[self.spec_type]
+ self.spec_data = col_spec_data.array.copy()
+ self.spec_unit = col_spec_data.unit
+ self.spec_dtype = col_spec_data.dtype
+ self.spec_fits_format = col_spec_data.format
# keywords
self.EXPOSURE = self.header.get("EXPOSURE")
self.BACKSCAL = self.header.get("BACKSCAL")