ytree.data_structures.arbor.Arbor.save_arbor
- Arbor.save_arbor(**kwargs)[source]
Save the arbor to a file.
The saved arbor can be re-loaded as an arbor.
- Parameters:
filename (optional, string) – Output file keyword. If filename ends in “.h5”, the main header file will be just that. If not, filename will be <filename>/<basename>.h5. Default: “arbor”.
fields (optional, list of strings) – The fields to be saved. If not given, all fields will be saved.
trees (optional, list or array of TreeNodes) – If given, only save trees stemming from these nodes. If not provide, all trees will be saved.
save_in_place (optional, bool or None) – If True, analysis fields will be saved to the original arbor, even if only a subset of all trees is provided with the trees keyword. This will essentially “update” the arbor in place. If False and only a subset of all trees is provided, a new arbor will be created containing only the trees provided. If set to None, behavior is determined by the type of arbor loaded. If the arbor is a YTreeArbor (i.e., saved with save_arbor), save_in_place will be set to True. If not of this type, it will be set to False. Default: None
save_roots_only (optional, bool) – If True, only field values of each node are saved. If False, field data for the entire tree stemming from that node are saved. Default: False.
max_file_size (optional, float) – The maximum number of nodes saved to a single file. Smaller numbers will result in more files. Performance may change somewhat with different values. Default: 524288 (2^19).
- Returns:
header_filename – The filename of the saved arbor.
- Return type:
string
Examples
>>> import ytree >>> a = ytree.load("rockstar_halos/trees/tree_0_0_0.dat") >>> fn = a.save_arbor() >>> # reload it >>> a2 = ytree.load(fn)