def constant_pressure_line(p):
    p = YTQuantity(p, 'dyn / cm**2')
    rho_list = []
    T_list = []
    e_list = np.linspace(-2, 3, 100)
    e_list = np.power(10, e_list)
    for e in e_list:
        e = YTQuantity(e, 'keV * cm**2')
        rho_list.append(calculate_density(e, p))
        T_list.append(calculate_temperature(e, p))
    return np.array(rho_list), np.array(T_list)
def constant_entropy_line(e):
    e = YTQuantity(e, 'keV * cm**2')
    rho_list = []
    T_list = []
    p_list = np.linspace(-15.5, -11, 100)
    p_list = np.power(10, p_list)
    for p in p_list:
        p = YTQuantity(p, 'dyn / cm**2')
        rho_list.append(calculate_density(e, p))
        T_list.append(calculate_temperature(e, p))
    return np.array(rho_list), np.array(T_list)
예제 #3
0
 def getGridInput(self, text):
     """Read out grid unit input and give feedback"""
     # reference unit
     fieldUnit = YTQuantity(1, "au").units
     from yt.units.unit_object import UnitParseError
     lineEdit = self.Misc_Dict["gridunit"]
     try:
         textUnit = YTQuantity(1, text).units
         if fieldUnit.same_dimensions_as(textUnit):
             lineEdit.turnTextBlack()
             newUnit = lineEdit.text()
         else:
             lineEdit.turnTextRed()
             newUnit = str(fieldUnit)
     except (UnitParseError, AttributeError, TypeError):
         lineEdit.turnTextRed()
         newUnit = str(fieldUnit)
     self.Config_Dict["Misc_gridunit"] = newUnit
예제 #4
0
def test_parse_value():
    t_yt = parse_value(YTQuantity(300.0, "ks"), "s")
    t_astropy = parse_value(Quantity(300.0, "ks"), "s")
    t_float = parse_value(300000.0, "s")
    t_tuple = parse_value((300.0, "ks"), "s")

    assert t_astropy == t_yt
    assert t_float == t_yt
    assert t_tuple == t_yt
def constant_rho_line(rho):
    rho = YTQuantity(rho, 'g/cm**3')
    p_list = []
    entropy_list = []
    T_list = np.linspace(3, 8, 100)
    T_list = np.power(10, T_list)
    for T in T_list:
        p_list.append(calculate_pressure(rho, T))
        entropy_list.append(calculate_entropy(rho, T))
    return np.array(p_list), np.array(entropy_list)