spheres.visualization.majorana_sphere.MajoranaSphere¶
-
class
spheres.visualization.majorana_sphere.
MajoranaSphere
(spin, scene=None, pos=<0, 0, 0>, radius=None, sphere_color=<0, 0, 1>, sphere_opacity=0.3, sphere_draggable=True, star_colors=None, make_trails=False, show_rotation_axis=True, show_phase=False, show_reference_axes=False, show_norm=False, show_wavefunction=False, wavefunction_type='coherent', wavefunction_samples=15)[source]¶ Bases:
spheres.visualization.vp_object.VObject
MajoranaSphere provides a nice way to visualize (pure) spin-j states using vpython for graphics, whether in a jupyter notebook or in a standalone environment.
-
spin
¶ The spin-j state represented. If this attribute is set, the visualization is automatically updated.
- Type
qt.Qobj
-
j
¶ Its j value.
- Type
float
-
xyz
¶ Majorana points in cartesian coordinates.
- Type
np.ndarray
-
phase
¶ Complex phase of the spin state.
- Type
complex
-
scene
¶ Scene in which to place the Majorana sphere. Defaults to a global scene.
- Type
vp.canvas
-
show_rotation_axis
¶ Whether to show the expected rotation axis. If this attribute is set, the visualization is automatically updated.
- Type
bool
-
show_phase
¶ Whether to show the phase. If this attribute is set, the visualization is automatically updated.
- Type
bool
-
show_reference_axes
¶ Whether to show reference cartesian axes. If this attribute is set, the visualization is automatically updated.
- Type
bool
-
show_norm
¶ Whether to show the norm of the state as a label. If this attribute is set, the visualization is automatically updated.
- Type
bool
-
sphere_draggable
¶ Whether one can drag the sphere with the mouse. If this attribute is set, the visualization is automatically updated.
- Type
bool
-
make_trails
¶ Whether the stars leave trails. If this attribute is set, the visualization is automatically updated.
- Type
bool
-
show_wavefunction
¶ Whether to show spin coherent wavefunction. If this attribute is set, the visualization is automatically updated.
- Type
bool
-
wavefunction_type
¶ “majorana” or “coherent”. The former evaluates the amplitude on a spin coherent state at sample points on the sphere. The latter evaluates the normalized Majorana function. The two should be antipodal to each other.If this attribute is set, the visualization is automatically updated.
- Type
str
-
wavefunction_samples
¶ Number of sample points.
- Type
int
-
__init__
(spin, scene=None, pos=<0, 0, 0>, radius=None, sphere_color=<0, 0, 1>, sphere_opacity=0.3, sphere_draggable=True, star_colors=None, make_trails=False, show_rotation_axis=True, show_phase=False, show_reference_axes=False, show_norm=False, show_wavefunction=False, wavefunction_type='coherent', wavefunction_samples=15)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(spin[, scene, pos, radius, …])Initialize self.
add_toggle
(name, create)change_wavefunction_type
()Clears the last snapshot taken.
Clear star trails.
create_norm
()create_phase
()create_reference_axes
()create_rotation_axis
()create_wavefunction
()destroy
()Destroys the Majorana sphere.
destroy_vchildren
(vchildren)evolve
(H[, dt, T])Evolves the state, updating the visual in real time.
mousedown
()mousemove
()mouseup
()refresh
()refresh_norm
()refresh_phase
()refresh_reference_axes
()refresh_rotation_axis
()refresh_spin
()refresh_stars
()refresh_trails
()refresh_wavefunction
()snapshot
()Takes a snaphot of the stars, phase, and rotation axis.
sphere_drag
()start_sphere_dragging
()stop_sphere_dragging
()toggle
(name[, value])-