xopto.util.convolve module

fiber_reflectance(r: numpy.ndarray, reflectance: numpy.ndarray, sds: float, dcore: float, nsimps: int = 1000, loginterp: bool = False, uneven: bool = False, **kwargs)numpy.ndarray[source]

Computes reflectance detected through optical fibers with the given geometry. The reflectance can be computed by integrating:

& 2 \int_{\max(sds - r_c, 0)}^{\max(sds + r_c, 0)} \arccos\left(\frac{r^2 + sds^2 - r_c^2}{2 r_c sds}\right) \text{reflectance}(r) r dr,

& \text{where}\; r_c = dcore/2

Parameters
  • r (np.ndarray vector) – Vector of points at which the radially symmetric reflectance is defined. The points must be sorted in ascending order and include the range [sds - dcore/2, sds + dcore/2].

  • reflectance (np.ndarray vector or 2D array) – Radially symmetric reflectance at points r. To compute the reflectance through fibers for multiple reflectances, use a 2D array with individual reflectances in the rows (n, r.size).

  • sds (float or list/tuple of float) – Distance to the fiber center.

  • dcore (float) – Fiber diameter.

  • nsimps (int) – Number of integration points used by the simpson method.

  • loginterp (bool) – If True, the interpolation of reflectance is computed in log space. This can in some cases improve the accuracy of integration.

  • uneven (bool) – Set to true if unevenly spaced points can be found in r.

  • kwargs (dict) – Keyword arguments are passed to scipy.interpolate.interp1d.

Returns

fiber_reflectance – Reflectance collected through the fibers. The size of the vector equals the number of elements in sds. If reflectance is a 2D array then the results are stored in rows (n, len(sds)).

Return type

np.ndarray vector or 2D array