Skip to content

Commit

Permalink
Merge pull request #531 from chdahlqvist/master
Browse files Browse the repository at this point in the history
Introduction of completeness_curve and completeness_map functions
  • Loading branch information
VChristiaens authored Apr 29, 2022
2 parents f230c16 + a90dfd6 commit c2c5714
Show file tree
Hide file tree
Showing 3 changed files with 888 additions and 10 deletions.
13 changes: 8 additions & 5 deletions paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ authors:
- name: Ralf Farkas
orcid: 0000-0002-7647-1429
affiliation: 3
- name: Alan Rainot
orcid: 0000-0001-9904-0624
affiliation: 4
- name: Carl-Henrik Dahlqvist
orcid: 0000-0003-4994-9244
affiliation: 1
- name: Henry Ngo
orcid: 0000-0001-5172-4859
affiliation: 4
- name: Alan Rainot
orcid: 0000-0001-9904-0624
affiliation: 5
- name: Olivier Absil
orcid: 0000-0002-4006-6237
Expand All @@ -38,9 +41,9 @@ affiliations:
index: 2
- name: Rheinische Friedrich-Wilhelms-Universität Bonn, Germany
index: 3
- name: Institute of Astronomy, KU Leuven, Belgium
index: 4
- name: NRC Herzberg Astronomy and Astrophysics, Victoria, BC, Canada
index: 4
- name: Institute of Astronomy, KU Leuven, Belgium
index: 5
- name: School of Physics and Astronomy, Monash University, Vic 3800, Australia
index: 6
Expand Down
75 changes: 75 additions & 0 deletions tests/test_contrcurve.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
"""
Tests for metrics/contrcurve.py
"""
import copy
from .helpers import fixture, np
from vip_hci.psfsub.pca_local import pca_annular
from vip_hci.metrics import completeness_curve,completeness_map
from vip_hci.preproc import frame_crop

@fixture(scope="module")

def get_cube(example_dataset_adi):
"""
Get the ADI sequence from conftest.py.
Parameters
----------
example_dataset_adi : fixture
Taken automatically from ``conftest.py``.
Returns
-------
dsi : VIP Dataset
"""
dsi = copy.copy(example_dataset_adi)

return dsi

def test_completeness_curve(get_cube):

ds = get_cube

excpected_res=np.array([1200])
cen=ds.psf.shape[-1]//2
psf=frame_crop(ds.psf,10,cenxy=[cen,cen])
an_dist,comp_curve = completeness_curve(ds.cube,ds.angles,psf,
ds.fwhm,pca_annular,an_dist=[20],
ini_contrast=excpected_res,plot=False)

if np.allclose(comp_curve/excpected_res, [1], atol=0.5):
check=True
else:
print(comp_curve)
check=False

msg = "Issue with completeness curve estimation"
assert check, msg

def test_completeness_map(get_cube):

ds = get_cube

excpected_res=np.array([1200])
cen=ds.psf.shape[-1]//2
psf=frame_crop(ds.psf,10,cenxy=[cen,cen])
an_dist,comp_map = completeness_map(ds.cube,ds.angles,psf,
ds.fwhm,pca_annular,an_dist=[20],
ini_contrast=excpected_res)

if np.allclose(comp_map[:,-2]/excpected_res, [1], atol=0.5):
check=True
else:
print(comp_map[:,-2])
check=False

msg = "Issue with completeness map estimation"
assert check, msg






Loading

0 comments on commit c2c5714

Please sign in to comment.