import wsp_tools as wt from wsp_tools import np, plt wt.cielab_cmap() X = np.linspace(0,1,100) x, y = np.meshgrid(X, X) data = x + 1j * y plt.imshow(wt.cielab_image(data)) plt.title("intensity, uniform") plt.show() plt.imshow(wt.cielab_image(data, brightness='amplitude')) plt.title("amplitude, uniform") plt.show() plt.imshow(wt.cielab_image(data, alpha='intensity')) plt.title("intensity, intensity") plt.show() plt.imshow(wt.cielab_image(data, alpha='amplitude')) plt.title("intensity, amplitude") plt.show() plt.imshow(wt.rgba(data), cmap='viridis') plt.title("rgba, cmap=viridis") plt.show()
def test_zR(self): assert (np.isclose(wt.zR(3191460985702.0464, 1e-6), 1.5957304928510232)) def test_w(self): assert (np.isclose(wt.w(0, 1e-6, 3191460985702.0464), 1e-6)) def test_roc(self): assert (np.isclose(wt.roc(1, 1e-6, 3191460985702.0464), 3.5463558058145694)) X = np.linspace(-1e-8, 1e-8, 64) Y = np.linspace(-1e-8, 1e-8, 128) Z = np.linspace(-1e-8, 1e-8, 3) x2, y2 = np.meshgrid(X, Y) x3, y3, z3 = np.meshgrid(X, Y, Z) class TestBesselShape: def test_bessel2(self): bessel2 = wt.bessel(x2, y2, z=0) assert (bessel2.shape == (128, 64)) def test_bessel3(self): bessel3 = wt.bessel(x3, y3, z3) assert (bessel3.shape == (128, 64, 3)) class TestBesselPacketShape: def test_bessel_packet(self):
import wsp_tools as wt from wsp_tools import np, plt # %% X = np.linspace(-100e-9, 100e-9, 16) Z = np.linspace(-100e-9, 100e-9, 5) x2, y2 = np.meshgrid(X, X) x3, y3, z3 = np.meshgrid(X, X, Z) dx = X[1] - X[0] dy = X[1] - X[0] # %% def test_jchessmodel2(): m2 = wt.jchessmodel(x2, y2, z=0, n=1) assert (m2[0].shape == (16, 16)) def test_jchessmodel3(): m3 = wt.jchessmodel(x3, y3, z3, n=1) assert (m3[0].shape == (16, 16, 5)) def test_ab_phase2(): m2 = wt.jchessmodel(x2, y2, z=0, n=1) phase = wt.ab_phase(m2[0], m2[1], m2[2], dx, dy) assert (phase.shape == (16, 16)) def test_ab_phase3(): m3 = wt.jchessmodel(x3, y3, z3, n=1)