Skip to content

Commit

Permalink
Simplify extract_bs call.
Browse files Browse the repository at this point in the history
  • Loading branch information
DrSoulain committed Jul 8, 2020
1 parent 7c6c6c1 commit 6850b76
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion amical/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .analysis.easy_candid import fit_binary, getContrastLimit
from .core import calibrate
from .mf_pipeline.ami_function import make_mf
from .mf_pipeline.bispect import extract_bs_mf
from .mf_pipeline.bispect import extract_bs
from .oifits import cal2dict, data2obs, load, loadc, save, show

__version__ = "0.3dev"
4 changes: 2 additions & 2 deletions amical/mf_pipeline/bispect.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
warnings.filterwarnings("ignore")


def extract_bs_mf(cube, filename, maskname, filtname=None, targetname=None, bs_MultiTri=False, n_blocks=0, peakmethod='gauss',
hole_diam=0.8, cutoff=1e-4, fw_splodge=0.7, naive_err=False, n_wl=3, verbose=False, display=True,):
def extract_bs(cube, filename, maskname, filtname=None, targetname=None, bs_MultiTri=False, n_blocks=0, peakmethod='gauss',
hole_diam=0.8, cutoff=1e-4, fw_splodge=0.7, naive_err=False, n_wl=3, verbose=False, display=True,):
"""Compute bispectrum (bs, v2, cp, etc.) from a data cube.
Parameters:
Expand Down
2 changes: 1 addition & 1 deletion amical/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ def sphere_parang(hdr):

def checkSeeingCond(list_nrm):
""" Extract the seeing conditions, parang, averaged vis2
and cp of a list of nrm classes extracted with extract_bs_mf
and cp of a list of nrm classes extracted with extract_bs
function (bispect.py).
Output
Expand Down
13 changes: 7 additions & 6 deletions example_NIRISS.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# groundbased observations.
# ----------------------------------

# AMI parameters (refer to the docstrings of `extract_bs_mf` for details)
# AMI parameters (refer to the docstrings of `extract_bs` for details)
params_ami = {"peakmethod": 'gauss',
"bs_MultiTri": False,
"maskname": "g7",
Expand All @@ -46,10 +46,10 @@

# Extract raw complex observables for the target and the calibrator:
# It's the core of the pipeline (amical/mf_pipeline/bispect.py)
bs_t = amical.extract_bs_mf(cube_t, file_t, targetname='fakebinary',
**params_ami, display=True)
bs_c = amical.extract_bs_mf(cube_c, file_c, targetname='fakepsf',
**params_ami, display=False)
bs_t = amical.extract_bs(cube_t, file_t, targetname='fakebinary',
**params_ami, display=True)
bs_c = amical.extract_bs(cube_c, file_c, targetname='fakepsf',
**params_ami, display=False)

# Calibrate the raw data to get get calibrated V2 and CP
# bs_c can be a single calibrator result or a list of calibrator.
Expand All @@ -68,6 +68,7 @@
# So we imposed ncore=1 by default (no multiproc), you can
# try to increase ncore option in fit_binary but it could crash
# depending on your system (tested on OSX-mojave).
fit = amical.fit_binary(s[1], step=50, verbose=False, ncore=1)
if False:
fit = amical.fit_binary(s[1], step=50, verbose=False, ncore=1)

plt.show(block=True)
10 changes: 5 additions & 5 deletions example_SPHERE.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
corr_ghost=False,
display=True)[0]

# AMI parameters (refer to the docstrings of `extract_bs_mf` for details)
# AMI parameters (refer to the docstrings of `extract_bs` for details)
params_ami = {"peakmethod": 'gauss',
"bs_MultiTri": False,
"maskname": "g7",
Expand All @@ -34,10 +34,10 @@

# # Extract raw complex observables for the target and the calibrator:
# # It's the core of the pipeline (amical/mf_pipeline/bispect.py)
bs_t = amical.extract_bs_mf(cube_t, file_t, targetname='HD142527',
**params_ami, display=True)
bs_c = amical.extract_bs_mf(cube_c, file_c, targetname='HD142695',
**params_ami, display=False)
bs_t = amical.extract_bs(cube_t, file_t, targetname='HD142527',
**params_ami, display=True)
bs_c = amical.extract_bs(cube_c, file_c, targetname='HD142695',
**params_ami, display=False)

# In case of multiple files for a same target, you can
# check the seeing condition and select only the good ones.
Expand Down

0 comments on commit 6850b76

Please sign in to comment.