@@ -171,7 +171,6 @@ def beam_position(self):
171171 """
172172 raise NotImplementedError
173173
174-
175174 @property
176175 def extra_config_kwargs (self ):
177176 return {}
@@ -289,7 +288,8 @@ def __init__(
289288 self .group = group
290289
291290 if detector_filter is None :
292- detector_filter = detector_coatings .Filter (** FILTER_DEFAULTS .TARDIS )
291+ detector_filter = detector_coatings .Filter (
292+ ** FILTER_DEFAULTS .TARDIS )
293293 self .filter = detector_filter
294294
295295 if detector_coating is None :
@@ -1709,7 +1709,7 @@ def calc_physics_package_transmission(self, energy: np.floating,
17091709 need to consider HED and HEDM samples separately
17101710 """
17111711 bvec = self .bvec
1712- sample_normal = np .dot (rMat_s , [0. ,0. ,- 1. ])
1712+ sample_normal = np .dot (rMat_s , [0. , 0. , - 1. ])
17131713 seca = 1. / np .dot (bvec , sample_normal )
17141714
17151715 tth , eta = self .pixel_angles ()
@@ -1720,7 +1720,8 @@ def calc_physics_package_transmission(self, energy: np.floating,
17201720
17211721 secb = np .abs (1. / np .dot (dvecs , sample_normal ).reshape (self .shape ))
17221722
1723- T_sample = self .calc_transmission_sample (seca , secb , energy , physics_package )
1723+ T_sample = self .calc_transmission_sample (
1724+ seca , secb , energy , physics_package )
17241725 T_window = self .calc_transmission_window (secb , energy , physics_package )
17251726
17261727 transmission_physics_package = T_sample * T_window
@@ -1729,45 +1730,53 @@ def calc_physics_package_transmission(self, energy: np.floating,
17291730 def calc_transmission_sample (self , seca : np .array ,
17301731 secb : np .array , energy : np .floating ,
17311732 physics_package : AbstractPhysicsPackage ) -> np .array :
1732- thickness_s = physics_package .sample_thickness # in microns
1733- mu_s = 1. / physics_package .sample_absorption_length (energy ) # in microns^-1
1733+ thickness_s = physics_package .sample_thickness # in microns
1734+ # in microns^-1
1735+ mu_s = 1. / physics_package .sample_absorption_length (energy )
17341736 x = (mu_s * thickness_s )
17351737 pre = 1. / x / (secb - seca )
17361738 num = np .exp (- x * seca ) - np .exp (- x * secb )
17371739 return pre * num
17381740
17391741 def calc_transmission_window (self , secb : np .array , energy : np .floating ,
17401742 physics_package : AbstractPhysicsPackage ) -> np .array :
1741- thickness_w = physics_package .window_thickness # in microns
1742- mu_w = 1. / physics_package .window_absorption_length (energy ) # in microns^-1
1743+ thickness_w = physics_package .window_thickness # in microns
1744+ # in microns^-1
1745+ mu_w = 1. / physics_package .window_absorption_length (energy )
17431746 return np .exp (- thickness_w * mu_w * secb )
17441747
17451748 def calc_effective_pinhole_area (self , physics_package : AbstractPhysicsPackage ) -> np .array :
17461749 """get the effective pinhole area correction
17471750 """
1748- hod = (physics_package .pinhole_thickness /
1749- physics_package .pinhole_diameter )
1750- bvec = self .bvec
1751+ effective_pinhole_area = np .ones (self .shape )
17511752
1752- tth , eta = self .pixel_angles ()
1753- angs = np .vstack ((tth .flatten (), eta .flatten (),
1754- np .zeros (tth .flatten ().shape ))).T
1755- dvecs = angles_to_dvec (angs , beam_vec = bvec )
1753+ if (not np .isclose (physics_package .pinhole_diameter , 0 )
1754+ and not np .isclose (physics_package .pinhole_thickness , 0 )):
1755+
1756+ hod = (physics_package .pinhole_thickness /
1757+ physics_package .pinhole_diameter )
1758+ bvec = self .bvec
1759+
1760+ tth , eta = self .pixel_angles ()
1761+ angs = np .vstack ((tth .flatten (), eta .flatten (),
1762+ np .zeros (tth .flatten ().shape ))).T
1763+ dvecs = angles_to_dvec (angs , beam_vec = bvec )
1764+
1765+ cth = - dvecs [:, 2 ].reshape (self .shape )
1766+ tanth = np .tan (np .arccos (cth ))
1767+ f = hod * tanth
1768+ f [np .abs (f ) > 1. ] = np .nan
1769+ asinf = np .arcsin (f )
1770+ effective_pinhole_area = (
1771+ (2 / np .pi ) * cth * (np .pi / 2 - asinf - f * np .cos (asinf )))
17561772
1757- cth = - dvecs [:,2 ].reshape (self .shape )
1758- tanth = np .tan (np .arccos (cth ))
1759- f = hod * tanth
1760- f [np .abs (f ) > 1. ] = np .nan
1761- asinf = np .arcsin (f )
1762- effective_pinhole_area = (
1763- (2 / np .pi ) * cth * (np .pi / 2 - asinf - f * np .cos (asinf )))
17641773 return effective_pinhole_area
17651774
17661775 def calc_transmission_generic (self ,
17671776 secb : np .array ,
17681777 thickness : np .floating ,
17691778 absorption_length : np .floating ) -> np .array :
1770- mu = 1. / absorption_length # in microns^-1
1779+ mu = 1. / absorption_length # in microns^-1
17711780 return np .exp (- thickness * mu * secb )
17721781
17731782 def calc_transmission_phosphor (self ,
0 commit comments