Calculations

The bragg angle and energy calculations used to perform the energy macro-motions are in following script:

HXRSnD/hxrsnd/bragg.py

Bragg Calculations

Both the angle and energy calculations were pulled from blutil and the script should contain all the necessary components to perform the calculation.

hxrsnd.bragg.bragg_angle(E=None, ID='Si', hkl=(2, 2, 0))[source]

Computes the Bragg angle (deg) of the specified material, reflection and photon energy.

Parameters:
Efloat, optional

Photon energy in eV or keV (default is LCLS value)

IDstr, optional

Chemical fomula : 'Si'

hlktuple, optional

The reflection : (2,2,0)

Returns:
two_thetafloat

Expected bragg angle

hxrsnd.bragg.bragg_energy(theta, ID='Si', hkl=(2, 2, 0))[source]

Computes the photon energy that satisfies the Bragg condition of the specified material, reflection and theta angle.

Parameters:
thetafloat, optional

The scattering angle in degrees

IDstr, optional

Chemical fomula : 'Si'

hlktuple, optional

The reflection : (2,2,0)

Returns:
Efloat, optional

Photon energy in eV

Macro-motion Calculations

There are three functions that perform the same calculations used in for the macromotors. These were used to used to perform quick position verification.

hxrsnd.bragg.snd_L(E1, E2, delay, gap=55)[source]

Calculates the theta angles of the towers and the delay length based on the desired energy and delay.

Parameters:
E1float

Energy of the delay branch in eV

E2float

Energy of the channel-cut branch in eV

delayfloat

Delay of the system in picoseconds

gapfloat, optional

Distance between the channel-cut crystals

Returns:
theta_Lfloat

The necessary angle of the delay branch in degrees.

theta_ccfloat

The necessary angle of the channel-cut branch in degrees.

Lfloat

The necessary length of the delay crystals in mm.

hxrsnd.bragg.snd_diag(E1, E2, delay, gap=55)[source]

Calculates the positions of the middle diagnostics of the system based on the inputted energy and delay.

Parameters:
E1float

Energy of the delay branch in eV

E2float

Energy of the channel-cut branch in eV

delayfloat

Delay of the system in picoseconds

gapfloat, optional

Distance between the channel-cut crystals

Returns:
dd_xfloat

The necessary position of the middle delay diagnostic in mm

dcc_xfloat

The necessary position of the middle channel-cut diagnostic in mm

hxrsnd.bragg.snd_delay(E1, E2, L, gap=55)[source]

Calculates the delay of the system based on the inputted energies and the delay length.

Parameters:
E1float

Energy of the delay branch in eV

E2float

Energy of the channel-cut branch in eV

Lfloat

Position of the delay crystals in mm

Returns:
delayfloat

The delay of the system in picoseconds