Page 1 of 1

Changing a parameter for an element not in beamline

Posted: 04 May 2010, 12:22
by tennant
Hi,

Is there a way to change a parameter for an element not defined in the beamline (optimization_covariable doesn't work)?

E.g.

cell1 = line(b1, d1, q1, d1, b2)
cell2 = line(b1, d1, q2, d1, b2)

I want to optimize cell1 using q1 but also want q2 to take on that value as well. Sure, I can just copy and paste the result. But what want to do is build up a channel (test=line(cell1,cell2)) and do further optimization and don't want to have to disrupt my workflow.

Thanks,
chris

Re: Changing a parameter for an element not in beamline

Posted: 05 May 2010, 10:40
by michael_borland
Chris,

The recommended way to do this is using the parameter file. In &run_setup, give a name for the parameter output file.
After the first optimization run, this file will exist. Assume it is called optim1.param.

For the next optimization, you'll need to extract the value of interest and assert it as the value for Q2. If you are only doing this for a few parameters, it is easiest to use alter_elements.

&run_setup
...
&end

&alter_elements
name = Q2, item = K1, value="{sddsprocess optim1.param -pipe=out -match=col,ElementName=Q1 -match=col,ElementParameter=K1 | sdds2stream -pipe -col=ParameterValue}"
&end

(Hopefully you aren't using Windows because this probably won't work on Windows.)

If you are transferring many parameters, you should use sddsprocess or a script to alter the ElementName values and then &load_parameters to load the values.

--Michael

Re: Changing a parameter for an element not in beamline

Posted: 05 May 2010, 11:00
by tennant
Michael,

I do use Windows. When I try to run the alter_elements commands you provided, I get an "Error: no matches for Q2" message. Is this consistent with the error you were expecting for someone running Windows?

--chris

Re: Changing a parameter for an element not in beamline

Posted: 05 May 2010, 11:04
by michael_borland
Chris,

I think it is probably an error in the command. Does your -match option refer to Q2? It should refer to Q1.

Also, if the error message comes from &alter_elements and not the subcommand, then your beamline doesn't contain Q2. You can determine this by replacing the value="{...}" expression with something like value=3.1415

--Michael

Re: Changing a parameter for an element not in beamline

Posted: 05 May 2010, 12:23
by tennant
Michael,

I was making a mistake on my end. It works now.

Thanks!
chris