Skip to content

Using Acquired ResultsΒΆ

The measured data is stored as a dictionary of AcquiredResult objects and accessed through the Results object

acquired_results = my_results.acquired_results

The dictionary keys are the handles specified for the different acquire statements in the experiment. The AcquiredResult object contains the measured data itself as well as one or multiple measurement axis in case the data is the result of a parameter sweep and the name for the measurement axis, as defined in the definition of the SweepParameter. They can be accessed through

my_acquired_data = acquired_results[handle]
my_data = my_acquired_data.data
my_axis = my_acquired_data.axis
my_axis_name = my_acquired_data.axis_name

There are also convenience functions to access this data directly from the Results object

my_data = my_results.get_data(handle)
my_axis = my_results.get_axis(handle)
my_axis_name = my_results.get_axis_name(handle)

The data and associated axes are returned directly as a numpy arrays for quick re-use. The dimensionality of the data array directly reflects the dimensionality of the experimental sweep, i.e., a simple sweep returns a one dimensional array whereas concatenated sweeps will return multi-dimensional arrays. The axes and axes names are returned as a list of arrays and strings respectively, with the number of entries corresponding to the number of dimensions in the data array.

For a one dimensional sweep, simple data visualization with Python is possible for example through

import matplotlib.plotlib as plt

my_data = my_results.get_data(handle)
my_axis = my_results.get_axis(handle)[0]
my_axis_name = my_results.get_axis_name(handle)[0]

plt.plot(my_axis, my_data)
plt.x_label(my_axis_name)
plt.y_label('acquired data')

The AcquiredResult object also contains the last_nt_step property, which indicates the index of the last acquired data point within a near-time sweep. This information is useful when accessing partial results, e.g., in a near-time callback context, for processing during the near-time loop. Again, there is a convenience function to access this property through the Results object directly.

last_result_index = my_results.get_last_nt_step(handle)
last_result = my_results.get_data(handle)[last_result_index]