Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidal truncation du #63

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions example_notebooks/custom_mass_concentration_relations.ipynb

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion pyHalo/Halos/HaloModels/TNFW.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pyHalo.Halos.halo_base import Halo
import numpy as np
from pyHalo.Halos.tnfw_halo_util import tnfw_mass_fraction

from scipy.integrate import quad

class TNFWFieldHalo(Halo):

Expand Down Expand Up @@ -99,6 +99,7 @@ def profile_args(self):

if not hasattr(self, '_profile_args'):
truncation_radius_kpc = self._truncation_class.truncation_radius_halo(self)

self._profile_args = (self.c, truncation_radius_kpc)
return self._profile_args

Expand Down
19 changes: 12 additions & 7 deletions pyHalo/Halos/galacticus_truncation/interp_mass_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,28 +80,33 @@ class InterpGalacticus(object):
def __init__(self):
from pyHalo.Halos.galacticus_truncation.johnsonSUparams import a_fit, \
b_fit
log10c_values = np.linspace(np.log10(2.0), np.log10(384), 25)
t_inf_values = np.linspace(0.0, 8.1, 25)
a_values = np.array(a_fit).reshape(25, 25)
b_values = np.array(b_fit).reshape(25, 25)
_points = (t_inf_values, log10c_values)
log10c_values = np.linspace(np.log10(2.0), np.log10(384), 10)
t_inf_values = np.linspace(0.0, 8.1, 10)
chost_values = np.linspace(3.0, 9.0, 10)
a_values = np.array(a_fit).reshape(10, 10, 10)
b_values = np.array(b_fit).reshape(10, 10, 10)
_points = (t_inf_values, log10c_values, chost_values)
self._a_interp = RegularGridInterpolator(_points, a_values, bounds_error=False,
fill_value=None)
self._b_interp = RegularGridInterpolator(_points, b_values, bounds_error=False,
fill_value=None)

def __call__(self, log10_concentration_infall, time_since_infall):
def __call__(self, log10_concentration_infall, time_since_infall, chost):
"""
Evaluates the prediction from galacticus for subhalo bound mass
:param log10_concentration_infall: log10(c) where c is the halo concentration at infall
:param time_since_infall: the time ellapsed since infall and the deflector redshift
:param chost: host halo concentration at z=0.5
:return: the log10(bound mass divided by the infall mass), plus scatter
"""
log10_concentration_infall = max(np.log10(2), log10_concentration_infall)
log10_concentration_infall = min(np.log10(384), log10_concentration_infall)
time_since_infall = max(0.0, time_since_infall)
time_since_infall = min(time_since_infall, 8.1)
p = (time_since_infall, log10_concentration_infall)
#chost = max(3.0, chost)
chost = max(6.0, chost) # we're getting some unphysical behavior at chost = 3.0
chost = min(9.0, chost)
p = (time_since_infall, log10_concentration_infall, chost)
a, b = self._a_interp(p), self._b_interp(p)
output = float(johnsonsu.rvs(a, b))
return output
5 changes: 3 additions & 2 deletions pyHalo/Halos/galacticus_truncation/johnsonSUparams.py

Large diffs are not rendered by default.

Loading
Loading