@@ -15,19 +15,19 @@ def _top_hat(z, half_slit_width):
1515def _model_function (z , diameter , z0 , I0 , mud , slope ):
1616 """
1717 Compute the model function with the following steps:
18- 1. Recenter z to x by subtracting z0 ( so that the circle is centered at 0 and it is easier to compute length l)
18+ 1. Let dz = z-z0, so that dz is centered at 0
1919 2. Compute length l that is the effective length for computing intensity I = I0 * e^{-mu * l}:
20- - For x within the diameter range , l is the chord length of the circle at position x
21- - For x outside this range, l = 0
20+ - For dz within the capillary diameter , l is the chord length of the circle at position dz
21+ - For dz outside this range, l = 0
2222 3. Apply a linear adjustment to I0 by taking I0 as I0 - slope * z
2323 """
2424 min_radius = - diameter / 2
2525 max_radius = diameter / 2
26- x = z - z0
26+ dz = z - z0
2727 length = np .piecewise (
28- x ,
29- [x < min_radius , (min_radius <= x ) & (x <= max_radius ), x > max_radius ],
30- [0 , lambda x : 2 * np .sqrt ((diameter / 2 ) ** 2 - x ** 2 ), 0 ],
28+ dz ,
29+ [dz < min_radius , (min_radius <= dz ) & (dz <= max_radius ), dz > max_radius ],
30+ [0 , lambda dz : 2 * np .sqrt ((diameter / 2 ) ** 2 - dz ** 2 ), 0 ],
3131 )
3232 return (I0 - slope * z ) * np .exp (- mud / diameter * length )
3333
0 commit comments