From 3c3403e95d707351a47470297c2e96de1215d50c Mon Sep 17 00:00:00 2001 From: Carlos Gomez Date: Mon, 22 May 2017 17:23:05 +0200 Subject: [PATCH 1/2] Minor fixes (one more Numpy non-int indices error). --- readme.rst | 5 +++-- vip/pca/pca_fullfr.py | 4 ++-- vip/phot/contrcurve.py | 4 ++-- vip/preproc/cosmetics.py | 6 +++--- vip/var/shapes.py | 3 ++- vip/var/utils_var.py | 10 +++++++--- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/readme.rst b/readme.rst index f2815c0f..52a37939 100644 --- a/readme.rst +++ b/readme.rst @@ -4,8 +4,9 @@ VIP - Vortex Image Processing package Attribution ------------ -Please cite Gomez Gonzalez et al. 2017 (accepted) whenever you publish data -reduced with VIP. Astrophysics Source Code Library reference [ascl:1603.003] +Please cite Gomez Gonzalez et al. 2017 (accepted, `arXiv`_) +whenever you publish data reduced with VIP. Astrophysics Source Code Library +reference [ascl:1603.003]. Introduction diff --git a/vip/pca/pca_fullfr.py b/vip/pca/pca_fullfr.py index b3ec300f..5349c530 100644 --- a/vip/pca/pca_fullfr.py +++ b/vip/pca/pca_fullfr.py @@ -4,7 +4,7 @@ PCA algorithm performed on full frame for ADI, RDI or SDI (IFS data). """ -from __future__ import division +from __future__ import division, print_function __author__ = 'C. Gomez @ ULg' __all__ = ['pca', @@ -556,7 +556,7 @@ def truncate_svd_get_finframe(matrix, angle_list, ncomp, V): transformed = np.dot(V[:ncomp], matrix.T) reconstructed = np.dot(transformed.T, V[:ncomp]) residuals = matrix - reconstructed - frsize = np.sqrt(matrix.shape[1]) # only for square frames + frsize = int(np.sqrt(matrix.shape[1])) # only for square frames residuals_res = reshape_matrix(residuals, frsize, frsize) residuals_res_der = cube_derotate(residuals_res, angle_list) frame = cube_collapse(residuals_res_der, mode=collapse) diff --git a/vip/phot/contrcurve.py b/vip/phot/contrcurve.py index e641add0..32e49b81 100644 --- a/vip/phot/contrcurve.py +++ b/vip/phot/contrcurve.py @@ -436,8 +436,8 @@ def throughput(cube, angle_list, psf_template, fwhm, pxscale, algo, nbranch=1, # each branch is computed separately for br in range(nbranch): # each pattern is computed separately. For each pattern the companions - # are separated by "fc_rad_sep * fwhm" - for irad in range(fc_rad_sep): + # are separated by "fc_rad_sep * fwhm", interleaving the injections + for irad in range(fc_rad_sep): radvec = vector_radd[irad::fc_rad_sep] cube_fc = array.copy() # filling map with small numbers diff --git a/vip/preproc/cosmetics.py b/vip/preproc/cosmetics.py index 774ecd9c..3c9f1d9a 100644 --- a/vip/preproc/cosmetics.py +++ b/vip/preproc/cosmetics.py @@ -40,9 +40,9 @@ def cube_crop_frames(array, size, xy=None, verbose=True): """ if not array.ndim == 3: - raise TypeError('\nArray is not 3d, not a cube') + raise TypeError('Array is not 3d, not a cube') if not isinstance(size, int): - raise TypeError('\nSize must be integer') + raise TypeError('Size must be integer') if size%2!=0: size -= 1 if size >= array.shape[1]: @@ -53,7 +53,7 @@ def cube_crop_frames(array, size, xy=None, verbose=True): if xy is not None: if not (isinstance(xy[0], int) or isinstance(xy[1], int)): - raise TypeError('\nXY must be a tuple of integers') + raise TypeError('XY must be a tuple of integers') cenx, ceny = xy # Note the +1 when closing the interval (python doesn't include the # endpoint) diff --git a/vip/var/shapes.py b/vip/var/shapes.py index 716698e6..64f1edf6 100644 --- a/vip/var/shapes.py +++ b/vip/var/shapes.py @@ -259,7 +259,8 @@ def get_square_robust(array, size, y, x, position=False, else: # wing is added to the sides of the subframe center. Note the +1 when # closing the interval (python doesn't include the endpoint) - array_view = array[y-wing_bef:y+wing_aft+1, x-wing_bef:x+wing_aft+1].copy() + array_view = array[int(y-wing_bef):int(y+wing_aft+1), + int(x-wing_bef):int(x+wing_aft+1)].copy() if position: return array_view, y-wing_bef, x-wing_bef else: return array_view diff --git a/vip/var/utils_var.py b/vip/var/utils_var.py index 16e6b601..7d92bc04 100644 --- a/vip/var/utils_var.py +++ b/vip/var/utils_var.py @@ -125,7 +125,7 @@ def pp_subplots(*args, **kwargs): else: logscale = False if kwargs.has_key('cmap'): custom_cmap = kwargs['cmap'] - else: custom_cmap = 'CMRmap' # 'RdBu_r' + else: custom_cmap = 'magma' # 'CMRmap' 'RdBu_r' if kwargs.has_key('colorb'): colorb = kwargs['colorb'] else: colorb = True @@ -212,8 +212,12 @@ def pp_subplots(*args, **kwargs): cb = colorbar(im, ax=ax, cax=cax, drawedges=False) cb.outline.set_linewidth(0.1) cb.ax.tick_params(labelsize=8) - if grid: - ax.grid('on', which='both', color='w') + if grid: + ax.tick_params(axis='both', which='minor') + minor_ticks = np.arange(0, data[i].shape[0], 10) + ax.set_xticks(minor_ticks, minor=True) + ax.set_yticks(minor_ticks, minor=True) + ax.grid('on', which='minor', color='gray', linewidth=1, alpha=.6) else: ax.grid('off') if noax: ax.set_axis_off() From 6204d2097934a4c63e01ce0ef81cdb1587f0dd1a Mon Sep 17 00:00:00 2001 From: Carlos Gomez Date: Mon, 22 May 2017 17:23:35 +0200 Subject: [PATCH 2/2] 0.7.1 --- vip/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vip/__init__.py b/vip/__init__.py index 36653c81..f99f6611 100644 --- a/vip/__init__.py +++ b/vip/__init__.py @@ -12,7 +12,7 @@ from . import stats from . import var -__version__ = "0.7.0" +__version__ = "0.7.1" print("---------------------------------------------------") print(" oooooo oooo ooooo ooooooooo. ")