Utils
get_structure(*args, min_length=3)
Converts the structural elements into a string with padding.
Source code in supermat/core/utils.py
1 2 3 4 5 |
|
is_subsection(subsection, section)
Determines if one hierarchical section ID is a subsection of another.
This function compares two hierarchical structure IDs (e.g., "1.2.3" and "1.2") to determine if the first is a subsection of the second. A section is considered a subsection if it shares all non-zero parts with its parent section and can have additional parts after the parent's sequence.
For example
- "1.2.3" is a subsection of "1.2"
- "1.2.0" is a subsection of "1.2"
- "1.3" is not a subsection of "1.2"
- "1.2" is not a subsection of "1.2.3"
Zero parts in the section ID (e.g., "1.2.0") act as wildcards and will match any corresponding part in the
subsection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
subsection |
str
|
The structure ID to check if it's a subsection (e.g., "1.2.3") |
required |
section |
str
|
The potential parent structure ID to compare against (e.g., "1.2") |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if 'subsection' is a subsection of 'section', False otherwise |
Source code in supermat/core/utils.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
split_structure(structure)
Retrieves the structural elements from structure id.
Source code in supermat/core/utils.py
8 9 10 |
|