Note
Go to the end to download the full example code.
Gaia colour-magnitude diagram#
Beware - extra dependencies required here!
You’ll need to have installed the extra dependencies of cogsworth
to estimate source photometry. Check out the installation page for more details on how to do this!
A colour-magnitude diagram using simulated photometry for Gaia.
Each point represents a star in the population, coloured by its stellar type. Circles are used for bound binaries, and triangles for unbound binaries (upwards indicating the primary star, downwards indicating the secondary star).

Run for 2000 binaries
Ended up with 2657 binaries with m1 > 0 solar masses
[2e-02s] Sample initial binaries
[6.1s] Evolve binaries (run COSMIC)
[79.1s] Get orbits (run gala)
Overall: 85.2s
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:82: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
return pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/isochrones/bc.py:109: FutureWarning: Starting with pandas version 3.0 all arguments of to_hdf except for the argument 'path_or_buf' will be keyword-only.
df.to_hdf(hdf_filename, "df")
/home/docs/checkouts/readthedocs.org/user_builds/cogsworth/envs/latest/lib/python3.10/site-packages/tables/attributeset.py:462: NaturalNameWarning: object name is not a valid Python identifier: 'axis1_name[Fe/H]'; it does not match the pattern ``^[a-zA-Z_][a-zA-Z0-9_]*$``; you will not be able to use natural naming to access this object; using ``getattr()`` will still work, though
check_attribute_name(name)
import cogsworth
import matplotlib.pyplot as plt
p = cogsworth.pop.Population(2000, processes=1, BSE_settings={"binfrac": 1.0})
p.create_population()
p.get_observables(filters=["G", "BP", "RP"],
assume_mw_galactocentric=True, ignore_extinction=True)
cogsworth.plot.plot_cmd(p, show=False)
plt.tight_layout() # <-- this is just to get rid of weird padding in online docs
plt.show()
Total running time of the script: (1 minutes 32.515 seconds)