aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2017-02-20 21:13:01 +0800
committerAaron LI <aaronly.me@outlook.com>2017-02-20 21:13:01 +0800
commit770d77da3ce9d91dd5fd2bca548797d67cd79989 (patch)
tree531609ddedfb944285dd24872307486db121c115
parentdeed9f233b0f22a4778d547587442d6834a9e53d (diff)
downloadchandra-acis-analysis-770d77da3ce9d91dd5fd2bca548797d67cd79989.tar.bz2
Fix errors in acispy/region.py and scripts/calc_centroid.py
-rw-r--r--acispy/region.py2
-rwxr-xr-xscripts/calc_centroid.py5
2 files changed, 4 insertions, 3 deletions
diff --git a/acispy/region.py b/acispy/region.py
index 09e42fa..dd98d20 100644
--- a/acispy/region.py
+++ b/acispy/region.py
@@ -210,7 +210,7 @@ class Regions:
def __init__(self, regfile=None):
if regfile:
- self.regions = self.load(regfile)
+ self.load(regfile)
else:
self.regions = []
diff --git a/scripts/calc_centroid.py b/scripts/calc_centroid.py
index 2f4606f..6d8ba33 100755
--- a/scripts/calc_centroid.py
+++ b/scripts/calc_centroid.py
@@ -20,7 +20,7 @@ from _context import acispy
from acispy.manifest import get_manifest
from acispy.pfiles import setup_pfiles
from acispy.ds9 import ds9_view
-from acispy.regions import Regions
+from acispy.region import Regions
def smooth_image(infile, outfile=None,
@@ -177,7 +177,8 @@ def main():
radius=radius)
print("Done!", file=sys.stderr)
- open(args.outfile, "w").write("point(%f,%f)\n" % centroid).close()
+ with open(args.outfile, "w") as f:
+ f.write("point(%f,%f)\n" % centroid)
print("Saved centroid to file:", args.outfile, file=sys.stderr)
if args.view:
ds9_view(img_smoothed, regfile=args.outfile)