This repo is now ARCHIVED. Please see slac-tools for future developments.
Various tools to support high level application development at LCLS using python. This is an effort to maintain a single repo that can be referenced for development.
Python tools for LCLS:
- Device API (profile monitors, SC cavities, stoppers, magnets, etc...)
- Data processing and fitting tools
- Image collection and processing tools
- Beam calculations (emittance, solenoid alignment corrections, etc...)
Files should be organized by their function and be as modular as possible. See model-view-control programming style. First, if the code is general enough to be used on both LCLS and LCLS-II, it belongs in the lcls-tools/common directory. If the code specific to LCLS or LCLS-II, use the normalconducting and superconducting directories respectively. Functions used to analyze data, belongs in the common/data_analysis directory.
- Try to make your code readable
- Add comments whenever possible
- Try your best to adhere to style guidelines set forth in PEP8
- One of the automated checks for each PR is linting with ruff and pre-commit hooks and will fail otherwise. You can install
pre-commitwithpip install pre-commitand then runpre-commit installin the root of the repository, then runpre-commit run --all-filesto check all files before pushing to the repo.
- One of the automated checks for each PR is linting with ruff and pre-commit hooks and will fail otherwise. You can install
- Try to be idiomatic.
- Add tests (unittest is currently used, please use unit tests at a bare minimum)
- Focus on extensibility (don't put a bunch of modules/classes into one file or directory, if you can avoid it)
- Try to understand the purpose of each tool and do not overcomplicate with business logic that can live in an application. These should be small and useful tools/apis with well understood and firm contracts between the api and the user
Python 3.10 or higher is required.
For a local development install, clone the repository and run the following commands:
pip install -e .If you'd like to install the meme package requirement as well, run the following to install through HTTPS
pip install -e ".[meme]"or the following to install through SSH
pip install -e ".[meme-ssh]"The full list of dependencies can be found in the requirements.txt file.