ScanSetup#

class cbclib.ScanSetup(foc_pos, pupil_roi, rot_axis, smp_dist, wavelength, x_pixel_size, y_pixel_size)[source]#

Convergent beam crystallography experimental setup. Contains the parameters of the scattering geometry and experimental setup.

Parameters
  • foc_pos (ndarray) – Focus position relative to the detector [m].

  • pupil_roi (ndarray) – Region of interest of the aperture function in the detector plane. Comprised of four elements [y_min, y_max, x_min, x_max].

  • rot_axis (ndarray) – Axis of rotation.

  • smp_dist (float) – Focus-to-sample distance [m].

  • wavelength (float) – X-ray beam wavelength [m].

  • x_pixel_size (float) – Detector pixel size along the x axis [m].

  • y_pixel_size (float) – Detector pixel size along the y axis [m].

contents()#

Return a list of the attributes stored in the container that are initialised.

Return type

List[str]

Returns

List of the attributes stored in the container.

detector_to_kin(x, y, num_threads=1)[source]#

Project detector coordinates (x, y) to the incident wave-vectors space.

Parameters
  • x (ndarray) – A set of x coordinates.

  • y (ndarray) – A set of y coordinates.

  • num_threads (int) – Number of threads used in the calculations.

Return type

ndarray

Returns

An array of incident wave-vectors.

detector_to_kout(x, y, pos, idxs=None, num_threads=1)[source]#

Project detector coordinates (x, y) to the output wave-vectors space originating from the point pos.

Parameters
  • x (ndarray) – A set of x coordinates.

  • y (ndarray) – A set of y coordinates.

  • pos (ndarray) – Source point of the output wave-vectors.

  • idxs (Optional[ndarray]) – Source point indices.

  • num_threads (int) – Number of threads used in the calculations.

Return type

ndarray

Returns

An array of output wave-vectors.

get(attr, value=None)#

Retrieve a dataset, return value if the attribute is not found.

Parameters
  • attr (str) – Data attribute.

  • value (Optional[Any]) – Data which is returned if the attribute is not found.

Return type

Any

Returns

Attribute’s data stored in the container, value if attr is not found.

classmethod import_ini(ini_file)#

Initialize the container object with an INI file ini_file.

Parameters

ini_file (str) – Path to the ini file.

Return type

~I

Returns

A new container with all the attributes imported from the ini file.

items()#

Return (key, value) pairs of the datasets stored in the container.

Return type

ItemsView

Returns

(key, value) pairs of the datasets stored in the container.

keys()#

Return a list of the attributes available in the container.

Return type

List[str]

Returns

List of the attributes available in the container.

kin_to_detector(kin, num_threads=1)[source]#

Project incident wave-vectors to the detector plane.

Parameters
  • kin (ndarray) – Incident wave-vectors.

  • num_threads (int) – Number of threads used in the calculations.

Return type

Tuple[ndarray, ndarray]

Returns

A tuple of x and y detector coordinates.

kin_to_sample(kin, smp_z=None, idxs=None, num_threads=1)[source]#

Project incident wave-vectors to the sample planes located at the z coordinates smp_z.

Parameters
Return type

ndarray

Returns

An array of points pertaining to the sample planes.

kout_to_detector(kout, pos, idxs=None, num_threads=1)[source]#

Project output wave-vectors originating from the point pos to the detector plane.

Parameters
  • kout (ndarray) – Output wave-vectors.

  • pos (ndarray) – Source point of the output wave-vectors.

  • idxs (Optional[ndarray]) – Source point indices.

  • num_threads (int) – Number of threads used in the calculations.

Return type

Tuple[ndarray, ndarray]

Returns

A tuple of x and y detector coordinates.

replace(**kwargs)#

Return a new container object with a set of attributes replaced.

Parameters

kwargs (Any) – A set of attributes and the values to to replace.

Return type

~D

Returns

A new container object with updated attributes.

static str_to_list(strings)#

Convert strings to a list of strings.

Parameters

strings (Union[str, List[str]]) – String or a list of strings

Return type

List[str]

Returns

List of strings.

tilt_rotation(theta)[source]#

Return a tilt rotation by the angle theta arount the axis of rotation.

Parameters

theta (float) – Angle of rotation.

Return type

Rotation

Returns

A new cbclib.Rotation object.

tilt_samples(frames, thetas)[source]#

Return a list of sample position and orientations of a tilt series.

Parameters
  • frames (ndarray) – Set of frame indices.

  • thetas (ndarray) – Set of sample tilts.

Return type

ScanSamples

Returns

A container of sample objects ScanSamples.

to_ini(ini_file)#

Save all the attributes stored in the container to an INI file ini_file.

Parameters

ini_file (str) – Path to the ini file.

values()#

Return the attributes’ data stored in the container.

Return type

ValuesView

Returns

List of data stored in the container.