If stars are generated with the function based on a mix of Gaia DR2 and simulated stars create_stars_Gaia and planets are generated with create_planets_bergsten, nonsensical numbers of planets per star occur (from negative values to 10^18 planets per star)
I believe the problem lies in the random initialization of num_planets with np.empty, which fills it with random values. Later, only the values for stars with masses within the bin ranges are overwritten with the actual number of planets. As create_stars_Gaia seems to produce stars outside of the mass range create_planets_bergsten can handle, some nonsensical values remain, leading to a crash further down due to the negative numbers.
If stars are generated with the function based on a mix of Gaia DR2 and simulated stars
create_stars_Gaia
and planets are generated withcreate_planets_bergsten
, nonsensical numbers of planets per star occur (from negative values to 10^18 planets per star)I believe the problem lies in the random initialization of
num_planets
withnp.empty
, which fills it with random values. Later, only the values for stars with masses within the bin ranges are overwritten with the actual number of planets. Ascreate_stars_Gaia
seems to produce stars outside of the mass rangecreate_planets_bergsten
can handle, some nonsensical values remain, leading to a crash further down due to the negative numbers.