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
Sampled 2597 binaries
[2e-02s] Sample initial binaries
[6.9s] Evolve binaries (run COSMIC)
[46.2s] Integrate galactic orbits (run gala)
Overall: 53.1s
cogsworth warning: 52 out of bounds points for Teff when interpolating MIST BCs (valid range: 1499.9956513820387 to 499999.995007974). Clipping to bounds.
cogsworth warning: 76 out of bounds points for logg when interpolating MIST BCs (valid range: -1.0 to 9.5). Clipping to bounds.
cogsworth warning: 52 out of bounds points for Teff when interpolating MIST BCs (valid range: 1499.9956513820387 to 499999.995007974). Clipping to bounds.
cogsworth warning: 76 out of bounds points for logg when interpolating MIST BCs (valid range: -1.0 to 9.5). Clipping to bounds.
cogsworth warning: 145 out of bounds points for Teff when interpolating MIST BCs (valid range: 1499.9956513820387 to 499999.995007974). Clipping to bounds.
cogsworth warning: 172 out of bounds points for logg when interpolating MIST BCs (valid range: -1.0 to 9.5). Clipping to bounds.
cogsworth warning: 145 out of bounds points for Teff when interpolating MIST BCs (valid range: 1499.9956513820387 to 499999.995007974). Clipping to bounds.
cogsworth warning: 172 out of bounds points for logg when interpolating MIST BCs (valid range: -1.0 to 9.5). Clipping to bounds.
import cogsworth
import matplotlib.pyplot as plt
p = cogsworth.pop.Population(2000, processes=1,
use_default_BSE_settings=True)
p.create_population()
p.get_observables(filters=["Gaia_G_EDR3", "Gaia_BP_EDR3", "Gaia_RP_EDR3"],
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 19.213 seconds)