Skip to content

Commit

Permalink
Merge pull request #398 from carlgogo/master
Browse files Browse the repository at this point in the history
vip v0.9.10
  • Loading branch information
carlos-gg authored May 4, 2019
2 parents 31e470d + e9be6f7 commit cd90c9a
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 79 deletions.
14 changes: 3 additions & 11 deletions docs/source/vip_hci.metrics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ vip\_hci.metrics.fakedisk module
:undoc-members:
:show-inheritance:

vip\_hci.metrics.frame\_analysis module
---------------------------------------

.. automodule:: vip_hci.metrics.frame_analysis
:members:
:undoc-members:
:show-inheritance:

vip\_hci.metrics.phase\_function module
---------------------------------------

Expand All @@ -81,10 +73,10 @@ vip\_hci.metrics.scattered\_light\_disk module
:undoc-members:
:show-inheritance:

vip\_hci.metrics.snr module
---------------------------
vip\_hci.metrics.snr\_source module
-----------------------------------

.. automodule:: vip_hci.metrics.snr
.. automodule:: vip_hci.metrics.snr_source
:members:
:undoc-members:
:show-inheritance:
Expand Down
16 changes: 0 additions & 16 deletions docs/source/vip_hci.pca.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,6 @@ vip\_hci.pca.pca\_fullfr module
:undoc-members:
:show-inheritance:

vip\_hci.pca.pca\_fullfr\_grid module
-------------------------------------

.. automodule:: vip_hci.pca.pca_fullfr_grid
:members:
:undoc-members:
:show-inheritance:

vip\_hci.pca.pca\_fullfr\_increm module
---------------------------------------

.. automodule:: vip_hci.pca.pca_fullfr_increm
:members:
:undoc-members:
:show-inheritance:

vip\_hci.pca.pca\_local module
------------------------------

Expand Down
2 changes: 1 addition & 1 deletion vip_hci/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.9.9"
__version__ = "0.9.10"

from . import andromeda
from . import preproc
Expand Down
17 changes: 6 additions & 11 deletions vip_hci/metrics/fakecomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,13 @@ def cube_inject_companions(array, psf_template, angle_list, flevel, plsc,
if not isinstance(plsc, float):
raise TypeError("`plsc` must be a float")

rad_dists = np.asarray(rad_dists).reshape(-1) # forces ndim=1
positions = []

# ADI case
if array.ndim == 3:
ceny, cenx = frame_center(array[0])

rad_dists = np.asarray(rad_dists).reshape(-1) # forces ndim=1

if not rad_dists[-1] < min(ceny, cenx) - 5:
raise ValueError('rad_dists last location is at the border (or '
'outside) of the field')
Expand Down Expand Up @@ -132,19 +131,14 @@ def cube_inject_companions(array, psf_template, angle_list, flevel, plsc,

if verbose:
print('\t(X,Y)=({:.2f}, {:.2f}) at {:.2f} arcsec '
'({:.2f} pxs)'.format(pos_x, pos_y, rad_arcs, rad))
'({:.2f} pxs from center)'.format(pos_x, pos_y,
rad_arcs, rad))

# ADI+mSDI (IFS) case
if array.ndim == 4 and psf_template.ndim == 3:
ceny, cenx = frame_center(array[0, 0])

if isinstance(rad_dists, (int, float)):
check_coor = rad_dists
rad_dists = np.array([rad_dists])
elif isinstance(rad_dists, (list, np.ndarray)):
check_coor = rad_dists[-1]
rad_dists = np.array(rad_dists)
if not check_coor < min(ceny, cenx) - 5:
if not rad_dists[-1] < min(ceny, cenx) - 5:
raise ValueError('rad_dists last location is at the border (or '
'outside) of the field')

Expand Down Expand Up @@ -195,7 +189,8 @@ def cube_inject_companions(array, psf_template, angle_list, flevel, plsc,

if verbose:
print('\t(X,Y)=({:.2f}, {:.2f}) at {:.2f} arcsec '
'({:.2f} pxs)'.format(pos_x, pos_y, rad_arcs, rad))
'({:.2f} pxs from center)'.format(pos_x, pos_y,
rad_arcs, rad))

if full_output:
return array_out, positions
Expand Down
52 changes: 27 additions & 25 deletions vip_hci/pca/pca_fullfr.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,37 +68,39 @@ def pca(cube, angle_list, cube_ref=None, scale_list=None, ncomp=1,
target frames.
* ADI (``cube`` is a 3d array): if an int is provided, ``ncomp`` is the
number of PCs extracted from ``cube`` itself. If ``ncomp`` is a float in
the interval (0, 1] then it corresponds to the desired cumulative
explained variance ratio (the corresponding number of components is
estimated). If ``ncomp`` is a tuple, then it corresponds to an interval
of PCs in which final residual frames are computed. If ``source_xy`` is
not None, then the S/Ns (mean value in a 1xFWHM circular aperture) of
the given (X,Y) coordinates are computed.
number of PCs extracted from ``cube`` itself. If ``ncomp`` is a float
in the interval (0, 1] then it corresponds to the desired cumulative
explained variance ratio (the corresponding number of components is
estimated). If ``ncomp`` is a tuple, then it corresponds to an
interval of PCs in which final residual frames are computed. If
``source_xy`` is not None, then the S/Ns (mean value in a 1xFWHM
circular aperture) of the given (X,Y) coordinates are computed.
* ADI+RDI (``cube`` and ``cube_ref`` are 3d arrays): ``ncomp`` is the
number of PCs obtained from ``cube_ref``. If ``ncomp`` is a tuple, then
it corresponds to an interval of PCs (obtained from ``cube_ref``) in
which final residual frames are computed. If ``source_xy`` is not None,
then the S/Ns (mean value in a 1xFWHM circular aperture) of the given
(X,Y) coordinates are computed.
number of PCs obtained from ``cube_ref``. If ``ncomp`` is a tuple,
then it corresponds to an interval of PCs (obtained from ``cube_ref``)
in which final residual frames are computed. If ``source_xy`` is not
None, then the S/Ns (mean value in a 1xFWHM circular aperture) of the
given (X,Y) coordinates are computed.
* ADI+mSDI (``cube`` is a 4d array and ``adimsdi="single"``): ``ncomp``
is the number of PCs obtained from the whole set of frames
(n_channels * n_adiframes). If ``ncomp`` is a float in the interval
(0, 1] then it corresponds to the desired CEVR, and the corresponding
number of components will be estimated. If ``ncomp`` is a tuple, then it
corresponds to an interval of PCs in which final residual frames are
computed. If ``source_xy`` is not None, then the S/Ns (mean value in a
1xFWHM circular aperture) of the given (X,Y) coordinates are computed.
is the number of PCs obtained from the whole set of frames
(n_channels * n_adiframes). If ``ncomp`` is a float in the interval
(0, 1] then it corresponds to the desired CEVR, and the corresponding
number of components will be estimated. If ``ncomp`` is a tuple, then
it corresponds to an interval of PCs in which final residual frames
are computed. If ``source_xy`` is not None, then the S/Ns (mean value
in a 1xFWHM circular aperture) of the given (X,Y) coordinates are
computed.
* ADI+mSDI (``cube`` is a 4d array and ``adimsdi="double"``): ``ncomp``
must be a tuple, where the first value is the number of PCs obtained
from each multi-spectral frame (if None then this stage will be skipped
and the spectral channels will be combined without subtraction); the
second value sets the number of PCs used in the second PCA stage,
ADI-like using the residuals of the first stage (if None then the second
PCA stage is skipped and the residuals are de-rotated and combined).
must be a tuple, where the first value is the number of PCs obtained
from each multi-spectral frame (if None then this stage will be
skipped and the spectral channels will be combined without
subtraction); the second value sets the number of PCs used in the
second PCA stage, ADI-like using the residuals of the first stage (if
None then the second PCA stage is skipped and the residuals are
de-rotated and combined).
svd_mode : {'lapack', 'arpack', 'eigen', 'randsvd', 'cupy', 'eigencupy',
'randcupy', 'pytorch', 'eigenpytorch', 'randpytorch'}, str optional
Expand Down
19 changes: 10 additions & 9 deletions vip_hci/pca/pca_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,18 @@ def pca_annular(cube, angle_list, cube_ref=None, scale_list=None, radius_int=0,
target (sectors of) frames. Depends on the dimensionality of `cube`.
* ADI and ADI+RDI case: if a single integer is provided, then the same
number of PCs will be subtracted at each separation (annulus). If a
tuple is provided, then a different number of PCs will be used for each
annulus (starting with the innermost one). If ``ncomp`` is set to
``auto`` then the number of PCs are calculated for each region/patch
automatically.
number of PCs will be subtracted at each separation (annulus). If a
tuple is provided, then a different number of PCs will be used for
each annulus (starting with the innermost one). If ``ncomp`` is set to
``auto`` then the number of PCs are calculated for each region/patch
automatically.
* ADI+mSDI case: ``ncomp`` must be a tuple (two integers) with the
number of PCs obtained from each multi-spectral frame (for each sector)
and the number of PCs used in the second PCA stage (ADI fashion, using
the residuals of the first stage). If None then the second PCA stage is
skipped and the residuals are de-rotated and combined.
number of PCs obtained from each multi-spectral frame (for each
sector) and the number of PCs used in the second PCA stage (ADI
fashion, using the residuals of the first stage). If None then the
second PCA stage is skipped and the residuals are de-rotated and
combined.
svd_mode : {'lapack', 'arpack', 'eigen', 'randsvd', 'cupy', 'eigencupy',
'randcupy', 'pytorch', 'eigenpytorch', 'randpytorch'}, str optional
Expand Down
13 changes: 7 additions & 6 deletions vip_hci/pca/utils_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ def pca_grid(cube, angle_list, fwhm=None, range_pcs=None, source_xy=None,
Size of the FWHM in pixels, used for computing S/Ns when ``source_xy``
is passed.
range_pcs : None or tuple, optional
The interval of PCs to be tried. If a range is entered as
[PC_INI, PC_MAX] a sequential grid will be evaluated between PC_INI
and PC_MAX with step of 1. If a range is entered as
[PC_INI, PC_MAX, STEP] a grid will be evaluated between PC_INI and
PC_MAX with the given STEP. If None, PC_INI=1, PC_MAX=n_frames-1 and
STEP=1, which will result in longer running time.
The interval of PCs to be tried. If a ``range_pcs`` is entered as
``[PC_INI, PC_MAX]`` a sequential grid will be evaluated between
``PC_INI`` and ``PC_MAX`` with step of 1. If a ``range_pcs`` is entered
as ``[PC_INI, PC_MAX, STEP]`` a grid will be evaluated between
``PC_INI`` and ``PC_MAX`` with the given ``STEP``. If ``range_pcs`` is
None, ``PC_INI=1``, ``PC_MAX=n_frames-1`` and ``STEP=1``, which will
result in longer running time.
source_xy : None or tuple of floats
X and Y coordinates of the pixel where the source is located and whose
SNR is going to be maximized.
Expand Down

0 comments on commit cd90c9a

Please sign in to comment.