aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/ds9.py
blob: af25a42241e4bd51c64d97dbb1b1296f450e44a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)