aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/ds9.py
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2017-02-16 19:31:59 +0800
committerAaron LI <aaronly.me@outlook.com>2017-02-17 01:16:46 +0800
commit3c372e344bedc3de10cc949d285bd7a66dfe1aad (patch)
tree13608aa5e041984102758b27289ca5bb11666915 /scripts/ds9.py
parent9d415275efdbdd49bcdb827a314f3b42ec5a269a (diff)
downloadchandra-acis-analysis-3c372e344bedc3de10cc949d285bd7a66dfe1aad.tar.bz2
Add module ds9.py for easier image viewing
Diffstat (limited to 'scripts/ds9.py')
-rw-r--r--scripts/ds9.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/ds9.py b/scripts/ds9.py
new file mode 100644
index 0000000..af25a42
--- /dev/null
+++ b/scripts/ds9.py
@@ -0,0 +1,27 @@
+# Copyright (c) 2017 Weitian LI <liweitianux@live.com>
+# MIT license
+
+"""
+Wrapper function to view FITS files using DS9.
+"""
+
+import subprocess
+
+
+def ds9_view(filename, regfile=None, regformat="ciao", regsystem="physical",
+ cmap="he", binfactor=2, scale="linear", smooth=None):
+ """
+ Wrapper function to view FITS files using DS9.
+ """
+ cmd = [
+ "ds9", filename,
+ "-regions", "format", regformat,
+ "-regions", "system", regsystem,
+ "-regions", regfile,
+ "-cmap", cmap,
+ "-bin", "factor", binfactor,
+ "-scale", scale,
+ ]
+ if smooth:
+ cmd += ["-smooth", "yes", "-smooth", "radius", smooth]
+ subprocess.check_call(cmd)