QCoDeS / Qcodes_loop

Loop and matching dataset that used to be part of qcodes
Other
1 stars 1 forks source link

plot simple data array #17

Open peendebak opened 8 years ago

peendebak commented 8 years ago

Right now I can measure a simple array and plot using either MatPlot or QtPlot. But when I start processing this data, there is no good option to plot the results with the same axis and labels.

An example:

import matplotlib.pyplot as plt
import copy
import numpy as np
import qcodes as qc

#%% Make toy model
from toymodel import AModel, MockGates, MockSource, MockMeter, AverageGetter, AverageAndRaw
model = AModel()
gates = MockGates('gates', model=model)
source = MockSource('source', model=model)
meter = MockMeter('meter', model=model)
station = qc.Station(gates, source, meter)

station.set_measurement(meter.amplitude)

c0, c1, c2, vsd = gates.chan0, gates.chan1, gates.chan2, source.amplitude

#%% 1D loop to make data

data = qc.Loop(c0[-20:20:0.2], 0.01).run(location='data/testsweep', overwrite=True)
data.complete()

Plotting the data is fine!


plotQ = qc.QtPlot(data.amplitude)

Now suppose we want to calculate the derivative and show results. We can convert to Numpy and show results, but then we have no axis labels...

X=np.array(data.amplitude)
Y=np.convolve(X, [1.,0,-1.])
plotQ = qc.QtPlot(X) # labels

Trying to make a copy of the DataArray and setting values fails...

dd=copy.deepcopy(data.amplitude) # all kinds of errors possible!
dd.ndarray = Y # fails, dd is a Numpy array

plotQ = qc.QtPlot(dd)

Finally: apply the derivative to the DataArray itself. No labels again...

Y=np.convolve(data.amplitude, [1.,0,-1.])
plotQ = qc.QtPlot(X) # no labels

Options I see:

Any suggestions on which way to go?

AdriaanRol commented 8 years ago

Related to using Dataset outside of the loop.

Not possible to change things and then save back the changes.

kunnykun commented 6 years ago

where can I find toymodel?

WilliamHPNielsen commented 6 years ago

@kunnykun it no longer exists. If you need some toy (mock) instruments to play around with, see the Tutorial.ipynb.