Skip to content

Commit

Permalink
Allow importing properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Corentin Cadiou authored and cphyc committed Sep 21, 2023
1 parent c72c993 commit 0a02ccd
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tangos/input_handlers/yt.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,27 @@ def _load_halo_cat_without_caching(self, ts_extension, snapshot_file):
def get_properties(self):
return {}

def available_object_property_names_for_timestep(self, ts_extension, object_typetag):
h, _ = self._load_halo_cat(ts_extension, object_typetag)
return [fn for ft, fn in h.field_list if ft == "halos"]


def iterate_object_properties_for_timestep(self, ts_extension, object_typetag, property_names):
h, ad = self._load_halo_cat(ts_extension, object_typetag)

props_with_ftype = [
("halos", name) for name in property_names
]

ad.get_data(props_with_ftype)

Nhalo = len(ad["halos", "particle_identifier"])
data = zip(range(Nhalo), range(Nhalo), *(
ad[_] for _ in props_with_ftype
))

return data

class YtRamsesRockstarInputHandler(YtInputHandler):
patterns = ["output_0????"]
auxiliary_file_patterns = ["halos_*.bin"]
Expand Down

0 comments on commit 0a02ccd

Please sign in to comment.