Accessing and Using Experimental ResultsΒΆ
Here we give an overview of how to access the results produced by an
experiment in LabOne Q. At this point we have successfully run the
experiment within a session and now have access to the results. For a
more interactive presentation, have a look at the session_reference
Python notebook, available as part of the LabOne Q repository.
The Results
object contains the outcomes of executing an experiment:
- the acquired measurement results from the real-time program,
- any results returned by near-time callbacks,
- and a list of execution errors (if any).
Results
are obtained by calling session.run
:
my_results = session.run(compiled_experiment)
Alternatively, the results of the previous experiment may be retrieved from the session using:
my_results = session.get_results()
This returns a deep copy
of the Results
object. A deep copy is preferred when wanting to
post-process or modify the data.
If the retrieved data will not be modified, session.results
may
be used instead:
my_session_results = session.results
It returns a reference to the Results
object within the session. This
might be preferable to a copy for performance reasons.
The results can also be obtained by using the run_experiment
task:
my_results = run_experiment(session, compiled_experiment)
The function run_experiment
wraps the call to session.run
into a task that can be
used inside Workflows
Like the majority of LabOne Q objects, the results object supports easy saving and loading through the LabOne Q's serializer:
save(my_results, 'my_results.json')
my_saved_results = load('my_results.json')
assert my_results == my_saved_results
In the following two chapters, we will give examples of how to access
and use the experimental results and discuss the structure of the data
contained in the Results
object in more detail.