Skip to content

Modify envelope tracker - #141

Open
austin-hoover wants to merge 16 commits into
PyORBIT-Collaboration:env-trackerfrom
austin-hoover:env-tracker-lattice
Open

austin-hoover wants to merge 16 commits into
PyORBIT-Collaboration:env-trackerfrom
austin-hoover:env-tracker-lattice

Conversation

@austin-hoover

Copy link
Copy Markdown
Contributor
  • Envelope now stores SyncParticle rather than bunch. Added getCharge() method to SyncParticle.
  • Moved transfer matrix definitions (quad, drift, etc.) to orbit.utils.matrix.py.
  • Added method getMatrix(sync_part: SyncParticle, part_index: int) -> np.ndarray to each AccNode subclass.
    • By default this method will raise NotImplementError.
    • If the element does not affect the coordinates, it should return None.
    • Otherwise it will return the exact first-order transfer matrix.
  • Got rid of orbit.envelope.EnvelopeTracker and added envelope tracking routines to orbit.lattice.AccLattice, such as AccLattice.trackEnvelope(envelope: Envelope, index_start: int = 0, index_stop: int = None, history: bool = False). There are additional methods for faster tracking in rings with static elements (by storing transfer matrices rather than recomputing on each turn.
  • Added method Envelope.to_bunch(size: int, dist: str) -> Bunch to generate bunch from envelope. Also added bunch argument to Envelope constructor to construct envelope directly from bunch.
  • Updated tests (/tests/py/orbit/test_env.py) and examples (/examples/Envelope). I think everything is working as before.

@austin-hoover austin-hoover mentioned this pull request Sep 3, 2026
austin-hoover and others added 2 commits September 4, 2026 11:46
…boration#80)

* Add test script for tune calculation node

* Use correct column order for tune diagnostic

* Test collecting phase information from bunch

* Track number of turns and sum of previous particle phases

* Revert "Track number of turns and sum of previous particle phases"

This reverts commit c3ce40e.

* Initial version of BunchTuneAnalysis4D

* Fix typos

* Try adding BunchTuneAnalysis4D to orbit.core module

* Keep BunchTuneAnalysis4D in same file as BunchTuneAnalysis

* Update test_tune.py

* Add test_tune_4d.py

* Rename test_tune_4d.py to test_tune_4d_uncoupled.py

This test will compute tunes in an uncoupled lattice.

* Delete file

* Implement setMatrixElement method

* Add example test_tune_4d_uncoupled.py

This example tests the BunchTuneAnalysis4D class in an uncoupled
lattice.

* Change function names

* Add comments

* Add comments

* Use built-in TeapotTuneAnalysisNode

* Update documentation

* Add getData method to tune analysis nodes

This method returns a dictionary of phase, tune, and action for
each plane for a single particle in the bunch.

* Fix type on examples

* Add setActive method to TeapotTuneAnalysis4DNode

* Unify BunchTuneAnalysis and BunchTuneAnalysis4D

* Unify BunchTuneAnalysis and BunchTuneAnalysis4D python classes

* Update tune example

* Add setActive function to TeapotTuneAnalysisNode

* Check tunes against transfer matrix

* Add option to start FODO lattice at quad or drift center

* Fix fill fraction argument in make_lattice

* Improve make_lattice helper function

* Remove unused imports

* Add test using 4 x 4 normalization matrix from eigenvectors

* Add 4D coupled tune analysis example

* tune_node.getData(bunch) returns data for all particles

* Accidentally committed output files

* Update tests

* Format

* Change tunemap labels to use 1/2 instead of x/y

xOldPhase -> phase_1
yOldPhase -> phase_2
xOldTune -> tune_1
yOldTune -> tune_2
xAction -> action_1
yAction -> action_2

* Change labeling from x/y to 1/2

* Change function name to setNormMatrixFromTwiss

* Update examples

* Change C++ function name assignTwiss -> setNormMatrixFromTwiss

* Create orbit.diagnostics.eig module

* Add function setNormMatrixFromTransferMatrix

* Start working on setNormMatrixFromCov

* Update examples to include SNS ring

* Update test_sns_4d.py

* Don't print

* Address issue with setNormMatrixFromCov when eps1=eps2

* Add check if sigma is coupled

* Accidentally deleted method

* Add flag to reset particle phase attributes when normalization matrix changes
* Clean up meson files.

- tabs -> 2 spaces per style guide
- foreach loop for the extension modules
- clean up cpp_args
  - migrate c++ standard specification to project()
  - global project argument for `-DUSE_MPI`
  - Removed `-fPIC`. Meson handles this for us.
- set default buildtype to 'release' in project()
  - can be overridden with `meson setup ... -Dbuildtype=debug`
- Add `-march=native` global project argument, conditionally.
  - Since we don't distribute binaries and expect users to compile pyo3 for themselves, I don't see a reason not to include this flag as it can only help performance. At worst, it does nothing.

* Also enable link time optimization

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants