panalytical: For Panalytical XRD data

Extractors for various exports of Panalytical X-ray diffractograms.

yadg.extractors.panalytical.common module

yadg.extractors.panalytical.common.panalytical_comment(line: str) dict

Processes a comments from the file header into a dictionary.

Parameters:

line – A line containing the comment.

Returns:

A dictionary containing the processed comment.

Return type:

dict

yadg.extractors.panalytical.common.snake_case(s: str) str

Converts Sentence case. and camelCase strings to snake_case.

From https://stackoverflow.com/a/1176023

Parameters:

s – The input string to be converted.

Returns:

The corresponding snake_case string.

Return type:

str

yadg.extractors.panalytical.csv module

Handles processing of csv exports of Panalytical XRD files.

Usage

Available since yadg-4.2.

pydantic model dgbowl_schemas.yadg.dataschema_6_0.filetype.Panalytical_csv
Config:
  • extra: str = forbid

Validators:

field filetype: Literal['panalytical.csv'] [Required]

Schema

xarray.DataTree:
  coords:
    uts:            !!float               # Unix timestamp
    angle:          !!float               # 2θ angle
  data_vars:
    intensity:      (uts, angle)          # Measured intensity

Metadata

With the exception of the comment, the metadata present in the csv file is extracted from the file header without post-processing.

Notes on file structure

These files are split into a [Measurement conditions] and a [Scan points] section. The former stores the metadata and the latter all the datapoints.

Uncertainties

The uncertainties of "angle" are taken from the number of significant figures.

The uncertainties of "intensity" are taken from the number of significant figures.

Code author: Nicolas Vetsch, Peter Kraus

yadg.extractors.panalytical.csv.extract(*, fn: str, encoding: str, timezone: str, **kwargs: dict) DataTree

yadg.extractors.panalytical.xrdml module

Handles processing of Panalytical XRDML files.

Usage

Available since yadg-4.2.

pydantic model dgbowl_schemas.yadg.dataschema_6_0.filetype.Panalytical_xrdml
Config:
  • extra: str = forbid

Validators:

field filetype: Literal['panalytical.xrdml'] [Required]

Schema

xarray.DataTree:
  coords:
    uts:            !!float               # Unix timestamp
    angle:          !!float               # 2θ angle
  data_vars:
    intensity:      (uts, angle)          # Measured intensity

Metadata

The following metadata is extracted:

  • sample: Metadata information about the sample.

  • wavelength: Measurement wavelength.

  • comment: A free-form description of the experiment.

  • incident_beam_path

  • diffracted_beam_path

  • counting_time

Note

The returned metadata contain only a subset of the available metadata in the XML file. If something important is missing, please contact us!

Notes on file structure

These are xml-formatted files, which we here parse using the xml.etree library into a Python dict.

The angle returned from this parser is based on a linear interpolation of the start and end point of the scan, and is the \(2\theta\). The values of \(\omega\) are discarded.

Uncertainties

The uncertainties of in "angle" are taken as the step-width of the linearly spaced \(2\theta\) values.

The uncertainties of of "intensity" are currently set to a constant value of 1.0 count as all the supported files seem to produce integer values.

Code author: Nicolas Vetsch, Peter Kraus

yadg.extractors.panalytical.xrdml.etree_to_dict(e: Element) dict

Recursively converts an ElementTree.Element into a dictionary.

Element attributes are stored into “@”-prefixed attribute keys. Element text is stored into “#text” for all nodes.

From https://stackoverflow.com/a/10076823.

yadg.extractors.panalytical.xrdml.extract(*, fn: str, timezone: str, **kwargs: dict) DataTree

yadg.extractors.panalytical.xy module

Handles processing of xy exports of Panalytical XRD files. When possible, the xrdml or csv files should be used instead.

Usage

Available since yadg-4.2.

pydantic model dgbowl_schemas.yadg.dataschema_6_0.filetype.Panalytical_xy
Config:
  • extra: str = forbid

Validators:

field filetype: Literal['panalytical.xy'] [Required]

Schema

xarray.DataTree:
  coords:
    angle:          !!float               # 2θ angle
  data_vars:
    intensity:      (angle)          # Measured intensity

Metadata

No metadata is present in files.

Notes on file structure

These files basically just contain the [Scan points] part of Panalytical csv files. As a consequence, no metadata is recorded, and the format does not have an associated timestamp.

Code author: Nicolas Vetsch, Peter Kraus

yadg.extractors.panalytical.xy.extract(*, fn: str, encoding: str, **kwargs: dict) DataTree