ytree.data_structures.arbor.Arbor.add_analysis_field

Arbor.add_analysis_field(name, units, dtype=None, default=0)[source]

Add an empty field to be filled by analysis operations.

Parameters:
  • name (string) – Field name.
  • units (string) – Field units.
  • dtype (optional, type) – Data type for field values. If None, the default data type of the arbor is used. Default: None.
  • default (optional, numeric) – Default field value when field is initialized. Default: 0.

Examples

>>> import ytree
>>> a = ytree.load("tree_0_0_0.dat")
>>> a.add_analysis_field("robots", "Msun * kpc")
>>> # Set field for some halo.
>>> my_tree = a[0]
>>> my_tree["tree"][7]["robots"] = 1979.816