logic_tree
Classes for the combined SRM + GMCM logic trees used to define a seismic hazard model.
HazardComponentBranch
¶
A component branch of the combined (SRM + GMCM) logic tree comprised of an srm branch and a gmcm branch.
The HazardComposite branch is the smallest unit necessary to create a hazard curve realization.
Source code in toshi_hazard_post/logic_tree.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
gmcm_hash_digest
property
¶
The hash digest of the gmcm branch.
registry_identity
property
¶
The registry identity of the component branch.
The registry identity is formed as concatinations of the source and gmcm identities. {source branch id}{gmcm branch1}|{gmcm branch2}...
source_hash_digest
property
¶
The hash digest of the source branch.
__init__(source_branch, gmcm_branches)
¶
Initialize a new HazardComponentBranch object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_branch
|
SourceBranch
|
The source branch of the composite branch. |
required |
gmcm_branches
|
tuple[GMCMBranch, ...]
|
The GMCM branches that make up the composite branch. |
required |
Source code in toshi_hazard_post/logic_tree.py
106 107 108 109 110 111 112 113 114 115 116 117 | |
HazardCompositeBranch
¶
A composite branch of the combined (SRM + GMCM) logic tree.
A HazardCompositeBranch will have multiple sources and multiple ground motion models and is formed by taking all combinations of branches from the branch sets. The HazardComposite branch is an Iterable and will return HazardComponentBranch when iterated.
Source code in toshi_hazard_post/logic_tree.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
__init__(branches, source_weight)
¶
Initialize a new HazardCompositeBranch object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
branches
|
list[HazardComponentBranch]
|
The source-ground motion pairs that comprise the HazardCompositeBranch |
required |
source_weight
|
float
|
The weight of the source branch. |
required |
Source code in toshi_hazard_post/logic_tree.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
__iter__()
¶
Iterate over all HazardComponentBranches that make up the HazardCompositeBranch.
Source code in toshi_hazard_post/logic_tree.py
170 171 172 173 | |
__next__()
¶
Get the next HazardComponentBranch.
Source code in toshi_hazard_post/logic_tree.py
175 176 177 178 179 180 181 | |
HazardLogicTree
¶
The combined (SRM + GMCM) logic tree needed to define the complete hazard model.
Source code in toshi_hazard_post/logic_tree.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
branch_hash_table
property
¶
The simplest structure used to iterate though the realization hashes.
Each element of the list represents a composite branch as a list of hashes of the component branches that make up the composite branch.
Returns:
| Name | Type | Description |
|---|---|---|
hash_list |
list[list[str]]
|
the list of composite branches, each of wich is a list of component branch hashes. |
component_branches
property
¶
Get the component branches (each SRM branch with all possible GMCM branch matches).
Returns:
| Name | Type | Description |
|---|---|---|
component_branches |
list[HazardComponentBranch]
|
the component branches that make up the independent realizations of the logic tree |
component_digests
property
¶
The hash digests of the component branches, in the same order as component_branches.
Returns:
| Name | Type | Description |
|---|---|---|
component_digests |
list[str]
|
the hash digest of each component branch |
composite_branches
property
¶
Get the composite branches combining the SRM branches with the appropraite GMCM branches.
The tectonic region types will be matched between SRM and GMCM branches.
Returns:
| Name | Type | Description |
|---|---|---|
composite_branches |
list[HazardCompositeBranch]
|
the composite branches that make up all full realizations of the complete hazard |
list[HazardCompositeBranch]
|
logic tree |
weights
property
¶
The weights for every enumerated branch (srm + gmcm) of the logic tree.
Returns:
| Name | Type | Description |
|---|---|---|
weights |
NDArray
|
one dimensional array of branch weights |
__init__(srm_logic_tree, gmcm_logic_tree)
¶
Initialize a new HazardLogicTree object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
srm_logic_tree
|
SourceLogicTree
|
The seismicity rate model logic tree. |
required |
gmcm_logic_tree
|
GMCMLogicTree
|
The ground motion characterisation model logic tree. |
required |
Source code in toshi_hazard_post/logic_tree.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
branch_index_columns(branch_index_table)
¶
The component branches in each column of the branch index table, for calculators.composite_rate_bounds().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
branch_index_table
|
NDArray
|
composite branches as rows of indices into the component branches |
required |
Returns:
| Type | Description |
|---|---|
list[NDArray]
|
The sorted unique indices in each column of branch_index_table. |
Source code in toshi_hazard_post/logic_tree.py
88 89 90 91 92 93 94 95 96 97 | |
build_branch_index_table(branch_hash_table, component_digests)
¶
Convert the branch hash table to a table of indices into the component branches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
branch_hash_table
|
Sequence[Sequence[str]] | NDArray
|
composite branches represented as a list of hashes of the component branches |
required |
component_digests
|
Sequence[str]
|
the hash digests of the component branches. The position of a digest in this sequence is its index in the returned table. |
required |
Returns:
| Type | Description |
|---|---|
NDArray
|
The index table with shape (n composite branches, n component branches per composite branch) |
Raises:
| Type | Description |
|---|---|
KeyError
|
if the branch hash table has a digest that is not in component_digests. |
Source code in toshi_hazard_post/logic_tree.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |