dara.xrd module#
Load and process XRD data files (.xrdml, .xy, .rasx).
- class RASXFile(angles, intensities, binary_data=None)[source]#
Bases:
XRDDataLoad Rigaku RASX file data format.
- property binary_data: bytes | None#
Binary data.
- class RawFile(angles, intensities, binary_data=None)[source]#
Bases:
XRDDataLoad Rigaku RAW file data format.
- property binary_data: bytes | None#
Binary data.
- class XRDData(angles, intensities, errors=None)[source]#
Bases:
MSONableGeneral XRD data class; this is the base class for XRDMLFile, XYFile and other XRD data formats. This class ensures that all XRD data can be serialized.
- property angles: ndarray#
2-theta values.
- property errors: ndarray | None#
Errors in intensity values.
- property intensities: ndarray#
Intensity values (counts).
- class XRDMLFile(angles, intensities, xrdml_dict=None)[source]#
Bases:
XRDDataXRDML file class, useful for loading .xrdml data. This is the file type used by the Aeris instrument.
- to_xrdml_file(fn='xrd_data.xrdml')[source]#
Save as an XRDML file.
- Parameters:
fn (
str|Path) – filename to save to. Defaults to “xrd_data.xrdml”.- Return type:
None
- property xrdml_dict: dict | None#
Dictionary representation of the XRDML file.
- class XYFile(angles, intensities, errors=None)[source]#
Bases:
XRDDataXY file class, useful for loading .xy data.
- get_xrdml_data(xrd_dict)[source]#
Get angles and intensities from an XRDML dictionary.
- Return type:
tuple[ndarray,ndarray]
- load_rasx(file)[source]#
Convert RASX file to xy data.
RASX files are ZIP archives containing: - root.xml file - Data*/ folders with Profile*.txt files (scan_angle, intensity, attenuation) - MesurementConditions*.xml files (note: typo in original format)
This function extracts the first scan’s data from the first Profile file found.
- Return type:
tuple[tuple[ndarray,ndarray],bytes]- Returns:
Tuple of ((angles, intensities), content) where content is the raw ZIP bytes. The content is kept for potential round-trip saving, though it’s rarely used.
- load_raw(file)[source]#
Convert raw file to xy data.
- Return type:
tuple[tuple[ndarray,ndarray],bytes]
- load_xrdml(file)[source]#
Load an XRDML file and returns a dictionary using xmltodict.
- Return type:
dict