How to add attribute 'cosmology' to halo catalog built by 'halotools.sim_manager.RockstarHlistReader()'?
Closed this issue · 2 comments
SMDPL is not provided in the halotools.empirical_models.PrebuiltHodModelFactory()
, so I build a SMDPL halo catalog via halotools.sim_manager.RockstarHlistReader()
:
from astropy.cosmology import Planck13
reader = RockstarHlistReader(input_fname, columns_to_keep_dict, output_fname, simname, halo_finder, redshift,\
version_name, Lbox, particle_mass, overwrite=True, cosmology = Planck13)
reader.read_halocat(columns_to_convert_from_kpc_to_mpc = ['halo_rvir', 'halo_rs'] ,write_to_disk = True,\
update_cache_log = True)
But there is no attribute 'cosmology' in the output:
halocat = CachedHaloCatalog(simname = 'SMDPL', halo_finder='rockstar', version_name='rockstar', redshift = 0.)
halocat.cosmology
>>> AttributeError: 'CachedHaloCatalog' object has no attribute 'cosmology'
I want to ask how can I add attribute 'cosmology' into the output, since halotools.sim_manager.RockstarHlistReader()
do not accept such a parameter.
The attributes bound to the reader were really only intended to disambiguate one simulation from the next, to avoid collisions between multiple halo catalogs, and so cosmology
is not an attribute of the CachedHaloCatalog class. If you'd like to have cosmology
attached to a CachedHaloCatalog instance, probably the simplest thing is to just write a wrapper that inherits from CachedHaloCatalog and adds this attribute.
Thanks a lot.