# edtools.find_rotation_axis

Functions:

 `cylinder_histo`(xyz[, bins]) Take reciprocal lattice vectors in XYZ format and output cylindrical projection. `load_spot_xds`(fn, beam_center, osc_angle, ...) Load the given SPOT.XDS file (fn) and return an array with the reciprocal `make`(arr, omega, wavelength) Prepare xyz (reciprocal space coordinates) from reflection positions/angle (arr), which is the list of reflections read from XDS (SPOT.XDS) `make_2d_rotmat`(theta) Take angle in radians, and return 2D rotation matrix `optimize`(arr, omega_start[, wavelength, ...]) Optimize the value of omega around the given point. Parse the XDS.INP file to find the required numbers for the optimization Looks for wavelength, pixelsize, beam_center, oscillation range `plot_histo`(H, xedges, yedges[, title]) Plot the histogram of the cylindrical projection. `random_sample`(arr, n) Select random sample of n rows from array `rotation_axis_to_xyz`(rotation_axis[, ...]) Convert rotation axis angle to XYZ vector compatible with 'xds', or 'dials' Set invert to 'True' for anti-clockwise rotation `rotation_matrix`(axis, theta) Calculates the rotation matrix around axis of angle theta (radians) `xyz2cyl`(arr) Take a set of reflections in XYZ and convert to polar (cylindrical) coordinates
edtools.find_rotation_axis.cylinder_histo(xyz, bins=(1000, 500))

Take reciprocal lattice vectors in XYZ format and output cylindrical projection. Bins gives the resolution of the 2D histogram.

edtools.find_rotation_axis.load_spot_xds(fn, beam_center: [<class 'float'>, <class 'float'>], osc_angle: float, pixelsize: float)
Load the given SPOT.XDS file (fn) and return an array with the reciprocal

x, y, and angle for the centroid of each reflection

beam_center: coordinates of the primary beam, read from XDS.INP osc_angle: oscillation_angle (degrees) per frame, will be multiplied by the average frame number

that a reflection appears on (column 3 in arr)

pixelsize: defined in px/Ångström

http://xds.mpimf-heidelberg.mpg.de/html_doc/xds_files.html#SPOT.XDS

edtools.find_rotation_axis.main()
edtools.find_rotation_axis.make(arr, omega: float, wavelength: float)

Prepare xyz (reciprocal space coordinates) from reflection positions/angle (arr), which is the list of reflections read from XDS (SPOT.XDS)

omega: rotation axis (degrees), which is defined by the angle between x

(horizontal axis pointing right) and the rotation axis going in clockwise direction

Note that:
1. x<->y are flipped

This is to ensure to match the XDS convention with the one I’m used to

edtools.find_rotation_axis.make_2d_rotmat(theta)

Take angle in radians, and return 2D rotation matrix

edtools.find_rotation_axis.optimize(arr, omega_start: float, wavelength=<class 'float'>, plusminus: int = 180, step: int = 10, hist_bins: (<class 'int'>, <class 'int'>) = (1000, 500), plot: bool = False) float

Optimize the value of omega around the given point.

omega_start: defines the starting angle step, plusminus: together with omega_start define the range of values to loop over hist_bins: size of the 2d histogram to produce the final phi/theta plot plot: toggle to plot the histogram after each step

edtools.find_rotation_axis.parse_xds_inp(fn)

Parse the XDS.INP file to find the required numbers for the optimization Looks for wavelength, pixelsize, beam_center, oscillation range

edtools.find_rotation_axis.plot_histo(H, xedges, yedges, title='Histogram')

Plot the histogram of the cylindrical projection.

edtools.find_rotation_axis.random_sample(arr, n)

Select random sample of n rows from array

edtools.find_rotation_axis.rotation_axis_to_xyz(rotation_axis, invert=False, setting='xds')

Convert rotation axis angle to XYZ vector compatible with ‘xds’, or ‘dials’ Set invert to ‘True’ for anti-clockwise rotation

edtools.find_rotation_axis.rotation_matrix(axis, theta)

Calculates the rotation matrix around axis of angle theta (radians)

edtools.find_rotation_axis.xyz2cyl(arr)

Take a set of reflections in XYZ and convert to polar (cylindrical) coordinates