diff --git a/docs/source/vip_hci.metrics.rst b/docs/source/vip_hci.metrics.rst index c619a8a7..9e729eda 100644 --- a/docs/source/vip_hci.metrics.rst +++ b/docs/source/vip_hci.metrics.rst @@ -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 --------------------------------------- @@ -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: diff --git a/docs/source/vip_hci.pca.rst b/docs/source/vip_hci.pca.rst index ea16506b..e8443464 100644 --- a/docs/source/vip_hci.pca.rst +++ b/docs/source/vip_hci.pca.rst @@ -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 ------------------------------ diff --git a/vip_hci/__init__.py b/vip_hci/__init__.py index 3085084a..0225af96 100644 --- a/vip_hci/__init__.py +++ b/vip_hci/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.9.9" +__version__ = "0.9.10" from . import andromeda from . import preproc diff --git a/vip_hci/metrics/fakecomp.py b/vip_hci/metrics/fakecomp.py index 65d9792e..d72eadb3 100644 --- a/vip_hci/metrics/fakecomp.py +++ b/vip_hci/metrics/fakecomp.py @@ -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') @@ -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') @@ -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 diff --git a/vip_hci/pca/pca_fullfr.py b/vip_hci/pca/pca_fullfr.py index 23e08329..20ce9988 100644 --- a/vip_hci/pca/pca_fullfr.py +++ b/vip_hci/pca/pca_fullfr.py @@ -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 diff --git a/vip_hci/pca/pca_local.py b/vip_hci/pca/pca_local.py index 782d292b..354b4fe1 100644 --- a/vip_hci/pca/pca_local.py +++ b/vip_hci/pca/pca_local.py @@ -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 diff --git a/vip_hci/pca/utils_pca.py b/vip_hci/pca/utils_pca.py index f2381cbe..d1ecda14 100644 --- a/vip_hci/pca/utils_pca.py +++ b/vip_hci/pca/utils_pca.py @@ -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.