refnx/util/general.py
def beamfrackernel(kernelx, kernely, length, angle):
    """
    The beam fraction intercepted by a sample, used for calculating footprints.

    Parameters
    ----------
    kernelx: array-like
        x axis for the probability kernel
    kernely: array-like
        probability kernel describing the intensity distribution of the beam
    length: float
        length of the sample
    angle: float
        angle of incidence (degrees)

    Returns
    -------
    fraction: float
        The fraction of the beam intercepted by a sample.
    """
    height_of_sample = length * np.sin(np.radians(angle))
    total = integrate.simps(kernely, kernelx)
    lowlimit = np.where(-height_of_sample / 2.0 >= kernelx)[0][-1]
    hilimit = np.where(height_of_sample / 2.0 <= kernelx)[0][0]

    area = integrate.simps(
        kernely[lowlimit : hilimit + 1], kernelx[lowlimit : hilimit + 1]
    )
    return area / total

    The beam fraction intercepted by a sample, used for calculating footprints.

    Parameters
    ----------
    kernelx: array-like
        x axis for the probability kernel
    kernely: array-like
        probability kernel describing the intensity distribution of the beam
    length: float
        length of the sample
    angle: float
        angle of incidence (degrees)

    Returns
    -------
    fraction: float
        The fraction of the beam intercepted by a sample.
    
The beam fraction intercepted by a sample, used for calculating footprints.
Parameters

array-like
x axis for the probability kernel
kernely: array-like
probability kernel describing the intensity distribution of the beam
length: float
length of the sample
angle: float
angle of incidence (degrees)

Returns

float
The fraction of the beam intercepted by a sample.
The beam fraction intercepted by a sample used for calculating footprints . Parameters array - like x axis for the probability kernel kernely : array - like probability kernel describing the intensity distribution of the beam length : float length of the sample angle : float angle of incidence ( degrees ) Returns float The fraction of the beam intercepted by a sample .
def beamfrackernel(kernelx, kernely, length, angle):
    height_of_sample = length * np.sin(np.radians(angle))
    total = integrate.simps(kernely, kernelx)
    lowlimit = np.where(-height_of_sample / 2.0 >= kernelx)[0][-1]
    hilimit = np.where(height_of_sample / 2.0 <= kernelx)[0][0]
    area = integrate.simps(
        kernely[lowlimit : hilimit + 1], kernelx[lowlimit : hilimit + 1]
    )
    return area / total
def beamfrackernel ( kernelx , kernely , length , angle ) : height_of_sample = length * np . sin ( np . radians ( angle ) ) total = integrate . simps ( kernely , kernelx ) lowlimit = np . where ( - height_of_sample / 2.0 >= kernelx ) [ 0 ] [ - 1 ] hilimit = np . where ( height_of_sample / 2.0 <= kernelx ) [ 0 ] [ 0 ] area = integrate . simps ( kernely [ lowlimit : hilimit + 1 ] , kernelx [ lowlimit : hilimit + 1 ] ) return area / total
The beam fraction intercepted by a sample, used for calculating footprints.
The beam fraction intercepted by a sample used for calculating footprints .
"""
    The beam fraction intercepted by a sample, used for calculating footprints.

    Parameters
    ----------
    kernelx: array-like
        x axis for the probability kernel
    kernely: array-like
        probability kernel describing the intensity distribution of the beam
    length: float
        length of the sample
    angle: float
        angle of incidence (degrees)

    Returns
    -------
    fraction: float
        The fraction of the beam intercepted by a sample.
    """
kernelx
kernely
length
angle