Skip to content

Commit 6c6abb1

Browse files
committed
some measurement window test
1 parent eb917b7 commit 6c6abb1

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/program/linspace_tests2.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,45 @@ def test_commands(self):
104104
commands = to_increment_commands(self._program_to_test)
105105
# so far just a test to see if the program creation works at all.
106106
# self.assertEqual([self.program], program)
107+
108+
109+
class SequencedIterationTest(TestCase):
110+
def setUp(self,base_time=1e2,rep_factor=2):
111+
wait = AtomicMultiChannelPT(
112+
ConstantPT(f'64*{base_time}*1e1', {'a': '-1. + idx_a * 0.01 + y_gain', }),
113+
ConstantPT(f'64*{base_time}*1e1', {'b': '-.5 + idx_b * 0.02'})
114+
)
115+
116+
dependent_constant = AtomicMultiChannelPT(
117+
ConstantPT(10 ** 5, {'a': -.3}),
118+
ConstantPT(10 ** 5, {'b': 'idx_b*0.02',}),
119+
)
107120

121+
dependent_constant2 = AtomicMultiChannelPT(
122+
ConstantPT(2*10 ** 5, {'a': '-.3+idx_b*0.01'}),
123+
ConstantPT(2*10 ** 5, {'b': 'idx_b*0.01',}),
124+
measurements=[('c',0,10**5)]
125+
)
126+
127+
pt = (dependent_constant @ dependent_constant2 @ (wait.with_iteration('idx_a', rep_factor*10*2)) \
128+
@ dependent_constant2).with_iteration('idx_b', rep_factor*10)\
108129

130+
step_len = 10**5*5 + rep_factor*10*2*64*base_time*1e1
131+
132+
self.measurements = {
133+
'c': (
134+
np.repeat(np.arange(0.,(rep_factor*10)*step_len,step_len),2)+np.array([10**5,step_len-2*10**5]*rep_factor*10),
135+
np.ones(rep_factor*10*2)*10**5
136+
)
137+
}
138+
139+
self.pulse_template = MappingPT(pt,parameter_mapping=dict(y_gain=0.3,))
140+
141+
def test_measurements(self):
142+
program_builder = LinSpaceBuilder()
143+
self._program_to_test = self.pulse_template.create_program(program_builder=program_builder)
144+
self.assertIsNone(np.testing.assert_array_equal(self._program_to_test[0].get_measurement_windows()['c'], self.measurements['c']))
145+
109146

110147
class AmplitudeSweepTest(TestCase):
111148
def setUp(self,rep_factor=2):

0 commit comments

Comments
 (0)