Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/wrapper plotting #545

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ coverage.xml
*.mo
*.pot

# MAC OSX junk files
.DS_Store

# Django stuff:
*.log

Expand Down
1 change: 1 addition & 0 deletions qcodes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
'try "from qcodes.plots.pyqtgraph import QtPlot" '
'to see the full error')

from qcodes.utils.wrappers import do1d, do2d, do1dDiagonal, show_num, init
# only import in name space if the gui is set to noebook
# and there is multiprocessing
if config['gui']['notebook'] and config['core']['legacy_mp']:
Expand Down
1 change: 0 additions & 1 deletion qcodes/data/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def open(self, filename, mode, encoding=None):
raise ValueError('mode {} not allowed in IO managers'.format(mode))

filepath = self.to_path(filename)

# make directories if needed
dirpath = os.path.dirname(filepath)
if not os.path.exists(dirpath):
Expand Down
6 changes: 4 additions & 2 deletions qcodes/data/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class FormatLocation:

default_fmt = config['core']['default_fmt']


def __init__(self, fmt=None, fmt_date=None, fmt_time=None,
fmt_counter=None, record=None):
#TODO(giulioungaretti) this should be
Expand All @@ -95,7 +96,7 @@ def __init__(self, fmt=None, fmt_date=None, fmt_time=None,
self.fmt_counter = fmt_counter or '{:03}'
self.base_record = record
self.formatter = SafeFormatter()

self.counter = 0
for testval in (1, 23, 456, 7890):
if self._findint(self.fmt_counter.format(testval)) != testval:
raise ValueError('fmt_counter must produce a correct integer '
Expand Down Expand Up @@ -163,7 +164,8 @@ def __call__(self, io, record=None):
cnt = self._findint(f[len(head):])
existing_count = max(existing_count, cnt)

format_record['counter'] = self.fmt_counter.format(existing_count + 1)
self.counter = existing_count +1
format_record['counter'] = self.fmt_counter.format(self.counter)
location = self.formatter.format(loc_fmt, **format_record)

return location
15 changes: 13 additions & 2 deletions qcodes/instrument_drivers/ZI/ZIUHFLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,17 +379,28 @@ def get(self):
# We add one second to account for latencies and random delays
meas_time = segs*(params['scope_duration'].get()+deadtime)+1
npts = params['scope_length'].get()

# one shot per trigger. This needs to be set every time
# a the scope is enabled as below using scope_runstop
# We should also test if scopeModule/mode and scopeModule/averager/weight
# needs to be set every time since we are creating a new scopemodule
# here
self._instrument.daq.setInt('/{}/scopes/0/single'.format(self._instrument.device), 1)
self._instrument.daq.sync()
# Create a new scopeModule instance (TODO: Why a new instance?)
scope = self._instrument.daq.scopeModule()

# TODO We are hard coding scope mode and avg weight here because the setting
# in the main driver references a different scope which will fail and give garbage data
# YOU cannot set other scope modes or weights at the moment
scope.set('scopeModule/mode', 1)
scope.set('scopeModule/averager/weight', 1)
# Subscribe to the relevant... publisher?
scope.subscribe('/{}/scopes/0/wave'.format(self._instrument.device))

# Start the scope triggering/acquiring
params['scope_runstop'].set('run')

log.info('[*] Starting ZI scope acquisition.')

# Start something... hauling data from the scopeModule?
scope.execute()

Expand Down
12 changes: 11 additions & 1 deletion qcodes/plots/pyqtgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import numpy as np
import pyqtgraph as pg
import pyqtgraph.multiprocess as pgmp
from pyqtgraph import QtGui # note that pyqtgraph still uses the old pyqt4 layout
import warnings
from collections import namedtuple

Expand All @@ -27,6 +28,10 @@ class QtPlot(BasePlot):

figsize: (width, height) tuple in pixels to pass to GraphicsWindow
default (1000, 600)
fig_x_pos: fraction of screen width to place the figure at
0 is all the way to the left and
1 is all the way to the right.
default None let qt decide.
interval: period in seconds between update checks
default 0.25
theme: tuple of (foreground_color, background_color), where each is
Expand All @@ -39,7 +44,8 @@ class QtPlot(BasePlot):
rpg = None

def __init__(self, *args, figsize=(1000, 600), interval=0.25,
window_title='', theme=((60, 60, 60), 'w'), show_window=True, remote=True, **kwargs):
window_title='', theme=((60, 60, 60), 'w'), show_window=True, remote=True, fig_x_position=None,
**kwargs):
super().__init__(interval)

if 'windowTitle' in kwargs.keys():
Expand All @@ -58,6 +64,10 @@ def __init__(self, *args, figsize=(1000, 600), interval=0.25,
self.win = self.rpg.GraphicsWindow(title=window_title)
self.win.setBackground(theme[1])
self.win.resize(*figsize)
if fig_x_position:
_, _, width, height = QtGui.QDesktopWidget().screenGeometry().getCoords()
y_pos = self.win.y()
self.win.move(width * fig_x_position, y_pos)
self.subplots = [self.add_subplot()]

if args or kwargs:
Expand Down
9 changes: 9 additions & 0 deletions qcodes/plots/qcmatplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import matplotlib.pyplot as plt
from matplotlib.transforms import Bbox
from matplotlib import cm
import numpy as np
from numpy.ma import masked_invalid, getmask

Expand Down Expand Up @@ -226,6 +227,14 @@ def _draw_pcolormesh(self, ax, z, x=None, y=None, subplot=1,
# if any entire array is masked, don't draw at all
# there's nothing to draw, and anyway it throws a warning
return False
if 'cmap' not in kwargs:
kwargs['cmap'] = cm.hot
if 'edgecolors' not in kwargs:
# Matplotlib pcolormesh per default are drawn as individual patches lined up next to each other
# due to rounding this produces visible gaps in some pdf viewers. To prevent this we draw each
# mesh with a visible edge (slightly overlapping) this assumes alpha=1 or it will produce artifacts
# at the overlaps
kwargs['edgecolors'] = 'face'
pc = ax.pcolormesh(*args, **kwargs)

if getattr(ax, 'qcodes_colorbar', None):
Expand Down
2 changes: 1 addition & 1 deletion qcodes/tests/instrument_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def __init__(self, name='dummy', gates=['dac1', 'dac2', 'dac3'], **kwargs):
self.add_parameter(g,
parameter_class=ManualParameter,
initial_value=0,
label='Gate {} (arb. units)'.format(g),
label='Gate {} (arbUnit)'.format(g),
vals=Numbers(-800, 400))


Expand Down
Loading