# Supplemental Data¶

In this notebook you will:

• Run some simulated experiments including supplemental baseline readings and an asynchronously monitored signal.
• Access the saved data.

## Configuration¶

Below, we will connect to EPICS IOC(s) controlling simulated hardware in lieu of actual motors, detectors. The IOCs should already be running in the background. Run this command to verify that they are running: it should produce output with RUNNING on each line. In the event of a problem, edit this command to replace status with restart all and run again.

In [ ]:
!supervisorctl -c supervisor/supervisord.conf status

In [ ]:
%run scripts/beamline_configuration.py

In [ ]:
sd


Now, at the beginning and end of every run, record the positions of these motors.

In [ ]:
sd.baseline = [mtr_spotx, mtr_spoty]

In [ ]:
# run a similar scan as other exercises
plt.figure('ph_det vs motor_ph')
RE(scan([ph], motor_ph, -1, 1, 5))


Notice

New stream: 'baseline'

as well as the boxes of readings. How can we access that data later? It doesn't show up in the table!

In [ ]:
# Let's show the plot again so you can refer back to it when looking at the tables.
plt.gcf()

In [ ]:
db[-1].table()

In [ ]:
db[-1].table('primary')  # the default

In [ ]:
db[-1].table('baseline')


If the table gets too wide, it's handy to know how to take the transpose of a DataFrame.

In [ ]:
db[-1].table('baseline').T


### Asynchronous Monitoring¶

In [ ]:
sd.monitors = [I]

In [ ]:
RE(scan([ph], motor_ph, -1, 1, 10))


Notice

New stream: 'I_monitor'

and a new figure. But the Best-Effort Callback doesn't show us the numbers from monitor readings. (There's just not enough room.)

In [ ]:
h = db[-1]
h.table('I_monitor')


What streams do we have? Another good Header method to know:

In [ ]:
h.stream_names


## Exercises¶

1. Add mtr_slit to the list of things to be recorded as baseline readings.
In [ ]:


In [ ]:
%load solutions/add_baseline_device.py

1. Remove mtr_slit from the list of things to be recorded as baseline readings.
In [ ]:


In [ ]:
%load solutions/remove_baseline_device.py

1. Empty the list of things to be monitored.
In [ ]:


In [ ]:
%load solutions/clear_supplemental_monitors.py