Calculating deprojected Sérsic profiles
The class DeprojSersicModel
is used to compute profiles for the deprojected Sérsic mass distributions.
First, we initialize an instance of DeprojSersicModel
, and define a radius array.
[1]:
import numpy as np
import deprojected_sersic_models as deproj_sersic
# Define a radius array
R = np.arange(0., 10.5, 0.5)
# Deprojected Sérsic mass distribution object
smodel = deproj_sersic.DeprojSersicModel(total_mass=1.e11, Reff=5., n=1., q=0.2)
Individual profiles
A number of methods are available to compute the various profiles of this mass distribution.
Circular velocity
[2]:
vcirc = smodel.v_circ(R)
# Make pseudo table for plotting
table_gather = {'R': R, 'vcirc': vcirc, 'n': smodel.n, 'q': smodel.q, 'invq': smodel.invq,
'total_mass': smodel.total_mass, 'Reff': smodel.Reff}
# Plot profile
%config InlineBackend.figure_format = 'svg' # Tutorial plot configuration
deproj_sersic.plot.plot_profiles_single_type(table_gather, prof_name='v_circ',
fig_kwargs={'figsize': (4., 8./9.*4.)})
Enclosed mass (in 3D sphere)
[3]:
menc = smodel.enclosed_mass(R)
# Make pseudo table for plotting
table_gather = {'R': R, 'menc3D_sph': menc, 'n': smodel.n, 'q': smodel.q, 'invq': smodel.invq,
'total_mass': smodel.total_mass, 'Reff': smodel.Reff}
# Plot profile
deproj_sersic.plot.plot_profiles_single_type(table_gather, prof_name='enclosed_mass',
fig_kwargs={'figsize': (4., 8./9.*4.)})
Mass density
[4]:
rho = smodel.density(R)
# Make pseudo table for plotting
table_gather = {'R': R, 'rho': rho, 'n': smodel.n, 'q': smodel.q, 'invq': smodel.invq,
'total_mass': smodel.total_mass, 'Reff': smodel.Reff}
# Plot profile
deproj_sersic.plot.plot_profiles_single_type(table_gather, prof_name='density',
fig_kwargs={'figsize': (4., 8./9.*4.)})
Log density slope
[5]:
# Log density slope
dlnrho_dlnR = smodel.dlnrho_dlnR(R)
# Make pseudo table for plotting
table_gather = {'R': R, 'dlnrho_dlnR': dlnrho_dlnR, 'n': smodel.n,
'q': smodel.q, 'invq': smodel.invq,
'total_mass': smodel.total_mass, 'Reff': smodel.Reff}
# Plot profile
deproj_sersic.plot.plot_profiles_single_type(table_gather, prof_name='dlnrho_dlnR',
fig_kwargs={'figure_figsize': (4., 8./9.*4.)})
Projected mass surface density (i.e., 2D Sérsic distribution)
[6]:
surfdens = smodel.surface_density(R)
# Make pseudo table for plotting
table_gather = {'R': R, 'surface_density': surfdens, 'n': smodel.n,
'q': smodel.q, 'invq': smodel.invq,
'total_mass': smodel.total_mass, 'Reff': smodel.Reff}
# Plot profile
deproj_sersic.plot.plot_profiles_single_type(table_gather, prof_name='surface_density',
fig_kwargs={'figsize': (4., 8./9.*4.)})
Projected enclosed (in ellipses; i.e., 2D Sérsic curve-of-growth)
[7]:
menc_2D = smodel.projected_enclosed_mass(R)
# Make pseudo table for plotting
table_gather = {'R': R, 'projected_enclosed_mass': menc_2D, 'n': smodel.n,
'q': smodel.q, 'invq': smodel.invq,
'total_mass': smodel.total_mass, 'Reff': smodel.Reff}
# Plot profile
deproj_sersic.plot.plot_profiles_single_type(table_gather, prof_name='projected_enclosed_mass',
fig_kwargs={'figure_figsize': (4., 8./9.*4.)})
Table of profiles
Finally, the method DeprojSersicModel.profile_table(R)
can be used to return a full set of profiles calculated over the radius array \(r\).
[8]:
table = smodel.profile_table(R)
# Plot profiles
deproj_sersic.plot.plot_profiles(table)
This procedure can be used to either recreate the pre-computed tables, or to compute profiles for values of n
and q
that are not already available.
In particular, this procedure can be scripted to compute new saved tables. This is easily accomplished with the combination of DeprojSersicModel.profile_table()
and deprojected_sersic_models.io.save_profile_table()
.
An example of such a scripting approach can be seen in the functions in deprojected_sersic_models.table_generation.py