[docs]classZotinoChannel(DACChannel):@kerneldef_set_voltage(self,voltage:TFloat,update_dac:TBool=True):self.dac_device._zotino_device.write_dac(self.channel,voltage)ifself.debug_output:self.experiment.log.info(self.identifier+": Written to channel {0}",[self.channel])self.experiment.log.info(self.identifier+": Voltage: {0}",[voltage])ifupdate_dac:self.dac_device.update()
[docs]classFastino(DAC):"""The Sinara Fast ADC called Fastino Args: fastino_device: The ARTIQ fastino device from the `device_db` parallel_event_delay: Time by which occuring parallel events in ramps are moved [s] (default: 10ns) """kernel_invariants={"_fastino_device","parallel_event_delay"}def__init__(self,fastino_device,parallel_event_delay:TBool=10e-9,*args,**kwargs):DAC.__init__(self,num_chan=32,*args,**kwargs)self._fastino_device=fastino_device# variables for detecting parallel eventsself.event_slots=np.array([-1]*32,dtype=np.int64)self.event_slots_max_idx=-1self.parallel_event_delay=parallel_event_delay@kerneldef_prerun(self):# self._fastino_device.init()pass
[docs]@kerneldefregister_event(self,time:TInt64)->TFloat:last_used=self.event_slots_max_idxfirst_free=last_used+1shift_needed=Falseforiinrange(self.event_slots_max_idx,-1,-1):event=self.event_slots[i]# check if the time of the event already passedifevent<now_mu():self.event_slots[i]=-1iflast_used==self.event_slots_max_idx:last_used=ifirst_free=i# check for collision with the new eventifevent==time:shift_needed=Trueself.event_slots_max_idx=last_usedifshift_needed:returnself.register_event(time+self.core.seconds_to_mu(self.parallel_event_delay))+\
self.parallel_event_delayelse:self.event_slots[first_free]=timeiffirst_free>=last_used:self.event_slots_max_idx=first_freereturn0.0
[docs]classFastinoChannel(DACChannel):@kernel(flags={"fast-math"})def_ramp_voltage(self,duration:TFloat,voltage_start:TFloat,voltage_end:TFloat,ramp_timestep:TFloat=200e-6,relocate_parallel:TBool=True):""" This method implements a stupid ramp on an abstract level. This will most likely work but be slow. If your hardware has native support for ramping, please override this function when you inherit from VoltageSource """ifrelocate_parallel:offset=self.dac_device.register_event(now_mu())ifoffset>0.0:self.experiment.log.warning(self.identifier+": Found paralell ramp, delaying..")delay(offset)n=int(duration/ramp_timestep)ramp_timestep=duration/float(n)foriinrange(n+1):self._set_voltage(voltage_start+i*(voltage_end-voltage_start)/n,zero_time=True)delay(ramp_timestep)@kerneldef_set_voltage(self,voltage:TFloat,zero_time:TBool=False):self.dac_device._fastino_device.set_dac(self.channel,voltage)# self.experiment.log.info(self.identifier + ": setting voltage to {0} V", [voltage])ifnotzero_time:delay(0.1e-6)