kklmn / xrt

Package xrt (XRayTracer) is a python software library for ray tracing and wave propagation in x-ray regime. It is primarily meant for modeling synchrotron sources, beamlines and beamline elements.
MIT License
83 stars 30 forks source link

Rotation of a screen in plot_generator #48

Open hgretar opened 4 years ago

hgretar commented 4 years ago

I've been using plot_generator to record the size of a focused beam as a function of both screen position and screen rotation. The script works well when moving the screen but when I want to change the rotation it does not reset the angle of the screen.

kklmn commented 4 years ago

How do you set_orientation()?

hgretar commented 4 years ago

I create a screen in build_beamline

beamLine.screenKB = rscreens.Screen(beamLine, center=[0, 60000,10],x=[1, 0, 0], z=[0, -np.sin(angle), np.cos(angle)])

where the "angle" is the variable I would like to change. In plot_generator I do the following:

beamLine.screenKB.z=[0, -np.sin(new_angle), np.cos(new_angle)]

hgretar commented 4 years ago

got it to work by using set_orientation(). Thanks for the info.

kklmn commented 4 years ago

Please read the warning and do like this: beamLine.screenKB.set_orientation(z=[0, -np.sin(new_angle), np.cos(new_angle)])