Skip to content

Commit

Permalink
[#914] _class05_legacy: add option cryst to be dict
Browse files Browse the repository at this point in the history
  • Loading branch information
AD265925 authored and AD265925 committed Mar 1, 2024
1 parent 327a3e4 commit 6876dbd
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tofu/data/_class05_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,23 @@ def _check(
f"Arg cryst must be a valid .npz file, loadable!\n{error}"
)
raise Exception(msg)
elif isinstance(cryst, dict):
if cryst.dmat is None:
msg = (
f"Arg cryst must have a valid dmat dict, loadable!\n{error}"
)
raise Exception(msg)
elif cryst.dgeom is None:
msg = (
f"Arg cryst must have a valid dgeom dict, loadable!\n{error}"
)
raise Exception(msg)
elif cryst.dbragg is None:
msg = (
f"Arg cryst must have a valid dbragg dict, loadable!\n{error}"
)
raise Exception(msg)


# check class
if not cryst.__class__.__name__ == 'CrystalBragg':
Expand Down Expand Up @@ -222,4 +239,4 @@ def _extract_dmat(cryst):
'power_ratio': cryst._dbragg['rockingcurve']['value'],
}

return dmat
return dmat

0 comments on commit 6876dbd

Please sign in to comment.