Skip to content
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
2 changes: 1 addition & 1 deletion .readthedocs.yml → .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# .readthedocs.yml
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

Expand Down
24 changes: 9 additions & 15 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# the global Astropy configuration which is loaded here before anything
# else. See astropy.sphinx.conf for which values are set there.

from configparser import ConfigParser
from datetime import datetime
import os
import sys
from configparser import ConfigParser
from datetime import datetime

try:
from sphinx_astropy.conf.v1 import * # noqa
Expand All @@ -30,7 +30,6 @@
conf.read([os.path.join(os.path.dirname(__file__), '..', 'setup.cfg')])
setup_cfg = dict(conf.items('metadata'))


# -- General configuration ----------------------------------------------------
# By default, highlight as Python 3.
# highlight_language = 'python3'
Expand All @@ -53,16 +52,16 @@
rst_epilog = """.. _imexam: high-level_API.html"""

# Render inheritance diagrams in SVG
#graphviz_output_format = "svg"
# graphviz_output_format = "svg"
#
#graphviz_dot_args = [
# graphviz_dot_args = [
# '-Nfontsize=10',
# '-Nfontname=Helvetica Neue, Helvetica, Arial, sans-serif',
# '-Efontsize=10',
# '-Efontname=Helvetica Neue, Helvetica, Arial, sans-serif',
# '-Gfontsize=10',
# '-Gfontname=Helvetica Neue, Helvetica, Arial, sans-serif'
#]
# ]
# -- Project information ------------------------------------------------------

# This does not *have* to match the package name, but typically does
Expand All @@ -77,10 +76,9 @@
package = sys.modules[project]

# The short X.Y version.
version = package.__version__.split('-', 1)[0] # The full version, including alpha/beta/rc tags.
version = package.__version__.split('-', 1)[0] # The full version, including alpha/beta/rc tags.
release = package.__version__


# -- Options for HTML output ------------------------------------------------
# The global astropy configuration uses a custom theme,
# 'bootstrap-astropy', which is installed along with astropy. A different
Expand Down Expand Up @@ -130,26 +128,23 @@
html_static_path = ['_static']
html_style = 'imexam.css'


# -- Options for LaTeX output -------------------------------------------------
# Grouping the document tree into LaTeX files. List of tuples (source
# start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [('index', project + '.tex', project + u' Documentation', author, 'manual')]
latex_documents = [('index', project + '.tex', project + u' Documentation', author, 'manual')]
latex_logo = '_static/imexam_logo.pdf'

# -- Options for manual page output ------------------------------------------- # One entry per manual page. List of tuples (source start file, name,
# -- Options for manual page output ------------------------------------------- # One entry per manual page. List of tuples (source start file, name,
# description, authors, manual section).
man_pages = [('index', project.lower(), project + u' Documentation',
[author], 1)]


# -- Resolving issue number to links in changelog -----------------------------
github_project = setup_cfg['github_project']
github_issues_url = f'https://github.com/{github_project}/issues/'


# -- Turn on nitpicky mode for sphinx (to warn about references not found) ----
nitpicky = False
nitpicky = True
nitpick_ignore = []

# Some warnings are impossible to suppress, and you can list specific
Expand All @@ -171,7 +166,6 @@
target = target.strip()
nitpick_ignore.append((dtype, target))


# -- Options for linkcheck output ---------------------------------------------
linkcheck_retry = 5
linkcheck_ignore = ['http://data.astropy.org',
Expand Down
32 changes: 17 additions & 15 deletions imexam/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@
the viewer and the imexamine classes
"""

import warnings
import astropy
import logging
import os
import astropy
import warnings

from .util import set_logging

try:
from .ginga_viewer import ginga

have_ginga = True
except ImportError:
have_ginga = False

try:
from . import imexamxpa # noqa

have_xpa = True
from .ds9_viewer import ds9
except ImportError:
Expand Down Expand Up @@ -567,7 +569,7 @@ def aimexam(self, get_name=False):
if get_name:
return self.exam.imexam_option_funcs['a'][0].__name__
else:
return(self.exam.aper_phot_pars)
return (self.exam.aper_phot_pars)

def cimexam(self, get_name=False):
"""Show the current parameters for the 'c' key.
Expand All @@ -578,7 +580,7 @@ def cimexam(self, get_name=False):
if get_name:
return self.exam.imexam_option_funcs['c'][0].__name__
else:
return(self.exam.colplot_pars)
return (self.exam.colplot_pars)

def dimexam(self, get_name=False):
"""Show the current parameters for the 'd' key.
Expand All @@ -589,14 +591,14 @@ def dimexam(self, get_name=False):
if get_name:
return self.exam.imexam_option_funcs['d'][0].__name__
else:
return(self.exam.com_center_pars)
return (self.exam.com_center_pars)

def eimexam(self, get_name=False):
"""Show the current parameters for the 'e' key, returns dict."""
if get_name:
return self.exam.imexam_option_funcs['e'][0].__name__
else:
return(self.exam.contour_pars)
return (self.exam.contour_pars)

def himexam(self, get_name=False):
"""Show the current parameters for 'h' key, returns dict.
Expand All @@ -607,7 +609,7 @@ def himexam(self, get_name=False):
if get_name:
return self.exam.imexam_option_funcs['h'][0].__name__
else:
return(self.exam.histogram_pars)
return (self.exam.histogram_pars)

def jimexam(self, get_name=False):
"""Show the current parameters for 1D fit line plots, returns dict.
Expand All @@ -618,7 +620,7 @@ def jimexam(self, get_name=False):
if get_name:
return self.exam.imexam_option_funcs['j'][0].__name__
else:
return(self.exam.line_fit_pars)
return (self.exam.line_fit_pars)

def kimexam(self, get_name=False):
"""Show the current parameters for 1D fit column plots, returns dict.
Expand All @@ -629,7 +631,7 @@ def kimexam(self, get_name=False):
if get_name:
return self.exam.imexam_option_funcs['k'][0].__name__
else:
return(self.exam.column_fit_pars)
return (self.exam.column_fit_pars)

def limexam(self, get_name=False):
"""Show the current parameters for line plots, returns dict.
Expand All @@ -640,7 +642,7 @@ def limexam(self, get_name=False):
if get_name:
return self.exam.imexam_option_funcs['l'][0].__name__
else:
return(self.exam.lineplot_pars)
return (self.exam.lineplot_pars)

def mimexam(self, get_name=False):
"""Show the current parameters for statistical regions, returns dict.
Expand All @@ -651,7 +653,7 @@ def mimexam(self, get_name=False):
if get_name:
return self.exam.imexam_option_funcs['m'][0].__name__
else:
return(self.exam.report_stat_pars)
return (self.exam.report_stat_pars)

def gimexam(self, get_name=False):
"""Show the current parameters for curve of growth plots, returns dict.
Expand All @@ -662,7 +664,7 @@ def gimexam(self, get_name=False):
if get_name:
return self.exam.imexam_option_funcs['g'][0].__name__
else:
return(self.exam.curve_of_growth_pars)
return (self.exam.curve_of_growth_pars)

def rimexam(self, get_name=False):
"""Show the current parameters for curve of growth plots, returns dict.
Expand All @@ -673,7 +675,7 @@ def rimexam(self, get_name=False):
if get_name:
return self.exam.imexam_option_funcs['r'][0].__name__
else:
return(self.exam.radial_profile_pars)
return (self.exam.radial_profile_pars)

def wimexam(self, get_name=False):
"""Show the current parameters for surface plots, returns dict.
Expand All @@ -684,7 +686,7 @@ def wimexam(self, get_name=False):
if get_name:
return self.exam.imexam_option_funcs['w'][0].__name__
else:
return(self.exam.surface_pars)
return (self.exam.surface_pars)

def timexam(self, get_name=False):
"""Show current parameters for image cutouts,returns dict.
Expand All @@ -695,7 +697,7 @@ def timexam(self, get_name=False):
if get_name:
return self.exam.imexam_option_funcs['t'][0].__name__
else:
return(self.exam.cutout_pars)
return (self.exam.cutout_pars)

def unlearn(self):
"""Unlearn all the imexam parameters and reset to default."""
Expand Down
49 changes: 24 additions & 25 deletions imexam/ds9_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,26 @@

"""

import atexit
import logging
import matplotlib.image as mpimage
import matplotlib.pyplot as plt
import numpy as np
import os
import shutil
import sys
import numpy as np
from subprocess import Popen
import time
import warnings
import logging
from tempfile import mkdtemp
import matplotlib.image as mpimage
import matplotlib.pyplot as plt
from astropy.io import fits
from matplotlib import get_backend
import atexit
from subprocess import Popen
from subprocess import call
from tempfile import mkdtemp

from . import util
from .imexamxpa import XpaException
# The XPA class controls interaction with DS9
from .xpa_wrap import XPA
from .imexamxpa import XpaException

from . import util
from astropy.io import fits

__all__ = ['ds9']

Expand Down Expand Up @@ -507,7 +506,7 @@ def _purge_local(self):
except OSError:
warnings.warn(
"Warning : couldn't delete the temporary \
directory ({0:s})".format(self._tmpd_name,))
directory ({0:s})".format(self._tmpd_name, ))

self._need_to_purge = False

Expand Down Expand Up @@ -576,9 +575,9 @@ def _run_unixonly_ds9(self):

self._tmpd_name = mkdtemp(
prefix="xpa_" +
env.get(
"USER",
""),
env.get(
"USER",
""),
dir="/tmp")

# this is the first directory the servers looks for on the path
Expand Down Expand Up @@ -1289,14 +1288,14 @@ def mark_region_from_array(self, input_points,
for location in input_points:
if rtype == "circle":
pline = rtype + " " + \
str(location[x]) + " " + str(location[y]) + " " + str(size)
str(location[x]) + " " + str(location[y]) + " " + str(size)
self.log.info(pline)
self.set_region(pline)

try:
if(len(str(location[comment])) > 0):
pline = "text " + str(float(location[x]) + textoff) +\
" " + str(float(location[y]) + textoff) + " '" +\
if (len(str(location[comment])) > 0):
pline = "text " + str(float(location[x]) + textoff) + \
" " + str(float(location[y]) + textoff) + " '" + \
str(location[comment]) + "' #font=times"
self.log.info(pline)
self.set_region(pline)
Expand Down Expand Up @@ -1354,20 +1353,20 @@ def make_region(self, infile, labels=False, header=0, textoff=10, size=5):
words = lines[i].split(',')
x.append(words[0].strip())
y.append(words[1].strip())
if(len(words) > 2 and labels):
if (len(words) > 2 and labels):
text.append(words[2].strip())

# now write out to a reg file
out = infile + ".reg"
f = open(out, 'w')
for i in range(0, len(lines), 1):
pline = "image; " + point + \
"(" + x[i] + "," + y[i] + "," + str(size) + ")\n"
"(" + x[i] + "," + y[i] + "," + str(size) + ")\n"
f.write(pline)
if(len(text) > 0):
if (len(text) > 0):
pline = "image;text(" + str(float(x[i]) + delta) + "," + \
str(float(y[i]) + delta) + \
"{ " + text[i] + " })# font=\"time 12 bold\"\n"
str(float(y[i]) + delta) + \
"{ " + text[i] + " })# font=\"time 12 bold\"\n"
f.write(pline)
f.close()

Expand Down Expand Up @@ -1681,7 +1680,7 @@ def snapsave(self, filename=None, format=None, resolution=100):
call(cstring)
print(f"Image saved to {filename}")
self.log.info(f"Image saved to {filename}")
return(filename)
return (filename)

def grab(self):
"""Make a copy of the image view."""
Expand Down