Single-Crystal X-Ray Diffraction tasks#

How to use

These tasks come from ewoksscxrd. It can be installed with

pip install ewoksscxrd

ℹ️ These tasks are used at the following ESRF beamlines: ID11, ID15B

AverageFrames#

Reads an HDF5 file with frames, averages them along the frame axis, and saves the averaged image in EDF format using fabio. images is a list of lima HDF5 files.

The HDF5 file is assumed to contain a 3D dataset (n_frames, height, width). By default, it will attempt to use the dataset named “/entry_0000/measurement/data”.

Identifier:
ewoksscxrd.tasks.averageframes.AverageFrames
Task type:
class
Inputs:
images*
output*
Outputs:
image
output_path

CreateIniFiles#

Task to copy a .ini file to the specified output location.

Identifier:
ewoksscxrd.tasks.createinifiles.CreateIniFiles
Task type:
class
Inputs:
ini_file*
output*
Outputs:
saved_files_path

CreateParFiles#

Identifier:
ewoksscxrd.tasks.createparfiles.CreateParFiles
Task type:
class
Inputs:
output*
par_file*
beam
detector_height
detector_square_size
detector_width
distance
polarization
wavelength
Outputs:
saved_files_path

CreateRunFiles#

Identifier:
ewoksscxrd.tasks.createrunfiles.CreateRunFiles
Task type:
class
Inputs:
output*
run_parameters*
Outputs:
saved_files_path

CreateSetCcdFiles#

Identifier:
ewoksscxrd.tasks.createsetccdfiles.CreateSetCcdFiles
Task type:
class
Inputs:
ccd_set_file*
output*
Outputs:
saved_files_path

CreateXDSInp#

Create an XDS.INP file using explicit experiment parameters.

Identifier:
ewoksscxrd.tasks.createxdsinp.CreateXDSInp
Task type:
class
Inputs:
data_range*
detector*
nx*
ny*
oscillation_range*
output*
qx*
qy*
background_pixel
background_range
beam
beam_divergence
beam_divergence_esd
detector_distance
direction_of_detector_x_axis
direction_of_detector_y_axis
distance
exclude_resolution_range
filename
fraction_of_polarization
friedels_law
incident_beam_direction
include_resolution_range
job
job_comment_lines
library
maximum_number_of_strong_pixels
minimum_number_of_pixels_in_a_spot
minimum_valid_pixel_value
name_template_of_data_frames
orgx
orgy
overload
polarization_plane_normal
refine_correct
refine_idxref
refine_integrate
reflecting_range
reflecting_range_esd
rotation_axis
sensor_thickness
signal_pixel
silicon
space_group_number
spot_range
starting_angle
starting_frame
trusted_region
unit_cell_constants
untrusted_rectangles
wavelength
xds_extra
Outputs:
saved_files_path

DataPortal#

Task that builds a gallery by processing an image:

  • Normalizes/clamps the image to 8-bit grayscale.

  • Applies binning with a defined binning factor.

  • Saves the processed image as a PNG (or as specified by gallery_output_format) in a folder called “gallery” within the processed data directory.

  • Infers ICAT parameters from the processed data directory and stores processed data metadata using pyicat_plus.

Inputs:

  • image: A 2D numpy.ndarray (or a 3D array with a singleton first dimension).

  • output: A file path; its directory is used as the processed data directory.

Optional inputs:

  • gallery_output_format: Output image file format (default “png”).

  • gallery_overwrite: Whether to overwrite an existing file (default True).

  • gallery_output_binning: Binning factor (default 1, meaning no binning).

  • bounds: A tuple (lower_bound, upper_bound) used for normalization. If not provided, lower_bound defaults to 0 and upper_bound is set to the 99.9th percentile of pixel values below 1e9, with any pixel at or above 1e9 set to 0. This generated image is only for display purposes.

Identifier:
ewoksscxrd.tasks.dataportal.DataPortal
Task type:
class
Inputs:
image*
output*
bounds
gallery_output_binning
gallery_output_format
gallery_overwrite
metadata
Outputs:
gallery_file_path

Eiger2CBF#

Wrap :mod:fabio.app.eiger2cbf as an Ewoks task.

Identifier:
ewoksscxrd.tasks.eiger2cbf.Eiger2CBF
Task type:
class
Inputs:
images*
output*
alpha
beam
chi
debug
distance
dry_run
dummy
energy
flip_lr
flip_ud
kappa
mask
offset
omega
phi
pilatus
rotation
transpose
verbose
wavelength
Outputs:
output_path

Eiger2Crysalis#

Identifier:
ewoksscxrd.tasks.eiger2crysalis.Eiger2Crysalis
Task type:
class
Inputs:
beam*
distance*
images*
output*
processed_output*
alpha
cal_mask
custom_frame_set_path
debug
dry_run
dummy
energy
flip_lr
flip_ud
kappa
list
offset
omega
phi
polarization
rotation
theta
transpose
verbose
wavelength
Outputs:
output_path

Lima2Thresholding#

Reads a 4D HDF5 file (shape: (nframes, 2, H, W)) and processes each frame:

  • For each pixel, if image1 exceeds dectris_masking_value (optional, default: 1e6), the two corresponding pixel values are summed.

  • Otherwise, image1 is scaled by scale_factor and subtracted from image0.

  • Any negative result values after subtraction are set to 0.

The processed result (a 3D image) is then written to output in LImA HDF5 format.

Inputs: images: list of input HDF5 files. output: destination file path for the processed result. scale_factor: scaling factor applied to image1 for subtraction. dectris_masking_value: threshold for image1 (optional; default: 2**32 - 1).

Outputs: output_path: final path of the saved file.

Identifier:
ewoksscxrd.tasks.lima2thresholding.Lima2Thresholding
Task type:
class
Inputs:
images*
output*
scale_factor*
dectris_masking_value
Outputs:
output_path

TiffFiles#

Reads an HDF5 file with frames, extracts each individual frame, and saves them as TIFF images in a folder called ‘xdi’. The TIFF images will have a key called imageDescription, default is eiger, if the detector name is supplied, it will be set accordingly

The HDF5 file is assumed to contain a 2D or 3D dataset (n_frames, height, width) at the dataset path “/entry_0000/measurement/data”. The output folder xdi is created in PROCESSED_DATA/sample/sample_dataset/scan0001.

Identifier:
ewoksscxrd.tasks.tifffiles.TiffFiles
Task type:
class
Inputs:
images*
output*
detector_name
Outputs:
images_list
output_path