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()

clear_snapshot()

Clears the last snapshot taken.

clear_trails()

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])

clear_snapshot()[source]

Clears the last snapshot taken.

clear_trails()[source]

Clear star trails.

destroy()[source]

Destroys the Majorana sphere.

evolve(H, dt=0.05, T=6.283185307179586)[source]

Evolves the state, updating the visual in real time.

Parameters
  • H (qt.Qobj) – Hamiltonian.

  • dt (float) – Time step.

  • T (float) – Time interval.

snapshot()[source]

Takes a snaphot of the stars, phase, and rotation axis. In other words, makes a copy of them.