import yt from yt.fields.particle_fields import \ add_nearest_neighbor_field fbase = "./group_subh_hgas_iso_hdf5_plt_cnt_0000" fbase_part = "./group_subh_hgas_iso_hdf5_part_0000" ds = yt.load(fbase, particle_filename = fbase_part) fn, = add_nearest_neighbor_field("all", "particle_position", ds) dd = ds.all_data() print(dd[fn])