|
Peano
|
Functions | |
| parse_tuple_string (tuple_str) | |
| Parse a string representation of a (weight, subtree_id) tuple. | |
| CustomGridGenerator (name, yaml_file_path) | |
| Generate a Tree object by reading from a YAML file created by generate_tree_yaml(). | |
| CustomGridGenerator.CustomGridGenerator | ( | name, | |
| yaml_file_path | |||
| ) |
Generate a Tree object by reading from a YAML file created by generate_tree_yaml().
This function reconstructs the complete tree structure from a YAML file, including all spatial data, metadata, and subtree assignments. It provides a way to reload previously processed trees for further analysis or modification.
The function expects YAML files with the structure created by generate_tree_yaml():
The function rebuilds the tree arrays by:
Comprehensive validation includes:
Args: name (str): Descriptive name for the loaded tree (overrides YAML name if desired) yaml_file_path (str): Path to the YAML file containing tree structure
Returns: Tree: Reconstructed Tree object with complete structure
Raises: FileNotFoundError: If YAML file doesn't exist or isn't readable yaml.YAMLError: If YAML file has syntax errors KeyError: If required fields are missing from YAML structure ValueError: If data formats are inconsistent or invalid
Example: ```python
tree = CustomGridGenerator( name="ReloadedTree", yaml_file_path="TreeStructure_l4_s3_split.yaml" )
print(f"Loaded tree: {tree._name}") print(f"Dimensions: {tree._dimension}D") print(f"Levels: {tree._max_level}") print(f"Leaf count: {tree._leaf_count}") print(f"Subtrees: {tree._subtree_count}")
from strategies.SplitTrees import split_tree split_tree(tree, number_of_subtrees=2) ```
Note:
Definition at line 139 of file CustomGridGenerator.py.
References parse_tuple_string().

| CustomGridGenerator.parse_tuple_string | ( | tuple_str | ) |
Parse a string representation of a (weight, subtree_id) tuple.
Supports various formats:
Args: tuple_str (str): String representation of the tuple
Returns: tuple: (weight, subtree_id) as integers
Raises: ValueError: If the string cannot be parsed as a valid tuple
Definition at line 105 of file CustomGridGenerator.py.
Referenced by CustomGridGenerator().
