def display_single_halo(self, *args, **kwargs): # Get entropy profile entropy_profile_obj = EntropyProfiles( max_radius_r500=self.max_radius_r500, simple_electron_number_density=self.simple_electron_number_density, weighting=self.weighting, shell_average=self.shell_average ) _, entropy_profile, K500 = entropy_profile_obj.process_single_halo(*args, **kwargs) entropy_profile /= K500 radial_bin_centres, cumulative_gas_mass_profile, cumulative_mass_profile, m500fb = self.process_single_halo(*args, **kwargs) gas_fraction_enclosed = cumulative_gas_mass_profile / m500fb if xlargs.debug: print('fb', self.fb) print('radial_bin_centres/r500', repr(radial_bin_centres)) print('entropy_profile/K500', repr(entropy_profile)) print('gas_fraction_enclosed', repr(gas_fraction_enclosed)) set_mnras_stylesheet() fig, axes = plt.subplots(constrained_layout=True) axes.plot( gas_fraction_enclosed, entropy_profile, linestyle='-', color='r', linewidth=1, alpha=1, ) axes.set_xscale('linear') axes.set_yscale('linear') axes.set_ylabel(r'$K/K_{500}$') axes.set_xlabel(r'$f_{\rm gas}(<r)/f_b = M_{\rm gas} / (M_{500}\ f_b)$') axes.set_ylim([0, 2]) axes.set_xlim([0, 1]) fig.suptitle( ( f"{os.path.basename(xlargs.run_directory)}\n" f"Central FoF group only\t\tEstimator: {xlargs.mass_estimator}" ), fontsize=5 ) if not xlargs.quiet: plt.show() plt.close()
import sys import os.path from matplotlib import pyplot as plt import numpy as np from unyt import Solar_Mass import traceback sys.path.append("..") from scaling_relations import EntropyFgasSpace, EntropyProfiles from register import find_files, set_mnras_stylesheet, xlargs, default_output_directory from literature import Sun2009, Pratt2010, Croston2008, Cosmology snap, cat = find_files() kwargs = dict(path_to_snap=snap, path_to_catalogue=cat) set_mnras_stylesheet() try: cosmology = Cosmology() gas_profile_obj = EntropyFgasSpace(max_radius_r500=1.) radial_bin_centres, cumulative_gas_mass_profile, cumulative_mass_profile, m500fb = gas_profile_obj.process_single_halo( **kwargs) entropy_profile_obj = EntropyProfiles(max_radius_r500=1) _, entropy_profile, K500 = entropy_profile_obj.process_single_halo( **kwargs) entropy_profile /= K500 gas_fraction_enclosed = cumulative_gas_mass_profile / m500fb