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: 3472e1abd35f
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: 13b4929dd832
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Apr 7, 2016

  1. Copy the full SHA
    6a783ea View commit details
  2. Copy the full SHA
    13b4929 View commit details
Showing with 12 additions and 10 deletions.
  1. +2 −1 artiq/devices/pdq2/driver.py
  2. +4 −4 artiq/test/test_pdq2.py
  3. +3 −2 artiq/test/test_wavesynth.py
  4. +3 −3 artiq/wavesynth/compute_samples.py
3 changes: 2 additions & 1 deletion artiq/devices/pdq2/driver.py
Original file line number Diff line number Diff line change
@@ -198,13 +198,14 @@ def program_segments(self, segments, data):
duration = line["duration"]
trigger = line.get("trigger", False)
for segment, data in zip(segments, line["channel_data"]):
silence = data.pop("silence", False)
if len(data) != 1:
raise ValueError("only one target per channel and line "
"supported")
for target, target_data in data.items():
getattr(segment, target)(
shift=shift, duration=duration, trigger=trigger,
**target_data)
silence=silence, **target_data)

def program(self, program, channels=None):
if channels is None:
8 changes: 4 additions & 4 deletions artiq/test/test_pdq2.py
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ def test_cmd_program(self):
self.dev.program(_test_program)
self.dev.cmd("START", True)
self.dev.cmd("ARM", True)
#self.dev.cmd("TRIGGER", True)
# self.dev.cmd("TRIGGER", True)
return self.dev.dev.getvalue()

def test_synth(self):
@@ -103,10 +103,10 @@ def test_run_plot(self):
"duration": 40,
"channel_data": [
{"bias": {"amplitude": [.4, .04, -2e-3]}},
{"bias": {
"amplitude": [.5],
{
"bias": {"amplitude": [.5]},
"silence": True,
}},
},
{"dds": {
"amplitude": [.8, .08, -4e-3, 0],
"phase": [.25, .025, .02/40],
5 changes: 3 additions & 2 deletions artiq/test/test_wavesynth.py
Original file line number Diff line number Diff line change
@@ -121,6 +121,7 @@ def test_run(self):

@unittest.skip("manual/visual test")
def test_plot(self):
import cairoplot
from matplotlib import pyplot as plt
x, y = self.drive()
cairoplot.scatter_plot("plot.png", [x, y])
plt.plot(x, y)
plt.show()
6 changes: 3 additions & 3 deletions artiq/wavesynth/compute_samples.py
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ def next(self):
return self.amplitude.next()*cos(2*pi*self.phase.next())


class Wave:
class Channel:
def __init__(self):
self.bias = Spline()
self.dds = DDS()
@@ -80,7 +80,7 @@ class TriggerError(Exception):

class Synthesizer:
def __init__(self, nchannels, program):
self.channels = [Wave() for _ in range(nchannels)]
self.channels = [Channel() for _ in range(nchannels)]
self.program = program
# line_iter is None: "wait for segment selection" state
# otherwise: iterator on the current position in the frame
@@ -104,6 +104,7 @@ def trigger(self):
while True:
for channel, channel_data in zip(self.channels,
line["channel_data"]):
channel.set_silence(channel_data.get("silence", False))
if "bias" in channel_data:
channel.bias.set_coefficients(
channel_data["bias"]["amplitude"])
@@ -115,7 +116,6 @@ def trigger(self):
channel_data["dds"]["phase"])
if channel_data["dds"].get("clear", False):
channel.dds.phase.clear()
channel.set_silence(channel_data.get("silence", False))

if line.get("dac_divider", 1) != 1:
raise NotImplementedError