ytree.data_structures.tree_node.TreeNode.save_tree¶
-
TreeNode.
save_tree
(filename=None, fields=None)[source]¶ Save the tree to a file.
The saved tree can be re-loaded as an arbor.
Parameters: - filename (optional, string) – Output file keyword. Main header file will be named <filename>/<filename>.h5. Default: “tree_<uid>”.
- fields (optional, list of strings) – The fields to be saved. If not given, all fields will be saved.
Returns: filename – The filename of the saved arbor.
Return type: string
Examples
>>> import ytree >>> a = ytree.load("rockstar_halos/trees/tree_0_0_0.dat") >>> # save the first tree >>> fn = a[0].save_tree() >>> # reload it >>> a2 = ytree.load(fn)