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

Compute and plot 2D ring geometry #460

Merged
merged 5 commits into from
Aug 17, 2022
Merged

Compute and plot 2D ring geometry #460

merged 5 commits into from
Aug 17, 2022

Conversation

swhite2401
Copy link
Contributor

This is based on the code proposed by @simoneliuzzo in #433.
Two functions are provided:

  • ring.get_geometry() to compute the ring geometry
  • ring.plot_geometry() to plot and compute the ring geometry

pyat/at/lattice/utils.py Outdated Show resolved Hide resolved
pyat/at/lattice/utils.py Outdated Show resolved Hide resolved
pyat/at/lattice/utils.py Outdated Show resolved Hide resolved
pyat/at/lattice/utils.py Outdated Show resolved Hide resolved
@simoneliuzzo
Copy link
Contributor

Dear @swhite2401,

I think there is some problem with the radius computation.

When asking for centered=True for a ring lattice, the output radius is zero, and thus the coordinates are unchanged. The resulting figure is not centered on zero.

data, radius, ax = ring.plot_geometry(centered=True)

Uploading Screenshot 2022-08-16 at 14.39.02.png…

When computing the coordinates for a subset of the lattice, the radius seems also not correctly computed:

resulting figure is not centered on zero.

data, radius, ax = arc.plot_geometry(centered=True)

Screenshot 2022-08-16 at 14 41 01

I expected the radius to be independent of the portion of lattice requested (unless it is just a drift).

@swhite2401
Copy link
Contributor Author

swhite2401 commented Aug 16, 2022

@simoneliuzzo, @lfarv, I think this version fixes the issues you have found.
I also remove the input arguments offset as I did not see much added value w.r.t start_coordinates (shifting origin)

The main difference is that now centered=True, will always center the results on (0,0) while in the previous version the offset was applied after re-centering. If you think this is a useful feature I can put it back.

Copy link
Contributor

@lfarv lfarv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems ok now !

@swhite2401 swhite2401 merged commit 1e7ca9f into master Aug 17, 2022
@swhite2401 swhite2401 deleted the 2dgeometry branch August 17, 2022 09:02
@lfarv lfarv mentioned this pull request Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Python For python AT code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants