Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_user_api(cubeviz_helper, spectrum1d_cube, spectrum1d_cube_sb_unit, cube

with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="No observer defined on WCS.*")
cubeviz_helper.load_data(cube, data_label='test')
cubeviz_helper.load(cube, data_label='test')

mm = cubeviz_helper.plugins['Moment Maps']
cmc = mm._obj.continuum_marks['center']
Expand Down Expand Up @@ -84,7 +84,7 @@ def test_moment_calculation(cubeviz_helper, spectrum1d_cube,
dc = cubeviz_helper.app.data_collection
with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="No observer defined on WCS.*")
cubeviz_helper.load_data(cube, data_label='test')
cubeviz_helper.load(cube, data_label='test')

flux_viewer = cubeviz_helper.app.get_viewer(cubeviz_helper._default_flux_viewer_reference_name)

Expand Down Expand Up @@ -175,7 +175,7 @@ def test_moment_calculation(cubeviz_helper, spectrum1d_cube,
def test_moment_velocity_calculation(cubeviz_helper, spectrum1d_cube):
with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="No observer defined on WCS.*")
cubeviz_helper.load_data(spectrum1d_cube, data_label='test')
cubeviz_helper.load_(spectrum1d_cube, data_label='test')

uncert_viewer = cubeviz_helper.app.get_viewer("uncert-viewer")

Expand Down Expand Up @@ -228,7 +228,7 @@ def test_moment_velocity_calculation(cubeviz_helper, spectrum1d_cube):
def test_moment_frequency_unit_conversion(cubeviz_helper, spectrum1d_cube_larger):
with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="No observer defined on WCS.*")
cubeviz_helper.load_data(spectrum1d_cube_larger, data_label='test')
cubeviz_helper.load(spectrum1d_cube_larger, data_label='test')

uc = cubeviz_helper.plugins['Unit Conversion']
mm = cubeviz_helper.plugins['Moment Maps']
Expand Down Expand Up @@ -261,7 +261,7 @@ def test_write_momentmap(cubeviz_helper, spectrum1d_cube, tmp_path):

with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="No observer defined on WCS.*")
cubeviz_helper.load_data(spectrum1d_cube, data_label='test')
cubeviz_helper.load(spectrum1d_cube, data_label='test')
plugin = cubeviz_helper.plugins['Moment Maps']
plugin.calculate_moment()

Expand All @@ -280,7 +280,7 @@ def test_momentmap_nirspec_prism(cubeviz_helper):

with warnings.catch_warnings():
warnings.simplefilter("ignore")
cubeviz_helper.load_data(cached_uri(uri), cache=True)
cubeviz_helper.load(cached_uri(uri), cache=True)
uc = cubeviz_helper.plugins["Unit Conversion"]
uc.open_in_tray() # plugin has to be open for unit change to take hold
uc._obj.show_translator = True
Expand Down Expand Up @@ -311,7 +311,7 @@ def test_correct_output_spectral_y_units(cubeviz_helper, spectrum1d_cube_custom_
# load surface brigtness cube
with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="No observer defined on WCS.*")
cubeviz_helper.load_data(sb_cube, data_label='test')
cubeviz_helper.load(sb_cube, data_label='test')

uc = cubeviz_helper.plugins["Unit Conversion"]
uc.open_in_tray() # plugin has to be open for unit change to take hold
Expand Down Expand Up @@ -382,7 +382,7 @@ def test_moment_zero_unit_flux_conversions(cubeviz_helper,
# load surface brigtness cube
with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="No observer defined on WCS.*")
cubeviz_helper.load_data(sb_cube, data_label='test')
cubeviz_helper.load(sb_cube, data_label='test')

# get plugins
uc = cubeviz_helper.plugins["Unit Conversion"]
Expand Down
6 changes: 3 additions & 3 deletions jdaviz/configs/cubeviz/plugins/slice/tests/test_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_slice(cubeviz_helper, spectrum1d_cube):
sl.vue_play_start_stop()
assert not sl.is_playing

cubeviz_helper.load_data(spectrum1d_cube, data_label='test')
cubeviz_helper.load(spectrum1d_cube, data_label='test')
app.add_data_to_viewer("flux-viewer", "test[FLUX]")
app.add_data_to_viewer("uncert-viewer", "test[FLUX]")
app.add_data_to_viewer("spectrum-viewer", "Spectrum (sum)")
Expand Down Expand Up @@ -94,7 +94,7 @@ def test_slice(cubeviz_helper, spectrum1d_cube):


def test_indicator_settings(cubeviz_helper, spectrum1d_cube):
cubeviz_helper.load_data(spectrum1d_cube, data_label='test')
cubeviz_helper.load(spectrum1d_cube, data_label='test')
app = cubeviz_helper.app
app.add_data_to_viewer("flux-viewer", "test[FLUX]")
app.add_data_to_viewer("spectrum-viewer", "Spectrum (sum)")
Expand All @@ -116,7 +116,7 @@ def test_indicator_settings(cubeviz_helper, spectrum1d_cube):

@pytest.mark.filterwarnings('ignore:No observer defined on WCS')
def test_init_slice(cubeviz_helper, spectrum1d_cube):
cubeviz_helper.load_data(spectrum1d_cube, data_label='test')
cubeviz_helper.load(spectrum1d_cube, data_label='test')

fv = cubeviz_helper.app.get_viewer('flux-viewer')
sl = cubeviz_helper.plugins['Slice']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@pytest.mark.skipif(IN_GITHUB_ACTIONS, reason="Test requires computer with audio output.")
def test_sonify_data(cubeviz_helper, spectrum1d_cube_larger):
cubeviz_helper.load_data(spectrum1d_cube_larger, data_label="test")
cubeviz_helper.load(spectrum1d_cube_larger, data_label="test")
sonify_plg = cubeviz_helper.app.get_tray_item_from_name('cubeviz-sonify-data')
assert sonify_plg.stream_active

Expand Down Expand Up @@ -58,7 +58,7 @@ def test_sonify_data(cubeviz_helper, spectrum1d_cube_larger):

@pytest.mark.skipif(not IN_GITHUB_ACTIONS, reason="Plugin disabled only in CI")
def test_sonify_data_disabled(cubeviz_helper, spectrum1d_cube_larger):
cubeviz_helper.load_data(spectrum1d_cube_larger, data_label="test")
cubeviz_helper.load(spectrum1d_cube_larger, data_label="test")
sonify_plg = cubeviz_helper.app.get_tray_item_from_name('cubeviz-sonify-data')
assert sonify_plg.disabled_msg
with pytest.raises(ValueError, match='Unable to sonify cube'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@

def test_version_after_nddata_update(cubeviz_helper, spectrum1d_cube_with_uncerts):
# Also test that plugin is disabled before data is loaded.
plg = cubeviz_helper.plugins['3D Spectral Extraction']
assert plg._obj.disabled_msg != ''

cubeviz_helper.load_data(spectrum1d_cube_with_uncerts)
assert '3D Spectral Extraction' not in cubeviz_helper.plugins
cubeviz_helper.load(spectrum1d_cube_with_uncerts)
assert '3D Spectral Extraction' in cubeviz_helper.plugins

spectral_cube = cubeviz_helper.app.data_collection[0].get_object(NDDataArray)
uncert_cube = cubeviz_helper.app.data_collection[1].get_object(StdDevUncertainty)
Expand Down Expand Up @@ -64,7 +63,7 @@ def test_gauss_smooth_before_spec_extract(cubeviz_helper, spectrum1d_cube_with_u
np.ones_like(spectrum1d_cube_with_uncerts.data)
)

cubeviz_helper.load_data(spectrum1d_cube_with_uncerts)
cubeviz_helper.load(spectrum1d_cube_with_uncerts)
gs_plugin = cubeviz_helper.plugins['Gaussian Smooth']._obj

gs_plugin.dataset_selected = f'{cubeviz_helper.app.data_collection[0].label}'
Expand Down Expand Up @@ -125,7 +124,7 @@ def test_subset(
CirclePixelRegion(PixCoord(0.5, 0), radius=1.2)
]

cubeviz_helper.load_data(spectrum1d_cube_with_uncerts)
cubeviz_helper.load(spectrum1d_cube_with_uncerts)
cubeviz_helper.plugins['Subset Tools'].import_region(regions, combination_mode='new')

plg = cubeviz_helper.plugins['3D Spectral Extraction']
Expand All @@ -149,7 +148,7 @@ def test_subset(

def test_extracted_file_in_export_plugin(cubeviz_helper, spectrum1d_cube_with_uncerts, tmp_path):

cubeviz_helper.load_data(spectrum1d_cube_with_uncerts)
cubeviz_helper.load(spectrum1d_cube_with_uncerts)

extract_plugin = cubeviz_helper.plugins['3D Spectral Extraction']

Expand All @@ -164,7 +163,7 @@ def test_extracted_file_in_export_plugin(cubeviz_helper, spectrum1d_cube_with_un

def test_aperture_markers(cubeviz_helper, spectrum1d_cube):

cubeviz_helper.load_data(spectrum1d_cube)
cubeviz_helper.load(spectrum1d_cube)
cubeviz_helper.plugins['Subset Tools'].import_region(
[CirclePixelRegion(PixCoord(0.5, 0), radius=1.2)])

Expand Down Expand Up @@ -216,7 +215,7 @@ def test_aperture_markers(cubeviz_helper, spectrum1d_cube):
def test_cone_aperture_with_different_methods(cubeviz_helper, spectrum1d_cube_largest,
subset, aperture_method, expected_flux_1000,
expected_flux_2400):
cubeviz_helper.load_data(spectrum1d_cube_largest)
cubeviz_helper.load(spectrum1d_cube_largest)
center = PixCoord(5, 10)
cubeviz_helper.plugins['Subset Tools'].import_region(
CirclePixelRegion(center, radius=2.5), combination_mode='new')
Expand Down Expand Up @@ -249,7 +248,7 @@ def test_cone_aperture_with_different_methods(cubeviz_helper, spectrum1d_cube_la
)
def test_cylindrical_aperture_with_different_methods(cubeviz_helper, spectrum1d_cube_largest,
subset, aperture_method, expected_flux_wav):
cubeviz_helper.load_data(spectrum1d_cube_largest, data_label="test")
cubeviz_helper.load(spectrum1d_cube_largest, data_label="test")
center = PixCoord(5, 10)
cubeviz_helper.plugins['Subset Tools'].import_region([
CirclePixelRegion(center, radius=2.5),
Expand All @@ -274,7 +273,7 @@ def test_cylindrical_aperture_with_different_methods(cubeviz_helper, spectrum1d_

# NOTE: Not as thorough as circle and ellipse above but good enough.
def test_rectangle_aperture_with_exact(cubeviz_helper, spectrum1d_cube_largest):
cubeviz_helper.load_data(spectrum1d_cube_largest)
cubeviz_helper.load(spectrum1d_cube_largest)
cubeviz_helper.plugins['Subset Tools'].import_region(
RectanglePixelRegion(PixCoord(5, 10), width=4, height=4))

Expand Down Expand Up @@ -302,7 +301,7 @@ def test_background_subtraction(cubeviz_helper, spectrum1d_cube_largest):
# add constant background:
spectrum1d_cube_largest = spectrum1d_cube_largest + 1 * u.Jy

cubeviz_helper.load_data(spectrum1d_cube_largest)
cubeviz_helper.load(spectrum1d_cube_largest)
cubeviz_helper.plugins['Subset Tools'].import_region([
CirclePixelRegion(PixCoord(5, 10), radius=2.5),
EllipsePixelRegion(PixCoord(13, 10), width=3, height=5)], combination_mode='new')
Expand Down Expand Up @@ -354,7 +353,7 @@ def test_background_subtraction(cubeviz_helper, spectrum1d_cube_largest):


def test_cone_and_cylinder_errors(cubeviz_helper, spectrum1d_cube_largest):
cubeviz_helper.load_data(spectrum1d_cube_largest)
cubeviz_helper.load(spectrum1d_cube_largest)
center = PixCoord(5, 10)
cubeviz_helper.plugins['Subset Tools'].import_region([
CirclePixelRegion(center, radius=2.5),
Expand Down Expand Up @@ -382,7 +381,7 @@ def test_cone_and_cylinder_errors(cubeviz_helper, spectrum1d_cube_largest):

def test_cone_aperture_with_frequency_units(cubeviz_helper, spectral_cube_wcs):
data = Spectrum(flux=np.ones((128, 129, 256)) * u.nJy, wcs=spectral_cube_wcs)
cubeviz_helper.load_data(data, data_label="Test Flux")
cubeviz_helper.load(data, data_label="Test Flux")
cubeviz_helper.plugins['Subset Tools'].import_region(
[CirclePixelRegion(PixCoord(14, 15), radius=2.5)])

Expand All @@ -399,7 +398,7 @@ def test_cone_aperture_with_frequency_units(cubeviz_helper, spectral_cube_wcs):

def test_cube_extraction_with_nan(cubeviz_helper, image_cube_hdu_obj):
image_cube_hdu_obj[1].data[:, :2, :2] = np.nan
cubeviz_helper.load_data(image_cube_hdu_obj, data_label="with_nan")
cubeviz_helper.load(image_cube_hdu_obj, data_label="with_nan")
extract_plg = cubeviz_helper.plugins['3D Spectral Extraction']
sp = extract_plg.extract() # Default settings (sum)
assert_allclose(sp.flux.value, 9.6E-16) # (10 x 10) - 4
Expand All @@ -412,7 +411,7 @@ def test_cube_extraction_with_nan(cubeviz_helper, image_cube_hdu_obj):


def test_autoupdate_results(cubeviz_helper, spectrum1d_cube_largest):
cubeviz_helper.load_data(spectrum1d_cube_largest)
cubeviz_helper.load(spectrum1d_cube_largest)
cubeviz_helper.plugins['Subset Tools'].import_region(
CircularROI(xc=5, yc=5, radius=2))

Expand All @@ -439,7 +438,7 @@ def test_autoupdate_results(cubeviz_helper, spectrum1d_cube_largest):


def test_aperture_composite_detection(cubeviz_helper, spectrum1d_cube):
cubeviz_helper.load_data(spectrum1d_cube)
cubeviz_helper.load(spectrum1d_cube)
subset_plugin = cubeviz_helper.plugins['Subset Tools']
spec_extr_plugin = cubeviz_helper.plugins['3D Spectral Extraction']._obj

Expand All @@ -461,7 +460,7 @@ def test_aperture_composite_detection(cubeviz_helper, spectrum1d_cube):


def test_extraction_composite_subset(cubeviz_helper, spectrum1d_cube):
cubeviz_helper.load_data(spectrum1d_cube)
cubeviz_helper.load(spectrum1d_cube)

subset_plugin = cubeviz_helper.plugins['Subset Tools']
spec_extr_plugin = cubeviz_helper.plugins['3D Spectral Extraction']._obj
Expand Down Expand Up @@ -502,7 +501,7 @@ def test_extraction_composite_subset(cubeviz_helper, spectrum1d_cube):

def test_spectral_extraction_with_correct_sum_units(cubeviz_helper,
spectrum1d_cube_fluxunit_jy_per_steradian):
cubeviz_helper.load_data(spectrum1d_cube_fluxunit_jy_per_steradian)
cubeviz_helper.load(spectrum1d_cube_fluxunit_jy_per_steradian)
spec_extr_plugin = cubeviz_helper.plugins['3D Spectral Extraction']._obj
collapsed = spec_extr_plugin.extract()

Expand All @@ -528,7 +527,7 @@ def test_default_spectral_extraction(cubeviz_helper, spectrum1d_cube_fluxunit_jy
# for a spatial subset that captures all data-containing spaxels. this
# regression tests make sure that doesn't happen anymore by accounting
# for non-science pixels in the sums:
cubeviz_helper.load_data(spectrum1d_cube_fluxunit_jy_per_steradian)
cubeviz_helper.load(spectrum1d_cube_fluxunit_jy_per_steradian)

subset_plugin = cubeviz_helper.plugins['Subset Tools']

Expand All @@ -548,7 +547,7 @@ def test_default_spectral_extraction(cubeviz_helper, spectrum1d_cube_fluxunit_jy
def test_spectral_extraction_unit_conv_one_spec(
cubeviz_helper, spectrum1d_cube_fluxunit_jy_per_steradian
):
cubeviz_helper.load_data(spectrum1d_cube_fluxunit_jy_per_steradian)
cubeviz_helper.load(spectrum1d_cube_fluxunit_jy_per_steradian)
spectrum_viewer = cubeviz_helper.app.get_viewer(
cubeviz_helper._default_spectrum_viewer_reference_name)
uc = cubeviz_helper.plugins["Unit Conversion"]
Expand Down Expand Up @@ -612,7 +611,7 @@ def test_spectral_extraction_scientific_validation(
# load observations into Cubeviz
with warnings.catch_warnings():
warnings.simplefilter('ignore')
cubeviz_helper.load_data(cached_uri(uri), cache=True)
cubeviz_helper.load(cached_uri(uri), cache=True)

# add a subset with an aperture centered on each source
subset_plugin = cubeviz_helper.plugins['Subset Tools']
Expand Down Expand Up @@ -666,7 +665,7 @@ def test_spectral_extraction_flux_unit_conversions(cubeviz_helper,
sb_cube = spectrum1d_cube_custom_fluxunit(fluxunit=flux_unit / angle_unit,
shape=(5, 4, 4),
with_uncerts=True)
cubeviz_helper.load_data(sb_cube)
cubeviz_helper.load(sb_cube)

spectrum_viewer = cubeviz_helper.app.get_viewer(
cubeviz_helper._default_spectrum_viewer_reference_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_cubeviz_aperphot_cube_orig_flux(request, helper_str, image_cube_hdu_obj


def test_cubeviz_aperphot_generated_3d_gaussian_smooth(cubeviz_helper, image_cube_hdu_obj_microns):
cubeviz_helper.load_data(image_cube_hdu_obj_microns, data_label="test")
cubeviz_helper.load(image_cube_hdu_obj_microns, data_label="test")
flux_unit = u.Unit("erg*s^-1*cm^-2*Angstrom^-1*pix^-2") # actually a sb
solid_angle_unit = PIX2

Expand Down Expand Up @@ -164,7 +164,7 @@ def test_cubeviz_aperphot_cube_sr_and_pix2(cubeviz_helper,
# set so the output values between units will be the same

cube = spectrum1d_cube_custom_fluxunit(fluxunit=cube_unit)
cubeviz_helper.load_data(cube, data_label="test")
cubeviz_helper.load(cube, data_label="test[FLUX]")

aper = RectanglePixelRegion(center=PixCoord(x=3, y=1), width=1, height=1)
bg = RectanglePixelRegion(center=PixCoord(x=2, y=0), width=1, height=1)
Expand Down Expand Up @@ -227,7 +227,7 @@ def test_cubeviz_aperphot_cube_orig_flux_mjysr(cubeviz_helper,
# but for a single surface brightness unit and without changing the pixel
# area to make outputs the same. it was requested in review to keep both tests
cube = spectrum1d_cube_custom_fluxunit(fluxunit=u.MJy / u.sr)
cubeviz_helper.load_data(cube, data_label="test")
cubeviz_helper.load(cube, data_label="test[FLUX]")

aper = RectanglePixelRegion(center=PixCoord(x=3, y=1), width=1, height=1)
bg = RectanglePixelRegion(center=PixCoord(x=2, y=0), width=1, height=1)
Expand Down Expand Up @@ -323,7 +323,7 @@ def test_cubeviz_aperphot_unit_conversions(cubeviz_helper,
# load cube with specified unit
cube = spectrum1d_cube_custom_fluxunit(fluxunit=cube_unit, shape=(5, 5, 4),
with_uncerts=True)
cubeviz_helper.load_data(cube, data_label="test")
cubeviz_helper.load(cube, data_label="test")

# get plugins
st = cubeviz_helper.plugins['Subset Tools']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_remote_server_disable_save_serverside():


def test_get_data_spatial_and_spectral(cubeviz_helper, spectrum1d_cube_larger):
cubeviz_helper.load_data(spectrum1d_cube_larger, data_label="test")
cubeviz_helper.load(spectrum1d_cube_larger, data_label="test")
unit = spectrum1d_cube_larger.spectral_axis.unit
subset_plugin = cubeviz_helper.plugins['Subset Tools']
subset_plugin.import_region([
Expand Down
Loading
Loading