From 3c372e344bedc3de10cc949d285bd7a66dfe1aad Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 16 Feb 2017 19:31:59 +0800 Subject: Add module ds9.py for easier image viewing --- scripts/ds9.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 scripts/ds9.py 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 +# 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) -- cgit v1.2.2