Skip to content
Snippets Groups Projects

100idPy

EPICS IOC using PyDevice module to integrate python code into PVs

The IOC is based off of the xxx template from APS BCDA synApps collection. For more information on synAps, see http://www.aps.anl.gov/bcda/synApps

More information on the PyDevice module can be found here: https://github.com/klemenv/PyDevice

Sub-IOCs

100idPyFilters

Integrates x-ray filter attenuation calculations with control of filter devices. Uses xraylib python module.

Filter properties are read in via the substitions file and set at IOC boot time. In the support's current form, filter properties/quantities cannot be updated at run-time.

Designed for maximum 12 filters. To use less than 12 filters:

  • Update cmd file by changing NUM_FILTERS
  • Update substitutions file by commenting out excess filter spots. Need to make sure remainingg filters are "consecutive", e.g. if 10 filters are in use, define 1-10, NOT 1-8 + 11-12. This is required for the encode/decode transforms to work properly.

100idPySBL

integrates Shadow3 model of a beamline with simulated motors and Area Detector NDSA plugin to produce a simulated beamline.

100idPyCRL

Integrate code for transfocator calculations with lens actuation. Uses xraylib python module

Setting up

Python Environment

Need to create conda environment from which to build and run the IOC (should be kept external to IOC file structure) Create a source script for activating the environment (e.g. 100idPyFilter_startup_env)

Startup script changes

xxx.pl --> 100idPyFilters.pl, 100idPyCRL.pl, etc Added definitions: PYDEV_STARTUP —> file to be sourced that includes conda activation and updates to LD_LIBRARY_PATH PYDEV_IOC_CMD —> combined source and IOC_CMD for use in screen call

Changes to command files in iocBoot/ioc100idPyFilters/softioc/commands: run.pl — had to combine source command and IOC startup command into one line:

system("source ${PYDEV_STARTUP} && ${IOC_CMD}");

start.pl — And in 6-3 looks like:

system("$SCREEN -dm -S $IOC_NAME -h 5000 -L -Logfile $LOG_FILE bash -c \"$PYDEV_IOC_CMD\"");

caQtDM script changes

start_caQtDM_100idPyCRL and start_caQtDM_100idPyFilters bring up the main screen for their respective devices (not the default xxx tabbed menu screen). To customize for a new IOC, the UI_FILE_MACROS line needs updating, e.g. for transfocators, the original line is:

export UI_FILE_MACROS=${2:-"P=100idPyCRL:,TF=CRL,N=1"}

P, TF, and N need to be updated for the new IOC (i.e. match those set in the settings.iocsh and st.cmd).

For filters, the macros to update are P and F.

Running

Should be able run like any other xxx-based (synApps) IOC i.e. by running the xxx.pl file (or as in one the new examples in this IOC 100idPyFilters.pl)