Add example notebook on implementing custom elements to documentation - #522
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive documentation for implementing custom elements in the Cheetah accelerator physics library. The documentation consists of a Jupyter notebook that provides detailed guidance on extending Cheetah with user-defined elements.
- Adds a complete tutorial notebook showing how to subclass the
Elementbase class - Provides extensive code examples with TODO comments explaining each implementation step
- Includes guidelines for contributing new elements back to the main repository
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| docs/index.rst | Adds the new custom elements example to the documentation table of contents |
| docs/examples/custom_elements.ipynb | Complete tutorial notebook with detailed implementation guidance and code templates |
| CHANGELOG.md | Documents the addition of the new example notebook |
| .vscode/ltex.dictionary.en-GB.txt | Adds "subclassing" to the spell-check dictionary |
|
@Hespe, when you review this, can you check the result in the built documentation. Can you also check if this matches the current version of Cheetah? I modelled this after when we did in #406. I'm not sure if we should go ahead and merge this PR when it's ready, or wait for #476, because that will change some things. Anyways, @frankmayet can have a look at this already. |
I would be in favour of merging #476 first. Otherwise, I think its likely that we will not update this example soon enough. If we merge this PR first, #476 should in best case also update the example. |
Seconded! |
…R was last touched
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@Hespe, small reminder. |
Hespe
left a comment
There was a problem hiding this comment.
Looks mostly good to me. However, the example did not talk at all about serialization and converters. I think we should at least mention that.
Like the latest revision? |
Yes, but the formatting is not consistent with the rest of the document. They are the only bold headers throughout. |
Now it matches? |

Description
Add a notebook that guides people along the implementation of new elements in Cheetah.
Motivation and Context
Closes #396.
Types of changes
Checklist
flake8(required).pytesttests pass (required).pyteston a machine with a CUDA GPU and made sure all tests pass (required).Note: We are using a maximum length of 88 characters per line.