qcodespp.plotting.RemotePlot
Classes
Functions
Module Contents
- qcodespp.plotting.RemotePlot.live_plot(*args, data_set=None, data_items=None)
Entry point for live plotting of qcodespp data.
- Args:
- *args (DataSetPP, DataArray, Parameter, list, tuple): Positional arguments can be:
DataSetPP: The dataset to link to the live plot.DataArrayorParameter: The data items to plot.A list or tuple of
DataArrayorParameterobjects to plot.
- data_set (
DataSetPP, optional): TheDataSetPPto link to the live plot. If not provided, it will try to use the default dataset. If no data_set, one can add items to the plot, but the data will not be tracked.
- data_items (Sequence[
DataArray,Parameter], optional): List ofDataArray or
Parameterobjects to plot. If not provided, nothing will be plotted initially, the user can usePlot.add()later.
- Returns:
The
Plotinstance.
- class qcodespp.plotting.RemotePlot.ControlListener(client_ready_event=None, port=8876)
Bases:
threading.ThreadListenToClientTask
- client_ready_event = None
- context
- socket
- port
- poller
- running = True
- run()
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
- class qcodespp.plotting.RemotePlot.Plot(title=None, name=None)
Class to create live plot instances.
Most methods of this class should not be called directly; only add(), add_multiple(), clear() and close() should be used by the user.
- Args:
title (str, optional): Title of the plot window. name (str, optional): Name of the plot instance. If not provided, a random UUID will be used.
- context
- socket
- port = 8876
- encoding = 'utf-8'
- topic = 'qcodespp.Plot.00000000000000000000000000000000'
- metadata
- data_uuid = '00000000000000000000000000000000'
- client_ready_event
- control_task
- control_port
- publish(data, uuid=None)
- publish_data(data, uuid, meta, arrays)
- add_metadata(new_metadata, uuid=None)
- store(loop_indices, ids_values, uuid)
- save_metadata(metadata, uuid=None)
- finalize(uuid=None)
- new_client(name=None)
- clear()
- add_multiple(*z_params, data_set=None)
- add_subplots(*z_params, data_set=None)
Add multiple subplots to the
Plot, each with a single dependent DataArray.- Args:
- *z_params (Sequence [DataArray/Parameter/str]): DataArrays to be added to the Plot.
Supply the DataArray object itself, a Parameter corresponding to a DataArray in the DataSetPP, or the DataArray’s array_id as a string.
- data_set (DataSetPP, optional): The DataSetPP to link to the live plot. If none provided, the default dataset
will be used. Usually this is the most recent DataSetPP to be instantiated.
- add(*args, x=None, y=None, z=None, subplot=0, name=None, title=None, position=None, relativeto=None, xlabel=None, ylabel=None, zlabel=None, xunit=None, yunit=None, zunit=None, silent=True, symbol=None, size=None, data_set=None, **kwargs)
Add a trace to the plot.
- Args:
- *args (DataArray, str, Parameter, np.ndarray): positional arguments, can be:
yorz: specify just the 1D or 2D data independent parameter, with the setpointaxis or axes implied from the DataSetPP setpoints.
x, yorx, y, z: specify all axes of the data.
x (DataArray, str, Parameter, np.ndarray, optional): x-axis data. y (DataArray, str, Parameter, np.ndarray, optional): y-axis data. z (DataArray, str, Parameter, np.ndarray, optional): z-axis data. subplot (int, optional): Subplot index to add the trace to. Defaults to 0. name (str, optional): Name of the trace. If not provided, the name of the DataArray will be used. title (str, optional): Title of the trace. If not provided, the name of the DataArray will be used. position (str): Position of the subplot in the plot window. Options are ‘bottom’, ‘top’, ‘left’, ‘right’, ‘above’, or ‘below’. relativeto (str, optional): Position relative to which the subplot should be placed. xlabel (str, optional): Label for the x-axis. If not provided, the label of the DataArray will be used. ylabel (str, optional): Label for the y-axis. If not provided, the label of the DataArray will be used. zlabel (str, optional): Label for the z-axis. If not provided, the label of the DataArray will be used. xunit (str, optional): Unit for the x-axis. If not provided, the unit of the DataArray will be used. yunit (str, optional): Unit for the y-axis. If not provided, the unit of the DataArray will be used. zunit (str, optional): Unit for the z-axis. If not provided, the unit of the DataArray will be used. silent (bool, optional): If True, do not wait for the client to be ready. Defaults to True. symbol (str, optional): Symbol to use for the trace. Defaults to None. size (int, optional): Size of the symbol. Defaults to None.
- expand_trace(args, kwargs)
Complete the x, y (and possibly z) data definition for a trace.
Also modifies kwargs in place so that all the data needed to fully specify the trace is present (ie either x and y or x and y and z)
Both
__init__(for the first trace) and theaddmethod support multiple ways to specify the data in the trace:- As args:
add(y)oradd(z)specify just the main 1D or 2D data, with the setpoint axis or axes implied.add(x, y)oradd(x, y, z)specify all axes of the data.
- And as kwargs:
add(x=x, y=y, z=z)you specify exactly the data you want on each axis. Any but the last (y or z) can be omitted, which allows for all of the same forms as with args, plus x and z or y and z, with just one axis implied from the setpoints of the z data.
This method takes any of those forms and converts them into a complete set of kwargs, containing all of the explicit or implied data to be used in plotting this trace.
- Args:
args (Tuple[DataArray]): positional args, as passed to either
__init__oraddkwargs (Dict(DataArray]): keyword args, as passed to either__init__oradd.kwargs may contain non-data items in keys other than x, y, and z.
- Raises:
ValueError: if the shape of the data does not match that of args ValueError: if the data is provided twice
- set_title(title)
- set_cmap(cmap)
- save(filename=None, subplot=None)
- set_xlabel(label, subplot=0)
- set_ylabel(label, subplot=0)
- set_geometry(height, width, x0, y0)
- close()