import math


def flux_ratio(meas_x, meas_y):
    """
    Calculate the flux ratio between two `heuslertools.mbe.flux_ratio.FluxMeasurement`s.
    The ratio is calculate with
    $$\\frac{J_X}{J_Y}=\\frac{BEP_X}{BEP_Y}\\cdot\\frac{\\eta_Y}{\\eta_X}\\cdot\\sqrt{\\frac{T_X M_Y}{T_Y M_X}}$$
    """
    return (meas_x.bep/meas_y.bep)*(meas_y.ionization_efficiency/meas_x.ionization_efficiency)*math.sqrt((meas_x.temperature*meas_y.mass)/(meas_y.temperature*meas_x.mass))