@@ -68,16 +68,15 @@ def setUp(self):
68
68
hold = ConstantPT (10 ** 6 , {'a' : '-1. + idx * 0.01' })
69
69
hold_random = ConstantPT (10 ** 5 , {'a' : - .4 })
70
70
# self.pulse_template = (hold_random@(hold_random@hold).with_repetition(10)@hold_random@hold)\
71
- self .pulse_template = (hold_random @(hold ).with_repetition (10 ))\
72
- .with_iteration ('idx' , 200 )
71
+ self .pulse_template = (hold_random @ hold .with_repetition (10 )).with_iteration ('idx' , 200 )
73
72
74
73
self .program = LinSpaceIter (
75
74
length = 200 ,
76
75
body = (
77
- LinSpaceHold (bases = (- .4 ), factors = None ,duration_base = TimeType (10 ** 6 ), duration_factors = None ),
78
- LinSpaceRepeat (
76
+ LinSpaceHold (bases = (- .4 ,), factors = ( None ,), duration_base = TimeType (10 ** 5 ), duration_factors = None ),
77
+ LinSpaceRepeat (body = (
79
78
LinSpaceHold (bases = (- 1. ,),factors = ((0.01 ,),),duration_base = TimeType (10 ** 6 ),duration_factors = None ),
80
- 10 ),
79
+ ), count = 10 ),
81
80
# LinSpaceHold(bases=(-.4),factors=None,duration_base=TimeType(10**6),duration_factors=None),
82
81
# LinSpaceHold(bases=(-1.,),factors=((0.01,),),duration_base=TimeType(10**6),duration_factors=None)
83
82
),)
@@ -86,20 +85,20 @@ def setUp(self):
86
85
key = DepKey .from_voltages ((0.01 ,), DEFAULT_INCREMENT_RESOLUTION )
87
86
88
87
self .commands = [
89
- [ Set (channel = 0 , value = - 0.4 , key = DepKey (factors = ())),
88
+ Set (channel = 0 , value = - 0.4 , key = DepKey (factors = ())),
90
89
Wait (duration = TimeType (100000 , 1 )),
91
90
#here is what currently happens:
92
- # Set(channel=0, value=-1.0, key=DepKey(factors=(10000000,))),
93
- # Wait(duration=TimeType(1000000, 1)),
94
- # LoopLabel(idx=0, count=9),
95
- # Wait(duration=TimeType(1000000, 1)),
96
- # LoopJmp(idx=0),
97
- #however, i think this is what should happen (maybe also with an additional "Set" before,
98
- #which might cause complications if omitted in other contexts like AWG amplitude:
99
- LoopLabel (idx = 0 , count = 10 ),
100
91
Set (channel = 0 , value = - 1.0 , key = DepKey (factors = (10000000 ,))),
101
92
Wait (duration = TimeType (1000000 , 1 )),
93
+ LoopLabel (idx = 0 , count = 9 ),
94
+ Wait (duration = TimeType (1000000 , 1 )),
102
95
LoopJmp (idx = 0 ),
96
+ #however, i think this is what should happen (maybe also with an additional "Set" before,
97
+ #which might cause complications if omitted in other contexts like AWG amplitude:
98
+ #LoopLabel(idx=0, count=10),
99
+ #Set(channel=0, value=-1.0, key=DepKey(factors=(10000000,))),
100
+ #Wait(duration=TimeType(1000000, 1)),
101
+ #LoopJmp(idx=0),
103
102
104
103
LoopLabel (idx = 1 , count = 199 ),
105
104
Set (channel = 0 , value = - 0.4 , key = DepKey (factors = ())),
@@ -108,12 +107,21 @@ def setUp(self):
108
107
Wait (duration = TimeType (1000000 , 1 )),
109
108
LoopLabel (idx = 2 , count = 9 ),
110
109
#also here, an increment 0 may be helpful (at least to be able to force).
111
- Increment (channel = 0 , value = 0 , dependency_key = DepKey (factors = (10000000 ,))),
110
+ # Increment(channel=0, value=0, dependency_key=DepKey(factors=(10000000,))),
112
111
Wait (duration = TimeType (1000000 , 1 )),
113
112
LoopJmp (idx = 2 ),
114
- LoopJmp (idx = 1 )]
113
+ LoopJmp (idx = 1 )
115
114
]
116
115
116
+ self .output = []
117
+ time = TimeType (0 )
118
+ for idx in range (200 ):
119
+ self .output .append ((time , [- .4 ]))
120
+ time += TimeType (10 ** 5 )
121
+ self .output .append ((time , [- 1. + idx * 0.01 ]))
122
+ time += TimeType (10 ** 7 )
123
+
124
+
117
125
def test_program (self ):
118
126
program_builder = LinSpaceBuilder (('a' ,))
119
127
program = self .pulse_template .create_program (program_builder = program_builder )
@@ -123,6 +131,12 @@ def test_commands(self):
123
131
commands = to_increment_commands ([self .program ])
124
132
self .assertEqual (self .commands , commands )
125
133
134
+ def test_output (self ):
135
+ vm = LinSpaceVM (1 )
136
+ vm .set_commands (self .commands )
137
+ vm .run ()
138
+ assert_vm_output_almost_equal (self , self .output , vm .history )
139
+
126
140
127
141
class PlainCSDTest (TestCase ):
128
142
def setUp (self ):
0 commit comments