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
- Required inputs:
images, output
- Optional inputs:
- Outputs:
image, output_path
createIniFiles#
- Identifier:
ewoksscxrd.tasks.createinifiles.createIniFiles
- Task type:
class
- Required inputs:
ini_file, output
- Optional inputs:
- Outputs:
saved_files_path
createParFiles#
- Identifier:
ewoksscxrd.tasks.createparfiles.createParFiles
- Task type:
class
- Required inputs:
output, par_file
- Optional inputs:
- Outputs:
saved_files_path
createRunFiles#
- Identifier:
ewoksscxrd.tasks.createrunfiles.createRunFiles
- Task type:
class
- Required inputs:
output, run_parameters
- Optional inputs:
- Outputs:
saved_files_path
createSetCcdFiles#
- Identifier:
ewoksscxrd.tasks.createsetccdfiles.createSetCcdFiles
- Task type:
class
- Required inputs:
ccd_set_file, output
- Optional inputs:
- 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 65,000, with any pixel at or above 65,000 set to 0. This generated image is only for display purposes.
- Identifier:
ewoksscxrd.tasks.dataportal.dataPortal
- Task type:
class
- Required inputs:
image, output
- Optional inputs:
bounds, gallery_output_binning, gallery_output_format, gallery_overwrite
- Outputs:
gallery_file_path
Eiger2Crysalis#
- Identifier:
ewoksscxrd.tasks.eiger2crysalis.Eiger2Crysalis
- Task type:
class
- Required inputs:
beam, distance, images, output, processed_output
- Optional inputs:
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 as follows:
For each pixel, if the value in 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 the specified output file 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 value applied to image1 (optional; default: 2**32 - 1).
Outputs: output_path: final path of the saved file.
- Identifier:
ewoksscxrd.tasks.lima2thresholding.lima2Thresholding
- Task type:
class
- Required inputs:
images, output, scale_factor
- Optional inputs:
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 ‘tiff_files’.
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 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
- Required inputs:
images, output
- Optional inputs:
detector_name
- Outputs:
images_list, output_path