From 2aaf7d8106e7d596654c9ae1cf0fa75fd642f3eb Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sun, 19 Feb 2017 16:26:40 +0800 Subject: Setup module 'acispy' and clean 'scripts' directory Setup a module 'acispy' to hold some generic Python modules for better/easier reuse, and clean up the 'scripts' directory, which will be used to hold the CLI tools. --- acispy/ds9.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 acispy/ds9.py (limited to 'acispy/ds9.py') diff --git a/acispy/ds9.py b/acispy/ds9.py new file mode 100644 index 0000000..e8c8e88 --- /dev/null +++ b/acispy/ds9.py @@ -0,0 +1,30 @@ +# 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, + "-cmap", cmap, + "-bin", "factor", str(binfactor), + "-scale", scale, + ] + if regfile: + cmd += [ + "-regions", "format", regformat, + "-regions", "system", regsystem, + "-regions", regfile, + ] + if smooth: + cmd += ["-smooth", "yes", "-smooth", "radius", str(smooth)] + subprocess.check_call(cmd) -- cgit v1.2.2