Example #1
0
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)
Example #2
0
    # 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
    )

    print("Module opened at slot", slot)

    # create a new wave object
    wave = sd.SD_Wave()

    # load a csv file as the wave data
    error = wave.newFromFile(waveformFile)

    # load the wave into the AWG RAM
    error = card.waveformLoad(wave, 0)

    card.clockSetFrequency(f_clk)

    # modulation - amplitude.
    error = card.modulationAmplitudeConfig(
        nChannel=0,
        modulationType=1,  # 0: off, 1: amplitude, 2: offset
        deviationGain=1)
# 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)

f_sample = f_clk / (5 * prescl)
print("sample rate:", f_sample / 1e6, "MHz")

# when to start after the trigger
delay = 10  # [10 ns]

# mod_type attr is unused in this script; amplitude modulation harcoded.
mod_type = ModTypes['amplitude']
start_trig = sd.SD_TriggerModes.EXTTRIG_CYCLE
wfm0 = Waveform(mod_type, wfm_tau, wfm_pts, sigma, wfm_arr0, prescl, 0,
                start_trig, sd.SD_Wave())
wfm1 = Waveform(mod_type, wfm_tau, wfm_pts, sigma, wfm_arr1, prescl, delay,
                start_trig, sd.SD_Wave())
waveforms = [wfm0, wfm1]
# for wv in waveforms:
# wv.arr[0] = wv.arr[-1] = 0 # set the endpts to zero
"""channel defaults"""

# for now, I leave the settings for each channel the same, set below
channels = [0, 1]
""" card and channel setup """
card = sd.SD_AOU()
slot = 12
error = card.openWithSlot("", 0,
                          slot)  # productName, chassis can be left blank/0.
if error < 0: