From 654a0540d0824d4dfc9f8e751bab69655638bd9f Mon Sep 17 00:00:00 2001 From: Michael Tremmel Date: Fri, 20 Jun 2025 08:38:52 -0400 Subject: [PATCH] force pynbody to load in metal data to avoid issue with server modes for calculating properties. Previously metals, FeMassFrac, and OxMassFrac would not be recognized by default as possible profiles before explicitly loaded in (i.e. halo.g['metals']) --- properties.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/properties.py b/properties.py index 04ae4e7..f1a559f 100644 --- a/properties.py +++ b/properties.py @@ -61,6 +61,13 @@ def plot_ylabel(self): return r"Mass Flux $(M_\odot yr^{-1})$" def _get_profile(self, halo, maxrad): + halo.g['metals'] + halo.s['metals'] + halo.g['FeMassFrac'] + halo.s['FeMassFrac'] + halo.g['OxMassFrac'] + halo.s['OxMassFrac'] + delta = self.plot_xdelta() nbins = int(0.9*maxrad / delta) maxrad = 0.1*maxrad + delta * nbins @@ -187,6 +194,12 @@ def _get_profile(self, halo, maxrad): ox_pro_g = None ox_pro_s = None + halo.g['metals'] + halo.s['metals'] + halo.g['FeMassFrac'] + halo.s['FeMassFrac'] + halo.g['OxMassFrac'] + halo.s['OxMassFrac'] if len(halo.g)>10: pro_g = pynbody.analysis.profile.Profile(halo.g, type='lin', ndim=3, min=0, max=maxrad, nbins=nbins, weight='mass') @@ -228,6 +241,13 @@ def _get_profile(self, halo, maxrad): fe_pro = None ox_pro = None + halo.g['metals'] + halo.s['metals'] + halo.g['FeMassFrac'] + halo.s['FeMassFrac'] + halo.g['OxMassFrac'] + halo.s['OxMassFrac'] + if len(halo)>10: if 'massHot' in halo.loadable_keys(): twophase = pynbody.filt.HighPass('massHot', 0) @@ -744,4 +764,4 @@ def calculate(self, halo, properties): mdot_grid_sum, _ = np.histogram(t_orbit[order],weights=Mdot_orbit[order],bins=nbins,range=(0,grid_tmax_Gyr)) mdot_grid_ave = mdot_grid_sum/mdot_grid_n - return mdot_grid_ave[self.store_slice(t_max)] \ No newline at end of file + return mdot_grid_ave[self.store_slice(t_max)]