@@ -85,18 +85,12 @@ def setUp(self):
8585 )
8686
8787 #not working
88- self .pulse_template_1 = (
88+ self .pulse_template = (
8989 dependent_constant @
9090 dependent_constant2 .with_repetition (rep_factor ) @
9191 wait .with_iteration ('idx_a' , rep_factor )
9292 ).with_iteration ('idx_b' , rep_factor )
9393
94- #not working
95- self .pulse_template_2 = (
96- dependent_constant2 .with_repetition (rep_factor ) @
97- wait .with_iteration ('idx_a' , rep_factor )
98- ).with_iteration ('idx_b' , rep_factor )
99-
10094 wait_hold = LinSpaceHold (
10195 bases = (- 1.0 , - 0.5 ),
10296 factors = ((0.0 , 0.01 ), (0.05 , 0.0 ),),
@@ -116,21 +110,16 @@ def setUp(self):
116110 duration_factors = None
117111 )
118112
119- self .program_1 = LinSpaceIter (
113+ self .program = LinSpaceIter (
120114 length = rep_factor ,
121115 body = (
122116 dependent_hold_1 ,
123117 LinSpaceRepeat (body = (dependent_hold_2 ,), count = rep_factor ),
124118 LinSpaceIter (body = (wait_hold ,), length = rep_factor ),
125119 )
126120 )
127- self .program_2 = []#TODO
128-
129- key = DepKey .from_voltages ((0.05 ,), DEFAULT_INCREMENT_RESOLUTION )
130121
131- wait_cmd = Wait (duration = TimeType (100 , 1 ))
132-
133- self .commands_1 = [
122+ self .commands = [
134123 Set (channel = 0 , value = - 1.0 , key = DepKey (factors = ())),
135124 Set (channel = 1 , value = - 0.5 , key = DepKey (factors = (50000000 ,))),
136125 Wait (duration = TimeType (100 , 1 )),
@@ -139,6 +128,7 @@ def setUp(self):
139128 Increment (channel = 1 , value = 0.2 , dependency_key = DepKey (factors = (50000000 ,))),
140129 Wait (duration = TimeType (100 , 1 )),
141130
131+ # This is the repetition
142132 LoopLabel (idx = 0 , count = 1 ),
143133 Wait (duration = TimeType (100 , 1 )),
144134 LoopJmp (idx = 0 ),
@@ -160,60 +150,53 @@ def setUp(self):
160150 Increment (channel = 1 , value = 0.2 , dependency_key = DepKey (factors = (50000000 ,))),
161151 Wait (duration = TimeType (100 , 1 )),
162152
153+ # next repetition
163154 LoopLabel (idx = 3 , count = 1 ),
164155 Wait (duration = TimeType (100 , 1 )),
165156 LoopJmp (idx = 3 ),
166157
167- Increment (channel = 0 ,
168- value = - 0.01 ,
169- dependency_key = DepKey (factors = (0 , 10000000 ))),
170- Increment (channel = 1 , value = - 0.2 , dependency_key = DepKey (factors = (50000000 ,))),
171- Wait (duration = TimeType (100 , 1 )),
172- LoopLabel (idx = 4 , count = 1 ),
173- Increment (channel = 0 , value = 0.01 , dependency_key = DepKey (factors = (0 , 10000000 ))),
174- Wait (duration = TimeType (100 , 1 )),
175- LoopJmp (idx = 4 ),
176- LoopJmp (idx = 2 )]
177-
158+ Increment (channel = 0 ,
159+ value = - 0.01 ,
160+ dependency_key = DepKey (factors = (0 , 10000000 ))),
161+ Increment (channel = 1 , value = - 0.2 , dependency_key = DepKey (factors = (50000000 ,))),
162+ Wait (duration = TimeType (100 , 1 )),
178163
179- self . pulse_template_1 = (
180- dependent_constant @
181- dependent_constant2 . with_repetition ( rep_factor ) @
182- wait . with_iteration ( 'idx_a' , rep_factor )
183- ). with_iteration ( 'idx_b' , rep_factor )
164+ LoopLabel ( idx = 4 , count = 1 ),
165+ Increment ( channel = 0 , value = 0.01 , dependency_key = DepKey ( factors = ( 0 , 10000000 ))),
166+ Wait ( duration = TimeType ( 100 , 1 )),
167+ LoopJmp ( idx = 4 ),
168+ LoopJmp ( idx = 2 )]
184169
185170 time = TimeType (0 )
186- self .output_1 = []
171+ self .output = []
187172 for idx_b in range (rep_factor ):
188173 # does not account yet for floating poit errors. We would need to sum here
189- self .output_1 .append ((time , (- 1.0 , - 0.5 + idx_b * 0.05 )))
174+ self .output .append ((time , (- 1.0 , - 0.5 + idx_b * 0.05 )))
190175 time += TimeType .from_float (base_time )
191176
192177 for _ in range (rep_factor ):
193- self .output_1 .append ((time , (- 0.5 , - 0.3 + idx_b * 0.05 )))
178+ self .output .append ((time , (- 0.5 , - 0.3 + idx_b * 0.05 )))
194179 time += TimeType .from_float (base_time )
195180
196181 for idx_a in range (rep_factor ):
197- self .output_1 .append ((time , (- 1.0 + 0.01 * idx_a , - 0.5 + idx_b * 0.05 )))
182+ self .output .append ((time , (- 1.0 + 0.01 * idx_a , - 0.5 + idx_b * 0.05 )))
198183 time += TimeType .from_float (base_time )
199184
200-
201185 def test_program_1 (self ):
202186 program_builder = LinSpaceBuilder (('a' ,'b' ))
203- program_1 = self .pulse_template_1 .create_program (program_builder = program_builder )
204- self .assertEqual ([self .program_1 ], program_1 )
187+ program_1 = self .pulse_template .create_program (program_builder = program_builder )
188+ self .assertEqual ([self .program ], program_1 )
205189
206190 def test_commands_1 (self ):
207- commands = to_increment_commands ([self .program_1 ])
208- self .assertEqual (self .commands_1 , commands )
191+ commands = to_increment_commands ([self .program ])
192+ self .assertEqual (self .commands , commands )
209193
210194 def test_output_1 (self ):
211195 vm = LinSpaceVM (2 )
212- vm .set_commands (commands = self .commands_1 )
196+ vm .set_commands (commands = self .commands )
213197 vm .run ()
214- assert_vm_output_almost_equal (self , self .output_1 , vm .history )
198+ assert_vm_output_almost_equal (self , self .output , vm .history )
215199
216-
217200
218201class PlainCSDTest (TestCase ):
219202 def setUp (self ):
0 commit comments