@@ -1745,22 +1745,28 @@ def calc_transmission_window(self, secb: np.array, energy: np.floating,
17451745 def calc_effective_pinhole_area (self , physics_package : AbstractPhysicsPackage ) -> np .array :
17461746 """get the effective pinhole area correction
17471747 """
1748- hod = (physics_package .pinhole_thickness /
1749- physics_package .pinhole_diameter )
1750- bvec = self .bvec
1748+ effective_pinhole_area = np .ones (self .shape )
17511749
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 )
1750+ if (physics_package .pinhole_diameter != 0.
1751+ and physics_package .pinhole_thickness != 0. ):
1752+
1753+ hod = (physics_package .pinhole_thickness /
1754+ physics_package .pinhole_diameter )
1755+ bvec = self .bvec
1756+
1757+ tth , eta = self .pixel_angles ()
1758+ angs = np .vstack ((tth .flatten (), eta .flatten (),
1759+ np .zeros (tth .flatten ().shape ))).T
1760+ dvecs = angles_to_dvec (angs , beam_vec = bvec )
1761+
1762+ cth = - dvecs [:,2 ].reshape (self .shape )
1763+ tanth = np .tan (np .arccos (cth ))
1764+ f = hod * tanth
1765+ f [np .abs (f ) > 1. ] = np .nan
1766+ asinf = np .arcsin (f )
1767+ effective_pinhole_area = (
1768+ (2 / np .pi ) * cth * (np .pi / 2 - asinf - f * np .cos (asinf )))
17561769
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 )))
17641770 return effective_pinhole_area
17651771
17661772 def calc_transmission_generic (self ,
0 commit comments