本文整理汇总了Python中treedict.TreeDict类的典型用法代码示例。如果您正苦于以下问题:Python TreeDict类的具体用法?Python TreeDict怎么用?Python TreeDict使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TreeDict类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: sequence
def sequence(self):
op = self.parameters.OpticalPumping
if op.optical_pumping_type == "continuous":
continuous = True
elif op.optical_pumping_type == "pulsed":
continuous = False
else:
raise Exception("Incorrect optical pumping type {0}".format(op.optical_pumping_type))
if continuous:
replace = {
"OpticalPumpingContinuous.optical_pumping_continuous_frequency_854": op.optical_pumping_frequency_854,
"OpticalPumpingContinuous.optical_pumping_continuous_amplitude_854": op.optical_pumping_amplitude_854,
"OpticalPumpingContinuous.optical_pumping_continuous_frequency_729": op.optical_pumping_frequency_729,
"OpticalPumpingContinuous.optical_pumping_continuous_amplitude_729": op.optical_pumping_amplitude_729,
"OpticalPumpingContinuous.optical_pumping_continuous_frequency_866": op.optical_pumping_frequency_866,
"OpticalPumpingContinuous.optical_pumping_continuous_amplitude_866": op.optical_pumping_amplitude_866,
}
self.addSequence(optical_pumping_continuous, TreeDict.fromdict(replace))
else:
# pulsed
replace = {
"OpticalPumpingPulsed.optical_pumping_pulsed_frequency_854": op.optical_pumping_frequency_854,
"OpticalPumpingPulsed.optical_pumping_pulsed_amplitude_854": op.optical_pumping_amplitude_854,
"OpticalPumpingPulsed.optical_pumping_pulsed_frequency_729": op.optical_pumping_frequency_729,
"OpticalPumpingPulsed.optical_pumping_pulsed_amplitude_729": op.optical_pumping_amplitude_729,
"OpticalPumpingPulsed.optical_pumping_pulsed_frequency_866": op.optical_pumping_frequency_866,
"OpticalPumpingPulsed.optical_pumping_pulsed_amplitude_866": op.optical_pumping_amplitude_866,
}
self.addSequence(optical_pumping_pulsed, TreeDict.fromdict(replace))
开发者ID:EQ4,项目名称:resonator,代码行数:30,代码来源:OpticalPumping.py
示例2: runTest
def runTest(preset_list, module, test_tree):
# Run several different versions; with and without cache
def test(opttree):
reset()
initialize(opttree)
runner = manager()
results = runner.getResults(modules = [module], presets = preset_list)
t = results[module]
if type(test_tree) is TreeDict:
for k, v in test_tree.iteritems():
assert t[k] == v, ("%s: t[%s] != %s" % (module, k, repr(v)))
else:
assert test_tree == t
opttree = TreeDict()
opttree.project_directory = project_directory
opttree.debug_mode = True
opttree.verbose_mode = True
test(opttree)
opttree.cache_directory = join(project_directory, ".cache")
test(opttree)
test(opttree)
shutil.rmtree(opttree.cache_directory, ignore_errors = True)
开发者ID:aurora1625,项目名称:lazyrunner,代码行数:32,代码来源:tests.py
示例3: testDictBehavior_07_FromKeys_01
def testDictBehavior_07_FromKeys_01(self):
p = TreeDict()
d = {}
key_iterable = ["alphabet"]
self.assert_(p.fromkeys(key_iterable) == d.fromkeys(key_iterable))
开发者ID:aurora1625,项目名称:treedict,代码行数:7,代码来源:test_dictbehavior.py
示例4: testRetrieve_03_ThroughLink
def testRetrieve_03_ThroughLink(self):
p = TreeDict()
p.a.b.link = p.d
p.d.v = 1
self.assert_(p["a.b.link.v"] == 1)
self.assert_(p.get("a.b.link.v") == 1)
开发者ID:real666maverick,项目名称:treedict,代码行数:7,代码来源:test_retrieval.py
示例5: sequence
def sequence(self):
op = self.parameters.OpticalPumping
if op.optical_pumping_type == 'continuous':
continuous = True
elif op.optical_pumping_type == 'pulsed':
continuous = False
else:
raise Exception ('Incorrect optical pumping type {0}'.format(op.optical_pumping_type))
if continuous:
replace = {
'OpticalPumpingContinuous.optical_pumping_continuous_frequency_854':op.optical_pumping_frequency_854,
'OpticalPumpingContinuous.optical_pumping_continuous_amplitude_854':op.optical_pumping_amplitude_854,
'OpticalPumpingContinuous.optical_pumping_continuous_frequency_729':op.optical_pumping_frequency_729,
'OpticalPumpingContinuous.optical_pumping_continuous_amplitude_729':op.optical_pumping_amplitude_729,
'OpticalPumpingContinuous.optical_pumping_continuous_frequency_866':op.optical_pumping_frequency_866,
'OpticalPumpingContinuous.optical_pumping_continuous_amplitude_866':op.optical_pumping_amplitude_866,
}
self.addSequence(optical_pumping_continuous, TreeDict.fromdict(replace))
else:
#pulsed
replace = {
'OpticalPumpingPulsed.optical_pumping_pulsed_frequency_854':op.optical_pumping_frequency_854,
'OpticalPumpingPulsed.optical_pumping_pulsed_amplitude_854':op.optical_pumping_amplitude_854,
'OpticalPumpingPulsed.optical_pumping_pulsed_frequency_729':op.optical_pumping_frequency_729,
'OpticalPumpingPulsed.optical_pumping_pulsed_amplitude_729':op.optical_pumping_amplitude_729,
'OpticalPumpingPulsed.optical_pumping_pulsed_frequency_866':op.optical_pumping_frequency_866,
'OpticalPumpingPulsed.optical_pumping_pulsed_amplitude_866':op.optical_pumping_amplitude_866,
}
self.addSequence(optical_pumping_pulsed, TreeDict.fromdict(replace))
开发者ID:EQ4,项目名称:resonator,代码行数:30,代码来源:OpticalPumping.py
示例6: testDangling_09_Count_03b_Deletion
def testDangling_09_Count_03b_Deletion(self):
p = TreeDict()
self.assert_(p._numDangling() == 0)
p.a
self.assert_(p._numDangling() == 1)
del p["a"]
self.assert_(p._numDangling() == 0)
开发者ID:aurora1625,项目名称:treedict,代码行数:7,代码来源:test_branches.py
示例7: testFromdict_with_get_02
def testFromdict_with_get_02(self):
t1 = TreeDict.fromdict({'a':1,'b':2})
t2 = TreeDict()
t2.update({'a':1,'b':2})
self.assert_(t1 == t2)
开发者ID:real666maverick,项目名称:treedict,代码行数:7,代码来源:test_regressions.py
示例8: sequence
def sequence(self):
r = self.parameters.Ramsey
replace = TreeDict.fromdict({
'Excitation_729.rabi_excitation_duration':r.first_pulse_duration,
'Excitation_729.rabi_excitation_phase':WithUnit(0, 'deg'),
'Excitation_729.channel_729':r.channel_729,
'Excitation_729.rabi_excitation_frequency':r.first_pulse_frequency
})
awg_wait_time = WithUnit(2,'ms')
self.addTTL('awg_off',self.start,awg_wait_time+r.ramsey_time+r.first_pulse_duration+r.second_pulse_duration)
#self.addTTL('awg_on',self.start,awg_wait_time+r.ramsey_time+r.first_pulse_duration+r.second_pulse_duration)
self.addSequence(empty_sequence, TreeDict.fromdict({'EmptySequence.empty_sequence_duration':awg_wait_time}))
self.addSequence(rabi_excitation, replace)
if r.spin_echo_enable:
self.addSequence(empty_sequence_with_echo, TreeDict.fromdict({'EmptySequence.empty_sequence_duration':r.ramsey_time}))
else:
self.addSequence(empty_sequence, TreeDict.fromdict({'EmptySequence.empty_sequence_duration':r.ramsey_time}))
#self.addDDS('radial', self.end, r.ramsey_time, WithUnit(220.0,'MHz'), WithUnit(-13.0,'dBm'))
#self.end = self.end + r.ramsey_time
replace = TreeDict.fromdict({
'Excitation_729.rabi_excitation_duration':r.second_pulse_duration,
'Excitation_729.rabi_excitation_phase':r.second_pulse_phase,
'Excitation_729.channel_729':r.channel_729,
'Excitation_729.rabi_excitation_frequency':r.second_pulse_frequency
})
self.addSequence(rabi_excitation_no_offset, replace)
# self.addSequence(rabi_excitation_no_offset, replace) #this is technically correct but can't do pulses shorter than 6us
# print(r.first_pulse_frequency,r.second_pulse_frequency,r.first_pulse_frequency-r.second_pulse_frequency)
# print(r.second_pulse_duration,r.first_pulse_duration)
开发者ID:HaeffnerLab,项目名称:space-time,代码行数:30,代码来源:RamseyTwoMode.py
示例9: run
def run(self, cxn, context):
dt = self.parameters.DriftTracker
ramsey_dt = self.parameters.DriftTrackerRamsey
if dt.line_selection_1 == dt.line_selection_2:
raise Exception ("The two Drift Tracking lines can not be the same")
replace_1 = TreeDict.fromdict({
'DriftTrackerRamsey.line_selection':dt.line_selection_1,
'DriftTrackerRamsey.pi_time':ramsey_dt.line_1_pi_time,
'DriftTrackerRamsey.amplitude':ramsey_dt.line_1_amplitude,
'DriftTrackerRamsey.detuning':WithUnit(0,'Hz'),
})
replace_2 = TreeDict.fromdict({
'DriftTrackerRamsey.line_selection':dt.line_selection_2,
'DriftTrackerRamsey.pi_time':ramsey_dt.line_2_pi_time,
'DriftTrackerRamsey.amplitude':ramsey_dt.line_2_amplitude,
'DriftTrackerRamsey.detuning':WithUnit(0,'Hz')
})
self.ramsey_dt.set_parameters(replace_1)
self.ramsey_dt.set_progress_limits(0, 50.0)
frequency_1,excitation = self.ramsey_dt.run(cxn, context)
self.ramsey_dt.set_parameters(replace_2)
self.ramsey_dt.set_progress_limits(50.0, 100.0)
frequency_2,excitation = self.ramsey_dt.run(cxn, context)
self.submit_centers(frequency_1, frequency_2)
开发者ID:ishan-t,项目名称:SQIP,代码行数:26,代码来源:drift_tracker_ramsey.py
示例10: checkUpdate_09_ProperParents
def checkUpdate_09_ProperParents(self, deep_copy, overwrite, preserve_structure):
p = TreeDict()
ab = p.a.b = unique_object()
ac = p.a.c = unique_object()
b = p.b = unique_object()
p2 = TreeDict()
p2.update(p)
self.assert_(p.a is not p2.a)
self.assert_(p.a.rootNode() is p)
self.assert_(p.a.parentNode() is p)
self.assert_(p2.a.rootNode() is p2)
self.assert_(p2.a.parentNode() is p2)
self.assert_(p.a.b == p2.a.b)
self.assert_(p.a.b is p2.a.b)
self.assert_(p.a.c == p2.a.c)
self.assert_(p.a.c is p2.a.c)
self.assert_(p == p2)
开发者ID:real666maverick,项目名称:treedict,代码行数:25,代码来源:test_update.py
示例11: setup_scan
def setup_scan(self, sideband):
if sideband == 'blue':
replace = TreeDict.fromdict({
'Spectrum.sensitivity_selection':'temperature',
'Spectrum.scan_selection':'auto',
'Spectrum.sideband_selection':self.bsb_sel,
'Spectrum.save_directory': self.bsb_scan_dir,
'Spectrum.dataset_name_append':self.datasetNameAppend,
'Spectrum.window_name': ['Blue sideband scan']
})
self.spectrum.set_parameters(replace)
elif sideband == 'red':
temp = self.parameters.Temperature
replace = TreeDict.fromdict({
'Spectrum.sensitivity_selection': 'temperature',
'Spectrum.scan_selection': 'auto',
'Spectrum.sideband_selection':self.rsb_sel,
'Spectrum.save_directory': self.rsb_scan_dir,
'Spectrum.dataset_name_append': self.datasetNameAppend,
'Spectrum.window_name': ['Red sideband scan']
})
self.spectrum.set_parameters(replace)
开发者ID:EQ4,项目名称:resonator,代码行数:28,代码来源:temperature.py
示例12: run
def run(self, cxn, context):
replace_no_mirror = TreeDict.fromdict({
'Parity_LLI.mirror_state':False,
'Parity_LLI.use_short_ramsey_time':False,
})
replace_mirror = TreeDict.fromdict({
'Parity_LLI.mirror_state':True,
'Parity_LLI.use_short_ramsey_time':False,
})
random_number = np.random.rand()
if (random_number>0.5):
self.parity_LLI.set_parameters(replace_no_mirror)
phase_no_mirror = self.parity_LLI.run(cxn, context)
self.parity_LLI.set_parameters(replace_mirror)
phase_mirror = self.parity_LLI.run(cxn, context)
else:
self.parity_LLI.set_parameters(replace_mirror)
phase_mirror = self.parity_LLI.run(cxn, context)
self.parity_LLI.set_parameters(replace_no_mirror)
phase_no_mirror = self.parity_LLI.run(cxn, context)
average_phase = (phase_no_mirror+phase_mirror)/2.0
difference_phase = (phase_no_mirror-phase_mirror)/2.0
submission = [time.time(),phase_mirror['deg'],phase_no_mirror['deg'],average_phase['deg'],difference_phase['deg']]
self.dv.add(submission,context=self.save_data)
开发者ID:HaeffnerLab,项目名称:HaeffnerLabLattice,代码行数:26,代码来源:Parity_LLI_monitor.py
示例13: run
def run(self, cxn, context):
dt = self.parameters.DriftTracker
ramsey_dt = self.parameters.DriftTrackerRamsey
if dt.line_selection_1 == dt.line_selection_2:
raise Exception ("The two Drift Tracking lines can not be the same")
replace_1 = TreeDict.fromdict({
'DriftTrackerRamsey.line_selection':dt.line_selection_1,
'DriftTrackerRamsey.pi_time':ramsey_dt.line_1_pi_time,
'DriftTrackerRamsey.amplitude':ramsey_dt.line_1_amplitude,
'DriftTrackerRamsey.detuning':WithUnit(0,'Hz'),
})
replace_2 = TreeDict.fromdict({
'DriftTrackerRamsey.line_selection':dt.line_selection_2,
'DriftTrackerRamsey.pi_time':ramsey_dt.line_2_pi_time,
'DriftTrackerRamsey.amplitude':ramsey_dt.line_2_amplitude,
'DriftTrackerRamsey.detuning':WithUnit(0,'Hz')
})
replace_1,replace_2 = np.random.permutation([replace_1,replace_2])
self.ramsey_dt.set_parameters(replace_1)
self.ramsey_dt.set_progress_limits(0, 50.0)
frequency_1,excitation = self.ramsey_dt.run(cxn, context)
error_sensitivity = ramsey_dt.error_sensitivity
if not 0.5 - error_sensitivity <= excitation <= 0.5 + error_sensitivity:
raise Exception("Incorrect Excitation {}".format(replace_1.DriftTrackerRamsey.line_selection))
self.ramsey_dt.set_parameters(replace_2)
self.ramsey_dt.set_progress_limits(50.0, 100.0)
frequency_2,excitation = self.ramsey_dt.run(cxn, context)
if not 0.5 - error_sensitivity <= excitation <= 0.5 + error_sensitivity:
raise Exception("Incorrect Excitation {}".format(replace_2.DriftTrackerRamsey.line_selection))
self.submit_centers(replace_1,frequency_1,replace_2,frequency_2)
开发者ID:HaeffnerLab,项目名称:cct,代码行数:31,代码来源:drift_tracker_ramsey.py
示例14: sequence
def sequence(self):
t = self.parameters.Tomography
iteration = int(t.iteration)
print "iteration"
print iteration
if not iteration in range(3):
raise Exception("Incorrect iteration of tomography {}".format(iteration))
if iteration == 0:
pass
elif iteration == 1:
replace = TreeDict.fromdict(
{
"Excitation_729.rabi_excitation_frequency": t.tomography_excitation_frequency,
"Excitation_729.rabi_excitation_amplitude": t.tomography_excitation_amplitude,
"Excitation_729.rabi_excitation_duration": t.rabi_pi_time / 2.0,
"Excitation_729.rabi_excitation_phase": WithUnit(0, "deg"),
}
)
self.addSequence(rabi_excitation, replace)
elif iteration == 2:
replace = TreeDict.fromdict(
{
"Excitation_729.rabi_excitation_frequency": t.tomography_excitation_frequency,
"Excitation_729.rabi_excitation_amplitude": t.tomography_excitation_amplitude,
"Excitation_729.rabi_excitation_duration": t.rabi_pi_time / 2.0,
"Excitation_729.rabi_excitation_phase": WithUnit(90, "deg"),
}
)
self.addSequence(rabi_excitation, replace)
开发者ID:EQ4,项目名称:resonator,代码行数:29,代码来源:Tomography.py
示例15: testRecursiveAttach_03_recursive_with_linked_nodes
def testRecursiveAttach_03_recursive_with_linked_nodes(self):
p = TreeDict()
p.a = p.adef.a
p.adef.a.v = 1
p.attach(recursive=True)
开发者ID:aurora1625,项目名称:treedict,代码行数:7,代码来源:test_branches.py
示例16: sequence
def sequence(self):
p = self.parameters
self.end = WithUnit(10, 'us')
self.addSequence(turn_off_all)
if p.DopplerCooling.mode_swapping_enable:
self.addSequence(doppler_cooling_with_mode_coupling)
else:
self.addSequence(doppler_cooling_after_repump_d)
if p.OpticalPumping.optical_pumping_enable:
self.addSequence(optical_pumping)
if p.SidebandCooling.sideband_cooling_enable:
if p.SidebandPrecooling.sideband_precooling_enable:
self.addSequence(sideband_precooling)
self.addSequence(sideband_cooling)
if p.PulsedHeating.pulsed_heating_enable:
#self.addSequence(pulsed_heating)
self.addSequence(pi_pulse)
self.addSequence(repump_d)
self.addSequence(optical_pumping)
if p.ParametricCoupling.parametric_coupling_enable:
self.addSequence(parametric_coupling, TreeDict.fromdict({'ParametricCoupling.parametric_coupling_phase':WithUnit(0, 'deg')}))
if p.WireCharging.wire_charging_enable:
self.addSequence(wire_charging, TreeDict.fromdict({'EmptySequence.empty_sequence_duration':p.WireCharging.wire_charging_duration}))
self.addSequence(empty_sequence, TreeDict.fromdict({'EmptySequence.empty_sequence_duration':p.Heating.background_heating_time}))
if p.ParametricCoupling.swap_after_heating:
self.addSequence(parametric_coupling, TreeDict.fromdict({'ParametricCoupling.drive_frequency': p.ParametricCoupling.drive_frequency}))
self.start_excitation_729 = self.end
self.addSequence(rabi_excitation)
self.addSequence(state_readout)
开发者ID:EQ4,项目名称:resonator,代码行数:29,代码来源:spectrum_rabi.py
示例17: testBranchStructureFrozen_01
def testBranchStructureFrozen_01(self):
p = TreeDict()
p.a = TreeDict(x = 1)
p.freeze(structure_only = True)
self.assertRaises(TypeError, lambda: p.attach(recursive = True))
开发者ID:aurora1625,项目名称:treedict,代码行数:7,代码来源:test_branches.py
示例18: addSequence
def addSequence(self, sequence, replacement_dict = TreeDict(), position = None):
"""
Insert a subsequence, position is either time or None to insert at the
end
"""
if sequence not in self.required_subsequences:
message = "Adding subsequence {0} that is not listed in the required subequences"
raise Exception (message.format(sequence.__class__.__name__))
if not type(replacement_dict) == TreeDict:
raise Exception ("replacement_dict must be a TreeDict")
for replacement_key in replacement_dict.keys():
parsed = tuple(replacement_key.split('.'))
key_list = self.replaced_parameters.get(sequence, [])
if not parsed in key_list:
message = "Error in {0}: replacing the key {1} in the sequence {2} that is not listed among the replacement parameters"
raise Exception(message.format(self, replacement_key, sequence))
if position is None:
position = self.end
# replacement conists of global replacement and keyword arguments
replacement = TreeDict()
replacement.update(self.replace)
replacement.update(replacement_dict)
seq = sequence(replacement, start = position)
self._dds_pulses.extend( seq._dds_pulses )
self._ttl_pulses.extend( seq._ttl_pulses )
self.end = max(self.end, seq.end)
开发者ID:xycc,项目名称:common,代码行数:26,代码来源:pulse_sequence.py
示例19: sequence
def sequence(self):
l = self.parameters.BareLineScan
cycles = int(l.cycles_per_sequence)
#turn off all the lights, then do doppler cooling
self.end = WithUnit(10, 'us')
self.addSequence(turn_off_all)
self.addSequence(doppler_cooling)
frequency_advance_duration = WithUnit(6, 'us')
ampl_off = WithUnit(-63.0, 'dBm')
self.addDDS('397',self.end, frequency_advance_duration, l.frequency_397_pulse, ampl_off)
self.addDDS('866',self.end, frequency_advance_duration, l.frequency_866_pulse, ampl_off) ###changed from radial to 866 :Hong
self.end += frequency_advance_duration
#record timetags while switching while cycling 'wait, pulse 397, wait, pulse 866'
start_recording_timetags = self.end
for i in range(cycles):
self.addSequence(empty_sequence, TreeDict.fromdict({'EmptySequence.empty_sequence_duration':l.between_pulses}))
self.addDDS('397',self.end, l.duration_397_pulse, l.frequency_397_pulse, l.amplitude_397_pulse)
self.end += l.duration_397_pulse
self.addSequence(empty_sequence, TreeDict.fromdict({'EmptySequence.empty_sequence_duration':l.between_pulses}))
self.addDDS('866',self.end, l.duration_866_pulse, l.frequency_866_pulse, l.amplitude_866_pulse) ###changed from radial to 866 :Hong
self.end += l.duration_866_pulse
stop_recording_timetags = self.end
timetag_record_duration = stop_recording_timetags - start_recording_timetags
#record timetags while cycling takes place
self.addTTL('TimeResolvedCount',start_recording_timetags, timetag_record_duration)
self.start_recording_timetags = start_recording_timetags
self.timetag_record_cycle = l.between_pulses + l.duration_397_pulse + l.duration_866_pulse+l.between_pulses
开发者ID:EQ4,项目名称:resonator,代码行数:28,代码来源:bare_line_scan.py
示例20: testEqualityWithDanglingNode_04
def testEqualityWithDanglingNode_04(self):
p1 = TreeDict()
p2 = TreeDict()
p1.a = 1
p2.a
self.assert_(p1 != p2)
开发者ID:aurora1625,项目名称:treedict,代码行数:7,代码来源:test_equalities.py
注:本文中的treedict.TreeDict类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论