Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
61185d8
Fresh run of tuto 2
VChristiaens Oct 28, 2024
88f4ef6
Deleted checkpoints
VChristiaens Oct 31, 2024
e5cdf27
Merge branch 'master' of https://github.com/vortex-exoplanet/VIP
VChristiaens Oct 31, 2024
ad9b76e
Merge branch 'master' of https://github.com/vortex-exoplanet/VIP
VChristiaens Nov 6, 2024
411cc84
Added new version
VChristiaens Nov 6, 2024
47b4131
Missing import added and PEP8 formatting
VChristiaens Nov 6, 2024
d36179b
Updated mu and sigma estimation to allow for f_guess and psfn to be p…
VChristiaens Nov 22, 2024
f1e13bc
Updated outputs of cube_recenter_2dfit to not be objects
VChristiaens Nov 22, 2024
d6c34c2
PEP8 formatting
VChristiaens Nov 22, 2024
fa82d1a
Re-ordered module loading in __init__ to avoid circular import
VChristiaens Nov 23, 2024
9b578d5
Placed cube_planet_free in fakecomp.py module to avoid circular import
VChristiaens Nov 23, 2024
0bf58e8
Updated import path for cube_planet_free
VChristiaens Nov 23, 2024
c1cca48
Added option to smooth PCA-SDI results before second-pass PCA-ADI in …
VChristiaens Nov 24, 2024
0ebff9a
New option for NEGFC to be compatible with input 4D ASDI cube and sin…
VChristiaens Nov 24, 2024
c0ddeaf
PCA-ADI step of 2-stage PCA-SADI is now compatible with a threshold i…
VChristiaens Nov 24, 2024
d89bfb5
PCA-ADI step of 2-stage PCA-SADI is now compatible with a threshold i…
VChristiaens Nov 24, 2024
daec49d
Propagated algorithm options to pca function in NEGFC, by popping all…
VChristiaens Nov 24, 2024
25bb7f3
Added option for scaling to be a tuple of 2 values for PCA-SADI in 2 …
VChristiaens Nov 24, 2024
e23beb2
Updated optional arguments treatment in NEGFC -- the arguments are no…
VChristiaens Nov 25, 2024
6158995
Updated cube_planet_free import path in test script
VChristiaens Nov 25, 2024
1396286
Adapted wedge test in mu_sigma estimate
VChristiaens Nov 25, 2024
b4d6484
Fixed psfn=None case in mu_sigma estimate
VChristiaens Nov 25, 2024
2972942
reverted mu_sigma function to original state as it is in fact compati…
VChristiaens Nov 25, 2024
f961f6b
Changed default number of bins for residual speckle uncertainty devia…
VChristiaens Nov 27, 2024
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
1,745 changes: 0 additions & 1,745 deletions docs/source/tutorials/.ipynb_checkpoints/01A_quickstart-checkpoint.ipynb

This file was deleted.

2,907 changes: 2,838 additions & 69 deletions docs/source/tutorials/02_preproc.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/pre_3_10/test_metrics_contrcurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from tests.helpers import fixture
from tests.helpers import np
from vip_hci.config import VLT_NACO
from vip_hci.fm.utils_negfc import cube_planet_free
from vip_hci.fm import cube_planet_free
from vip_hci.fm.utils_negfc import find_nearest
from vip_hci.metrics import contrast_curve
from vip_hci.preproc import frame_crop
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__ = "1.6.2"
__version__ = "1.6.4"

from . import preproc
from . import config
Expand Down
85 changes: 84 additions & 1 deletion vip_hci/fm/fakecomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
'normalize_psf',
'cube_inject_companions',
'generate_cube_copies_with_injections',
'frame_inject_companion']
'frame_inject_companion',
'cube_planet_free']

from multiprocessing import cpu_count
import numpy as np
Expand Down Expand Up @@ -810,3 +811,85 @@ def psf_norm_2d(psf, fwhm, threshold, mask_core, full_output, verbose):
msg += " ``vip_hci.preproc.cube_collapse`` first, or loop on the "
msg += "temporal axis."
raise ValueError(msg.format(array.shape[0]))


def cube_planet_free(planet_parameter, cube, angs, psfn, imlib='vip-fft',
interpolation='lanczos4', transmission=None):
"""Return a cube in which we have injected negative fake companion at the\
position/flux given by planet_parameter.

Parameters
----------
planet_parameter: numpy.array or list or tuple
The (r, theta, flux) for all known companions. For a 3D cube, this
parameter must have a shape (n_pl,3) or (3,) -- the latter case assumes
a single planet in the data. For a 4d cube r, theta and flux
must all be 1d arrays with length equal to cube.shape[0]; i.e.
planet_parameter should have shape: (n_pl,3,n_ch).
cube: numpy ndarray
The cube of fits images expressed as a numpy.array.
angs: numpy ndarray
The parallactic angle fits image expressed as a numpy.array.
psfn: 2d or 3d numpy ndarray
The normalized psf expressed as a numpy ndarray. Can be 3d for a 4d
(spectral+ADI) input cube.
imlib : str, optional
See the documentation of the ``vip_hci.preproc.frame_rotate`` function.
interpolation : str, optional
See the documentation of the ``vip_hci.preproc.frame_rotate`` function.
transmission: numpy array, optional
Radial transmission of the coronagraph, if any. Array with either
2 x n_rad, 1+n_ch x n_rad columns. The first column should contain the
radial separation in pixels, while the other column(s) are the
corresponding off-axis transmission (between 0 and 1), for either all,
or each spectral channel (only relevant for a 4D input cube).

Returns
-------
cpf : numpy.array
The cube with negative companions injected at the position given in
planet_parameter.

"""
cpf = np.zeros_like(cube)

# unify planet_parameter format
planet_parameter = np.array(planet_parameter)
cond1 = cube.ndim == 3 and planet_parameter.ndim < 2
cond2 = cube.ndim == 4 and planet_parameter.ndim < 3
if cond1 or cond2:
planet_parameter = planet_parameter[np.newaxis, :]

if cube.ndim == 4:
if planet_parameter.shape[2] != cube.shape[0]:
raise TypeError("Input planet parameter with wrong dimensions.")

for i in range(planet_parameter.shape[0]):
if i == 0:
cube_temp = cube
else:
cube_temp = cpf

if cube.ndim == 4:
for j in range(cube.shape[0]):
flevel = -planet_parameter[i, 2, j]
r = planet_parameter[i, 0, j]
theta = planet_parameter[i, 1, j]
cpf[j] = cube_inject_companions(cube_temp[j], psfn[j], angs,
flevel=flevel,
rad_dists=[r],
n_branches=1,
theta=theta,
imlib=imlib,
interpolation=interpolation,
verbose=False,
transmission=transmission)
else:
cpf = cube_inject_companions(cube_temp, psfn, angs, n_branches=1,
flevel=-planet_parameter[i, 2],
rad_dists=[planet_parameter[i, 0]],
theta=planet_parameter[i, 1],
imlib=imlib, verbose=False,
interpolation=interpolation,
transmission=transmission)
return cpf
Loading
Loading