예제 #1
0
파일: test_io.py 프로젝트: anand0xff/AMICAL
def test_save(filepath):
    hdu = fits.open(filepath)
    cube = hdu[0].data
    hdu.close()
    params_ami = {
        "peakmethod": 'fft',
        "bs_multi_tri": False,
        "maskname": "g7",
        "fw_splodge": 0.7,
    }
    bs = amical.extract_bs(cube,
                           filepath,
                           targetname='test',
                           **params_ami,
                           display=False)
    cal = amical.calibrate(bs, bs)
    assert isinstance(cal, munch.Munch)

    dic, savefile = amical.save(cal, oifits_file='test.oifits', fake_obj=True)
    v2 = dic['OI_VIS2']['VIS2DATA']
    cp = dic['OI_T3']['T3PHI']

    assert isinstance(dic, dict)
    assert isinstance(savefile, str)
    assert (isinstance(v2, np.ndarray))
    assert (isinstance(cp, np.ndarray))
    assert (len(v2) == 21)
    assert (len(cp) == 35)
예제 #2
0
def example_cal_fft(global_datadir):
    fits_file = global_datadir / "test.fits"
    with fits.open(fits_file) as fh:
        cube = fh[0].data
    bs = amical.extract_bs(
        cube,
        fits_file,
        targetname="test",
        bs_multi_tri=False,
        maskname="g7",
        fw_splodge=0.7,
        display=False,
        peakmethod="fft",
    )
    return amical.calibrate(bs, bs)
예제 #3
0
def test_cal_phscorr(global_datadir):
    fits_file = global_datadir / "test.fits"
    with fits.open(fits_file) as fh:
        cube = fh[0].data
    bs = amical.extract_bs(
        cube,
        fits_file,
        targetname="test",
        bs_multi_tri=False,
        maskname="g7",
        fw_splodge=0.7,
        display=False,
        peakmethod="fft",
    )
    cal = amical.calibrate(bs, bs, apply_atmcorr=True)
    assert isinstance(cal, munch.Munch)
예제 #4
0
파일: test_io.py 프로젝트: stellaCL/AMICAL
def test_save(bss, tmpdir):
    bs = bss["fft"]
    cal = amical.calibrate(bs, bs)
    assert isinstance(cal, munch.Munch)

    dic, savefile = amical.save(cal, oifits_file='test.oifits', 
                                datadir=tmpdir, fake_obj=True)
    v2 = dic['OI_VIS2']['VIS2DATA']
    cp = dic['OI_T3']['T3PHI']

    assert isinstance(dic, dict)
    assert isinstance(savefile, str)
    assert(isinstance(v2, np.ndarray))
    assert(isinstance(cp, np.ndarray))
    assert(len(v2) == 21)
    assert(len(cp) == 35)
예제 #5
0
파일: test_io.py 프로젝트: anand0xff/AMICAL
def test_show(filepath):
    hdu = fits.open(filepath)
    cube = hdu[0].data
    hdu.close()
    params_ami = {
        "peakmethod": 'fft',
        "bs_multi_tri": False,
        "maskname": "g7",
        "fw_splodge": 0.7,
    }
    bs = amical.extract_bs(cube,
                           filepath,
                           targetname='test',
                           **params_ami,
                           display=False)
    cal = amical.calibrate(bs, bs)
    amical.show(cal)
예제 #6
0
def perform_calibrate(args):
    """Calibrate the data with AMICAL (save calibrated oifits files)"""

    sciname, calname = _select_association_file(args)
    bs_t = amical.load_bs_hdf5(sciname)

    bs_c = []
    for x in calname:
        bs_c = amical.load_bs_hdf5(x)

    display = len(bs_c) > 1
    cal = amical.calibrate(
        bs_t,
        bs_c,
        clip=args.clip,
        normalize_err_indep=args.norm,
        apply_atmcorr=args.atmcorr,
        apply_phscorr=args.phscorr,
        display=display,
    )

    # Position angle from North to East
    pa = bs_t.infos.pa

    cprint("\nPosition angle computed for the data: pa = %2.3f deg" % pa,
           "cyan")

    # Display and save the results as oifits
    if args.plot:
        amical.show(cal, true_flag_t3=False, cmax=180, pa=pa)
        plt.show()

    oifits_file = Path(bs_t.infos.filename).stem + "_calibrated.fits"

    amical.save(cal, oifits_file=oifits_file, datadir=args.outdir)
    return 0
예제 #7
0
    "bs_multi_tri": False,
    "maskname": "g7",
    "fw_splodge": 0.7,
}

# 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="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 calibrated V2 and CP.
# bs_c can be a single calibrator result or a list of calibrators.
# (see amical/calibration.py for details).
cal = amical.calibrate(bs_t, bs_c)

# Display and save the results as oifits
amical.show(cal)
dic = amical.save(cal,
                  oifits_file="example_fakebinary_NIRISS.oifits",
                  fake_obj=True)

plt.show(block=True)
예제 #8
0
파일: test_io.py 프로젝트: stellaCL/AMICAL
def test_show(bss):
    bs = bss["fft"]
    cal = amical.calibrate(bs, bs)
    amical.show(cal)
예제 #9
0
파일: test_io.py 프로젝트: stellaCL/AMICAL
def test_calibration(bss):
    bs = bss["fft"]
    cal = amical.calibrate(bs, bs)
    assert isinstance(cal, munch.Munch)