Diffraction geometry: Protect for asin out of (-1,-1) range
This commit is contained in:
1 parent
7e1857f5c5
commit
93453e6048
1 file changed
+4
-2
@@ -42,6 +42,8 @@ class DiffractionGeometry(BaseModel):
|
||||
def calc_dtz_mm(self, exp_resolution_angstrom: float) -> float:
|
||||
if exp_resolution_angstrom <= 0:
|
||||
raise ValueError("Resolution must be positive")
|
||||
|
||||
theta = math.asin(self.wavelength_angstrom / (2 * exp_resolution_angstrom))
|
||||
x = self.wavelength_angstrom / (2 * exp_resolution_angstrom)
|
||||
if x >= 1.0 or x <= -1.0:
|
||||
return 0.0
|
||||
theta = math.asin(x)
|
||||
return self.detector_radius_mm / math.tan(theta)
|
||||
Reference in new issue
Block a user