@@ -107,8 +107,9 @@ def generate_code(self, hdf5_file):
107107
108108 try :
109109 prefix , channel = output .connection .split ()
110+ channel = int (channel )
110111 if channel not in self .allowed_chans :
111- LabscriptError (f"Channel { channel } must be 0 or 0 " )
112+ LabscriptError (f"Channel { channel } must be 0 or 1 " )
112113 except :
113114 msg = f"""{ output .description } :{ output .name } has invalid connection string.
114115 Only 'channel 0' or 'channel 1' is allowed.
@@ -117,26 +118,30 @@ def generate_code(self, hdf5_file):
117118
118119 DDSs [channel ] = output
119120
121+ # get which channels to program
122+ stat_DDSs = set (DDSs )& set (range (2 ))
120123 for connection in DDSs :
121124 dds = DDSs [connection ]
122125 dds .frequency .raw_output = self .validate_data (dds .frequency .static_value ,self .freq_limits ,dds )
123126 dds .amplitude .raw_output = self .validate_data (dds .amplitude .static_value ,self .amp_limits ,dds )
124127 dds .phase .raw_output = self .validate_data (dds .phase .static_value ,self .phase_limits ,dds )
125128
126- static_dtypes = [(f'freq{ i :d} ' ,np .float64 ) for i in self . allowed_chans ] + \
127- [(f'amp{ i :d} ' ,np .float64 ) for i in self . allowed_chans ] + \
128- [(f'phase{ i :d} ' ,np .float64 ) for i in self . allowed_chans ] + \
129- [(f'gate{ i :d} ' ,bool ) for i in self . allowed_chans ]
129+ static_dtypes = [(f'freq{ i :d} ' ,np .float64 ) for i in stat_DDSs ] + \
130+ [(f'amp{ i :d} ' ,np .float64 ) for i in stat_DDSs ] + \
131+ [(f'phase{ i :d} ' ,np .float64 ) for i in stat_DDSs ] + \
132+ [(f'gate{ i :d} ' ,bool ) for i in stat_DDSs ]
130133 static_table = np .zeros (1 ,dtype = static_dtypes )
131134
132135 for connection in DDSs :
136+ dds = DDSs [connection ]
133137 static_table [f'freq{ connection } ' ] = dds .frequency .raw_output
134138 static_table [f'amp{ connection } ' ] = dds .amplitude .raw_output
135139 static_table [f'phase{ connection } ' ] = dds .phase .raw_output
136140 static_table [f'gate{ connection } ' ] = connection in self .enabled_chans
137141
138142 grp = self .init_device_group (hdf5_file )
139- grp .create_dataset ('STATIC_DATA' ,compression = config .compression ,data = static_table )
143+ if stat_DDSs :
144+ grp .create_dataset ('STATIC_DATA' ,compression = config .compression ,data = static_table )
140145
141146 def enable_output (self , channel ):
142147 """Enable an output channel at the device level.
0 commit comments