Add the ability to build an SSC logic tree at runtime to skip XMLs#11497
Open
CB-quakemodel wants to merge 31 commits into
Open
Add the ability to build an SSC logic tree at runtime to skip XMLs#11497CB-quakemodel wants to merge 31 commits into
CB-quakemodel wants to merge 31 commits into
Conversation
Contributor
|
Not what I had in mind, but you cannot be a mind reader. The tests are useful, though. |
Contributor
|
No, it cannot be merged as it is. Hopefully, next week I will have some time to spend on this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here I add a new capability in the form of a class called
RuntimeSourceModelLT, which is used to build an SSC LT from a builder script provided by the user in the job file in place of the regular SSC logic tree XML (it still uses thesource_model_logic_tree_filekey).The builder script provided by the user must contain a top level function called
get_source_model_ltwhich returns a list of triples of(name, weight, xml_str)wherexml_stris just a text representation of the info that would be written to disk in an XML.The
RuntimeSourceModelLTensures that all the regular checks are performed when constructing the SSC LT (e.g. weights sum to 1).An example application can be found in
qa_test_data/logictree/case_34, which includes a builder script constructing a simple SSC logic tree using this approach. Checks in this QA test ensure that identical results are obtained with both full-enumeration and sampling when using an equivalent SSC logic tree constructed from XMLs. An expected results check is also added for event-based.There are also unit tests added to ensure other capabilities such as obtaining a composite source model and using to/from hdf5 are supported for
RuntimeSourceModelLT.*** IMPORTANT ***
This initial approach only accepts one branching level (i.e. you cannot apply epistemic uncertainties using additional branching levels, each branch you wish to describe must be represented by an individual XML, so if you want epistemic uncertainty on dip, you need one XML for each dip value).
The
BASE183limit is bypassed here (but realisations are still correctly handled and labelled uniquely). This is becauseRuntimeSourceModelLTaccepts an arbitrary number of branches because it bypasses the XML-basedSourceModelLogicTreevalidation that rejects branchsets larger than 183. The branch_path uniqueness problem that would arise beyond this limit is fixed by switching from aBASE183-indexed shortener to one that maps each branch name to itself, withshorten()updated to use the full name rather than just its first character (a check ensures this is only permitted forRuntimeSourceModelLTand also that eachnamein the list of triples returned inget_source_model_ltis unique as required.