Carrier and refractive index dynamics in core-shell nanolasers grown on silicon during spontaneous and stimulated emission