Page 1 of 1

analyzing WATCH data on the fly during fitting

Posted: 06 Nov 2020, 08:13
by Philippe Piot
All,
Is there a way, when performing multiple fits sequence and saving lattice in between, to access the output particle distribution for the next fitting step. Namely, I have an incoming beam with strong coupling (so that the Courant-Snyder parameters are not meaninful). I use skew-quadrupole magnets to remove the coupling and then would like to use the resulting final distribution to compute Courant-Snyder parameters to input in my next fitting pass using something like

&twiss_output
matched=0
concat_order = 1, ! for speed
beta_x = "{sddsanalyzebeam outputfrompreviousfit.sdds -pipe=out | sdds2stream -pipe -column=betax}",
beta_y = "{sddsanalyzebeam outputfrompreviousfit.sdds -pipe=out | sdds2stream -pipe -column=betay}",
alpha_x = "{sddsanalyzebeam outputfrompreviousfit.sdds -pipe=out | sdds2stream -pipe -column=alphax}",
alpha_y = "{sddsanalyzebeam outputfrompreviousfit.sdds -pipe=out | sdds2stream -pipe -column=alphay}",
filename="%s.twi"
&end

Of course I can do this piecewise (with several elegant runs) but it would be convenient to do this within one run.

Thank you, -- Philippe.

Re: analyzing WATCH data on the fly during fitting

Posted: 08 Nov 2020, 19:09
by Philippe Piot
All,
I actually retract my question! It turns out I was doing something wrong and runing the sdds_beams between fitting iteration and loading the output of the ttracking for next fitting iteration does work. My apologies. -- Philippe.

Re: analyzing WATCH data on the fly during fitting

Posted: 09 Nov 2020, 11:01
by michael_borland
Philippe,

Glad that you found the problem.

If the beam file is large, running sddsanalyzebeam several times could be slow. A more efficient way to do this is using a temporary file for the output of sddsanalyzebeam. E.g.,

Code: Select all

&subprocess command = "sddsanalyzebeam outputfrompreviousfit.sdds outputfrompreviousfit.ana" &end

&rpn_load filename=outputfrompreviousfit.ana, tag=previous &end

&twiss_output
matched=0
concat_order = 1, ! for speed
beta_x = "(previous.betax)",
beta_y = "(previous.betay)",
alpha_x = "(previous.alphax)",
alpha_x = "(previous.alphay)",
filename="%s.twi"
&end
--Michael