Skip to content
XRD Analyzer

2. Supported File Formats

Formatting specifications for XRD files. Learn how the parser processes data columns, text headers, and binary frames.

Overview of the File Parser

Because different diffractometer manufacturers use unique file formats, raw datasets often require conversion before analysis. XRD Analyzer features a client-side parsing pipeline designed to read plain text tables, strip metadata headers, extract binary frames, and read structured XML schemas locally.

1. Raw X-Y coordinate tables (.xy)

The `.xy` file layout is the most reliable format for data interchange. It is a plain text file containing two columns separated by a space or tab: the first column lists the $2\theta$ scattering angle (in degrees), and the second lists the diffracted intensity (in counts). The file should contain no metadata headers or text lines.

Example `.xy` column format:

10.0050 452.0000
10.0200 458.0000
10.0350 449.0000
10.0500 461.0000

2. Comma-separated spreadsheet files (.csv)

The `.csv` format is commonly used to export datasets from spreadsheet software. When exporting, make sure the columns are ordered: the first column must represent the $2\theta$ angles, and the second column must represent the matching raw intensities. You can include single-line column headers (like 2-Theta,Intensity); the parser will skip them automatically.

3. Standard text files (.txt)

Text files exported by instrument software often include metadata headers containing scan dates, anode configurations, step sizes, and current settings. The parser reads the file line-by-line, ignores lines starting with non-numeric characters (like `#` or letters), and extracts columns from the first valid data matrix.

[Header Lines] -> Ignored by parser
10.00 350.00 -> First valid line parsed
10.05 355.00 -> Second valid line parsed
Figure 2.1: How the parser skips non-numeric header metadata.

4. Bruker binary raw scans (.raw)

Bruker instrument software exports measurements in binary formats. When a `.raw` file is loaded, our engine reads the binary stream inside a Python script running in the Web Worker. This script extracts header data (like anode material and step sizes) and decodes the binary float arrays containing intensity values.

5. PANalytical diffraction XML patterns (.xrdml)

PANalytical diffractometers export data in `.xrdml` files. This is a structured XML schema that documents scan parameters, diffraction geometries, and intensity arrays. The parser reads these XML tags locally, extracts the start angle, step size, and counts array, and maps them to a flat coordinate table.