ytree.data_structures.arbor.Arbor.add_alias_field
- Arbor.add_alias_field(alias, field, units=None, force_add=True)[source]
Add a field as an alias to another field.
- Parameters:
alias (string) – Alias name.
field (string) – The field to be aliased.
units (optional, string) – Units in which the field will be returned.
force_add (optional, bool) – If True, add field even if it already exists and warn the user and raise an exception if dependencies do not exist. If False, silently do nothing in both instances. Default: True.
Examples
>>> import ytree >>> a = ytree.load("tree_0_0_0.dat") >>> # "Mvir" exists on disk >>> a.add_alias_field("mass", "Mvir", units="Msun") >>> print (a["mass"])