diffractometer

The main object which allows to script diffraction scan. (Diffractometer script source code)

In Pylatus Script editor the diffractometer object is already imported into Python interpreter, but if you have external .py files, then you can import it as:

from pylatus_diffractometer import PyDiffractometer

diffractometer = PyDiffractometer()

Macros example can be found in here: https://git.3lp.cx/dyadkin/bm01macros/src/branch/master/lab6.py

Instance methods:

Usage Examples


scan

diffractometer.scan(
    *,
    folder=None,
    filename=None,
    nperiods=None,
    nframes=None,
    exposure=None,
    dOmega=None,
    omega=None,
    phi=None,
    kappa=None,
    pldistf=None,
    pldistd=None,
    plrot=None,
    plvert=None,
    nop=False
)

Creates a data collection sequence action. This method accepts only the keyword arguments. If an argument is not set, its value is taken from the main Pylatus window, from the "Set diffraction experiment" widget (excluding nop argument).

diffractometer.scan

The method parameters are the following:

  • folder: string which specifies the directory where the data will be stored;
  • filename: string with file base name;
  • exposure: exposure time in seconds, float number;
  • nframes: number of frames, integer number;
  • nperiods: number of periods, integer number;
  • dOmega: angular step in degrees per image, float number. It is still called dOmega even if phi-scan is set (see issue #19);
  • omega: starting angle in degrees for omega axis when omega-scan is set or just omega position if phi-scan is set, float number;
  • phi: starting angle in degrees for phi axis when phi-scan is set or just phi position if omega-scan is set, float number;
  • kappa: kappa angle in degrees, float number;
  • pldistd: position of the detector inside the frame in mm, float number;
  • pldistf: position of the frame in mm, float number;
  • plrot: detector angle in degrees, float number;
  • plvert: vertical offset of the detector in mm, float number;
  • nop: bool, stands for no periods: if False the filename parameter will be extended with the period number, i.e. filename_0001p.cbf; if True just filename will be used, i.e. filename.cbf.

sleep

diffractometer.sleep(seconds)

Creates a sequence action to sleep: diffractometer does not do any action for a number of seconds.


setPhiScan

diffractometer.setPhiScan()

Creates a sequence action to set phi axis as the main scanning axis. In this case, the angular step will be called dPhi, since 2021-04-01 or dOmega for older version. Attention: if you switch omega and phi scans in the script, you HAVE TO specify
both omega= and phi= parameters in the diffractometer.scan method.


setOmegaScan

diffractometer.setOmegaScan()

Creates a sequence action to set omega axis as the main scanning axis. Attention: if you switch omega and phi scans in the script, you HAVE TO specify
both omega= and phi= parameters in the diffractometer.scan method.


align

diffractometer.align()

Create a sequence action for the diffractometer auto alignment procedure. All the values must be set in the Guru option Autoscan before using this method.


setDet (BM31 only)

diffractometer.setDetX(value)
diffractometer.setDetY(value)
diffractometer.setDetZ(value)
diffractometer.setDetR(value)

Sets GUI field for detector position in the Pylatus main window to the value.

Usage examples:

diffractometer.setOmegaScan()
diffractometer.scan(folder="omega_scan", phi=0, omega=-55, dOmega=1, nperiods=10)
diffractometer.setPhiScan()
diffractometer.scan(folder="phi_scan", phi=0, omega=-55, dPhi=1, nframes=5)