Ejemplo n.º 1
0
    def zp_product(
        p,
        value_range,
        resolution,
        hsv,
    ):
        xy = hl.xy_plane(value_range=hl.tuplify(value_range),
                         resolution=resolution)
        zp1 = hl.phase_threshold(
            hl.opl_zp(hl.perspective_plane(p=[0, 0, 10], xy=xy)))
        zp2 = hl.phase_threshold(
            hl.phase_conjugate(hl.opl_zp(hl.perspective_plane(p=p, xy=xy))))
        zp3 = hl.phase_threshold(zp1 + zp2)

        tiled = tile_images([
            hl.imagify(zp0, hsv=hsv, bwref=(0, 2 * math.pi))
            for zp0 in [zp1, zp2, zp3, zp1]
        ])
        # return hl.imagify(tiled)
        return tiled
        zp1, zp2, zp3 = [
            hl.imagify(zp0, hsv=hsv, bwref=(0, 2 * math.pi))
            for zp0 in [zp1, zp2, zp3]
        ]

        border_shape = list(zp1.shape)
        border_shape[1] = 10
        border = np.zeros(shape=border_shape)
        image = hl.np.hstack([zp1, border, zp2, border, zp3])
        # return hl.imagify(zp3)
        return hl.imagify(image)
Ejemplo n.º 2
0
    def images_func(a, b):
        zp1 = hl.opl_zp(hl.perspective_plane(xy, p=[0, 0, a]))
        zp2 = hl.phase_conjugate(
            hl.opl_zp(hl.perspective_plane(xy, p=[0, 0, b])))
        zp3 = zp1 + zp2

        return [hl.phase_threshold(zp) for zp in [zp1, zp2, zp3]]
Ejemplo n.º 3
0
def test_create_interactive_plot():
    xy = xy_plane(value_range=(-10, 10), resolution=300)
    example_params = dict(
        images_func=lambda x, y, z: [
            perspective_zp(perspective_plane(xy, p=[x, y, z])),
            perspective_zp(perspective_plane(xy, p=[0, 0, 50])),
            perspective_zp(perspective_plane(xy, p=[x, y, z]) - perspective_plane(xy, p=[0, 0, -50]))
        ],
        num_images=3,
        titles=[
            "zp: x,y,z",
            "zp: 0,0,-50",
            "combined"
        ],
        slider_params=[
            ["x", -10, 10],
            ["y", -10, 10],
            ["z", 0, 100]
        ]
    )
    create_interactive_plot(**example_params)
Ejemplo n.º 4
0
def zoneplate():
    params = dict(images_func=[
        lambda z, zoom: [
            hl.perspective_zp(
                hl.perspective_plane(hl.xy_plane(value_range=(-zoom, zoom),
                                                 resolution=500),
                                     p=[0, 0, z]))
        ]
    ],
                  titles=["perspective zone plate"],
                  slider_params=[
                      ["z", 0, 5],
                      ["zoom", 0.01, 20],
                  ])
    hl.create_interactive_plot(**params)
Ejemplo n.º 5
0
 def example_image(i):
     xy = xy_plane(value_range=(-10, 10), resolution=100)
     persp_xy = perspective_plane(xy, p=[0, 0, i*10])
     zp = perspective_zp(persp_xy)
     return zp
Ejemplo n.º 6
0
 def zp_func(x, y, z, zoom):
     return hl.opl_zp(
         hl.perspective_plane(p=[x, y, z],
                              xy=hl.xy_plane(value_range=(-zoom, zoom),
                                             resolution=1000)))