danielapai / bioverse

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

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

Closed matiscke closed 1 month ago

matiscke commented 1 month 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.