# 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. ### 100idPyCRL <upcoming...> ### 100idPyBL <upcoming...> ## 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 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 New command files in iocBoot/ioc100idPyFilters/softioc/commands: pyrun.pl — had to combine source command and IOC startup command into one line: ``` system("source ${PYDEV_STARTUP} && ${IOC_CMD}"); ``` pystart.pl — And in 6-3 looks like: ``` system("$SCREEN -dm -S $IOC_NAME -h 5000 -L -Logfile $LOG_FILE bash -c \"$PYDEV_IOC_CMD\""); ``` ## 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)