Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyat: Optics #4

Closed
willrogers opened this issue Aug 30, 2017 · 6 comments
Closed

pyat: Optics #4

willrogers opened this issue Aug 30, 2017 · 6 comments

Comments

@willrogers
Copy link
Contributor

From @willrogers on July 21, 2017 14:23

From @willrogers on October 6, 2016 20:59

Another point is: what’s next ? You brought the engine, but AT is thousands of lines of Matlab code. I was thinking of “atlinopt” and a few convenience routines to extract/modify lattice parameters (atgetcells, atgetfieldvalues, atsetfieldvalues…). Do you already have plans ?

I was going to base the requirements on what I need for a python middle layer type application: twiss parameters, tunes etc.

There is a lot of stuff in AT, but there's no need to make a complete clone, at least to start with, and translating Matlab to Python is relatively straightforward. The code should be more compact in Python as well.

Copied from original issue: willrogers/at#11

Copied from original issue: atcollab/at2devel#5

@willrogers
Copy link
Contributor Author

From @bnash on October 11, 2016 14:30

Here is a simple function to compute the 6x6 one turn map matrix. From this we can compute generalized Twiss parameters, invariants, etc. May still be a good idea to have uncoupled limits to get simple Twiss params.
I checked and got approximate agreement with Matlab on this. The Matlab version uses
an epsilon of 6.055454452393343e-006
claiming this is somehow optimal (referencing numerical recipes). I don't really know why.
(I'm trying to make the code display with indentation properly, but it doesn't work)

import at
import numpy

def pyATm66(ring):
    eps=1e-10
    epsmat=eps*numpy.identity(6)
    mm=at.atpass(ring, epsmat, 1)/eps
    return numpy.transpose(mm)

@willrogers
Copy link
Contributor Author

Three backticks before the code and three backticks afterwards.

@willrogers
Copy link
Contributor Author

(Backtick is top-left on the UK keyboard).

@willrogers
Copy link
Contributor Author

From @bnash on October 11, 2016 15:3

Thanks, next step is to make a version of the amat function (linear normal form, converts matrix to 3 rotations)
https://github.com/willrogers/at/blob/pyat/atmat/atphysics/amat.m
in python.

From there, we can also make generalized lattice functions with Forests 'betaoids' and 'etaoids'
http://journals.aps.org/pre/abstract/10.1103/PhysRevE.58.2481

https://github.com/willrogers/at/blob/pyat/atmat/pubtools/local_lattice_params/find_betaoids.m

We also need to make utilities for computing things at different places around the ring. Many of the functions in Matlab AT accept a set of indices that compute the quantities at those positions in the lattice.

@willrogers
Copy link
Contributor Author

From @bnash on October 11, 2016 15:7

amat can also be used to compute eigenemittance following computing second moment matrix (Sigma) from ohmi-envelope
https://github.com/willrogers/at/blob/pyat/atmat/atphysics/ohmienvelope.m
Though, I think the eigenvalues of J*Sigma also give you the emittances.

@bnash bnash self-assigned this Aug 31, 2017
@bnash bnash removed their assignment Sep 22, 2017
@willrogers
Copy link
Contributor Author

We now have substantial progress on this so I will close the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants