def beta(T: u.K, n: u.m**-3, B: u.T): """ The ratio of thermal pressure to magnetic pressure. Parameters ---------- T : ~astropy.units.Quantity The temperature of the plasma. n : ~astropy.units.Quantity The particle density of the plasma. B : ~astropy.units.Quantity The magnetic field in the plasma. Examples -------- >>> import astropy.units as u >>> beta(1*u.eV, 1e20*u.m**-3, 1*u.T) <Quantity 4.02670904e-05> >>> beta(8.8e3*u.eV, 1e20*u.m**-3, 5.3*u.T) <Quantity 0.01261482> Returns ------- beta: ~astropy.units.Quantity Dimensionless quantity. """ thermal_pressure = parameters.thermal_pressure(T, n) magnetic_pressure = parameters.magnetic_pressure(B) return thermal_pressure / magnetic_pressure
def time_thermal_pressure(self): thermal_pressure(1*u.eV, 1e20/u.m**3)
def test_thermal_pressure(): assert thermal_pressure(T_e, n_i).unit.is_equivalent(u.Pa) # TODO: may be array issues with arg "mass" assert_can_handle_nparray(thermal_pressure)
def test_thermal_pressure(): assert thermal_pressure(T_e, n_i).unit.is_equivalent(u.Pa)