Пример #1
0
def test_array_animator_wcs_2d_colorbar_buttons(wcs_4d):
    data = np.arange(120).reshape((5, 4, 3, 2))
    bf = [lambda x: x] * 10
    bl = ['h'] * 10
    a = ArrayAnimatorWCS(data, wcs_4d, [0, 0, 'y', 'x'],
                         colorbar=True, button_func=bf, button_labels=bl)
    a.update_plot(1, a.im, a.sliders[0]._slider)
    return a.fig
Пример #2
0
def test_array_animator_wcs_2d_clip_interval_change(wcs_4d):
    data = np.arange(120).reshape((5, 4, 3, 2))
    pclims = [5, 95]
    a = ArrayAnimatorWCS(data,
                         wcs_4d, [0, 0, 'x', 'y'],
                         clip_interval=pclims * u.percent)
    lims0 = a._get_2d_plot_limits()
    a.update_plot(1, a.im, a.sliders[0]._slider)
    lims1 = a._get_2d_plot_limits()
    assert np.all(lims0 != lims1)
    assert np.all(lims0 == np.percentile(data[..., 0, 0], pclims))
    assert np.all(lims1 == np.percentile(data[..., 1, 0], pclims))
Пример #3
0
def test_array_animator_wcs_2d_extra_sliders(wcs_4d):
    def vmin_slider(val, im, slider):
        im.set_clim(vmin=val)

    def vmax_slider(val, im, slider):
        im.set_clim(vmax=val)

    data = np.arange(120).reshape((5, 4, 3, 2))
    a = ArrayAnimatorWCS(data, wcs_4d, [0, 0, 'y', 'x'], colorbar=True,
                         slider_functions=[vmin_slider, vmax_slider],
                         slider_ranges=[[0, 100], [0, 100]])
    a.update_plot(1, a.im, a.sliders[0]._slider)
    return a.fig
Пример #4
0
def test_array_animator_wcs_2d_transpose_update_plot(wcs_4d):
    data = np.arange(120).reshape((5, 4, 3, 2))
    a = ArrayAnimatorWCS(data, wcs_4d, [0, 0, 'y', 'x'], colorbar=True)
    a.update_plot(1, a.im, a.sliders[0]._slider)
    return a.fig
Пример #5
0
def test_array_animator_wcs_1d_update_plot(wcs_4d):
    pytest.importorskip("astropy", minversion="4.0dev26173")
    data = np.arange(120).reshape((5, 4, 3, 2))
    a = ArrayAnimatorWCS(data, wcs_4d, [0, 0, 'x', 0], ylabel="Y axis!")
    a.update_plot(1, a.im, a.sliders[0]._slider)
    return a.fig