-
Notifications
You must be signed in to change notification settings - Fork 16
Implement max sfr physical #40
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
Changes from all commits
45c9011
84df2d1
1d37a33
a22b5f8
33d2d9c
3e643ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,10 +80,27 @@ def UVLF_binned(Astro_Parameters,Cosmo_Parameters,HMF_interpolator, zcenter, zwi | |
|
|
||
| xhi = np.subtract.outer(MUVcuthi, currMUV)/(np.sqrt(2) * sigmaUV) | ||
| xlo = np.subtract.outer(MUVcutlo, currMUV )/(np.sqrt(2) * sigmaUV) | ||
| weights = (erf(xhi) - erf(xlo)).T/(2.0 * MUVwidths) | ||
|
|
||
| if (Astro_Parameters.min_t_formation_Myr == None): | ||
| min_MUV = -100.0 # essentially no cutoff, since the scatter is large at low masses and can cause numerical issues if we try to integrate over unphysically bright galaxies there. This is just a numerical cutoff, not a physical one, and the exact value doesn't matter much since the scatter is large there anyway. | ||
| else: | ||
| Mstarmax = HMF_interpolator.Mhtab * Cosmo_Parameters.OmegaB /Cosmo_Parameters.OmegaM #max stellar mass in each halo, if all baryons turned to stars | ||
| _tmaxSFR = Astro_Parameters.min_t_formation_Myr * 1e6 #arbitrary timescale to determine max SFR in yrs | ||
| SFRmax = Mstarmax / (_tmaxSFR) | ||
| min_MUV = MUV_of_SFR(SFRmax, Astro_Parameters._kappaUV) #min MUV in each halo, if all baryons turned to stars at max SFR for 10 Myr. This is a very rough cutoff to avoid unphysically small MUVs (bright galaxies) at low masses, which can cause numerical issues since the scatter is large there. It's not a physical cutoff, just a numerical one. The exact value doesn't matter much since the scatter is large there anyway, but it prevents the code from trying to integrate over unphysically bright galaxies in low-mass halos. | ||
| x_min = (min_MUV - currMUV)/(np.sqrt(2) * sigmaUV) | ||
| xhi_cut = np.fmax(xhi, x_min) | ||
| xlo_cut = np.fmax(xlo, x_min) | ||
|
|
||
| weights_unnormalized = (erf(xhi_cut) - erf(xlo_cut)).T/(2.0 * MUVwidths) | ||
| weights = weights_unnormalized/ (0.5*(1-erf(x_min)+1e-6))[:,None] # Renormalize distributions based on the portion cut off by min_MUV | ||
|
|
||
| ### Standard as usual, no cuts: | ||
| # weights = (erf(xhi) - erf(xlo)).T/(2.0 * MUVwidths) #comment to myself, this 2 in denominator is correct here, nothing to do with the MUVwidths/2 a few lines above | ||
|
|
||
| UVLF_filtered = np.trapezoid(weights.T * HMFcurr, HMF_interpolator.Mhtab, axis=-1) | ||
|
Comment on lines
+84
to
101
|
||
|
|
||
|
|
||
| if(Astro_Parameters.USE_POPIII==False): | ||
| return UVLF_filtered | ||
| else: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new branch is described in the PR as a physicality cutoff based on a minimum formation time, but the in-line comments say this is “not a physical cutoff, just a numerical one”. This is contradictory and makes it unclear how
min_t_formation_Myris intended to be interpreted; please align the comments (and/or parameter naming) with the actual intended behavior.