<jupyter_start><jupyter_text>Interpolate Isochrones for PraesepeInstead of interpolating boundary condition tables and computing a new set of models, we can interpolate between two metallicities to calculate new isochrones for Praesepe at metallicities between [Fe/H] = 0.00 and 0.20.Load required libraries.<jupyter_code>%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np<jupyter_output><empty_output><jupyter_text>Read in isochrone files.<jupyter_code>iso_zp00 = np.genfromtxt('data/dmestar_00600.0myr_z+0.00_a+0.00_marcs.iso')
iso_zp20 = np.genfromtxt('data/dmestar_00600.0myr_z+0.20_a+0.00_marcs.iso')<jupyter_output><empty_output><jupyter_text>Check to confirm that isochrones are equal in length.<jupyter_code>len(iso_zp00) == len(iso_zp20)<jupyter_output><empty_output><jupyter_text>This is related to the fact that it was difficult to get models to converge at high metallicity below 0.26 Msun. Trimming the isochrones to be the same length.<jupyter_code>def trimIsochrone(isochrone):
    bools = [0.26 <= x[0] <= 1.61 for x in isochrone]
    return np.compress(bools, isochrone, axis=0)
iso_zp00_trim = trimIsochrone(iso_zp00)
iso_zp20_trim = trimIsochrone(iso_zp20)<jupyter_output><empty_output><jupyter_text>Again, check to confirm lengths are equal.<jupyter_code>len(iso_zp00_trim) == len(iso_zp20_trim)<jupyter_output><empty_output><jupyter_text>Now confirm that the mass resolution is equal for both isochrones.<jupyter_code>for i, line in enumerate(iso_zp00_trim):
    if line[0] != iso_zp20_trim[i, 0]:
        raise ValueError('Masses are not equal between the two isochrones in row {:4.0f}.'.format(i))
        break
    else:
        pass<jupyter_output><empty_output><jupyter_text>It appears that the masses at each point along the isochrones are equal. Now we may interpolate using a simple linear interpolation. Start by defining an interpolation routine.<jupyter_code>def isoLinInterp(FeH):
    return iso_zp00_trim[:, 0:6] + (iso_zp20_trim[:, 0:6] - iso_zp00_trim[:, 0:6])*(FeH - 0.0)/0.20<jupyter_output><empty_output><jupyter_text>and then interpolating at two intermediate points.<jupyter_code>iso_zp10 = isoLinInterp(0.10)
iso_zp15 = isoLinInterp(0.15)<jupyter_output><empty_output><jupyter_text>These should now be intermediate between the original two isochrones. Note that we've only interpolate fundamental properties, and not photometric magnitudes. These can be added separately as interpolating magnitudes in the isochrone may not be as accurate as interpolating bolometric corrections from the original data tables.<jupyter_code>fig, ax = plt.subplots(1, 3, figsize=(12., 8.), sharex=True)

ax[0].set_xlim(8000., 3000.)

ax[0].plot(10**iso_zp00_trim[:,1], iso_zp00_trim[:,3], '-', lw=2, c='#555555')
ax[0].plot(10**iso_zp20_trim[:,1], iso_zp20_trim[:,3], '-', lw=2, c='#222222')
ax[0].plot(10**iso_zp10[:,1], iso_zp10[:,3], '-', lw=2, c='#b22222')
ax[0].plot(10**iso_zp15[:,1], iso_zp15[:,3], '-', lw=2, c='#0094b2')

ax[1].plot(10**iso_zp00_trim[:,1], iso_zp00_trim[:,2], '-', lw=2, c='#555555')
ax[1].plot(10**iso_zp20_trim[:,1], iso_zp20_trim[:,2], '-', lw=2, c='#222222')
ax[1].plot(10**iso_zp10[:,1], iso_zp10[:,2], '-', lw=2, c='#b22222')
ax[1].plot(10**iso_zp15[:,1], iso_zp15[:,2], '-', lw=2, c='#0094b2')

ax[2].plot(10**iso_zp00_trim[:,1], iso_zp00_trim[:,4], '-', lw=2, c='#555555')
ax[2].plot(10**iso_zp20_trim[:,1], iso_zp20_trim[:,4], '-', lw=2, c='#222222')
ax[2].plot(10**iso_zp10[:,1], iso_zp10[:,4], '-', lw=2, c='#b22222')
ax[2].plot(10**iso_zp15[:,1], iso_zp15[:,4], '-', lw=2, c='#0094b2')<jupyter_output><empty_output><jupyter_text>The tracks shift as they should, so the interpolation worked! Now, we can save the new isochrones and compute colors for them separately.<jupyter_code>np.savetxt('data/dmestar_00600.0myr_z+0.10_a+0.00_marcs.iso', iso_zp10, fmt='%14.8f')
np.savetxt('data/dmestar_00600.0myr_z+0.15_a+0.00_marcs.iso', iso_zp15, fmt='%14.8f')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15778843726331734, 'fraction_numerical': 0.08331229487503156, 'mean_word_length': 7.152263374485597, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '556094', 'license': 'MIT', 'n_tokens_mistral': 1786, 'n_tokens_neox': 1614, 'n_words': 319, 'path': 'Projects/pleiades_colors/isochrone_interp.ipynb', 'repo_name': 'gfeiden/Notebook', 'size': '3961'}