danielapai / bioverse

A simulation framework to assess the statistical power of future biosignature surveys
MIT License
7 stars 6 forks source link

negative or incredibly large numbers of planets per star when combining simulated stars with default planet generator #60

Closed matiscke closed 4 months ago

matiscke commented 4 months ago

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.