Skip to content

Commit

Permalink
Merge pull request #2254 from j-bryan/mvn-pickle
Browse files Browse the repository at this point in the history
MultivariateNormal pickling fix
  • Loading branch information
dylanjm authored Jan 29, 2024
2 parents 43ab075 + 5369dc9 commit 730bf9a
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
1 change: 1 addition & 0 deletions ravenframework/Distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3614,6 +3614,7 @@ def _localSetState(self,pdict):
@ In, pdict, dict, the namespace state
@ Out, None
"""
super()._localSetState(pdict)
self.method = pdict.pop('method')
self.dimension = pdict.pop('dimension')
self.rank = pdict.pop('rank')
Expand Down
20 changes: 20 additions & 0 deletions tests/framework/ROM/TimeSeries/SyntheticHistory/tests
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,26 @@
[../]
[../]

[./VARMASample]
prereq = VARMA
type = 'RavenFramework'
input = 'varma_sample.xml'
[./csv0]
type = OrderedCSV
output = 'VARMA/pk_samples_0.csv'
gold_files = '../VARMA/samples_0.csv'
rel_err = 8.8e-1 # thank you, Windows and Linux diffs
zero_threshold = 1e-12
[../]
[./csv1]
type = OrderedCSV
output = 'VARMA/pk_samples_1.csv'
gold_files = '../VARMA/samples_1.csv'
rel_err = 8.8e-1 # thank you, Windows and Linux diffs
zero_threshold = 1e-12
[../]
[../]

[./VARMAInterpolated]
type = 'RavenFramework'
input = 'varma_interpolated.xml'
Expand Down
75 changes: 75 additions & 0 deletions tests/framework/ROM/TimeSeries/SyntheticHistory/varma_sample.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" ?>
<Simulation verbosity="debug">
<TestInfo>
<name>framework/ROM/TimeSeries/SyntheticHistory.VARMASample</name>
<author>j-bryan</author>
<created>2024-01-26</created>
<classesTested>SupervisedLearning.SyntheticHistory,TSA.VARMA</classesTested>
<description>Tests the ability to load and sample VARMA created by SyntheticHistory ROM.</description>
</TestInfo>

<RunInfo>
<WorkingDir>VARMA</WorkingDir>
<Sequence>read, sample</Sequence>
<batchSize>1</batchSize>
</RunInfo>

<Steps>
<IOStep name="read">
<Input class="Files" type="">pk</Input>
<Output class="Models" type="ROM">synth</Output>
</IOStep>
<MultiRun name="sample">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ROM">synth</Model>
<Sampler class="Samplers" type="MonteCarlo">mc</Sampler>
<Output class="DataObjects" type="HistorySet">samples</Output>
<Output class="OutStreams" type="Print">pk_samples</Output>
</MultiRun>
</Steps>

<Files>
<Input name="pk">varma.pk</Input>
</Files>

<Samplers>
<MonteCarlo name="mc">
<samplerInit>
<limit>2</limit>
<initialSeed>42</initialSeed>
</samplerInit>
<constant name="scaling">1.0</constant>
</MonteCarlo>
</Samplers>

<Models>
<ROM name="synth" subType="SyntheticHistory">
<Target>signal0, signal1, seconds</Target>
<Features>scaling</Features>
<pivotParameter>seconds</pivotParameter>
<varma target="signal0, signal1" seed='42'>
<P>1</P>
<Q>0</Q>
</varma>
</ROM>
</Models>

<OutStreams>
<Print name="pk_samples">
<type>csv</type>
<source>samples</source>
</Print>
</OutStreams>

<DataObjects>
<PointSet name="placeholder"/>
<HistorySet name="samples">
<Input>scaling</Input>
<Output>signal0, signal1</Output>
<options>
<pivotParameter>seconds</pivotParameter>
</options>
</HistorySet>
</DataObjects>

</Simulation>

0 comments on commit 730bf9a

Please sign in to comment.