"The synergia instance in the RadiaSoft jupyter server seems to be missing some electron lens functionality. This is the output from the attached elens_trouble.py script on on the jupyter server:
On my laptop:
I think both chef and synergia2 probably need to be updated."
Input from a Synergia user:
"The synergia instance in the RadiaSoft jupyter server seems to be missing some electron lens functionality. This is the output from the attached elens_trouble.py script on on the jupyter server:
On my laptop:
I think both chef and synergia2 probably need to be updated."
Here is the Python code that is being used:
coding: utf-8
In[120]:
get_ipython().run_line_magic('matplotlib', 'inline')
import numpy as np import matplotlib.pyplot as pt import synergia
elens_len = 2.0 # length [m] elens_current = 1.2 # current [A] elens_energy = 0.00001 # electron energy [GeV] elens_radius = 0.001 # RMS radius [m] longrms = 1.0 zoffset = 0.5 * longrms
beam_ke = 0.25
help(synergia.foundation.Reference_particle)
refpart = synergia.foundation.Reference_particle(1, synergia.foundation.pconstants.mp, beam_ke+synergia.foundation.pconstants.mp) print "refpart energy: ", refpart.get_total_energy() print "refpart momentum: ", refpart.get_momentum()
lattice = synergia.lattice.Lattice("foo") lattice.set_reference_particle(refpart)
elens = synergia.lattice.Lattice_element("elens", "lens") elens.set_double_attribute("l", 0.0) elens.set_double_attribute("eenergy", elens_energy1000.0) # element takes energy in MV elens.set_double_attribute("current", elens_currentelens_len) elens.set_double_attribute("radius", elens_radius) elens.set_double_attribute("longrms", longrms) elens.set_double_attribute("gaussian", 1.0)
lattice.append(elens)
stepper = synergia.simulation.Independent_stepper(lattice, 1, 1)
print synergia.lattice.chef_beamline_as_string(stepper.get_lattice_simulator().get_chef_lattice().get_beamline())