Example #1
0
def read(snapshot_number):
    _, path_to_catalogue = find_files()

    path_to_catalogue.replace(f'{xlargs.snapshot_number:04d}', f'{snapshot_number:04d}')

    vr_handle = velociraptor.load(path_to_catalogue)
    r500 = vr_handle.spherical_overdensities.r_500_rhocrit[0].to('Mpc').value
    xcminpot = vr_handle.positions.xcminpot[0].to('Mpc').value
    ycminpot = vr_handle.positions.ycminpot[0].to('Mpc').value
    zcminpot = vr_handle.positions.zcminpot[0].to('Mpc').value
    return r500, xcminpot, ycminpot, zcminpot
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
"""

import sys
import copy
import os
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import LogNorm

sys.path.append("..")

from scaling_relations import SliceGas
from register import default_output_directory, find_files, xlargs, set_mnras_stylesheet
from literature import Cosmology

s, c = find_files()
set_mnras_stylesheet()

centres = np.load(
    'map_centre_L0300N0564_VR18_-8res_MinimumDistance_fixedAGNdT8.5_Nheat1_alpha1p0.npy'
)

import matplotlib.offsetbox
from matplotlib.lines import Line2D


class AnchoredHScaleBar(matplotlib.offsetbox.AnchoredOffsetbox):
    """
    size: length of bar in data units
    extent : height of bar ends in axes units
    """