diff options
author | Aaron LI <aaronly.me@outlook.com> | 2017-02-19 16:26:40 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2017-02-19 16:26:40 +0800 |
commit | 2aaf7d8106e7d596654c9ae1cf0fa75fd642f3eb (patch) | |
tree | b524d1fa54a4ad6251d467175b71e9dfea5a6631 /acispy/ds9.py | |
parent | 89adbc474890c50963537e8e32bdeff8aa3e10d1 (diff) | |
download | chandra-acis-analysis-2aaf7d8106e7d596654c9ae1cf0fa75fd642f3eb.tar.bz2 |
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.
Diffstat (limited to 'acispy/ds9.py')
-rw-r--r-- | acispy/ds9.py | 30 |
1 files changed, 30 insertions, 0 deletions
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 <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, + "-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) |