#!/usr/bin/env python3 # # Weitian LI # Created: 2016-06-24 # Updated: 2016-06-25 # # Change logs: # 2016-06-25: # * Rename method 'interpolate()' to 'fit_spline()' # * Use 'InterpolatedUnivariateSpline' instead of 'interp1d' # * Implement 'calc_mass_total()' # * Update documentation # 2016-06-24: # * Update method 'gen_radius()' # """ Calculate the (gas and gravitational) mass profile and gravitational potential profile from the electron number density profile, under the assumption of hydrostatic equilibrium. The electron density profile and temperature profile are required. Assuming that the gas is in hydrostatic equilibrium with the gravitational potential and a spherically-symmetric distribution of the gas, we can write the hydrostatic equilibrium equation (HEE) of the ICM as (ref.[1], eq.(6)): derivative(P_gas, r) / rho_gas = - derivative(phi, r) = - G M_tot( # electron density profile ne_profile = ne_profile.txt # cooling function profile cf_profile = coolfunc_profile.txt # unit of the CF profile radius (default: pixel) cf_unit = "pixel" # temperature profile t_profile = t_profile.txt # unit of the T profile radius (default: pixel) t_unit = "pixel" # number of data points for the output profile calculation num_dp = 1000 # output gas mass profile m_gas_profile = mass_gas_profile.txt # output total (gravitational) mass profile m_total_profile = mass_total_profile.txt # output gravitational potential profile potential_profile = potential_profile.txt ------------------------------------------------------------ """ import argparse import numpy as np import astropy.units as au import astropy.constants as ac import scipy.interpolate as interpolate import scipy.integrate as integrate from scipy.misc import derivative from configobj import ConfigObj from astro_params import AstroParams, ChandraPixel from projection import Projection class DensityProfile: """ Utilize the 3D (electron number or gas mass) density profile to calculate the following quantities: * 2D projected surface brightness (requires cooling function profile) * gas mass profile (integrated, M_gas(