From eb6907d1fd3ee89c33e418f8eb4817901c401911 Mon Sep 17 00:00:00 2001 From: Carlos Gomez Date: Sat, 17 Feb 2018 18:43:15 +0100 Subject: [PATCH 1/3] VIP v0.9.0. Integration with DS9 is back! Docs updated. Small fixes. --- docs/source/vip_hci.conf.rst | 20 +-- docs/source/vip_hci.exlib.rst | 8 +- docs/source/vip_hci.fits.rst | 16 +- docs/source/vip_hci.frdiff.rst | 8 +- docs/source/vip_hci.llsg.rst | 12 +- docs/source/vip_hci.madi.rst | 8 +- docs/source/vip_hci.negfc.rst | 24 +-- docs/source/vip_hci.nmf.rst | 8 +- docs/source/vip_hci.pca.rst | 20 +-- docs/source/vip_hci.phot.rst | 24 +-- docs/source/vip_hci.preproc.rst | 40 ++--- docs/source/vip_hci.rst | 1 + docs/source/vip_hci.stats.rst | 24 +-- docs/source/vip_hci.tests.rst | 16 +- docs/source/vip_hci.var.rst | 20 +-- requirements | 4 +- vip_hci/__init__.py | 2 +- vip_hci/fits/__init__.py | 1 + vip_hci/fits/vipds9.py | 281 ++++++++++++++++++++++++++++++++ vip_hci/llsg/llsg.py | 2 +- vip_hci/var/utils_var.py | 16 +- 21 files changed, 426 insertions(+), 129 deletions(-) create mode 100644 vip_hci/fits/vipds9.py diff --git a/docs/source/vip_hci.conf.rst b/docs/source/vip_hci.conf.rst index 5c86ae79..559de4be 100644 --- a/docs/source/vip_hci.conf.rst +++ b/docs/source/vip_hci.conf.rst @@ -1,5 +1,5 @@ -vip\_hci.conf package -===================== +vip\_hci\.conf package +====================== .. automodule:: vip_hci.conf :members: @@ -9,32 +9,32 @@ vip\_hci.conf package Submodules ---------- -vip\_hci.conf.mem module ------------------------- +vip\_hci\.conf\.mem module +-------------------------- .. automodule:: vip_hci.conf.mem :members: :undoc-members: :show-inheritance: -vip\_hci.conf.param module --------------------------- +vip\_hci\.conf\.param module +---------------------------- .. automodule:: vip_hci.conf.param :members: :undoc-members: :show-inheritance: -vip\_hci.conf.timing module ---------------------------- +vip\_hci\.conf\.timing module +----------------------------- .. automodule:: vip_hci.conf.timing :members: :undoc-members: :show-inheritance: -vip\_hci.conf.utils\_conf module --------------------------------- +vip\_hci\.conf\.utils\_conf module +---------------------------------- .. automodule:: vip_hci.conf.utils_conf :members: diff --git a/docs/source/vip_hci.exlib.rst b/docs/source/vip_hci.exlib.rst index 681d8173..2b30fc59 100644 --- a/docs/source/vip_hci.exlib.rst +++ b/docs/source/vip_hci.exlib.rst @@ -1,5 +1,5 @@ -vip\_hci.exlib package -====================== +vip\_hci\.exlib package +======================= .. automodule:: vip_hci.exlib :members: @@ -9,8 +9,8 @@ vip\_hci.exlib package Submodules ---------- -vip\_hci.exlib.iuwt module --------------------------- +vip\_hci\.exlib\.iuwt module +---------------------------- .. automodule:: vip_hci.exlib.iuwt :members: diff --git a/docs/source/vip_hci.fits.rst b/docs/source/vip_hci.fits.rst index 87ce21b7..f6069181 100644 --- a/docs/source/vip_hci.fits.rst +++ b/docs/source/vip_hci.fits.rst @@ -1,5 +1,5 @@ -vip\_hci.fits package -===================== +vip\_hci\.fits package +====================== .. automodule:: vip_hci.fits :members: @@ -9,12 +9,20 @@ vip\_hci.fits package Submodules ---------- -vip\_hci.fits.fits module -------------------------- +vip\_hci\.fits\.fits module +--------------------------- .. automodule:: vip_hci.fits.fits :members: :undoc-members: :show-inheritance: +vip\_hci\.fits\.vipds9 module +----------------------------- + +.. automodule:: vip_hci.fits.vipds9 + :members: + :undoc-members: + :show-inheritance: + diff --git a/docs/source/vip_hci.frdiff.rst b/docs/source/vip_hci.frdiff.rst index 5b982b88..78d90d7b 100644 --- a/docs/source/vip_hci.frdiff.rst +++ b/docs/source/vip_hci.frdiff.rst @@ -1,5 +1,5 @@ -vip\_hci.frdiff package -======================= +vip\_hci\.frdiff package +======================== .. automodule:: vip_hci.frdiff :members: @@ -9,8 +9,8 @@ vip\_hci.frdiff package Submodules ---------- -vip\_hci.frdiff.framediff module --------------------------------- +vip\_hci\.frdiff\.framediff module +---------------------------------- .. automodule:: vip_hci.frdiff.framediff :members: diff --git a/docs/source/vip_hci.llsg.rst b/docs/source/vip_hci.llsg.rst index 2586593f..e9414b7b 100644 --- a/docs/source/vip_hci.llsg.rst +++ b/docs/source/vip_hci.llsg.rst @@ -1,5 +1,5 @@ -vip\_hci.llsg package -===================== +vip\_hci\.llsg package +====================== .. automodule:: vip_hci.llsg :members: @@ -9,16 +9,16 @@ vip\_hci.llsg package Submodules ---------- -vip\_hci.llsg.llsg module -------------------------- +vip\_hci\.llsg\.llsg module +--------------------------- .. automodule:: vip_hci.llsg.llsg :members: :undoc-members: :show-inheritance: -vip\_hci.llsg.thresholding module ---------------------------------- +vip\_hci\.llsg\.thresholding module +----------------------------------- .. automodule:: vip_hci.llsg.thresholding :members: diff --git a/docs/source/vip_hci.madi.rst b/docs/source/vip_hci.madi.rst index 125c6705..045cec33 100644 --- a/docs/source/vip_hci.madi.rst +++ b/docs/source/vip_hci.madi.rst @@ -1,5 +1,5 @@ -vip\_hci.madi package -===================== +vip\_hci\.madi package +====================== .. automodule:: vip_hci.madi :members: @@ -9,8 +9,8 @@ vip\_hci.madi package Submodules ---------- -vip\_hci.madi.adi\_source module --------------------------------- +vip\_hci\.madi\.adi\_source module +---------------------------------- .. automodule:: vip_hci.madi.adi_source :members: diff --git a/docs/source/vip_hci.negfc.rst b/docs/source/vip_hci.negfc.rst index 295963e5..5959a4b9 100644 --- a/docs/source/vip_hci.negfc.rst +++ b/docs/source/vip_hci.negfc.rst @@ -1,5 +1,5 @@ -vip\_hci.negfc package -====================== +vip\_hci\.negfc package +======================= .. automodule:: vip_hci.negfc :members: @@ -9,40 +9,40 @@ vip\_hci.negfc package Submodules ---------- -vip\_hci.negfc.mcmc\_sampling module ------------------------------------- +vip\_hci\.negfc\.mcmc\_sampling module +-------------------------------------- .. automodule:: vip_hci.negfc.mcmc_sampling :members: :undoc-members: :show-inheritance: -vip\_hci.negfc.nested\_sampling module --------------------------------------- +vip\_hci\.negfc\.nested\_sampling module +---------------------------------------- .. automodule:: vip_hci.negfc.nested_sampling :members: :undoc-members: :show-inheritance: -vip\_hci.negfc.simplex\_fmerit module -------------------------------------- +vip\_hci\.negfc\.simplex\_fmerit module +--------------------------------------- .. automodule:: vip_hci.negfc.simplex_fmerit :members: :undoc-members: :show-inheritance: -vip\_hci.negfc.simplex\_optim module ------------------------------------- +vip\_hci\.negfc\.simplex\_optim module +-------------------------------------- .. automodule:: vip_hci.negfc.simplex_optim :members: :undoc-members: :show-inheritance: -vip\_hci.negfc.utils\_negfc module ----------------------------------- +vip\_hci\.negfc\.utils\_negfc module +------------------------------------ .. automodule:: vip_hci.negfc.utils_negfc :members: diff --git a/docs/source/vip_hci.nmf.rst b/docs/source/vip_hci.nmf.rst index 0af3aa88..b9d75139 100644 --- a/docs/source/vip_hci.nmf.rst +++ b/docs/source/vip_hci.nmf.rst @@ -1,5 +1,5 @@ -vip\_hci.nmf package -==================== +vip\_hci\.nmf package +===================== .. automodule:: vip_hci.nmf :members: @@ -9,8 +9,8 @@ vip\_hci.nmf package Submodules ---------- -vip\_hci.nmf.nmf\_fullfr module -------------------------------- +vip\_hci\.nmf\.nmf\_fullfr module +--------------------------------- .. automodule:: vip_hci.nmf.nmf_fullfr :members: diff --git a/docs/source/vip_hci.pca.rst b/docs/source/vip_hci.pca.rst index e8443464..3d6742ab 100644 --- a/docs/source/vip_hci.pca.rst +++ b/docs/source/vip_hci.pca.rst @@ -1,5 +1,5 @@ -vip\_hci.pca package -==================== +vip\_hci\.pca package +===================== .. automodule:: vip_hci.pca :members: @@ -9,32 +9,32 @@ vip\_hci.pca package Submodules ---------- -vip\_hci.pca.pca\_fullfr module -------------------------------- +vip\_hci\.pca\.pca\_fullfr module +--------------------------------- .. automodule:: vip_hci.pca.pca_fullfr :members: :undoc-members: :show-inheritance: -vip\_hci.pca.pca\_local module ------------------------------- +vip\_hci\.pca\.pca\_local module +-------------------------------- .. automodule:: vip_hci.pca.pca_local :members: :undoc-members: :show-inheritance: -vip\_hci.pca.svd module ------------------------ +vip\_hci\.pca\.svd module +------------------------- .. automodule:: vip_hci.pca.svd :members: :undoc-members: :show-inheritance: -vip\_hci.pca.utils\_pca module ------------------------------- +vip\_hci\.pca\.utils\_pca module +-------------------------------- .. automodule:: vip_hci.pca.utils_pca :members: diff --git a/docs/source/vip_hci.phot.rst b/docs/source/vip_hci.phot.rst index 7d64e89d..9f871528 100644 --- a/docs/source/vip_hci.phot.rst +++ b/docs/source/vip_hci.phot.rst @@ -1,5 +1,5 @@ -vip\_hci.phot package -===================== +vip\_hci\.phot package +====================== .. automodule:: vip_hci.phot :members: @@ -9,40 +9,40 @@ vip\_hci.phot package Submodules ---------- -vip\_hci.phot.contrcurve module -------------------------------- +vip\_hci\.phot\.contrcurve module +--------------------------------- .. automodule:: vip_hci.phot.contrcurve :members: :undoc-members: :show-inheritance: -vip\_hci.phot.detection module ------------------------------- +vip\_hci\.phot\.detection module +-------------------------------- .. automodule:: vip_hci.phot.detection :members: :undoc-members: :show-inheritance: -vip\_hci.phot.fakecomp module ------------------------------ +vip\_hci\.phot\.fakecomp module +------------------------------- .. automodule:: vip_hci.phot.fakecomp :members: :undoc-members: :show-inheritance: -vip\_hci.phot.frame\_analysis module ------------------------------------- +vip\_hci\.phot\.frame\_analysis module +-------------------------------------- .. automodule:: vip_hci.phot.frame_analysis :members: :undoc-members: :show-inheritance: -vip\_hci.phot.snr module ------------------------- +vip\_hci\.phot\.snr module +-------------------------- .. automodule:: vip_hci.phot.snr :members: diff --git a/docs/source/vip_hci.preproc.rst b/docs/source/vip_hci.preproc.rst index e57aca6f..46f0180f 100644 --- a/docs/source/vip_hci.preproc.rst +++ b/docs/source/vip_hci.preproc.rst @@ -1,5 +1,5 @@ -vip\_hci.preproc package -======================== +vip\_hci\.preproc package +========================= .. automodule:: vip_hci.preproc :members: @@ -9,72 +9,72 @@ vip\_hci.preproc package Submodules ---------- -vip\_hci.preproc.badframes module ---------------------------------- +vip\_hci\.preproc\.badframes module +----------------------------------- .. automodule:: vip_hci.preproc.badframes :members: :undoc-members: :show-inheritance: -vip\_hci.preproc.badpixremoval module -------------------------------------- +vip\_hci\.preproc\.badpixremoval module +--------------------------------------- .. automodule:: vip_hci.preproc.badpixremoval :members: :undoc-members: :show-inheritance: -vip\_hci.preproc.cosmetics module ---------------------------------- +vip\_hci\.preproc\.cosmetics module +----------------------------------- .. automodule:: vip_hci.preproc.cosmetics :members: :undoc-members: :show-inheritance: -vip\_hci.preproc.derotation module ----------------------------------- +vip\_hci\.preproc\.derotation module +------------------------------------ .. automodule:: vip_hci.preproc.derotation :members: :undoc-members: :show-inheritance: -vip\_hci.preproc.parangles module ---------------------------------- +vip\_hci\.preproc\.parangles module +----------------------------------- .. automodule:: vip_hci.preproc.parangles :members: :undoc-members: :show-inheritance: -vip\_hci.preproc.recentering module ------------------------------------ +vip\_hci\.preproc\.recentering module +------------------------------------- .. automodule:: vip_hci.preproc.recentering :members: :undoc-members: :show-inheritance: -vip\_hci.preproc.rescaling module ---------------------------------- +vip\_hci\.preproc\.rescaling module +----------------------------------- .. automodule:: vip_hci.preproc.rescaling :members: :undoc-members: :show-inheritance: -vip\_hci.preproc.skysubtraction module --------------------------------------- +vip\_hci\.preproc\.skysubtraction module +---------------------------------------- .. automodule:: vip_hci.preproc.skysubtraction :members: :undoc-members: :show-inheritance: -vip\_hci.preproc.subsampling module ------------------------------------ +vip\_hci\.preproc\.subsampling module +------------------------------------- .. automodule:: vip_hci.preproc.subsampling :members: diff --git a/docs/source/vip_hci.rst b/docs/source/vip_hci.rst index 8bf54b37..0c977784 100644 --- a/docs/source/vip_hci.rst +++ b/docs/source/vip_hci.rst @@ -23,5 +23,6 @@ Subpackages vip_hci.phot vip_hci.preproc vip_hci.stats + vip_hci.tests vip_hci.var diff --git a/docs/source/vip_hci.stats.rst b/docs/source/vip_hci.stats.rst index f5a72b04..26ed1f5b 100644 --- a/docs/source/vip_hci.stats.rst +++ b/docs/source/vip_hci.stats.rst @@ -1,5 +1,5 @@ -vip\_hci.stats package -====================== +vip\_hci\.stats package +======================= .. automodule:: vip_hci.stats :members: @@ -9,40 +9,40 @@ vip\_hci.stats package Submodules ---------- -vip\_hci.stats.clip\_sigma module ---------------------------------- +vip\_hci\.stats\.clip\_sigma module +----------------------------------- .. automodule:: vip_hci.stats.clip_sigma :members: :undoc-members: :show-inheritance: -vip\_hci.stats.cube\_stats module ---------------------------------- +vip\_hci\.stats\.cube\_stats module +----------------------------------- .. automodule:: vip_hci.stats.cube_stats :members: :undoc-members: :show-inheritance: -vip\_hci.stats.distances module -------------------------------- +vip\_hci\.stats\.distances module +--------------------------------- .. automodule:: vip_hci.stats.distances :members: :undoc-members: :show-inheritance: -vip\_hci.stats.im\_stats module -------------------------------- +vip\_hci\.stats\.im\_stats module +--------------------------------- .. automodule:: vip_hci.stats.im_stats :members: :undoc-members: :show-inheritance: -vip\_hci.stats.utils\_stats module ----------------------------------- +vip\_hci\.stats\.utils\_stats module +------------------------------------ .. automodule:: vip_hci.stats.utils_stats :members: diff --git a/docs/source/vip_hci.tests.rst b/docs/source/vip_hci.tests.rst index 3f26d89a..6d991c2b 100644 --- a/docs/source/vip_hci.tests.rst +++ b/docs/source/vip_hci.tests.rst @@ -1,5 +1,5 @@ -vip\_hci.tests package -====================== +vip\_hci\.tests package +======================= .. automodule:: vip_hci.tests :members: @@ -9,24 +9,24 @@ vip\_hci.tests package Submodules ---------- -vip\_hci.tests.llsg\_dev\_backups module ----------------------------------------- +vip\_hci\.tests\.llsg\_dev\_backups module +------------------------------------------ .. automodule:: vip_hci.tests.llsg_dev_backups :members: :undoc-members: :show-inheritance: -vip\_hci.tests.ssd\_source module ---------------------------------- +vip\_hci\.tests\.ssd\_source module +----------------------------------- .. automodule:: vip_hci.tests.ssd_source :members: :undoc-members: :show-inheritance: -vip\_hci.tests.vipds9\_source module ------------------------------------- +vip\_hci\.tests\.vipds9\_source module +-------------------------------------- .. automodule:: vip_hci.tests.vipds9_source :members: diff --git a/docs/source/vip_hci.var.rst b/docs/source/vip_hci.var.rst index f6b2b487..8c60c7d1 100644 --- a/docs/source/vip_hci.var.rst +++ b/docs/source/vip_hci.var.rst @@ -1,5 +1,5 @@ -vip\_hci.var package -==================== +vip\_hci\.var package +===================== .. automodule:: vip_hci.var :members: @@ -9,32 +9,32 @@ vip\_hci.var package Submodules ---------- -vip\_hci.var.filters module ---------------------------- +vip\_hci\.var\.filters module +----------------------------- .. automodule:: vip_hci.var.filters :members: :undoc-members: :show-inheritance: -vip\_hci.var.fit\_2d module ---------------------------- +vip\_hci\.var\.fit\_2d module +----------------------------- .. automodule:: vip_hci.var.fit_2d :members: :undoc-members: :show-inheritance: -vip\_hci.var.shapes module --------------------------- +vip\_hci\.var\.shapes module +---------------------------- .. automodule:: vip_hci.var.shapes :members: :undoc-members: :show-inheritance: -vip\_hci.var.utils\_var module ------------------------------- +vip\_hci\.var\.utils\_var module +-------------------------------- .. automodule:: vip_hci.var.utils_var :members: diff --git a/requirements b/requirements index 73e13cc0..cfa34f34 100644 --- a/requirements +++ b/requirements @@ -11,4 +11,6 @@ pandas >= 0.18 matplotlib >= 1.4.3 psutil pyprind -opencv-python \ No newline at end of file +opencv-python +sphinx <= 1.5.6 +git+git://github.com/ericmandel/pyds9.git diff --git a/vip_hci/__init__.py b/vip_hci/__init__.py index 5b78566c..d6fe2e0d 100644 --- a/vip_hci/__init__.py +++ b/vip_hci/__init__.py @@ -13,7 +13,7 @@ from . import stats from . import var -__version__ = "0.8.9" +__version__ = "0.9.0" print("---------------------------------------------------") diff --git a/vip_hci/fits/__init__.py b/vip_hci/fits/__init__.py index aca8260d..c7dfe13c 100644 --- a/vip_hci/fits/__init__.py +++ b/vip_hci/fits/__init__.py @@ -9,4 +9,5 @@ from __future__ import absolute_import from .fits import * +from .vipds9 import * diff --git a/vip_hci/fits/vipds9.py b/vip_hci/fits/vipds9.py new file mode 100644 index 00000000..fd92f67b --- /dev/null +++ b/vip_hci/fits/vipds9.py @@ -0,0 +1,281 @@ +#! /usr/bin/env python + +""" +Module with a function for displaying numpy arrays on DS9 (wrapper of pyds9). +""" +from __future__ import print_function + +__author__ = 'Carlos Alberto Gomez Gonzalez' +__all__ = ['ds9'] + +import pyds9 + + +class ds9(object): + """ Creates a DS9 window (named 'VIP_ds9') using pyDS9 functionality. + + The methods of this class allow interacting with the DS9 window. It uses + XPA under the hood, which mean that using the ``set`` and ``get`` methods + one can have fine control of the DS9 window. More info here: + http://ds9.si.edu/doc/ref/xpa.html. + + """ + def __init__(self): + """ __init__ method. + """ + self.window_name = 'VIP_ds9' + self.window = pyds9.DS9(self.window_name) + + def clear_frames(self): + """ Clears all frames. """ + self.window = pyds9.DS9(self.window_name) + self.window.set('frame clear all') + + def create_frame(self): + """ Creates a new frame (if no window it creates one). """ + self.window = pyds9.DS9(self.window_name) + self.window.set('frame new') + + def cmap(self, value=None): + """ Controls the colormap for the current frame. The colormap name is + not case sensitive. A valid contrast value is from 0 to 10 and bias + value from 0 to 1. + + Parameters + ---------- + value : str, optional + Value to be passed to the cmap command. Syntax: + cmap [] + [file] + [load ] + [save ] + [invert yes|no] + [value ] + [tag [load|save] ] + [tag delete] + [match] + [lock [yes|no]] + [open|close] + """ + self.window = pyds9.DS9(self.window_name) + self.window.set('cmap ' + str(value)) + + + def crosshair_get(self): + """ Gets the physical coordinates (x,y) of the crosshair. + + Returns + ------- + x : float, optional + Crosshair x coordinate. + y : float, optional + Crosshair y coordinate. + """ + self.window = pyds9.DS9(self.window_name) + coor = self.window.get('crosshair') + x = float(coor.split()[0]) + y = float(coor.split()[1]) + return x, y + + def crosshair_set(self, x=None, y=None): + """ Sets the crosshair in given coordinates. + + Parameters + ---------- + x : float, optional + Crosshair x coordinate. + y : float, optional + Crosshair y coordinate. + """ + self.window = pyds9.DS9(self.window_name) + if x and y: + self.window.set('crosshair '+str(x)+' '+str(y)+' physical') + else: + self.window.set('mode crosshair') + + def delete_frame(self, all_frames=False): + """ Deletes last frame or all. + + Parameters + ---------- + all_frames : bool, optional + If True all frames are deleted, otherwise only the active one. + """ + self.window = pyds9.DS9(self.window_name) + if all_frames: + self.window.set('frame delete all') + else: + self.window.set('frame delete') + + def display(self, *arrays, **kwargs): + """ Displays one or multiple arrays (listed in ``*arrays``). + + Parameters + ---------- + *arrays : list of arrays + The arrays to be displayed. + **kwargs : dictionary, optional + Only one parameter is admitted: ``keep_frames``. When + ``keep_frames`` is passed and is set to True, the new arrays are + displayed in the existing window (creating new ds9 frames). If no + ``keep_frames`` is given or if it is set to False, then the existing + ds9 frames are not preserved. + """ + self.window = pyds9.DS9(self.window_name) + + if 'keep_frames' in kwargs: + if not kwargs['keep_frames']: + self.delete_frame(all_frames=True) + else: + self.delete_frame(all_frames=True) + + self.tile() + for i, array in enumerate(arrays): + if i == 0: + self.create_frame() + self.window.set_np2arr(array) + else: + self.window.set('frame new') + self.window.set_np2arr(array) + + def get(self, paramlist): + """ XPA get command. Gets data from ds9. See: + http://ds9.si.edu/doc/ref/xpa.html + """ + self.window = pyds9.DS9(self.window_name) + return self.window.get(paramlist) + + def lock(self, scale=True, colorbar=True, crosshair=True, slices=True): + """ Locks the scaling, colorbar, crosshair position, or slice in cube + for all existing ds9 frames (wrt the active one). """ + self.window = pyds9.DS9(self.window_name) + if scale: + self.window.set('lock scale yes') + if colorbar: + self.window.set('lock colorbar yes') + if crosshair: + self.window.set('lock crosshair image') + if slices: + self.window.set('lock slice image') + + def pan(self, x=None, y=None): + """ Sets the mode to pan or pans to given coordinates. + + Parameters + ---------- + x : float, optional + X coordinate. + y : float, optional + Y coordinate. + """ + self.window = pyds9.DS9(self.window_name) + if x and y: + self.window.set('pan to '+str(x)+' '+str(y)) + else: + self.window.set('mode pan') + + def rotate(self, value=None): + """ Rotates with a given angle. + + Parameters + ---------- + value : float, optional + Angle. + """ + self.window = pyds9.DS9(self.window_name) + if value: + self.window.set('rotate '+str(value)) + else: + self.window.set('rotate open') + + def scale(self, value=None): + """ Controls the limits and color scale distribution. + + Parameters + ---------- + value : str, optional + Controls the scaling. Syntax: + scale [linear|log|pow|sqrt|squared|asinh|sinh|histequ] + [log exp ] + [datasec yes|no] + [limits ] + [mode minmax||zscale|zmax] + [scope local|global] + [match] + [match limits] + [lock [yes|no]] + [lock limits [yes|no]] + [open|close] + """ + self.window = pyds9.DS9(self.window_name) + if value: + self.window.set('scale '+str(value)) + else: + self.window.set('scale open') + + def set(self, paramlist, data=None, data_func=None): + """ XPA set command. Sends data or commands to ds9. See: + http://ds9.si.edu/doc/ref/xpa.html + """ + self.window = pyds9.DS9(self.window_name) + self.window.set(paramlist, data, data_func) + + def tile(self, mode='column'): + """ Controls the tile display mode. + + Parameters + ---------- + mode : str, optional + The mode used for tiling the frames. Syntax: + tile [] + [yes|no] + [mode grid|column|row] + [grid] + [grid mode automatic|manual] + [grid direction x|y] + [grid layout ] + [grid gap ] + [row] + [column] + """ + self.window = pyds9.DS9(self.window_name) + if mode == 'off': + self.window.set('tile off') + else: + self.window.set('tile on') + self.window.set('tile mode ' + mode) + + def unlock(self, scale=True, colorbar=True, crosshair=True, slices=True): + """ The opposite of the ``lock`` method. + """ + self.window = pyds9.DS9(self.window_name) + if scale: + self.window.set('lock scale no') + if colorbar: + self.window.set('lock colorbar no') + if crosshair: + self.window.set('lock crosshair none') + if slices: + self.window.set('lock slice none') + + def zoom(self, value='to fit'): + """ Controls the current zoom value for the current frame. + + Parameters + ---------- + value : str or + Parameters of the zoom command. Syntax: + zoom [] + [ ] + [to ] + [to ] + [in] + [out] + [to fit] + [open|close] + """ + self.window = pyds9.DS9(self.window_name) + self.window.set('zoom ' + str(value)) + + + diff --git a/vip_hci/llsg/llsg.py b/vip_hci/llsg/llsg.py index c40deedb..2ded6947 100644 --- a/vip_hci/llsg/llsg.py +++ b/vip_hci/llsg/llsg.py @@ -318,7 +318,7 @@ def _decompose_patch(indices, i_patch, n_segments_ann, rank, low_rank_ref, data_segm = cube_init[:, yy, xx] if low_rank_ref: - ref_segments = range(n_segments_ann) + ref_segments = list(range(n_segments_ann)) ref_segments.pop(j) for m, n in enumerate(ref_segments): if m == 0: diff --git a/vip_hci/var/utils_var.py b/vip_hci/var/utils_var.py index 14d4470f..218966e7 100644 --- a/vip_hci/var/utils_var.py +++ b/vip_hci/var/utils_var.py @@ -297,7 +297,7 @@ def pp_subplots(*args, **kwargs): if not isinstance(custom_cmap, list): custom_cmap = [kwargs['cmap'] for i in range(num_plots)] else: - if not len(custom_cmap)==num_plots: + if not len(custom_cmap) == num_plots: raise RuntimeError('Cmap list does not have enough items') else: custom_cmap = ['viridis' for i in range(num_plots)] @@ -325,15 +325,17 @@ def pp_subplots(*args, **kwargs): if 'versp' in kwargs: ver_spacing = kwargs['versp'] else: - ver_spacing = 0 + ver_spacing = 0.2 # -------------------------------------------------------------------------- subplot_size = 4 - if rows == 0: raise TypeError + if rows == 0: + raise ValueError('Rows must be a positive integer') fig = figure(figsize=(cols*subplot_size, rows*subplot_size), dpi=dpi) - if tit is not None: fig.suptitle(tit, fontsize=14) + if tit is not None: + fig.suptitle(tit, fontsize=14) for i,v in enumerate(range(num_plots)): frame_size = data[i].shape[0] # assuming square frames @@ -342,8 +344,10 @@ def pp_subplots(*args, **kwargs): v += 1 ax = subplot(rows,cols,v) ax.set_aspect('equal') - if logscale: norm = colors.LogNorm(vmin=data[i].min(), vmax=data[i].max()) - else: norm = None + if logscale: + norm = colors.LogNorm(vmin=data[i].min(), vmax=data[i].max()) + else: + norm = None im = ax.imshow(data[i], cmap=custom_cmap[i], interpolation='nearest', origin='lower', vmin=vmin[i], vmax=vmax[i], norm=norm) From a36519d83b3c0e6c2b408b82d9a2dd16cb681933 Mon Sep 17 00:00:00 2001 From: Carlos Gomez Date: Sat, 17 Feb 2018 18:48:53 +0100 Subject: [PATCH 2/3] Updated readme --- docs/source/readme.rst | 23 ++++++++++------------- readme.rst | 23 ++++++++++------------- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/docs/source/readme.rst b/docs/source/readme.rst index de8686a8..3cc7e4b6 100644 --- a/docs/source/readme.rst +++ b/docs/source/readme.rst @@ -69,12 +69,12 @@ TL;DR setup guide Installation and dependencies ----------------------------- -The benefits of using a Python package manager (distribution), such as Anaconda or -Canopy, are many. Mainly, it brings easy and robust package management and -avoids messing up with your system's default python. An alternative is to use -package managers like apt-get for Ubuntu or -Homebrew/MacPorts/Fink for Macos. I personally recommend using Miniconda which you -can find here: https://conda.io/miniconda.html. +The benefits of using a Python package manager (distribution), such as +(ana)conda or Canopy, are many. Mainly, it brings easy and robust package +management and avoids messing up with your system's default python. An +alternative is to use package managers like apt-get for Ubuntu or +Homebrew/MacPorts/Fink for Macos. I personally recommend using Miniconda which +you can find here: https://conda.io/miniconda.html. ``VIP`` depends on existing packages from the Python ecosystem, such as ``numpy``, ``scipy``, ``matplotlib``, ``pandas``, ``astropy``, ``scikit-learn``, @@ -141,12 +141,9 @@ you could use ``conda``: $ conda install opencv -``VIP`` ships a stripped-down version of ``RO.DS9`` (by Russell Owen) for convenient -``xpaset/xpaget`` based interaction with ``DS9``. ``VIP`` contains a class -``vipDS9`` that works on top of ``RO.DS9`` containing several useful methods for -``DS9`` control such as displaying arrays, manipulating regions, controlling the -display options, etc. ``VipDS9`` functionality will only be available if you have -``DS9`` and ``XPA`` installed on your system PATH. +``VIP`` contains a class ``vip_hci.fits.ds9`` that enables, through pyDS9, the +interaction with a DS9 window (displaying numpy arrays, controlling the display +options, etc). Also, optionally you can install the Intel Math Kernel Library (MKL) optimizations provided that you have Anaconda(>v2.5) and ``conda`` on your @@ -159,7 +156,7 @@ computations. Run: Starting from version 0.8.0 ``VIP`` offers the possibility of computing SVDs on GPU by using ``cupy``. This remains an optional requirement, to be installed -by the user, as it requires having a real (good) GPU card and a proper CUDA +by the user, as it requires having a decent GPU card and a proper CUDA environment. Loading VIP diff --git a/readme.rst b/readme.rst index de8686a8..3cc7e4b6 100644 --- a/readme.rst +++ b/readme.rst @@ -69,12 +69,12 @@ TL;DR setup guide Installation and dependencies ----------------------------- -The benefits of using a Python package manager (distribution), such as Anaconda or -Canopy, are many. Mainly, it brings easy and robust package management and -avoids messing up with your system's default python. An alternative is to use -package managers like apt-get for Ubuntu or -Homebrew/MacPorts/Fink for Macos. I personally recommend using Miniconda which you -can find here: https://conda.io/miniconda.html. +The benefits of using a Python package manager (distribution), such as +(ana)conda or Canopy, are many. Mainly, it brings easy and robust package +management and avoids messing up with your system's default python. An +alternative is to use package managers like apt-get for Ubuntu or +Homebrew/MacPorts/Fink for Macos. I personally recommend using Miniconda which +you can find here: https://conda.io/miniconda.html. ``VIP`` depends on existing packages from the Python ecosystem, such as ``numpy``, ``scipy``, ``matplotlib``, ``pandas``, ``astropy``, ``scikit-learn``, @@ -141,12 +141,9 @@ you could use ``conda``: $ conda install opencv -``VIP`` ships a stripped-down version of ``RO.DS9`` (by Russell Owen) for convenient -``xpaset/xpaget`` based interaction with ``DS9``. ``VIP`` contains a class -``vipDS9`` that works on top of ``RO.DS9`` containing several useful methods for -``DS9`` control such as displaying arrays, manipulating regions, controlling the -display options, etc. ``VipDS9`` functionality will only be available if you have -``DS9`` and ``XPA`` installed on your system PATH. +``VIP`` contains a class ``vip_hci.fits.ds9`` that enables, through pyDS9, the +interaction with a DS9 window (displaying numpy arrays, controlling the display +options, etc). Also, optionally you can install the Intel Math Kernel Library (MKL) optimizations provided that you have Anaconda(>v2.5) and ``conda`` on your @@ -159,7 +156,7 @@ computations. Run: Starting from version 0.8.0 ``VIP`` offers the possibility of computing SVDs on GPU by using ``cupy``. This remains an optional requirement, to be installed -by the user, as it requires having a real (good) GPU card and a proper CUDA +by the user, as it requires having a decent GPU card and a proper CUDA environment. Loading VIP From dd0c82b177addc50dc1709b7d6f052b2a00e7461 Mon Sep 17 00:00:00 2001 From: Carlos Gomez Date: Sat, 17 Feb 2018 18:52:42 +0100 Subject: [PATCH 3/3] Readme update --- docs/source/readme.rst | 6 +++--- readme.rst | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/source/readme.rst b/docs/source/readme.rst index 3cc7e4b6..2a877506 100644 --- a/docs/source/readme.rst +++ b/docs/source/readme.rst @@ -141,9 +141,9 @@ you could use ``conda``: $ conda install opencv -``VIP`` contains a class ``vip_hci.fits.ds9`` that enables, through pyDS9, the -interaction with a DS9 window (displaying numpy arrays, controlling the display -options, etc). +``VIP`` contains a class ``vip_hci.fits.ds9`` that enables, through ``pyds9``, +the interaction with a DS9 window (displaying numpy arrays, controlling the +display options, etc). Also, optionally you can install the Intel Math Kernel Library (MKL) optimizations provided that you have Anaconda(>v2.5) and ``conda`` on your diff --git a/readme.rst b/readme.rst index 3cc7e4b6..2a877506 100644 --- a/readme.rst +++ b/readme.rst @@ -141,9 +141,9 @@ you could use ``conda``: $ conda install opencv -``VIP`` contains a class ``vip_hci.fits.ds9`` that enables, through pyDS9, the -interaction with a DS9 window (displaying numpy arrays, controlling the display -options, etc). +``VIP`` contains a class ``vip_hci.fits.ds9`` that enables, through ``pyds9``, +the interaction with a DS9 window (displaying numpy arrays, controlling the +display options, etc). Also, optionally you can install the Intel Math Kernel Library (MKL) optimizations provided that you have Anaconda(>v2.5) and ``conda`` on your