astropy / halotools

Python package for studying large scale structure, cosmology, and galaxy evolution using N-body simulations and halo models

Home Page:http://halotools.rtfd.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

masking function issue with subhalo models

mcp74 opened this issue · comments

commented

Hi all, I get an error when trying to populate a subvolume of a halo catalog via a masking function when using a subhalo-based model like Behroozi10:

>> model = PrebuiltSubhaloModelFactory('behroozi10', redshift=0.)
>> model.populate_mock(halocat = halocat, masking_function = f, enforce_PBC = False)

TypeError: populate() got an unexpected keyword argument 'masking_function'

It seems that the populate_mock() function only has the 'masking_function' option for HOD-based models. Could the same capability be implemented for subhalo-based models?

Hi @mcp74 I think the reason the masking function never got implemented for the case of subhalo-based models was just because it seemed comparatively simpler to simply apply a mask to the galaxy population after the fact. So, for example, would your use-case support the following workaround?

>>> model.populate_mock(halocat = halocat, enforce_PBC = False)
>>> mask = f(model.mock.galaxy_table)
>>> masked_galaxies = model.mock.galaxy_table[mask]

commented

Hi @aphearin, yes, that would work. I was looking into the masking function because it would be faster/more efficient to populate a smaller subvolume for each each model realization rather than populating the entire catalog. But I suppose it'd be the same to first populate, and then mask/compute the statistics in subvolumes. So that works.
Thanks for the reply!

No problem! Glad this workaround seems like it won't be too much of a hassle. Let me know how it goes in case you hit any snags.