refnx/util/general.py
def beamfrac(FWHM, length, angle):
    """
    Calculate the beam fraction intercepted by a sample.

    Parameters
    ----------
    FWHM: float
        The FWHM of the beam height
    length: float
        Length of the sample in mm
    angle: float
        Angle that the sample makes w.r.t the beam (degrees)

    Returns
    -------
    beamfrac: float
        The fraction of the beam that intercepts the sample
    """
    height_of_sample = length * np.sin(np.radians(angle))
    beam_sd = FWHM / 2 / np.sqrt(2 * np.log(2))
    probability = 2.0 * (
        stats.norm.cdf(height_of_sample / 2.0 / beam_sd) - 0.5
    )
    return probability

    Calculate the beam fraction intercepted by a sample.

    Parameters
    ----------
    FWHM: float
        The FWHM of the beam height
    length: float
        Length of the sample in mm
    angle: float
        Angle that the sample makes w.r.t the beam (degrees)

    Returns
    -------
    beamfrac: float
        The fraction of the beam that intercepts the sample
    
Calculate the beam fraction intercepted by a sample.
Parameters

float
The FWHM of the beam height
length: float
Length of the sample in mm
angle: float
Angle that the sample makes w.r.t the beam (degrees)

Returns

float
The fraction of the beam that intercepts the sample
Calculate the beam fraction intercepted by a sample . Parameters float The FWHM of the beam height length : float Length of the sample in mm angle : float Angle that the sample makes w . r . t the beam ( degrees ) Returns float The fraction of the beam that intercepts the sample
def beamfrac(FWHM, length, angle):
    height_of_sample = length * np.sin(np.radians(angle))
    beam_sd = FWHM / 2 / np.sqrt(2 * np.log(2))
    probability = 2.0 * (
        stats.norm.cdf(height_of_sample / 2.0 / beam_sd) - 0.5
    )
    return probability
def beamfrac ( FWHM , length , angle ) : height_of_sample = length * np . sin ( np . radians ( angle ) ) beam_sd = FWHM / 2 / np . sqrt ( 2 * np . log ( 2 ) ) probability = 2.0 * ( stats . norm . cdf ( height_of_sample / 2.0 / beam_sd ) - 0.5 ) return probability
Calculate the beam fraction intercepted by a sample.
Calculate the beam fraction intercepted by a sample .
"""
    Calculate the beam fraction intercepted by a sample.

    Parameters
    ----------
    FWHM: float
        The FWHM of the beam height
    length: float
        Length of the sample in mm
    angle: float
        Angle that the sample makes w.r.t the beam (degrees)

    Returns
    -------
    beamfrac: float
        The fraction of the beam that intercepts the sample
    """
FWHM
length
angle