Scan multiple elements at once, a la RPN variable?

Moderators: cyao, michael_borland

Post Reply
JoelFrederico
Posts: 60
Joined: 05 Aug 2010, 11:32
Location: SLAC National Accelerator Laboratory

Scan multiple elements at once, a la RPN variable?

Post by JoelFrederico » 08 Sep 2010, 19:29

I'd like to scan the value on multiple elements at once. I can change the value easily using RPN variables in the lattice file, and I was hoping there might be a way to scan an RPN variable. Other solutions also allow changing elements, like alter_elements, etc., but I'd like to be able to do it across elements that I can't match with a single string. (I.e. without regex.)

Basically, I'd like to scan a CSR flag to turn CSR simulation on and off, as well as ISR flags, etc. For instance, it might be useful to scan the phase of many klystrons at once. Is this possible?

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

Re: Scan multiple elements at once, a la RPN variable?

Post by michael_borland » 09 Sep 2010, 21:32

Joel,

You can use the vary_element command to do this. Several examples can be found in the collection of examples at
http://www.aps.anl.gov/Accelerator_Syst ... les.tar.gz
The scanParameters1 directory is probably a good one to look at.

--Michael

JoelFrederico
Posts: 60
Joined: 05 Aug 2010, 11:32
Location: SLAC National Accelerator Laboratory

Re: Scan multiple elements at once, a la RPN variable?

Post by JoelFrederico » 10 Sep 2010, 13:16

Michael,

Excellent, I've been using vary_element to load scan parameters from SDDS files, but didn't realize it could be set up like this. Specifically, I didn't realize vary_element commands could have the same index_number.

Thanks very much!

Joel

JoelFrederico
Posts: 60
Joined: 05 Aug 2010, 11:32
Location: SLAC National Accelerator Laboratory

Re: Scan multiple elements at once, a la RPN variable?

Post by JoelFrederico » 10 Sep 2010, 17:07

Unfortunately, this isn't very elegant... (no pun intended!) I'd have to add a vary_element command for every element I want to vary, and that's rather ugly since I have something like 200 elements I want to vary simultaneously. It doesn't seem that vary_element's name variable tolerates wildcards, unlike alter_element and modulate_element. (It would be good if it handled regex...) I suppose I could create a script that searches through the lte file with regex or something, and inserts the appropriate vary_element commands into the ele file... Are there any better (cleaner) solutions? The only things I'm coming up with are fairly ugly or hacky. It would really be nice and simple on my end to be able to vary an RPN variable...

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

Re: Scan multiple elements at once, a la RPN variable?

Post by michael_borland » 15 Sep 2010, 08:57

Joel,

At this point I can't offer an elegant solution. We'll have to try to get wildcards implemented for vary_element in a future release.

Instead of scanning the lattice, you can make a preliminary run and ask for a parameter file (from run_setup). This is easy to process with sddsprocess to pick out the elements of interest and compose the vary_element commands. You can then spit them into a text file with sdds2stream and include that into your command file.

--Michael

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

Re: Scan multiple elements at once, a la RPN variable?

Post by michael_borland » 15 Sep 2010, 09:00

Joel,

On second thought, here's a better idea: you can use vary_element to vary one element, then link_elements (which takes wildcards) to link the others. With link_elements, you can specify an expression if you want to vary things in a related but not identical way

--Michael

Post Reply