mirror of
https://github.com/cdtools-developers/cdtools.git
synced 2026-09-21 09:52:10 +02:00
Merge pull request #66 from cdtools-developers/bugfix/surface_normal_strip
Fix a bug preventing the default surface normal of [0 0 1] from ever being defined in Bragg2DPtycho
This commit is contained in:
@@ -285,13 +285,14 @@ class Bragg2DPtycho(CDIModel):
|
||||
# > dataset.sample_info['orientation'] > transmission geometry
|
||||
if surface_normal is not None:
|
||||
surface_normal = np.asarray(surface_normal)
|
||||
elif scattering_mode.strip().lower() in {'t', 'transmission'}:
|
||||
surface_normal = np.array([0.,0.,1.])
|
||||
elif scattering_mode.strip().lower() in {'r', 'reflection'}:
|
||||
outgoing_dir = np.cross(det_basis[:,0], det_basis[:,1])
|
||||
outgoing_dir /= np.linalg.norm(outgoing_dir)
|
||||
surface_normal = outgoing_dir + np.array([0.,0.,1.])
|
||||
surface_normal /= np.linalg.norm(outgoing_dir)
|
||||
elif isinstance(scattering_mode, str):
|
||||
if scattering_mode.strip().lower() in {'t', 'transmission'}:
|
||||
surface_normal = np.array([0.,0.,1.])
|
||||
elif scattering_mode.strip().lower() in {'r', 'reflection'}:
|
||||
outgoing_dir = np.cross(det_basis[:,0], det_basis[:,1])
|
||||
outgoing_dir /= np.linalg.norm(outgoing_dir)
|
||||
surface_normal = outgoing_dir + np.array([0.,0.,1.])
|
||||
surface_normal /= np.linalg.norm(outgoing_dir)
|
||||
elif scattering_mode is not None:
|
||||
raise ValueError(
|
||||
'Scattering mode must be either "transmission" ("t"), "reflection" ("r"), or the default of None.'
|
||||
|
||||
Reference in New Issue
Block a user