import yt yt.enable_parallelism() from yt.extensions.astro_analysis.halo_analysis import HaloCatalog def my_particle_mass(field, data): ptype = field.name[0] m = data.ds.quan(7e10, "Msun/h") return m * data[ptype, "particle_ones"] def setup_ds(ds): ds.add_field(("all", "my_particle_mass"), function=my_particle_mass, sampling_type="particle", units="Msun/h") my_sim = yt.load_simulation('enzo_tiny_cosmology/32Mpc_32.enzo', 'Enzo') my_sim.get_time_series(setup_function=setup_ds) hc = HaloCatalog(data_ds=my_sim, finder_method='rockstar', finder_kwargs={"num_readers": 1, "num_writers": 1, "particle_mass": 7e10, "mass_field": "my_particle_mass"}) hc.create()