Skip to content

Commit

Permalink
Add extraction test on file with mask
Browse files Browse the repository at this point in the history
  • Loading branch information
rosteen committed Dec 9, 2024
1 parent a53be86 commit bf81d1e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions jdaviz/configs/cubeviz/plugins/tests/test_parsers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

import numpy as np
import pytest
from astropy import units as u
Expand Down Expand Up @@ -206,6 +208,24 @@ def test_numpy_cube(cubeviz_helper):
assert isinstance(data.coords, PaddedSpectrumWCS)
assert flux.units == 'ct / pix2'

@pytest.mark.remote_data
def test_manga_cube(cubeviz_helper):
# Remote data test of loading and extracting an up-to-date (as of 11/19/2024) MaNGA cube
# This also tests that spaxel is converted to pix**2
with warnings.catch_warnings():
warnings.filterwarnings("ignore")
cubeviz_helper.load_data("https://stsci.box.com/shared/static/gts87zqt5265msuwi4w5u003b6typ6h0.gz", cache=True) # noqa

uc = cubeviz_helper.plugins['Unit Conversion']
uc.spectral_y_type = "Surface Brightness"

se = cubeviz_helper.plugins['Spectral Extraction']
se.function = "Mean"
se.extract()
extracted_max = cubeviz_helper.get_data("Spectrum (mean)").max()
assert_allclose(extracted_max.value, 2.836957E-18)
assert extracted_max.unit == u.Unit("erg / Angstrom s cm**2 pix**2")


def test_invalid_data_types(cubeviz_helper):
with pytest.raises(ValueError, match=r"The input file 'does_not_exist\.fits'"):
Expand Down

0 comments on commit bf81d1e

Please sign in to comment.