Skip to content

Commit c320fe5

Browse files
committed
fix tests
1 parent 87dc2db commit c320fe5

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

tests/program/linspace_tests2.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ def setUp(self):
1111
hold = ConstantPT(10 ** 6, {'a': '-1. + idx * 0.01'})
1212
self.pulse_template = hold.with_iteration('idx', 200)
1313

14-
self.program = LinSpaceIter(
14+
self.program = LinSpaceTopLevel(LinSpaceIter(
15+
to_be_stepped=False,
1516
length=200,
1617
body=(LinSpaceHold(
18+
channels=('a','b'),
1719
bases=(-1.,),
1820
factors=((0.01,),),
1921
duration_base=TimeType(10**6),
2022
duration_factors=None
2123
),)
22-
)
24+
))
2325

2426
key = DepKey.from_voltages((0.01,), DEFAULT_INCREMENT_RESOLUTION)
2527

@@ -38,7 +40,9 @@ def test_program(self):
3840
self.assertEqual([self.program], program)
3941

4042
def test_commands(self):
41-
commands = to_increment_commands(self.program)
43+
program_builder = LinSpaceBuilder()
44+
program = self.pulse_template.create_program(program_builder=program_builder)
45+
commands = to_increment_commands(program)
4246
self.assertEqual(self.commands, commands)
4347

4448

@@ -85,10 +89,10 @@ def setUp(self,base_time=1e2,rep_factor=2):
8589
ConstantPT(2*10 ** 5, {'b': 'idx_b*0.01',}),
8690
)
8791

88-
pt = (random_constant @ dependent_constant2 @ (wait.with_iteration('idx_a', rep_factor*10*2)) \
92+
pt = (dependent_constant @ dependent_constant2 @ (wait.with_iteration('idx_a', rep_factor*10*2)) \
8993
@ dependent_constant2).with_iteration('idx_b', rep_factor*10)\
9094

91-
self.pulse_template = pt
95+
self.pulse_template = MappingPT(pt,parameter_mapping=dict(y_gain=0.3,))
9296

9397
def test_program(self):
9498
program_builder = LinSpaceBuilder()
@@ -110,7 +114,7 @@ def setUp(self,rep_factor=2):
110114
amp_pt = "amp*1/8"*FunctionPT("sin(t/1000)","t_sin",channel='a')
111115

112116
pt = (normal_pt@amp_pt@normal_pt@amp_pt@amp_pt@normal_pt).with_iteration('amp', rep_factor)
113-
self.pulse_template = pt
117+
self.pulse_template = MappingPT(pt,parameter_mapping=dict(t_sin=64e2,))
114118

115119
def test_program(self):
116120
program_builder = LinSpaceBuilder()
@@ -139,7 +143,7 @@ def setUp(self,base_time=1e2,rep_factor=2):
139143
.with_repetition(rep_factor)@amp_inner.with_iteration('amp', rep_factor))\
140144
.with_iteration('amp2', rep_factor).with_iteration('freq', rep_factor).with_iteration('idx_a',rep_factor)
141145

142-
self.pulse_template = pt
146+
self.pulse_template = MappingPT(pt,parameter_mapping=dict(t_sin=64e2,idx_t=1,))
143147

144148
def test_program(self):
145149
program_builder = LinSpaceBuilder(to_stepping_repeat={'amp','amp2','off','freq'},)
@@ -154,7 +158,7 @@ def test_commands(self):
154158

155159

156160
class CombinedSweepTest(TestCase):
157-
def setUp(self,rep_factor=2):
161+
def setUp(self,base_time=1e2,rep_factor=2):
158162

159163
wait = ConstantPT(f'64*{base_time}*1e1*(1+idx_t)', {'a': f'-1. + idx_a * 0.5/{rep_factor}', 'b': f'-.5 + idx_a * 0.8/{rep_factor}'})
160164
normal_pt = ParallelConstantChannelPT(FunctionPT("sin(t/2000)","t_sin",channel='a'),{'b':-0.2})
@@ -164,13 +168,16 @@ def setUp(self,rep_factor=2):
164168
.with_iteration('amp', rep_factor)\
165169
.with_iteration('idx_a', rep_factor)\
166170
.with_iteration('idx_t', rep_factor)
167-
self.pulse_template = pt
171+
172+
self.pulse_template = MappingPT(pt,parameter_mapping=dict(t_sin=64e2,))
168173

169174
def test_program(self):
170175
program_builder = LinSpaceBuilder()
171176
self._program_to_test = self.pulse_template.create_program(program_builder=program_builder)
172177

173178
def test_commands(self):
179+
program_builder = LinSpaceBuilder()
180+
self._program_to_test = self.pulse_template.create_program(program_builder=program_builder)
174181
commands = to_increment_commands(self._program_to_test)
175182
# so far just a test to see if the program creation works at all.
176183
# self.assertEqual([self.program], program)

0 commit comments

Comments
 (0)