Skip to content

Commit

Permalink
Reading of PDS 70 spectral cube made directly in test - as it is not …
Browse files Browse the repository at this point in the history
…a proper Dataset
  • Loading branch information
VChristiaens committed Mar 17, 2024
1 parent 80708e3 commit 3f79838
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 54 deletions.
38 changes: 0 additions & 38 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,44 +186,6 @@ def example_dataset_ifs_crop():
return dataset


@pytest.fixture(scope="session")
def example_dataset_ifs_cen():
"""
Download example FITS IFS spectral cube with satellite spots.
Returns
-------
dataset : HCIDataset
Notes
-----
We use the helper function ``download_resource`` which handles the request
and puts it to sleep for a defined duration if too many requests are done.
They inherently call the Astropy's ``download_file`` function which uses
caching, so the file is downloaded at most once per test run.
"""
print("downloading data...")

url_d = "https://github.com/vortex-exoplanet/VIP_extras/raw/master/datasets"

f1 = download_resource("{}/sphere_ifs_PDS70_cen.fits".format(url_d))
f2 = download_resource("{}/sphere_ifs_PDS70_psf.fits".format(url_d))
f3 = download_resource("{}/sphere_ifs_PDS70_wl.fits".format(url_d))

# load fits
cube = vip.fits.open_fits(f1)
psf = vip.fits.open_fits(f2)
wl = vip.fits.open_fits(f3)

# create dataset object
dataset = vip.objects.Dataset(cube, psf=psf,
px_scale=vip.config.VLT_SPHERE_IFS["plsc"],
wavelengths=wl)

return dataset


@pytest.fixture(scope="session")
def example_dataset_rdi():
"""
Expand Down
26 changes: 10 additions & 16 deletions tests/pre_3_10/test_preproc_recentering.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,27 +647,21 @@ def test_radon(get_ifs_cube_cen, debug=False):
errormsg = "Error when recentering with Radon transform"
n_frames = 1

ds = get_ifs_cube_cen

# ===== OLD - datacube
# url_d="https://github.com/vortex-exoplanet/VIP_extras/raw/master/datasets"

# f1 = download_resource("{}/sphere_ifs_PDS70_cen.fits".format(url_d))
# f2 = download_resource("{}/sphere_ifs_PDS70_psf.fits".format(url_d))
url_d = "https://github.com/vortex-exoplanet/VIP_extras/raw/master/datasets"

# # load fits
# cube = vip.fits.open_fits(f1)
# psfifs = vip.fits.open_fits(f2)
# norm_psf, flux, fwhm = vip.fm.normalize_psf(
# psfifs, fwhm="fit", full_output=True, size=15
# )
f1 = download_resource("{}/sphere_ifs_PDS70_cen.fits".format(url_d))
f2 = download_resource("{}/sphere_ifs_PDS70_psf.fits".format(url_d))

# load fits
cube = vip.fits.open_fits(f1)
psfifs = vip.fits.open_fits(f2)
norm_psf, flux, fwhm = vip.fm.normalize_psf(
ds.psf, fwhm="fit", full_output=True, size=15
psfifs, fwhm="fit", full_output=True, size=15
)

# Fit BKG star position
med_fr = np.nanmedian(ds.cube, axis=0)
med_fr = np.nanmedian(cube, axis=0)
fit_res = vip.var.fit_2dgaussian(med_fr, crop=True, cropsize=13,
cent=(144, 147), debug=False,
full_output=True)
Expand Down Expand Up @@ -718,8 +712,8 @@ def test_radon(get_ifs_cube_cen, debug=False):
)
# med_y = 146.99531922145198
# med_x = 144.27429227212795
cube = ds.cube.copy()
for z in range(ds.cube.shape[0]):
cube = cube.copy()
for z in range(cube.shape[0]):
cube[z] = vip.fm.frame_inject_companion(
cube[z],
norm_psf[z],
Expand Down

0 comments on commit 3f79838

Please sign in to comment.