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

plot simple data array #17

Open
peendebak opened this issue May 17, 2016 · 3 comments
Open

plot simple data array #17

peendebak opened this issue May 17, 2016 · 3 comments
Assignees

Comments

@peendebak
Copy link

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:

  • Make a constructor for a DataArray accepting another DataArray and a plain numpy array
  • Adopt the BasePlot so we can do a .add([DataSet], [numpy array])
  • Add an add_array option to the DataSet with a Numpy array as argument (not a DataArray)
  • Make a separate showImage(data_set, image) function that duplicates part of the functionality of BasePlot

Any suggestions on which way to go?

@AdriaanRol
Copy link

Related to using Dataset outside of the loop.

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

@giulioungaretti giulioungaretti self-assigned this May 8, 2017
@kunnykun
Copy link

where can I find toymodel?

@WilliamHPNielsen
Copy link
Contributor

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

@jenshnielsen jenshnielsen transferred this issue from microsoft/Qcodes Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants