from scipy.stats import uniform, norm
from isochrones import get_ichrone
from isochrones.priors import ChabrierPrior, FehPrior, GaussianPrior, SalpeterPrior
from isochrones.populations import StarFormationHistory, StarPopulation, BinaryDistribution
mist = get_ichrone('mist')
sfh = StarFormationHistory() # Constant SFR for 10 Gyr; or, e.g., dist=norm(3, 0.2)
imf = SalpeterPrior(bounds=(0.4, 10)) # bounds on solar masses
binaries = BinaryDistribution(fB=0.4, gamma=0.3)
# feh = FehPrior(halo_fraction=0.2)
feh = GaussianPrior(-0.2, 0.2)
distance = 10 # pc (or this can be an isochrones.prior.Prior object, or anything with a "sample" method, really)
AV = 0. # Same rules as distance
pop = StarPopulation(mist, sfh=sfh, imf=imf, feh=feh, distance=distance, binary_distribution=binaries, AV=AV)
# df = pop.generate(1e3)
df = pop.generate(1e4)
mass_cols = [c for c in df.columns if 'mass' in c]
mag_cols = [c for c in df.columns if 'mag' in c]
df[mass_cols + mag_cols].describe()
/Users/tmorton/miniconda3/envs/isochrones-test/lib/python3.7/site-packages/numpy/lib/function_base.py:3949: RuntimeWarning: invalid value encountered in multiply x2 = take(ap, indices_above, axis=axis) * weights_above
mass | initial_mass | mass_B | J_mag | H_mag | K_mag | G_mag | BP_mag | RP_mag | W1_mag | ... | W1_mag_A | W1_mag_B | W2_mag_A | W2_mag_B | W3_mag_A | W3_mag_B | TESS_mag_A | TESS_mag_B | Kepler_mag_A | Kepler_mag_B | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
count | 10000.000000 | 10000.000000 | 3938.000000 | 9999.000000 | 9999.000000 | 9999.000000 | 9999.000000 | 9999.000000 | 9999.000000 | 9999.000000 | ... | 10000.000000 | 9999.000000 | 10000.000000 | 9999.000000 | 10000.000000 | 9999.000000 | 10000.000000 | 9999.000000 | 10000.000000 | 9999.000000 |
mean | 0.670888 | 0.670975 | 0.428296 | 5.339271 | 4.767139 | 4.645084 | 7.051012 | 7.724003 | 6.305132 | 4.585235 | ... | 4.714670 | inf | 4.706765 | inf | 4.624230 | inf | 6.387119 | inf | 7.071948 | inf |
std | 0.292004 | 0.292151 | 0.245443 | 1.460956 | 1.324058 | 1.268399 | 1.967236 | 2.233799 | 1.766639 | 1.236600 | ... | 1.232732 | NaN | 1.204002 | NaN | 1.175010 | NaN | 1.759946 | NaN | 1.981226 | NaN |
min | 0.399996 | 0.400000 | 0.101230 | -5.091975 | -6.054811 | -6.230790 | -2.808600 | -1.868095 | -3.734814 | -6.281676 | ... | -6.281676 | -0.102994 | -6.168032 | -0.088654 | -6.331509 | -0.066813 | -3.771154 | -0.376172 | -2.881644 | -0.459579 |
25% | 0.473648 | 0.473652 | 0.265326 | 4.474589 | 3.998677 | 3.936631 | 5.760916 | 6.173486 | 5.175456 | 3.912262 | ... | 4.059264 | 6.665550 | 4.095503 | 6.540160 | 4.037738 | 6.430966 | 5.255225 | 9.002746 | 5.738691 | 10.013641 |
50% | 0.586246 | 0.586269 | 0.378535 | 5.725333 | 5.031172 | 4.899170 | 7.612039 | 8.350696 | 6.794613 | 4.838975 | ... | 4.968868 | NaN | 4.997543 | NaN | 4.889936 | NaN | 6.891074 | NaN | 7.631786 | NaN |
75% | 0.780530 | 0.780567 | 0.525220 | 6.485865 | 5.808241 | 5.627971 | 8.648839 | 9.559601 | 7.726712 | 5.527412 | ... | 5.694469 | inf | 5.642365 | inf | 5.534702 | inf | 7.836016 | inf | 8.716225 | inf |
max | 6.111001 | 6.112195 | 3.643369 | 7.241765 | 6.599492 | 6.397824 | 10.380225 | 12.051508 | 9.196850 | 6.299183 | ... | 6.309124 | inf | 6.162478 | inf | 6.057223 | inf | 9.072022 | inf | 10.450276 | inf |
8 rows × 36 columns
import holoviews as hv
hv.extension('bokeh')
import hvplot.pandas
df['G-J'] = df.G_mag - df.J_mag
hover_cols = ['mass', 'age', 'radius']
options = dict(invert_yaxis=True)
hv.Layout([df.hvplot.scatter('G-J', 'G_mag', size=4, alpha=0.5, color='feh', cmap='viridis', hover_cols=hover_cols).options(**options),
df.hvplot.scatter('G-J', 'G_mag', size=4, alpha=0.5, color='age', cmap='viridis', hover_cols=hover_cols).options(**options)]).cols(1)