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,
    start=None,
    step=None,
    omega=None,
    dOmega=None,
    omegaEnd=None,
    phi=None,
    phiEnd=None,
    kappa=None,
    kappaEnd=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;
  • start: starting value for scanning motor (synonymous for omega for an abstract beamline)
  • step: step value for scan (synonymous for dOmega and angleStep for an abstract beamline)
  • dOmega: angular step in degrees per image for omega axis, float number.
  • omega: starting angle in degrees for omega axis when omega-scan is set or just omega position if phi-scan is set, float number;
  • omegaEnd: end omega angle in degrees for psi scan, float number;
  • phi: starting angle in degrees for phi axis when phi-scan is set or just phi position
  • phiEnd: end phi angle in degrees for psi scan, float number; if omega-scan is set, float number;
  • kappa: kappa angle in degrees, float number;
  • kappaEnd: end kappa angle in degrees for psi scan, 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.


abort

diffractometer.abort()

Creates a sequence action to abort the current diffraction data collection. Useful when data are collected periodically and user wants to stop it automatically when the temperature ramp is done.


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.


setPsiScan

diffractometer.setPsiScan()

Creates a sequence action to set psi axis as the main scanning axis.


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)