Skip to content

Commit

Permalink
Merge pull request #553 from VChristiaens/master
Browse files Browse the repository at this point in the history
Added option for contrast curve calculation
  • Loading branch information
VChristiaens authored Aug 11, 2022
2 parents 4680fb3 + 8055563 commit fd7bd49
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ high-contrast imaging algorithms
Given the rapid expansion of ``VIP``, we summarize here all novelties that were
brought to the package over the past five years. Specifically, the rest of this
manuscript summarizes all major changes since v0.7.0 [@Gomez:2017], that are
included in the latest release of ``VIP`` (v1.3.1). At a structural level,
included in the latest release of ``VIP`` (v1.3.2). At a structural level,
``VIP`` underwent a major change since version v1.1.0, which aimed to migrate
towards a more streamlined and easy-to-use architecture. The package now
revolves around five major modules (`fm`, `invprob`, `metrics`, `preproc` and
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.3.1"
__version__ = "1.3.2"


from . import preproc
Expand Down
36 changes: 22 additions & 14 deletions vip_hci/metrics/contrcurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@

def contrast_curve(cube, angle_list, psf_template, fwhm, pxscale, starphot,
algo, sigma=5, nbranch=1, theta=0, inner_rad=1, fc_rad_sep=3,
wedge=(0, 360), fc_snr=100, student=True, transmission=None,
smooth=True, interp_order=2, plot=True, dpi=vip_figdpi,
debug=False, verbose=True, full_output=False, save_plot=None,
object_name=None, frame_size=None, fix_y_lim=(),
figsize=vip_figsize, **algo_dict):
noise_sep=1, wedge=(0, 360), fc_snr=100, student=True,
transmission=None, smooth=True, interp_order=2, plot=True,
dpi=vip_figdpi, debug=False, verbose=True, full_output=False,
save_plot=None, object_name=None, frame_size=None,
fix_y_lim=(), figsize=vip_figsize, **algo_dict):
""" Computes the contrast curve at a given confidence (``sigma``) level for
an ADI cube or ADI+IFS cube. The contrast is calculated as
sigma*noise/throughput. This implementation takes into account the small
Expand Down Expand Up @@ -82,6 +82,10 @@ def contrast_curve(cube, angle_list, psf_template, fwhm, pxscale, starphot,
maximum possible value, a single fake companion will be injected per
cube and algorithm post-processing (which greatly affects computation
time).
noise_sep: int or None, optional
Radial sampling of the noise level. By default it is performed with a
radial step of 1 pixel. If set to None, it will be automatically set to
be sampled every fwhm pixels radially.
wedge : tuple of floats, optional
Initial and Final angles for using a wedge. For example (-90,90) only
considers the right side of an image.
Expand Down Expand Up @@ -193,7 +197,6 @@ def contrast_curve(cube, angle_list, psf_template, fwhm, pxscale, starphot,
else:
msg0 = 'ALGO : {}, FWHM = {}, # BRANCHES = {}, SIGMA = {}'
print(msg0.format(algo.__name__, fwhm_med, nbranch, sigma))
print(sep)

# throughput
verbose_thru = False
Expand Down Expand Up @@ -250,14 +253,19 @@ def contrast_curve(cube, angle_list, psf_template, fwhm, pxscale, starphot,
ntransmission[1] = np.mean(transmission[1:], axis=0)
transmission = ntransmission.copy()

if interp_order is not None:
# noise measured in the empty frame with better sampling, every px
# starting from 1*FWHM
noise_samp, res_lev_samp, rad_samp = noise_per_annulus(frame_nofc,
separation=1,
fwhm=fwhm_med,
init_rad=fwhm_med,
wedge=wedge)
if interp_order is not None or noise_sep != None:
# noise measured in the empty frame with nosie_sep sampling
if noise_sep is None:
rad_samp = vector_radd
noise_samp = res_throug[1]
res_lev_samp = res_throug[2]
else:
# starting from 1*FWHM
noise_samp, res_lev_samp, rad_samp = noise_per_annulus(frame_nofc,
separation=noise_sep,
fwhm=fwhm_med,
init_rad=fwhm_med,
wedge=wedge)
radmin = vector_radd.astype(int).min()
cutin1 = np.where(rad_samp.astype(int) == radmin)[0][0]
noise_samp = noise_samp[cutin1:]
Expand Down

0 comments on commit fd7bd49

Please sign in to comment.