Conversation
ionized maps class
-Functions take values instead of indexes -Added interpolators -Added Rmin and ZMAX
- Removed enforce_BMF_scale, allowing user to pick any box size and resolution, but forcing smoothing Rs. - Allow input Rs but comes with a warning. - Using linear barrier by default (uses new functions from reionization.py). - Updated partial ionizations, and added their massweightings. - Small fixes.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27 +/- ##
==========================================
+ Coverage 73.11% 74.27% +1.16%
==========================================
Files 9 11 +2
Lines 1700 2220 +520
==========================================
+ Hits 1243 1649 +406
- Misses 457 571 +114
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
JulianBMunoz
left a comment
There was a problem hiding this comment.
Great job Yonny and Emilie! This looks like pro coding. There are some physics questions in the comments (plus the slack). There are also some suggestions for docs, and also for optimization. Let's discuss it, but you can start working on it in the meantime
| numexpr | ||
| astropy No newline at end of file | ||
| astropy | ||
| tqdm |
| @@ -128,6 +132,9 @@ def test_background(): | |||
|
|
|||
| assert( (Coeffs.gamma_index2D >= 0.0).all()) #effective biases have to be larger than 0 in reasonable models, since galaxies live in haloes that are more clustered than average matter (in other words, SFRD grows monotonically with density) | |||
There was a problem hiding this comment.
what about an assert like this for the gamma_nion and gamma2 indices? Not sure if they have to always be positive, but at least that they're not nan
| from scipy.interpolate import interp1d | ||
| from scipy.interpolate import InterpolatedUnivariateSpline as spline | ||
| from pyfftw import empty_aligned as empty | ||
| from tqdm import trange |
| from scipy.interpolate import InterpolatedUnivariateSpline as spline | ||
| from pyfftw import empty_aligned as empty | ||
| from tqdm import trange | ||
| import time |
zeus21/maps.py
Outdated
| """ | ||
|
|
||
| #Measure time elapsed from start | ||
| start_time = time.time() |
| idx.append((np.abs(array - values[i])).argmin()) | ||
| return np.unique(idx) | ||
|
|
||
| def print_timer(start_time, text_before="", text_after=""): |
| SFRD_II_dR = np.trapz(integrand_II, HMF_interpolator.logtabMh, axis = 2) | ||
| # Compute SFRD and niondot quantities | ||
| SFRD_II_dR = np.trapezoid(integrand_II, HMF_interpolator.logtabMh, axis = 2) | ||
| niondot_II_dR = np.trapezoid(integrand_II*fesctab_II[None, None, :, None], HMF_interpolator.logtabMh, axis = 2) |
There was a problem hiding this comment.
isnt there an ionizing efficiency here? generically it could depend on Mh so let's bring it here if it was elsewhere
| self.gamma_II_index2D = np.log(SFRD_II_dR[:,:,-1]/SFRD_II_dR[:,:,0]) / (deltaArray[:,:,0,-1] - deltaArray[:,:,0,0]) | ||
| midpoint = deltaArray.shape[-1]//2 #midpoint of deltaArray at delta = 0 | ||
|
|
||
| self.gamma_II_index2D = np.log(SFRD_II_dR[:,:,midpoint+1]/SFRD_II_dR[:,:,midpoint-1]) / (deltaArray[:,:,0,midpoint+1] - deltaArray[:,:,0,midpoint-1]) |
There was a problem hiding this comment.
since we repeat this (and the 2nd derivative) a lot, is it worth functionalizing? take array, deltarray, midpoint, and return everything
|
|
||
| self.niondot_avg_II = Astro_Parameters.N_ion_perbaryon_II/cosmology.rho_baryon(Cosmo_Parameters,0.) * np.trapz(integrand_II_table * fesctab_II, HMF_interpolator.logtabMh, axis = 1) | ||
| self.niondot_avg_III = Astro_Parameters.N_ion_perbaryon_II/cosmology.rho_baryon(Cosmo_Parameters,0.) * np.trapz(integrand_III_table * fesctab_III, HMF_interpolator.logtabMh, axis = 1) | ||
| self.niondot_avg_II = Astro_Parameters.N_ion_perbaryon_II/cosmology.rho_baryon(Cosmo_Parameters,0.) * np.trapezoid(integrand_II_table * fesctab_II, HMF_interpolator.logtabMh, axis = 1) |
There was a problem hiding this comment.
let's discuss this, I'd prefer to parametrize this through xiion directly in nion. That said, I'm confused why this is repeated w.r.t. above
Fixed single-z map computation by precomputing partial ionizations as a function of density in reionization.py Allowed extrapolation of small R values in partial ionizations. This lets the user make more highly resolved maps than before.
maps.py: density array used for partial ionizations and massweighting now the density field smoothed by the pixel scale. reionization.py: minor tweaks for self-consistency
Maps: - Added mass variance correction to account for lack of ergodicity in smaller simulations - Fixed partial ionization computation accounting for this sigma correction. Bubbles: - Changed all interpolators to allow for linear extrapolation - Added new moving pivot for linear barrier to account for the typical bubble size changing at different redshifts. Now the typical bubbles are the ones best approximated in the linear barrier. - Now computing the ionized fraction from the analytic solution to the integral of the BMF. This accounts for contribution from bubbles outside the set radius range rather than integrating numerically. - Increased tolerance for wiggle between iterations of the BMF.
densities in reionization_maps, and delete_class_attributes to z21_utilities. Removed density_allz from partials in reionization_maps. Created astro_variations class in reionization_maps. Changed CosmoParams.Rsmmin to 0.05.
reionization_maps.
+ increase kmax in test_correlations + remove classy.class from cosmo_wrapper
Bubble mass function, barriers, iterations, and ionized maps.