Custom Diffraction tasks#

How to use

These tasks come from ewoksid11 ewoksid22 ewoksid31 ewoksoptics ewokspdf. It can be installed with

pip install ewoksid11 ewoksid22 ewoksid31 ewoksoptics ewokspdf

ℹ️ These tasks are used at the following ESRF beamlines: ID06, ID11, ID22, ID31

ID22H5ToSpec#

Identifier:

ewoksid22.convert.ID22H5ToSpec

Task type:

class

Required inputs:

filename

Optional inputs:

ascii_extension, entries, outdirs, outprefix, primary_outdir, rebin_filename, retry_timeout

Outputs:

entries, outfile

ID22TopasExtract#

Identifier:

ewoksid22.extract.ID22TopasExtract

Task type:

class

Required inputs:

filename, inp_file

Optional inputs:

entries, full_tth, inp_step, outdirs, outprefix, primary_outdir, startp, tth_max, tth_min

Outputs:

ID22Sum#

Identifier:

ewoksid22.sum.ID22Sum

Task type:

class

Required inputs:

binsize, filename

Optional inputs:

advanced, ascii_extension, entries, lowtth, outdirs, outprefix, primary_outdir, raw_filename, resfile, scaling, sum_all, sum_single

Outputs:

outfile

WaitScansFinished#

Identifier:

ewoksid22.wait.WaitScansFinished

Task type:

class

Required inputs:

filename

Optional inputs:

entries, retry_timeout

Outputs:

entries, filename

FlatFieldFromEnergy#

Interpolate an energy-stack of flat-field images.

The resulting flat-field image can be used as follows to correct diffraction patterns for flat field:

.. code::

Icor = I / flatfield
Identifier:

ewoksid31.tasks.flatfield.FlatFieldFromEnergy

Task type:

class

Required inputs:

energy, newflat, oldflat

Optional inputs:

Outputs:

flatfield

GenerateIniFile#

Generate the ini file needed for the detector distorsion. Save it in output_file. Inputs: - template_file: string, path of the ini template file - mapping_data: dict[str, any], A dictionary of key-value pairs used for substitution in the template file - output_file: string, the full path (including filename) where the ini file will be saved Outputs: - output_file: string, the full path (including filename) where the ini file is saved

Identifier:

ewoksoptics.tasks.generate_ini_file.GenerateIniFile

Task type:

class

Required inputs:

mapping_data, output_file, template_file

Optional inputs:

Outputs:

output_file

PdfGetXAverage#

Average a list of 1D XRPD patterns from provided output of IntegrateBlissScan

Inputs: - nxdata_url: .h5 path with NXData url Outputs: - radial: 1D array - intensity: 1D array - info: dict with radial_units and wavelength

Identifier:

ewoksid11.pdfgetx_average.PdfGetXAverage

Task type:

class

Required inputs:

nxdata_url

Optional inputs:

Outputs:

info, intensity, radial

PdfGetXConfig#

Parse pdfgetx config parameters

Identifier:

ewoksid11.pdfgetx_config.PdfGetXConfig

Task type:

class

Required inputs:

Optional inputs:

filename, pdfgetx_options_dict

Outputs:

pdfgetx_options

PdfGetXProcessor#

Extracts the PDF signal from provided intensities and radial

Inputs: - radial: 1D array - intensity: 1D array - info: dict with unit and wavelength - pdfgetx_options: PDFConfig object Outputs: - result: PDFGetter object with attributes defined by outputtype. Attributes are tuples with [0] X (radial) and [1] Y (intensity) - pdfgetx_options: PDFConfig object

Identifier:

ewoksid11.pdfgetx_processor.PdfGetXProcessor

Task type:

class

Required inputs:

info, intensity, pdfgetx_options, radial

Optional inputs:

Outputs:

pdfgetx_options, result

PdfGetXSaveAscii#

Saves the PDF result (iq, sq, fq, gr) in separate ASCII files

Inputs: - filename: h5file name that would have been used to save data from XrpdProcessor - result: PDFGetter object with attributes defined by outputtype. Attributes are tuples with [0] X (radial) and [1] Y (intensity) Outputs: - saved: True if saved - filename: list of saved filenames

Identifier:

ewoksid11.pdfgetx_save_ascii.PdfGetXSaveAscii

Task type:

class

Required inputs:

filename, result

Optional inputs:

Outputs:

filenames, saved

PdfGetXSaveNexus#

Saves the PDF result (iq, sq, fq, gr) in a NeXus file

Inputs: - output_filename: h5file name where the data must be saved - scan: scan number - detector name: name of the detector - result: PDFGetter object with attributes defined by outputtype. Attributes are tuples with [0] X (radial) and [1] Y (intensity) Outputs: - output_url: URL of the NXprocess containing the saved data

Identifier:

ewoksid11.pdfgetx_save_nexus.PdfGetXSaveNexus

Task type:

class

Required inputs:

detector_name, output_filename, pdfgetx_options, result, scan

Optional inputs:

lima_url_template, lima_url_template_args, retry_period, retry_timeout, subscan

Outputs:

output_url

CalibAverage#

Average a list of 2D images from bliss data url

Inputs: - bliss_data_url: format like /data/visitor/maXXXX/idXX/20240101/sample/dataset/dataset.h5::1.1/measurement/detector Outputs: - image: 2D image averaged from list of 2D images

Identifier:

ewoksid11.pyfai_calib_average.CalibAverage

Task type:

class

Required inputs:

bliss_data_url

Optional inputs:

Outputs:

image

CalibSave#

Saves the geometry from calibration result in output_path. By default, the geometry file will be: {calibrant}_YYYYMMDD_hhmm.poni

Inputs: - geometry: dictionnary, result of CalibrateSingle - calibrant: string with calibrant name used in CalibrateSingle - detector: string, default is detector - detector_config: dict with key splineFile - output_path: list of strings, where the poni will be saved - energy: float, in keV

Outputs: - output_path: list of strings, path of the poni files saved

Identifier:

ewoksid11.pyfai_calib_save.CalibSave

Task type:

class

Required inputs:

calibrant, detector, detector_config, energy, geometry, output_path

Optional inputs:

Outputs:

output_path

PdfGetXAverage#

Average a list of 1D XRPD patterns from provided output of IntegrateBlissScan

Inputs: - nxdata_url: .h5 path with NXData url - average_every: how many rows to average over; - ‘all’ for all rows, - ‘1’ for no averaging, - or any integer divisor of the total number of rows Outputs: - radial: 1D array - intensity: 1D or 2D array based on average_every - info: dict with radial_units and wavelength

Identifier:

ewokspdf.tasks.average.PdfGetXAverage

Task type:

class

Required inputs:

nxdata_url

Optional inputs:

average_every

Outputs:

info, intensity, radial

PdfGetXConfig#

Parse pdfgetx config parameters

Identifier:

ewokspdf.tasks.config.PdfGetXConfig

Task type:

class

Required inputs:

Optional inputs:

filename, pdfgetx_options_dict

Outputs:

pdfgetx_options

PdfGetXProcessor#

Extracts the PDF signal from provided intensities and radial

Inputs: - radial: 1D array - intensity: 1D or 2D array - info: dict with unit, wavelength, and nb_avg - pdfgetx_options: PDFConfig object Outputs: - results: List od PDFGetter object with attributes defined by outputtype. Attributes are tuples with [0] X (radial) and [1] Y (intensity) - info: dict with unit, wavelength, and nb_avg - pdfgetx_options: PDFConfig object

Identifier:

ewokspdf.tasks.processor.PdfGetXProcessor

Task type:

class

Required inputs:

info, intensity, pdfgetx_options, radial

Optional inputs:

Outputs:

info, pdfgetx_options, results

PdfGetXSaveAscii#

Saves the PDF result (iq, sq, fq, gr) in separate ASCII files

Inputs: - filename: Path to the base file used to save data. - results: List of PDFGetter objects with attributes for output types. - info: dict with unit, wavelength, and nb_avg Outputs: - saved: True if files are saved successfully. - filenames: List of saved filenames.

Identifier:

ewokspdf.tasks.save_ascii.PdfGetXSaveAscii

Task type:

class

Required inputs:

filename, info, results

Optional inputs:

Outputs:

filenames, saved

PdfGetXSaveNexus#

Saves the PDF results (iq, sq, fq, gr) in a NeXus file

Inputs: - nxdata_url: .h5 path with NXData url in which the data will be saved - results: List of PDFGetter object with attributes defined by outputtype. Attributes are tuples with [0] X (radial) and [1] Y (intensity) Outputs: - pdfgetx_options: pdfgetx.PDFConfig object containing the configuration

Identifier:

ewokspdf.tasks.save_nexus.PdfGetXSaveNexus

Task type:

class

Required inputs:

info, nxdata_url, pdfgetx_options, results

Optional inputs:

lima_url_template, lima_url_template_args, retry_period, retry_timeout, subscan

Outputs:

output_url