Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cd3b590962ca
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 36c3f022aa62
Choose a head ref
  • 3 commits
  • 2 files changed
  • 2 contributors

Commits on Oct 12, 2015

  1. Copy the full SHA
    7414b90 View commit details
  2. devices/novatech409b: improve simultaneous update API

    Joe Britton authored and sbourdeauducq committed Oct 12, 2015
    Copy the full SHA
    b5cc680 View commit details
  3. Copy the full SHA
    36c3f02 View commit details
Showing with 16 additions and 31 deletions.
  1. +4 −31 artiq/devices/novatech409b/driver.py
  2. +12 −0 artiq/language/scan.py
35 changes: 4 additions & 31 deletions artiq/devices/novatech409b/driver.py
Original file line number Diff line number Diff line change
@@ -137,50 +137,24 @@ def set_simultaneous_update(self, simultaneous):
else:
self._ser_send("I a")

def do_simultaneous_update(self):
"""Apply update in simultaneous update mode."""
self._ser_send("I p")

def set_freq(self, ch_no, freq):
"""Set frequency of one channel."""
self.set_simultaneous_update(False)
# Novatech expects MHz
self._ser_send("F{:d} {:f}".format(ch_no, freq/1e6))

def set_phase(self, ch_no, phase):
"""Set phase of one channel."""
# do this immediately, disable SimultaneousUpdate mode
self.set_simultaneous_update(False)
# phase word is required by device
# N is an integer from 0 to 16383. Phase is set to
# N*360/16384 deg; in ARTIQ represent phase in cycles [0, 1]
phase_word = round(phase*16383)
cmd = "P{:d} {:d}".format(ch_no, phase_word)
self._ser_send(cmd)

def set_freq_all_phase_continuous(self, freq):
"""Set frequency of all channels simultaneously.
Set frequency of all channels simultaneously.
1) all DDSs are set to phase continuous mode
2) all DDSs are simultaneously set to new frequency
Together 1 and 2 ensure phase continuous frequency switching.
"""
self.set_simultaneous_update(True)
self.set_phase_continuous(True)
for i in range(4):
self.set_freq(i, freq)
# send command necessary to update all channels at the same time
self._ser_send("I p")

def set_phase_all(self, phase):
"""Set phase of all channels simultaneously."""

self.set_simultaneous_update(True)
# Note that this only works if the continuous
# phase switching is turned off.
self.set_phase_continuous(False)
for i in range(4):
self.set_phase(i, phase)
# send command necessary to update all channels at the same time
self._ser_send("I p")

def set_gain(self, ch_no, volts):
"""Set amplitude of one channel."""

@@ -191,7 +165,6 @@ def set_gain(self, ch_no, volts):
s = "Amplitude out of range {v}".format(v=volts)
raise ValueError(s)

self.set_simultaneous_update(False)
s = "V{:d} {:d}".format(ch_no, dac_value)
self._ser_send(s)

12 changes: 12 additions & 0 deletions artiq/language/scan.py
Original file line number Diff line number Diff line change
@@ -47,6 +47,9 @@ def _gen(self):
def __iter__(self):
return self._gen()

def __len__(self):
return 1

def describe(self):
return {"ty": "NoScan", "value": self.value}

@@ -70,6 +73,9 @@ def _gen(self):
def __iter__(self):
return self._gen()

def __len__(self):
return self.npoints

def describe(self):
return {"ty": "LinearScan",
"min": self.min, "max": self.max, "npoints": self.npoints}
@@ -89,6 +95,9 @@ def __init__(self, min, max, npoints, seed=0):
def __iter__(self):
return iter(self.sequence)

def __len__(self):
return self.npoints

def describe(self):
return {"ty": "RandomScan",
"min": self.min, "max": self.max, "npoints": self.npoints}
@@ -103,6 +112,9 @@ def __init__(self, sequence):
def __iter__(self):
return iter(self.sequence)

def __len__(self):
return len(self.sequence)

def describe(self):
return {"ty": "ExplicitScan", "sequence": self.sequence}