Paste #346

Welcome To LodgeIt

Welcome to the LodgeIt pastebin. In order to use the notification feature a 31 day cookie with an unique ID was created for you. The lodgeit database does not store any information about you, it's just used for an advanced pastebin experience :-). Read more on the about lodgeit page. Have fun :-)

hide this notification

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
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()