GFM_StellarPhotometrics for all SNAPS

Elio Crisci

Hi everyone !

I’m trying to compute the GFM_StellarPhotometrics field — in particular mag_b — for each star particle at any snapshot in the same way as TNG does, using the BC03–based method described in this thread. I generate the table using the def makeStellarPhotometricsHDF5_BC03() function and then interpolate over it.
As a test case I’m using the subhalo with SubfindID = 10 at snapshot 99, but I can’t reproduce the same values stored in the TNG50 simulation.

My code:

import h5py
import numpy as np
from scipy.interpolate import RegularGridInterpolator
from scipy.interpolate import RectBivariateSpline
import illustris_python as il
import CosmoCal as CC
basePath = '../sims.TNG/TNG50-1/output/'
h = 0.6774

# ==========================
# load table BC03 
# ==========================
with h5py.File("stellar_photometrics.hdf5", "r") as f:

    logZ_grid   = f["LogMetallicity_bins"][:]  
    logAge_grid = f["LogAgeInGyr_bins"][:]     

    #  SSP mags_B normalized to 1 Msun 
    mag_B_grid  = f["Magnitude_B"][:]          

# ==========================
# Interpolator 2D  (logZ , logAge) -> mag_B
# ==========================
interp_B = RegularGridInterpolator((logZ_grid, logAge_grid), mag_B_grid, bounds_error=False, fill_value=None)


# ==========================
# Stars at Snap 99 for galaxy SubfindID = 10 

fieldsPart = ['Masses', 'GFM_StellarFormationTime','GFM_StellarPhotometrics','GFM_Metallicity','GFM_InitialMass']
subfindID=10
Snap=99

partSH=il.snapshot.loadSubhalo(basePath, Snap, subfindID , 'stars', fields=fieldsPart)

agea = partSH['GFM_StellarFormationTime']  
metals = partSH['GFM_Metallicity']
InitialMass = partSH['GFM_InitialMass']
magB = partSH['GFM_StellarPhotometrics'][:,1]
CurrentMass = partSH['Masses']

#clean wind particles (age <= 0)
indnowind = agea > 0.

agea = agea[indnowind]
metals = metals[indnowind]
InitialMass = InitialMass[indnowind]*1e10/h
CurrentMass = CurrentMass[indnowind]*1e10/h
magB = magB[indnowind]


print('TNG mags')
print(magB[:1])
print('Initial Mass , Initial Metallicity and scale factor')
print(InitialMass[:1],metals[:1],agea[:1])


# Age Universe at Snap 99, also return scale factor, redshift and lookback time for a given Snap
time = CC.get_time(snap = 99,)
ageU_at_snap = time[3]

# array of scale factor----> return age of Universe at that scale factor
time_stars = CC.AscaletoAgeU(agea)

#Age of stars at given Snap
age_stars = ageU_at_snap - time_stars

#preparing data from star for interpolation
logAge = np.log10(np.clip(age_stars, 1e-3, None))
logZ   = np.log10(np.clip(metals, 1e-5, None))

pts = np.column_stack((logZ,logAge))

# Interpolation
mag_B_ssp = interp_B(pts)

print('Mag for ssp  1 Msun')
print(mag_B_ssp[:1])

#mag_b for SSP of Inital Mass
mag_B = mag_B_ssp - 2.5*np.log10(InitialMass)

print('Interpolate mags')
print(mag_B[:1])

Below I show what I obtain for the first star particle.

Here are the relevant values

From TNG:

  • mags_b from TNG [-5.5265326]
  • initialMass, Initial Metallity, birth as scale factor :[76993.04] [0.05280386] [0.78129745]
  • log (Age/Gyr) and log Metallicity: [0.5228039] [-1.2773345]

From Interpolation with BC03 tables:

  • Mag_b for a ssp of 1 Msun [7.0779547]
  • Mags_b interpolated [-5.1381746]

So there is a difference of about 0.37 mag. At first I thought I might have made a mistake in the interpolation, but after trying alternative interpolation approaches I obtain very similar values.

To investigate further, I inspected the BC03 files. Since this star particle has GFM_Metallicity = 0.05280, I used the file named bc2003_hr_m72_chab_ssp.1color

The birth time corresponds to a scale factor of 0.78129745, i.e. an age of ≈ 3.33 Gyr → log(age/yr) ≈ 9.522.
In that file I find the following entry (excerpt of the table):

log-age-yr Mbol Umag Bmag Vmag Kmag 14-V 17-V 22-V 27-V U-J J-F F-N U-B B-V

5.100002 -2.8772 -0.6833 0.3679 0.6566 1.3966 -4.5563 -3.6206 -3.1758 -2.6092 -1.0391 -0.3117 -0.1551 -1.0512 -0.2887
5.150001 -2.9991 -0.7819 0.2755 0.5665 1.3176 -4.5817 -3.6441 -3.1956 -2.6256 -1.0455 -0.3136 -0.1566 -1.0575 -0.2910
5.199999 -2.9741 -0.7628 0.2934 0.5840 1.3329 -4.5763 -3.6391 -3.1915 -2.6222 -1.0442 -0.3133 -0.1563 -1.0562 -0.2906
9.439333 5.0906 7.3604 6.8300 5.9219 2.6505 4.6283 5.3888 4.8299 2.6821 0.7312 1.0448 0.7941 0.5304 0.9081
9.477121 5.1427 7.4901 6.9349 6.0081 2.6820 4.6099 5.3840 4.8911 2.7446 0.7596 1.0679 0.8173 0.5552 0.9267
9.511884 5.1969 7.6221 7.0407 6.0947 2.7182 4.5646 5.3463 4.9413 2.8092 0.7896 1.0913 0.8395 0.5815 0.9459
9.544068 5.2549 7.7600 7.1505 6.1849 2.7596 4.4979 5.2958 4.9789 2.8768 0.8215 1.1151 0.8616 0.6095 0.9656
9.574031 5.3107 7.8618 7.2402 6.2638 2.8049 4.4526 5.2525 4.9785 2.9070 0.8356 1.1296 0.8785 0.6216 0.9764

So, using the closest SSP value for 1 M_sun gives mag_b_ssp ≈ 7.0407, which seems to be consistent with my interpolating computed value.
I have also checked other star particles from the same galaxy and I observe similar discrepancies. I show you the first ten star particles for this galaxy:

TNG mags_b [-5.5265326, -5.2543945, -5.6814675, -5.740373, -4.3355055, -4.602944, -4.8916907, -4.712752, -5.628621, -4.5920005]

Mags_b interpolated [-5.1381746, -4.8484391, -5.27546944, -5.3343746, -3.83355231, -4.10609969, -4.39670906, -4.21544409, -5.17110325, -4.59200134]

What am I missing here? Could it be the interpolation, or perhaps the relation between the SSP magnitude and the magnitude scaled to the stellar particle mass?

#mag_b for SSP of Inital Mass
mag_B = mag_B_ssp - 2.5*np.log10(InitialMass)

Sorry for the long post, and thanks in advance for any help.

Best regards, and happy new year!

Dylan Nelson
  • 7 Jan

Why is the last value -4.592 (of the ten you posted) equal, while the rest are not?

  • Page 1 of 1