本文整理匯總了Python中qctoolkit.pulses.table_pulse_template.TablePulseTemplate.identifier方法的典型用法代碼示例。如果您正苦於以下問題:Python TablePulseTemplate.identifier方法的具體用法?Python TablePulseTemplate.identifier怎麽用?Python TablePulseTemplate.identifier使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qctoolkit.pulses.table_pulse_template.TablePulseTemplate
的用法示例。
在下文中一共展示了TablePulseTemplate.identifier方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: generate_TablePulseTemplates
# 需要導入模塊: from qctoolkit.pulses.table_pulse_template import TablePulseTemplate [as 別名]
# 或者: from qctoolkit.pulses.table_pulse_template.TablePulseTemplate import identifier [as 別名]
def generate_TablePulseTemplates(self,number_of_entries,max_dist=RANGE):
while 1:
x = TablePulseTemplate()
name = "TablePulseTemplate_{}".format(self.__TablePulseTemplateOffset)
self.__TablePulseTemplateOffset +=1
if bool(random.getrandbits(1)):
x.identifier = name
previous_min = 0
previous_max = 0
parameter_names = []
for i in range(number_of_entries):
dict_ = {}
for j in ["time","voltage"]:
a = random.choice(["float","str","ParameterDeclaration"])
if a == "float":
if j == "time":
dict_[j] = random.uniform(previous_max,previous_max+max_dist)
previous_min = dict_[j]
previous_max = dict_[j]
else:
dict_[j] = random.uniform(-RANGE,RANGE)
elif a == "str":
dict_[j] = "_".join([name,"str",str(i),str(j)])
parameter_names.append(dict_[j])
elif a == "ParameterDeclaration":
if j == "time":
dict_[j] = self.generate_ParameterDeclaration(previous_min, previous_min+max_dist, name, previous_max).__next__()
previous_min = dict_[j].min_value
previous_max = dict_[j].max_value
else:
dict_[j] = self.generate_ParameterDeclaration().__next__()
parameter_names.append(dict_[j].name)
x.add_entry(time=dict_["time"],voltage=dict_["voltage"],interpolation=random.choice(INTERPOLATION_STRATEGIES))
yield x