Analysing SPHERE Data¶
In this notebook, we will analyse some example data from the SPHERE aperture masking mode using AMICAL.
First, we import the relevant packages and tell it where to find the data.
In [1]:
import os
from matplotlib import pyplot as plt
import amical
In [5]:
datadir = "TestSPHEREData/"
file_t = os.path.join(datadir, "HD142527_IRD_SCIENCE_DBI_LEFT_CUBE.fits")
file_c = os.path.join(datadir, "HD142695_IRD_SCIENCE_DBI_LEFT_CUBE.fits")
Cleaning Step¶
Next, it is important to clean the SPHERE data, which need sky subtraction and clipping bad frames.
In [7]:
clean_param = {"isz": 149, "r1": 70, "dr": 2, "apod": True, "window": 65, "f_kernel": 3}
In [8]:
amical.show_clean_params(file_t, **clean_param)
cube_t = amical.select_clean_data(file_t, clip=True, **clean_param, display=True)
In [9]:
cube_c = amical.select_clean_data(file_c, clip=True, **clean_param, display=True)
Extracting Bispectra¶
We can now extract bispectral observables from the cleaned SPHERE data as normal.
In [10]:
# AMI parameters (refer to the docstrings of `extract_bs` for details)
params_ami = {
"peakmethod": "fft",
"bs_multi_tri": False,
"maskname": "g7",
"fw_splodge": 0.7,
"filtname": "K1",
}
In [11]:
# # 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(
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.
In [15]:
from amical.tools import check_seeing_cond, plot_seeing_cond
cond_t = check_seeing_cond([bs_t])
cond_c = check_seeing_cond([bs_c])
plot_seeing_cond([cond_t, cond_c], lim_seeing=1)
Out[15]:
Calibrate the data.¶
We calibrate the raw data to get get calibrated V2 and CP. bs_c
can be a single calibrator result or a list of calibrators - see amical/core.py
for details.
In [12]:
cal = amical.calibrate(bs_t, bs_c)
In [13]:
# Display and save the results as oifits
amical.show(cal, true_flag_t3=False, cmax=180, pa=0) # bs_t.infos.pa)
# amical.save(cal, oifits_file='example_HD142527_SPHERE.oifits',
# fake_obj=True, verbose=False, pa=bs_t.infos.pa)
-- SHOW -- Inputs are classes from amical.calibrate: -> (Check true_flag_v2, true_flag_t3 and snr parameters)
Out[13]: