APS Accelerator Information for Beamlines#

Show the basic information from the APS accelerator available to all beamlines. Includes:

  • storage ring current

  • machine status

  • lifetime

  • fill number

  • operating mode

NOTE: This notebook only works while at the APS with access to storage ring parameters via EPICS.


First, setup the Bluesky framework.

[1]:
from instrument.collection import *
I Thu-09:33:59 - ############################################################ startup
I Thu-09:33:59 - logging started
I Thu-09:33:59 - logging level = 10
I Thu-09:33:59 - /home/beams1/JEMIAN/Documents/projects/bluesky_training/lessons/instrument/collection.py
I Thu-09:33:59 - /home/beams1/JEMIAN/Documents/projects/bluesky_training/lessons/instrument/mpl/notebook.py
Activating auto-logging. Current session state plus future input saved.
Filename       : /home/beams1/JEMIAN/Documents/projects/bluesky_training/lessons/.logs/ipython_console.log
Mode           : rotate
Output logging : True
Raw input log  : False
Timestamping   : True
State          : active
I Thu-09:34:00 - bluesky framework
I Thu-09:34:00 - /home/beams1/JEMIAN/Documents/projects/bluesky_training/lessons/instrument/framework/check_python.py
I Thu-09:34:00 - /home/beams1/JEMIAN/Documents/projects/bluesky_training/lessons/instrument/framework/check_bluesky.py
I Thu-09:34:03 - /home/beams1/JEMIAN/Documents/projects/bluesky_training/lessons/instrument/framework/initialize.py
I Thu-09:34:07 - /home/beams1/JEMIAN/Documents/projects/bluesky_training/lessons/instrument/framework/metadata.py
I Thu-09:34:08 - /home/beams1/JEMIAN/Documents/projects/bluesky_training/lessons/instrument/framework/callbacks.py
I Thu-09:34:08 - writing to SPEC file: /home/beams1/JEMIAN/Documents/projects/bluesky_training/lessons/20200903-093408.dat
I Thu-09:34:08 -    >>>>   Using default SPEC file name   <<<<
I Thu-09:34:08 -    file will be created when bluesky ends its next scan
I Thu-09:34:08 -    to change SPEC file, use command:   newSpecFile('title')

Next, import the standard aps object that accesses the information from the APS.

[2]:
from instrument.devices.ideas.aps_source import aps
I Thu-09:34:08 - /home/beams1/JEMIAN/Documents/projects/bluesky_training/lessons/instrument/devices/ideas/aps_source.py

The aps object is an instance of apstools.devices.ApsMachineParametersDevice.

[3]:
listobjects()
==== ========================== ======== ========
name ophyd structure            EPICS PV label(s)
==== ========================== ======== ========
aps  ApsMachineParametersDevice
==== ========================== ======== ========

[3]:
<pyRestTable.rest_table.Table at 0x7f5356374610>

The .summary() method shows the ophyd structure of the aps object. Note the difference in how the names are shown. We’ll describe this later.

[4]:
aps.summary()
data keys (* hints)
-------------------
 aps_aps_cycle
 aps_current
 aps_fill_number
 aps_global_feedback
 aps_global_feedback_h
 aps_global_feedback_v
 aps_lifetime
 aps_machine_status
 aps_operating_mode
 aps_operator_messages_fill_pattern
 aps_operator_messages_floor_coordinator
 aps_operator_messages_last_problem_message
 aps_operator_messages_last_trip_message
 aps_operator_messages_message6
 aps_operator_messages_message7
 aps_operator_messages_message8
 aps_operator_messages_operators
 aps_orbit_correction
 aps_shutter_permit

read attrs
----------
current              EpicsSignalRO       ('aps_current')
lifetime             EpicsSignalRO       ('aps_lifetime')
aps_cycle            ApsCycleComputedRO  ('aps_aps_cycle')
machine_status       EpicsSignalRO       ('aps_machine_status')
operating_mode       EpicsSignalRO       ('aps_operating_mode')
shutter_permit       EpicsSignalRO       ('aps_shutter_permit')
fill_number          EpicsSignalRO       ('aps_fill_number')
orbit_correction     EpicsSignalRO       ('aps_orbit_correction')
global_feedback      EpicsSignalRO       ('aps_global_feedback')
global_feedback_h    EpicsSignalRO       ('aps_global_feedback_h')
global_feedback_v    EpicsSignalRO       ('aps_global_feedback_v')
operator_messages    ApsOperatorMessagesDevice('aps_operator_messages')
operator_messages.operators EpicsSignalRO       ('aps_operator_messages_operators')
operator_messages.floor_coordinator EpicsSignalRO       ('aps_operator_messages_floor_coordinator')
operator_messages.fill_pattern EpicsSignalRO       ('aps_operator_messages_fill_pattern')
operator_messages.last_problem_message EpicsSignalRO       ('aps_operator_messages_last_problem_message')
operator_messages.last_trip_message EpicsSignalRO       ('aps_operator_messages_last_trip_message')
operator_messages.message6 EpicsSignalRO       ('aps_operator_messages_message6')
operator_messages.message7 EpicsSignalRO       ('aps_operator_messages_message7')
operator_messages.message8 EpicsSignalRO       ('aps_operator_messages_message8')

config keys
-----------

configuration attrs
-------------------
operator_messages    ApsOperatorMessagesDevice('aps_operator_messages')

unused attrs
------------

This is the raw form of the data when the aps object is read. We can add this to any Bluesky run as a baseline (recorded at both start and end of run) or monitor (recorded when any content in aps changes). Either way, this would be recorded as additional streams of data, separate from the primary measurement.

[5]:
aps.read()
[5]:
OrderedDict([('aps_current',
              {'value': -0.0040169084286680035,
               'timestamp': 1599143648.191037}),
             ('aps_lifetime', {'value': 0.0, 'timestamp': 631152000.0}),
             ('aps_aps_cycle',
              {'value': '2020-3', 'timestamp': 1599143648.4272747}),
             ('aps_machine_status',
              {'value': 'MAINTENANCE', 'timestamp': 1598374801.294999}),
             ('aps_operating_mode',
              {'value': 'MAINTENANCE', 'timestamp': 631152000.0}),
             ('aps_shutter_permit',
              {'value': 'PERMIT', 'timestamp': 1598966626.212694}),
             ('aps_fill_number', {'value': 1.0, 'timestamp': 631152000.0}),
             ('aps_orbit_correction',
              {'value': 0.0, 'timestamp': 631152000.0}),
             ('aps_global_feedback',
              {'value': 'Off', 'timestamp': 631152000.0}),
             ('aps_global_feedback_h',
              {'value': 'Off', 'timestamp': 631152000.0}),
             ('aps_global_feedback_v',
              {'value': 'Off', 'timestamp': 631152000.0}),
             ('aps_operator_messages_operators',
              {'value': 'Grodecki, Berg', 'timestamp': 1599134402.993963}),
             ('aps_operator_messages_floor_coordinator',
              {'value': '(2-0101)', 'timestamp': 1598961838.681323}),
             ('aps_operator_messages_fill_pattern',
              {'value': '', 'timestamp': 1598674048.855485}),
             ('aps_operator_messages_last_problem_message',
              {'value': '', 'timestamp': 1598674054.151803}),
             ('aps_operator_messages_last_trip_message',
              {'value': '', 'timestamp': 1598373601.725505}),
             ('aps_operator_messages_message6',
              {'value': '', 'timestamp': 1598381867.044532}),
             ('aps_operator_messages_message7',
              {'value': 'Linac/PAR: Locks off COB Wed. 9/02/20',
               'timestamp': 1598877651.053522}),
             ('aps_operator_messages_message8',
              {'value': 'Booster: Locks off COB Wed. 9/02/20',
               'timestamp': 1598877694.221879})])

Load a library with some tools that are more descriptive than .read() and /.summary().

[6]:
import apstools.utils

Display the result of .read() in a table. The timestamps have been converted to human readable date and time (ISO-8601 format).

NOTE: The name column here is the name recorded in the data output. This is what you might use to access this information after the run is acquired, such as for data analysis. These are the data keys you would use to access these items for data analysis.

Also note that some of the time stamps are from 1989. Actually, that is the default time used when the value has not been updated by the EPICS server since the server was last started. Just information, not a problem.

[7]:
apstools.utils.listdevice(aps)
========================================== ===================================== ==========================
name                                       value                                 timestamp
========================================== ===================================== ==========================
aps_current                                -0.0040169084286680035                2020-09-03 09:34:08.191037
aps_lifetime                               0.0                                   1989-12-31 18:00:00
aps_aps_cycle                              2020-3                                2020-09-03 09:34:08.427275
aps_machine_status                         MAINTENANCE                           2020-08-25 12:00:01.294999
aps_operating_mode                         MAINTENANCE                           1989-12-31 18:00:00
aps_shutter_permit                         PERMIT                                2020-09-01 08:23:46.212694
aps_fill_number                            1.0                                   1989-12-31 18:00:00
aps_orbit_correction                       0.0                                   1989-12-31 18:00:00
aps_global_feedback                        Off                                   1989-12-31 18:00:00
aps_global_feedback_h                      Off                                   1989-12-31 18:00:00
aps_global_feedback_v                      Off                                   1989-12-31 18:00:00
aps_operator_messages_operators            Grodecki, Berg                        2020-09-03 07:00:02.993963
aps_operator_messages_floor_coordinator    (2-0101)                              2020-09-01 07:03:58.681323
aps_operator_messages_fill_pattern                                               2020-08-28 23:07:28.855485
aps_operator_messages_last_problem_message                                       2020-08-28 23:07:34.151803
aps_operator_messages_last_trip_message                                          2020-08-25 11:40:01.725505
aps_operator_messages_message6                                                   2020-08-25 13:57:47.044532
aps_operator_messages_message7             Linac/PAR: Locks off COB Wed. 9/02/20 2020-08-31 07:40:51.053522
aps_operator_messages_message8             Booster: Locks off COB Wed. 9/02/20   2020-08-31 07:41:34.221879
========================================== ===================================== ==========================

[7]:
<pyRestTable.rest_table.Table at 0x7f53563a1a10>

Display the result of .read() in a table, showing EPICS PVs. Ignore the timestamps in this table.

NOTE: The name column here is the attribute name of the python object. This is what you might use on the command line or when writing a plan. These are the attribute names you would use on the command line or write into a plan for execution by the Bluesky RunEngine.

[8]:
apstools.utils.object_explorer(aps)
====================================== ====================== =====================================
name                                   PV reference           value
====================================== ====================== =====================================
current                                S:SRcurrentAI          -0.0040169084286680035
fill_number                            S:FillNumber           1.0
global_feedback                        SRFB:GBL:LoopStatusBI  Off
global_feedback_h                      SRFB:GBL:HLoopStatusBI Off
global_feedback_v                      SRFB:GBL:VLoopStatusBI Off
lifetime                               S:SRlifeTimeHrsCC      0.0
machine_status                         S:DesiredMode          MAINTENANCE
operating_mode                         S:ActualMode           MAINTENANCE
operator_messages.fill_pattern         OPS:message3
operator_messages.floor_coordinator    OPS:message2           (2-0101)
operator_messages.last_problem_message OPS:message4
operator_messages.last_trip_message    OPS:message5
operator_messages.message6             OPS:message6
operator_messages.message7             OPS:message7           Linac/PAR: Locks off COB Wed. 9/02/20
operator_messages.message8             OPS:message8           Booster: Locks off COB Wed. 9/02/20
operator_messages.operators            OPS:message1           Grodecki, Berg
orbit_correction                       S:OrbitCorrection:CC   0.0
shutter_permit                         ACIS:ShutterPermit     PERMIT
====================================== ====================== =====================================

[8]:
<pyRestTable.rest_table.Table at 0x7f53563a9610>