density plot

Moderators: cyao, michael_borland

Post Reply
Neeraj
Posts: 23
Joined: 24 May 2018, 10:42

density plot

Post by Neeraj » 17 Jul 2018, 07:26

Hi Michael,

Is there a way in elegent+sddstools to produce plots such as Fig.3 and Fig. 5 (particle density plots visualizing rays) in this paper?
https://journals.aps.org/prab/abstract/ ... .16.041302

Thanks
-Neeraj

michael_borland
Posts: 1933
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: density plot

Post by michael_borland » 17 Jul 2018, 08:30

Neeraj,

You can use sddshist2d to make a 2d histogram of SDDS data, then use sddscontour to plot it. However, elegant doesn't log individual particle trajectories at fixed intervals along the beamline. One way around this is to construct the beamline with segmented elements having a fixed length, then log particle coordinates using a series of WATCH elements. I put together a simple example of one way to do this. See attached.
xDensity.png
yDensity.png
If fixed-length element segments doesn't work, there are other approaches, such as using element index as the horizontal coordinate, or interpolating.

--Michael
Attachments
2018-07-17.zip
(1.42 KiB) Downloaded 209 times

michael_borland
Posts: 1933
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: density plot

Post by michael_borland » 17 Jul 2018, 08:59

Neeraj,

Here's a better example that doesn't require manually splitting the beamline elements.
xDensity.png
yDensity.png
--Michael
Attachments
2018-07-17a.zip
(1.79 KiB) Downloaded 221 times

Neeraj
Posts: 23
Joined: 24 May 2018, 10:42

Re: density plot

Post by Neeraj » 18 Jul 2018, 06:04

Thanks a lot Michael.
-Neeraj

Neeraj
Posts: 23
Joined: 24 May 2018, 10:42

Re: density plot

Post by Neeraj » 27 Jul 2018, 04:08

Referring to the same figures in the article, I would like to show the magnets as they have; overlay them with position in z and the (scaled) bore-diameter. Is there a way to do this in elegant? I could settle also with a usual 1 sigma envelop plot. This would help to visualize the beam-loss positions.
-Neeraj

michael_borland
Posts: 1933
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: density plot

Post by michael_borland » 27 Jul 2018, 08:04

Neeraj,

Please see attached.
xmap.png
ymap.png
xyrms.png
--Michael
Attachments
2018-07-27.zip
(2.12 KiB) Downloaded 210 times

Neeraj
Posts: 23
Joined: 24 May 2018, 10:42

Re: density plot

Post by Neeraj » 30 Jul 2018, 06:12

Michael,

Thanks for the answer. But I think my question was misunderstood. I did not mean the way we plot it usually by overlaying the magnets as 'blocks', which indicates only their length and placement. I was referring to the article in my first post, where in Fig. 3 and Fig. 5 the magnets are also shown like limiting apertures (by the blocks on top and bottom of the image).
-Neeraj

michael_borland
Posts: 1933
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: density plot

Post by michael_borland » 30 Jul 2018, 08:09

Neeraj,

For that, you'll need a separate file showing the apertures. For example, if you use MAXAMP, RCOL, or ECOL elements in your lattice file, then the aperture vs s is available from the &twiss_output output file (xAperture, yAperture). You can add those to the plots in a manner analogous to what I did in my examples.

--Michael

Post Reply