物理模型¶

BlackBody¶

$B{\nu}（T）=A\frac{2h\nu^{3}/c^{2}}{exp（h\nu/kt）-1}$

import numpy as np
import matplotlib.pyplot as plt

from astropy.modeling.models import BlackBody
import astropy.units as u

wavelengths = np.logspace(np.log10(1000), np.log10(3e4), num=1000) * u.AA

# blackbody parameters
temperature = 10000 * u.K

# BlackBody provides the results in ergs/(cm^2 Hz s sr) when scale has no units
bb = BlackBody(temperature=temperature, scale=10000.0)
bb_result = bb(wavelengths)

fig, ax = plt.subplots(ncols=1)
ax.plot(wavelengths, bb_result, '-')

ax.set_xscale('log')
ax.set_xlabel(fr"$\lambda$ [{wavelengths.unit}]")
ax.set_ylabel(fr"$F(\lambda)$ [{bb_result.unit}]")

plt.tight_layout()
plt.show()


(png _, svgpdf

德鲁德1D¶

$D（x）=A\frac{（f/x_0）^2}{（（x/x_0-x 0/x）^2+（f/x_0）^2}$

import numpy as np
import matplotlib.pyplot as plt

from astropy.modeling.models import Drude1D
import astropy.units as u

wavelengths = np.linspace(1000, 4000, num=1000) * u.AA

# Parameters and model
mod = Drude1D(amplitude=1.0, x_0=2175. * u.AA, fwhm=400. * u.AA)
mod_result = mod(wavelengths)

fig, ax = plt.subplots(ncols=1)
ax.plot(wavelengths, mod_result, '-')

ax.set_xlabel(fr"$\lambda$ [{wavelengths.unit}]")
ax.set_ylabel(r"$D(\lambda)$")

plt.tight_layout()
plt.show()


(png _, svgpdf

NFW¶

$\rho（r）=\frac{\delta_c\rho{c}{r/r\u s（1+r/r\u s）^2}$

mass ：剖面的质量（如果未提供单位，则以太阳质量为单位）

concentration ：剖面浓度

redshift ：外形的红移

massfactor ：指定过敏感类型和因子的元组或字符串（默认值为“临界”，200））

cosmo ：用于密度计算的宇宙学（默认默认值_宇宙学）

mass = $$2.0 x 10^{15} M_{sun}$$

concentration =8.5

redshift =0.63

import numpy as np
import matplotlib.pyplot as plt
from astropy.modeling.models import NFW
import astropy.units as u
from astropy import cosmology

# NFW Parameters
mass = u.Quantity(2.0E15, u.M_sun)
concentration = 8.5
redshift = 0.63
cosmo = cosmology.Planck15
massfactor = ("critical", 200)

# Create NFW Object
n = NFW(mass=mass, concentration=concentration, redshift=redshift, cosmo=cosmo,
massfactor=massfactor)

# Plot creation
fig, ax = plt.subplots(2)
fig.suptitle('1 Dimensional NFW Profile')

# Density profile subplot
ax[0].set_yscale('log')
ax[0].set_xlabel(fr"$r$ [{radii.unit}]")
ax[0].set_ylabel(fr"$\rho$ [{n_result.unit}]")

# Create scaled density / scaled radius subplot
# NFW Object
n = NFW(mass=mass, concentration=concentration, redshift=redshift, cosmo=cosmo,
massfactor=massfactor)

radii = np.logspace(np.log10(1e-5), np.log10(2), num=1000) * u.Mpc

# Scaled density / scaled radius subplot
ax[1].set_xscale('log')
ax[1].set_yscale('log')
ax[1].set_xlabel(r"$r / r_s$")
ax[1].set_ylabel(r"$\rho / \rho_s$")

# Display plot
plt.tight_layout(rect=[0, 0.03, 1, 0.95])
plt.show()


(png _, svgpdf

$v{circ}（r）^2=\frac{1}{x}\frac{\ln（1+cx）-（cx）/（1+cx）}{\ln（1+c）-c/（1+c）}$

mass = $$2.0 x 10^{15} M_{sun}$$

concentration =8.5

redshift =0.63

“最大圆速度”和“最大圆速度半径”作为属性可用 v_maxr_max .

import matplotlib.pyplot as plt
from astropy.modeling.models import NFW
import astropy.units as u
from astropy import cosmology

# NFW Parameters
mass = u.Quantity(2.0E15, u.M_sun)
concentration = 8.5
redshift = 0.63
cosmo = cosmology.Planck15
massfactor = ("critical", 200)

# Create NFW Object
n = NFW(mass=mass, concentration=concentration, redshift=redshift, cosmo=cosmo,
massfactor=massfactor)

# NFW circular velocity distribution

# Plot creation
fig,ax = plt.subplots()
ax.set_title('NFW Profile Circular Velocity')
ax.set_xlabel(fr"$r$ [{radii.unit}]")
ax.set_ylabel(r"$v_{circ}$" + f" [{n_result.unit}]")