astropy/halotools

assert on Nhalos > 1

rainwoodman opened this issue · 1 comments

We sometimes do feed an empty catalog to halotools (e.g. if the selection is very narrow). I would imagined halotools shall produce an empty result on empty input.

However, this is what we get instead:

  File "/dev/shm/local/lib/python3.7/site-
> packages/halotools/sim_manager/user_supplied_halo_catalog.py", line
> 180, in _parse_constructor_kwargs
>     assert Nhalos > 1
> AssertionError

A quick glance shows there doesn't seem to be a reason why Nhalos has to be > 1 in UserSuppliedHaloCatalog. Could you elaborate the reason we need this assertion just for UserSuppliedHaloCatalog?

Thanks!

Possibly no reason other than, at that time, it was less work to just put in an assert rather than test an edge-case with no known use-case. But since you have a use-case, I just put this on the v0.7 list of fixes, which I'm shooting to release in December.