memoryfolder

メモです

bloch sphere drawing

bored from talks.

import numpy as np
from qutip import *

if __name__ = '__main__':

	dist2d = np.random.normal(scale=0.1,size=(2,500))
	plt.hist(dist2d[1,:])

	b = Bloch()
	# T
	theta = np.pi/4 + dist2d[1,:]/10
	phi = np.pi*0 + dist2d[0,:]*2
	x = np.sin(theta)*np.cos(phi)
	y = np.sin(theta)*np.sin(phi)
	z = np.cos(theta)
	theta = np.pi/3 + dist2d[1,:]
	phi = np.pi*0 + dist2d[0,:]/10
	x = np.concatenate((x,np.sin(theta)*np.cos(phi)))
	y = np.concatenate((y,np.sin(theta)*np.sin(phi)))
	z = np.concatenate((z,np.cos(theta)))

	# e
	theta = np.pi*0.36 + 0.2*np.cos(dist2d[1,:]*2.5*np.pi-np.pi/2)
	phi = np.pi*0.15 + 0.2*np.sin(dist2d[1,:]*2.5*np.pi-np.pi/2)
	x = np.concatenate((x,np.sin(theta)*np.cos(phi)))
	y = np.concatenate((y,np.sin(theta)*np.sin(phi)))
	z = np.concatenate((z,np.cos(theta)))
	theta = np.pi*0.35 + dist2d[1,:]/10
	phi = np.pi*0.15 + dist2d[0,:]
	x = np.concatenate((x,np.sin(theta)*np.cos(phi)))
	y = np.concatenate((y,np.sin(theta)*np.sin(phi)))
	z = np.concatenate((z,np.cos(theta)))

	#a
	theta = np.pi*0.36 + 0.2*np.cos(dist2d[1,:]*2.5*np.pi-np.pi/3)
	phi = np.pi*0.3 + 0.2*np.sin(dist2d[1,:]*2.5*np.pi-np.pi/3)
	x = np.concatenate((x,np.sin(theta)*np.cos(phi)))
	y = np.concatenate((y,np.sin(theta)*np.sin(phi)))
	z = np.concatenate((z,np.cos(theta)))
	theta = np.pi*0.36 + dist2d[1,:]*0.9
	phi = np.pi*0.34 + dist2d[1,:]*0.4+dist2d[0,:]*0.2
	x = np.concatenate((x,np.sin(theta)*np.cos(phi)))
	y = np.concatenate((y,np.sin(theta)*np.sin(phi)))
	z = np.concatenate((z,np.cos(theta)))

	# m
	theta = np.pi*0.36 + dist2d[1,:]*0.8
	phi = np.pi*0.4 + dist2d[0,:]*0.1
	x = np.concatenate((x,np.sin(theta)*np.cos(phi)))
	y = np.concatenate((y,np.sin(theta)*np.sin(phi)))
	z = np.concatenate((z,np.cos(theta)))
	theta = np.pi*0.32 + 0.06*np.cos(dist2d[1,:]*2.*np.pi-np.pi)
	phi = np.pi*0.43 + 0.06*np.sin(dist2d[1,:]*2.*np.pi-np.pi)
	x = np.concatenate((x,np.sin(theta)*np.cos(phi)))
	y = np.concatenate((y,np.sin(theta)*np.sin(phi)))
	z = np.concatenate((z,np.cos(theta)))
	theta = np.pi*0.36 + dist2d[1,:]*0.8
	phi = np.pi*0.45 + dist2d[0,:]*0.1
	x = np.concatenate((x,np.sin(theta)*np.cos(phi)))
	y = np.concatenate((y,np.sin(theta)*np.sin(phi)))
	z = np.concatenate((z,np.cos(theta)))
	theta = np.pi*0.32 + 0.06*np.cos(dist2d[1,:]*2.*np.pi-np.pi)
	phi = np.pi*0.47 + 0.06*np.sin(dist2d[1,:]*2.*np.pi-np.pi)
	x = np.concatenate((x,np.sin(theta)*np.cos(phi)))
	y = np.concatenate((y,np.sin(theta)*np.sin(phi)))
	z = np.concatenate((z,np.cos(theta)))
	theta = np.pi*0.36 + dist2d[1,:]*0.8
	phi = np.pi*0.49 + dist2d[0,:]*0.1
	x = np.concatenate((x,np.sin(theta)*np.cos(phi)))
	y = np.concatenate((y,np.sin(theta)*np.sin(phi)))
	z = np.concatenate((z,np.cos(theta)))

	vec = [x,y,z]
	b.add_points(vec)
	b.point_size = [1,1,1,1]
	b.point_color = ['r']
	b.show()

f:id:sunakku:20181006195128p:plain