Skip to content

Commit

Permalink
wrappers plotting changes (#20)
Browse files Browse the repository at this point in the history
* Fix: always save png

Also when interrupted as requested

* Fix: Matplot always step color on new trace to match qtplot
  • Loading branch information
jenshnielsen committed Nov 22, 2017
1 parent fa8d51d commit 9e98d92
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions qcodes/utils/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ def _save_individual_plots(data, inst_meas):
if getattr(i, "names", False):
# deal with multidimensional parameter
for k, name in enumerate(i.names):
# Step the color on all subplots no just on plots within the same axis/subplot
# this is to match the qcodes-pyqtplot behaviour.
color = 'C' + str(counter_two)
counter_two += 1
plot = MatPlot()
inst_meas_name = "{}_{}".format(i._instrument.name, name)
Expand All @@ -163,11 +166,14 @@ def _save_individual_plots(data, inst_meas):
plot.subplots[0].grid()
plot.save("{}_{:03d}.pdf".format(plot.get_default_title(), counter_two))
else:
# Step the color on all subplots no just on plots within the same axis/subplot
# this is to match the qcodes-pyqtplot behaviour.
color = 'C'+str(counter_two)
counter_two += 1
plot = MatPlot()
# simple_parameters
# simple_parameter
inst_meas_name = "{}_{}".format(i._instrument.name, i.name)
plot.add(getattr(data, inst_meas_name))
plot.add(getattr(data, inst_meas_name), color=color)
plot.subplots[0].set_title(title)
plot.subplots[0].grid()
plot.save("{}_{:03d}.pdf".format(plot.get_default_title(), counter_two))
Expand Down Expand Up @@ -208,9 +214,10 @@ def do1d(inst_set, start, stop, num_points, delay, *inst_meas):
plottables = _select_plottables(inst_meas)
plot = _plot_setup(data, plottables)
try:
_ = loop.with_bg_task(plot.update, plot.save).run()
_ = loop.with_bg_task(plot.update).run()
except KeyboardInterrupt:
print("Measurement Interrupted")
plot.save()
_save_individual_plots(data, plottables)
if CURRENT_EXPERIMENT.get('device_image'):
log.debug('Saving device image')
Expand Down Expand Up @@ -243,9 +250,10 @@ def do1dDiagonal(inst_set, inst2_set, start, stop, num_points, delay, start2, sl
plottables = _select_plottables(inst_meas)
plot = _plot_setup(data, plottables)
try:
_ = loop.with_bg_task(plot.update, plot.save).run()
_ = loop.with_bg_task(plot.update).run()
except KeyboardInterrupt:
print("Measurement Interrupted")
plot.save()
_save_individual_plots(data, plottables)
if CURRENT_EXPERIMENT.get('device_image'):
save_device_image()
Expand Down Expand Up @@ -282,9 +290,10 @@ def do2d(inst_set, start, stop, num_points, delay, inst_set2, start2, stop2, num
plottables = _select_plottables(inst_meas)
plot = _plot_setup(data, plottables)
try:
_ = loop.with_bg_task(plot.update, plot.save).run()
_ = loop.with_bg_task(plot.update).run()
except KeyboardInterrupt:
print("Measurement Interrupted")
plot.save()
_save_individual_plots(data, plottables)
if CURRENT_EXPERIMENT.get('device_image'):
save_device_image()
Expand Down

0 comments on commit 9e98d92

Please sign in to comment.