import ipyvolume
import numpy as np

ds = ipyvolume.datasets.aquariusA2.fetch()
ipyvolume.quickvolshow(ds.data, lighting=True)

"""
Explanation: <center><h1>ipyvolume</h1></center>
Repository: https://github.com/maartenbreddels/ipyvolume
Installation:
conda install -c conda-forge ipyvolume
Volume rendering
End of explanation
"""


stream = ipyvolume.datasets.animated_stream.fetch()

fig = ipyvolume.figure()
q = ipyvolume.quiver(*stream.data[:,0:50,:200], color="red", size=7)
ipyvolume.animation_control(q, interval=200)
ipyvolume.show()

u = np.linspace(-10, 10, 50)
x, y = np.meshgrid(u, u)
r = np.sqrt(x**2+y**2)
x = x.flatten()
y = y.flatten()
r = r.flatten()
time = np.linspace(0, np.pi*2, 50)
z = np.array([(np.cos(r + t) * np.exp(-r/5)) for t in time])
color = np.array([[np.cos(r + t), 1-np.abs(z[i]), 0.1+z[i]*0] for i, t in enumerate(time)])
size = (z+1)
color = np.transpose(color, (0, 2, 1))

ipyvolume.figure()
s = ipyvolume.scatter(x, z, y, color=color, marker="sphere")
ipyvolume.animation_control(s, interval=200)
ipyvolume.ylim(-3,3)
ipyvolume.show()

s.geo = "diamond"

s.size = 5

s.color = 1 - s.color

"""
Explanation: Animations
Animations are made in the shaders
End of explanation
"""


from ipywidgets import Widget
Widget.close_all()

"""
Explanation: Clean
End of explanation
"""


