當前位置: 首頁>>代碼示例>>Python>>正文


Python Plotter.bloch_vector方法代碼示例

本文整理匯總了Python中Plotter.Plotter.bloch_vector方法的典型用法代碼示例。如果您正苦於以下問題:Python Plotter.bloch_vector方法的具體用法?Python Plotter.bloch_vector怎麽用?Python Plotter.bloch_vector使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Plotter.Plotter的用法示例。


在下文中一共展示了Plotter.bloch_vector方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: type

# 需要導入模塊: from Plotter import Plotter [as 別名]
# 或者: from Plotter.Plotter import bloch_vector [as 別名]
import yaml
import numpy as np

config = "ham_conf.yml"
config_args = {}

if type(config) == str:
    with open(config) as cfile:
        config_args.update(yaml.load(cfile))
elif type(config) == dict:
    config_args.update(config)
else:
    print "config is wrong type"


""" Prepare Bloch Sphere settings """
db=Bloch()
colors = ["b","g","r","k"]#,"r","g","#CC6600"]
db.point_color = colors
db.point_marker = ['o']


result_states = qload("anim/notodd")

for i in range(4):
	db.add_points(np.transpose(np.array([Plotter.bloch_vector(result_states[t].ptrace(0)) for t in range(int(i*config_args['steps']/4.),int((i+1)*config_args['steps']/4.),10)])))

db.add_states(result_states[-1].ptrace(0))

db.show()
開發者ID:sqvarfort,項目名稱:data_probe_qubit_simulation,代碼行數:32,代碼來源:color_plot.py

示例2: log_result

# 需要導入模塊: from Plotter import Plotter [as 別名]
# 或者: from Plotter.Plotter import bloch_vector [as 別名]
def log_result(result):
    # This is called whenever simulation(i) returns a result.
    # result_list is modified only by the main process, not the pool workers.
    final_states.insert(result[0], result[1].ptrace(0))
    philist.insert(result[0], Plotter.extract_phi(Plotter.bloch_vector(result[1].ptrace(0))))
開發者ID:sqvarfort,項目名稱:data_probe_qubit_simulation,代碼行數:7,代碼來源:probe_data_simulation_parallel_tau_dvar_bak.py


注:本文中的Plotter.Plotter.bloch_vector方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。