Skip to content

Commit

Permalink
Added 'zone' option to mslice export
Browse files Browse the repository at this point in the history
  • Loading branch information
hexane360 committed Jan 12, 2024
1 parent 1e4e9e2 commit d927da9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions atomlib/io/mslice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion atomlib/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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
Expand Down

0 comments on commit d927da9

Please sign in to comment.