def performOpen(self, options={}): """Perform the operation of opening the instrument connection""" # timeout self.timeout_ms = int(1000 * self.dComCfg['Timeout']) # create AWG instance self.AWG = signadyne.SD_AOU() AWGPart = self.AWG.getProductNameBySlot(1, int(self.comCfg.address)) if not isinstance(AWGPart, (str, unicode)): raise InstrumentDriver.Error('Unit not available') # check that model is supported dOptionCfg = self.dInstrCfg['options'] for validId, validName in zip(dOptionCfg['model_id'], dOptionCfg['model_str']): if AWGPart.find(validId)>=0: # id found, stop searching break else: # loop fell through, raise ID error raise InstrumentDriver.IdError(AWGPart, dOptionCfg['model_id']) # set model self.setModel(validName) self.AWG.openWithSlot(AWGPart, 1, int(self.comCfg.address)) # keep track of if waveform was updated self.nCh = 4 self.lWaveUpdated = [False]*self.nCh # clear old waveforms self.AWG.waveformFlush() for ch in range(self.nCh): self.AWG.AWGflush(ch)
def performOpen(self, options={}): """Perform the operation of opening the instrument connection""" # timeout self.timeout_ms = int(1000 * self.dComCfg['Timeout']) # create AWG instance self.AWG = signadyne.SD_AOU() AWGPart = self.AWG.getProductNameBySlot(1, int(self.comCfg.address)) if not isinstance(AWGPart, str): raise InstrumentDriver.Error('Unit not available') # check that model is supported dOptionCfg = self.dInstrCfg['options'] for validId, validName in zip(dOptionCfg['model_id'], dOptionCfg['model_str']): if AWGPart.find(validId) >= 0: # id found, stop searching break else: # loop fell through, raise ID error raise InstrumentDriver.IdError(AWGPart, dOptionCfg['model_id']) # set model self.setModel(validName) self.AWG.openWithSlot(AWGPart, 1, int(self.comCfg.address)) # sampling rate and number of channles is set by model if validName in ('M3202', 'H3344'): # 1GS/s models self.dt = 1E-9 self.nCh = 4 elif validName in ('M3302', ): # two-channel, 500 MS/s model self.dt = 2E-9 self.nCh = 2 else: # assume 500 MS/s for all other models self.dt = 2E-9 self.nCh = 4 # keep track of if waveform was updated self.lWaveUpdated = [False] * self.nCh # clear old waveforms self.AWG.waveformFlush() for ch in range(self.nCh): self.AWG.AWGflush(ch)
# waveform pts - should match the value given in the waveform file wfm_pts = 50 # duration over which to unload the wave from RAM wfm_tau = 2.5e-7 # duration of the waveform to prescaler factor prescl_from_tau = lambda tau: int(tau * f_clk / ( 5 * wfm_pts)) # manual: 1.2.2.4 Prescaler and Sampling Rate prescl = prescl_from_tau(wfm_tau) print("prescl:", prescl) # card setup card = sd.SD_AOU() slot = 12 error = card.openWithSlot("", 0, slot) if error < 0: print("Error =", error) else: # flush all AWG for i in range(4): card.AWGflush(i) # trigger setup. only applies if AWGqueueWaveform has the trigger set to EXTTRIG card.AWGtriggerExternalConfig( nAWG=0, externalSource=0, # manual: Table 16, page 19 triggerBehavior=trig_edge # manual: Table 17, pages 19
import os import sys; import math sys.path.insert(0,'C:/Program Files/Signadyne/Libraries/Python') import signadyne card = signadyne.SD_AOU() slot = 2 error = card.openWithSlot("", 0, slot) if error < 0: print("Error =", error) else: print("Module opened at slot", slot) waveformFile = "C:/Users/Public/Documents/Signadyne/Examples/Waveforms/Gaussian.csv" wave=signadyne.SD_Wave() error = wave.newFromFile(waveformFile) error = card.waveformLoad(wave,0) card.AWGflush(0) card.AWGqueueWaveform(0,0,0,0,0,0) card.clockSetFrequency(1000000000) error = card.modulationAmplitudeConfig(0,0,0) print(error) error = card.modulationAngleConfig(0,1,1000000) print(error) card.channelAmplitude(0,1)