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: 2fbe22e15eab
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: c259c4f46fb1
Choose a head ref
  • 5 commits
  • 6 files changed
  • 1 contributor

Commits on Jan 31, 2015

  1. Copy the full SHA
    fad3c71 View commit details
  2. Copy the full SHA
    0e8f9ef View commit details
  3. Copy the full SHA
    3a2bd02 View commit details
  4. examples/flopping_f_simulation: use numpy array in scipy curve_fit

    Python lists cause problems with certain Scipy versions
    sbourdeauducq committed Jan 31, 2015
    Copy the full SHA
    47f1e3d View commit details
  5. Copy the full SHA
    c259c4f View commit details
Showing with 25 additions and 15 deletions.
  1. +4 −4 artiq/gui/rt_result_views.py
  2. +7 −6 artiq/gui/rt_results.py
  3. +1 −1 doc/manual/installing.rst
  4. +8 −1 examples/flopping_f_simulation.py
  5. +3 −2 examples/flopping_f_simulation_gui.glade
  6. +2 −1 setup.py
8 changes: 4 additions & 4 deletions artiq/gui/rt_result_views.py
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@


class RawWindow(Window):
def __init__(self, set_names):
def __init__(self, group_name, set_names):
self.labels = dict()

Window.__init__(self, title="Raw values",
Window.__init__(self, title=group_name + ": Raw values",
default_size=(200, 150))

grid = Gtk.Grid(row_spacing=6, column_spacing=6)
@@ -29,11 +29,11 @@ def set_data(self, data):


class PlotWindow(Window):
def __init__(self, set_names):
def __init__(self, group_name, set_names):
self.set_names = set_names
self.data = None

Window.__init__(self, title="/".join(set_names),
Window.__init__(self, title=group_name + ": " + "/".join(set_names),
default_size=(700, 500))

self.darea = Gtk.DrawingArea()
13 changes: 7 additions & 6 deletions artiq/gui/rt_results.py
Original file line number Diff line number Diff line change
@@ -5,19 +5,20 @@
from artiq.gui.rt_result_views import RawWindow, XYWindow


def _create_view(set_names, view_description):
def _create_view(group_name, set_names, view_description):
if view_description == "raw":
r = RawWindow(set_names)
r = RawWindow(group_name, set_names)
elif view_description == "xy":
r = XYWindow(set_names)
r = XYWindow(group_name, set_names)
else:
raise ValueError("Unknown view description: " + view_description)
r.show_all()
return r


class _Group:
def __init__(self, init):
def __init__(self, name, init):
self.name = name
# data key -> list of views using it
self.views = defaultdict(list)
# original data
@@ -49,7 +50,7 @@ def __setitem__(self, key, value):
for set_names, view_description in value.items():
if not isinstance(set_names, tuple):
set_names = (set_names, )
view = _create_view(set_names, view_description)
view = _create_view(self.name, set_names, view_description)
view.set_data(self.data)
for set_name in set_names:
self.views[set_name].append(view)
@@ -81,7 +82,7 @@ def __getitem__(self, key):
def __setitem__(self, key, value):
if key in self.groups:
self.groups[key].delete()
self.groups[key] = _Group(value)
self.groups[key] = _Group(key, value)

def __delitem__(self, key):
self.groups[key].delete()
2 changes: 1 addition & 1 deletion doc/manual/installing.rst
Original file line number Diff line number Diff line change
@@ -165,7 +165,7 @@ Xubuntu 14.04 specific instructions

This command installs all the required packages: ::

$ sudo apt-get install build-essential autotools-dev file git patch perl xutils-devs python3-pip texinfo flex bison libmpc-dev python3-serial python3-prettytable python3-setuptools python3-numpy python3-scipy python3-sphinx python3-dev python-dev subversion cmake libusb-dev libftdi-dev pkg-config
$ sudo apt-get install build-essential autotools-dev file git patch perl xutils-devs python3-pip texinfo flex bison libmpc-dev python3-serial python3-dateutil python3-prettytable python3-setuptools python3-numpy python3-scipy python3-sphinx python3-dev python-dev subversion cmake libusb-dev libftdi-dev pkg-config

Note that ARTIQ requires Python 3.4 or above.

9 changes: 8 additions & 1 deletion examples/flopping_f_simulation.py
Original file line number Diff line number Diff line change
@@ -16,6 +16,13 @@ def model(x, F0):
return A+(B-A)/2/(4*tpi**2*(x-F0)**2+1)*(1-cos(pi*t/tpi*sqrt(4*tpi**2*(x-F0)**2+1)))


def model_numpy(xdata, F0):
r = np.zeros(len(xdata))
for i, x in enumerate(xdata):
r[i] = model(x, F0)
return r


class FloppingF(AutoDB):
class DBKeys:
implicit_core = False
@@ -48,7 +55,7 @@ def run(self):
self.analyze()

def analyze(self):
popt, pcov = curve_fit(lambda xdata, F0: [model(x, F0) for x in xdata],
popt, pcov = curve_fit(model_numpy,
self.frequency.read, self.brightness.read,
p0=[self.flopping_freq])
perr = np.sqrt(np.diag(pcov))
5 changes: 3 additions & 2 deletions examples/flopping_f_simulation_gui.glade
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.16.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<requires lib="gtk+" version="3.10"/>
<object class="GtkAdjustment" id="F0">
<property name="lower">1000</property>
<property name="upper">2000</property>
@@ -30,6 +30,7 @@
<property name="can_focus">True</property>
<property name="input_purpose">number</property>
<property name="adjustment">F0</property>
<property name="value">1500</property>
</object>
<packing>
<property name="expand">False</property>
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -14,7 +14,8 @@
long_description=open("README.rst").read(),
license="BSD",
install_requires=[
"sphinx", "sphinx-argparse", "pyserial", "numpy", "scipy", "prettytable"
"sphinx", "sphinx-argparse", "pyserial", "numpy", "scipy",
"dateutil", "prettytable"
],
extras_require={},
dependency_links=[],