Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add autoscale option to ds9 load_fits #185

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
builder: html
configuration: docs/conf.py
fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

build:
image: latest

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: docs/rtd-pip-requirements
- method: pip
path: .
extra_requirements:
- docs
- method: setuptools
path: .
system_packages: false

submodules:
include: all
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version 0.8.2a (unreleased)
- add check for ds9 in alias as well as well as path
- python2->3 class and printing updates
- removed dependence on astropy_helpers
- added autoscale option to the ds9 load_fits that will zoom-to-fit and zscale by default

version 0.8.1 (2018-12-14)
--------------------------
Expand Down
4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ def _warn_node(self, msg, node, **kwargs):
os.path.abspath(os.path.join(os.path.dirname(__file__),
'local/python2_local_links.inv')))


# suppress epub errors for static file formats (.ico) on rtd
suppress_warnings = ['epub.unknown_project_files']

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
Expand Down
9 changes: 8 additions & 1 deletion imexam/ds9_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ def embed(self):
"""Embed the viewer in a notebook."""
print("Not Implemented for DS9")

def load_fits(self, fname, extver=None, mecube=False):
def load_fits(self, fname, extver=None, mecube=False, autoscale=True):
"""convenience function to load fits image to current frame.

Parameters
Expand All @@ -1135,6 +1135,10 @@ def load_fits(self, fname, extver=None, mecube=False):
mecube: bool, optional
If mecube is True, load the fits file as a cube into ds9

autoscale: bool
If true, the image will be autoscaled to zoom-to-fit as well
as flux autoscaled upon load

Notes
-----
To tell ds9 to open a file whose name or path includes spaces,
Expand Down Expand Up @@ -1192,6 +1196,9 @@ def load_fits(self, fname, extver=None, mecube=False):
self._viewer[frame]['user_array'] = None
else:
self.view(fname[extver].data)
if autoscale:
self.zoom()
self.scale()

def load_region(self, filename):
"""Load regions from a file which uses ds9 standard formatting.
Expand Down