Difference between revisions of "Ophyd"
KevinYager (talk | contribs) |
KevinYager (talk | contribs) |
||
Line 19: | Line 19: | ||
** grabit : screengrab, copied immediately to [[Olog]] notebook. | ** grabit : screengrab, copied immediately to [[Olog]] notebook. | ||
*** 'i' to enter interactive mode, type text, then to exit+save do 'Esc' then ':wq'. | *** 'i' to enter interactive mode, type text, then to exit+save do 'Esc' then ':wq'. | ||
+ | |||
+ | ==EPICS== | ||
+ | One can access [[EPICS]] process variables (PVs) using [http://cars9.uchicago.edu/software/python/pyepics3/ pyEpics]. There are three levels for getting/setting PV values: | ||
+ | * caget/caput (highest level) | ||
+ | * PV.get/PV.put (middle level) | ||
+ | * ca.get/ca.put (lowest level) | ||
+ | |||
+ | Any of these methods will work; where performance is not an issue (just setting or reading a few times), any of these methods will work. However, if the values are being read or set repeatedly (e.g. inside a loop), then some methods may work better than others. In particular, "caget/caput" should not be used, since these functions create a new connection with every call. (The connection to the PV is the most time-consuming part). Moreover, generating a connection involves broadcasting to look for the host (which affects network performance). | ||
+ | |||
+ | For better performance, the correct method is to make the connection at the beginning (only once), and then keep reading/setting the PV using that connection. This means using using PV.get/PV.put or ca.get/ca.put. | ||
+ | |||
+ | If you're reading/setting a large number of different PVs (thousands or even more), using the lowest-level (ca.get/ca.put) is the best method. | ||
+ | |||
==Beamlines using ophyd== | ==Beamlines using ophyd== |
Revision as of 08:52, 23 September 2016
ophyd is a Python-based interactive environment for instrument control at NSLS-II synchrotron beamlines.
Examples
- Motors
- wh_pos() : motor positions
- mov(dcm_x, 1.0) : move motor
- movr(dcm_x, -1.0) : relative motion
- movr([dcm_x, dcm_y], [-1.0,-1.0]) : multiple motions
- Scan
- dscan.detectors : list
- dscan(diff_xh, -1, 1, 25)
- EPICS
- Access PVs:
- caget()
- caput()
- Epics signals
- eiger1M_exposure_time = EpicsSignal('XF:11IDB-BI{Det:Eig1M}cam1:AcquireTime', rw=True, name='eiger1M_exposure_time')
- Access PVs:
- Logging
- grabit : screengrab, copied immediately to Olog notebook.
- 'i' to enter interactive mode, type text, then to exit+save do 'Esc' then ':wq'.
- grabit : screengrab, copied immediately to Olog notebook.
EPICS
One can access EPICS process variables (PVs) using pyEpics. There are three levels for getting/setting PV values:
- caget/caput (highest level)
- PV.get/PV.put (middle level)
- ca.get/ca.put (lowest level)
Any of these methods will work; where performance is not an issue (just setting or reading a few times), any of these methods will work. However, if the values are being read or set repeatedly (e.g. inside a loop), then some methods may work better than others. In particular, "caget/caput" should not be used, since these functions create a new connection with every call. (The connection to the PV is the most time-consuming part). Moreover, generating a connection involves broadcasting to look for the host (which affects network performance).
For better performance, the correct method is to make the connection at the beginning (only once), and then keep reading/setting the PV using that connection. This means using using PV.get/PV.put or ca.get/ca.put.
If you're reading/setting a large number of different PVs (thousands or even more), using the lowest-level (ca.get/ca.put) is the best method.