diff --git a/atomlib/io/mslice.py b/atomlib/io/mslice.py index e496663..cf29c0d 100644 --- a/atomlib/io/mslice.py +++ b/atomlib/io/mslice.py @@ -126,6 +126,7 @@ def write_mslice(cell: HasAtomCell, f: FileOrPath, template: t.Optional[MSliceFi conv_angle: t.Optional[float] = None, # mrad energy: t.Optional[float] = None, # keV defocus: t.Optional[float] = None, # angstrom + tilt: t.Optional[t.Tuple[float, float]] = None, # (mrad, mrad) tds: t.Optional[bool] = None, n_cells: t.Optional[ArrayLike] = None): """ @@ -216,6 +217,11 @@ def parse_xml_object(obj: et.Element) -> t.Dict[str, t.Any]: set_attr(struct, 'bparam', 'float', b) set_attr(struct, 'cparam', 'float', c) + if tilt is not None: + (tiltx, tilty) = tilt + set_attr(struct, 'tiltx', 'float', f"{tiltx:.4g}") + set_attr(struct, 'tilty', 'float', f"{tilty:.4g}") + if slice_thickness is not None: set_attr(params, 'slicethickness', 'float', f"{float(slice_thickness):.8g}") if tds is not None: diff --git a/atomlib/mixins.py b/atomlib/mixins.py index aadfbaf..d65cd9f 100644 --- a/atomlib/mixins.py +++ b/atomlib/mixins.py @@ -128,6 +128,7 @@ def write_mslice(self, f: FileOrPath, template: t.Optional[MSliceFile] = None, * conv_angle: t.Optional[float] = None, # mrad energy: t.Optional[float] = None, # keV defocus: t.Optional[float] = None, # angstrom + tilt: t.Optional[t.Tuple[float, float]] = None, # (mrad, mrad) tds: t.Optional[bool] = None, n_cells: t.Optional[ArrayLike] = None): """ @@ -144,7 +145,7 @@ def write_mslice(self, f: FileOrPath, template: t.Optional[MSliceFile] = None, * return write_mslice(self, f, template, slice_thickness=slice_thickness, scan_points=scan_points, scan_extent=scan_extent, conv_angle=conv_angle, energy=energy, defocus=defocus, - noise_sigma=noise_sigma, tds=tds, n_cells=n_cells) + noise_sigma=noise_sigma, tilt=tilt, tds=tds, n_cells=n_cells) def write_qe(self, f: FileOrPath, pseudo: t.Optional[t.Mapping[str, str]] = None): from .io import write_qe