RAVEN is a flexible and multi-purpose probabilistic risk analysis, validation and uncertainty quantification, parameter optimization, model reduction and data knowledge-discovering framework.
The ravenframework.Distributions.MultivariateNormal class pickles successfully and appears to unpickle successfully. However, some attributes of its parent class NDimensionalDistributions like workingDir are not saved on pickling, so calling the getInitParams method of MultivariateNormal causes the unpickled distribution to error our with an AttributeError.
This bug affects the ravenframework.TSA.VARMA class.
Steps to Reproduce
The following short script reproduces the error. I ran this from the raven base directory.
import os
import pickle
import numpy as np
from ravenframework.Distributions import MultivariateNormal
# Initialize a MultivariateNormal distribution object
dist = MultivariateNormal()
dist.method = 'pca'
dist.dimension = 2
dist.rank = 2
dist.mu = np.zeros(2)
dist.covariance = np.eye(2).ravel()
dist.workingDir = os.getcwd() # must be set or errors on pickling
dist.initializeDistribution()
# Pickle and unpickle the object
pk = pickle.dumps(dist)
dist2 = pickle.loads(pk)
# fails with "AttributeError: 'MultivariateNormal' object has no attribute 'workingDir'"
dist2.getInitParams()
Expected Behavior
All attributes set and stored by the parent class should also be recovered when pickling the child class. This should enable all class methods to execute properly after unpickling.
Screenshots and Input Files
See "Steps to Reproduce" for a minimum working example. The output of that example on my machine is shown in the included screenshot.
OS
MacOS
OS Version
14.3
Dependency Manager
CONDA
For Change Control Board: Issue Review
[x] Is it tagged with a type: defect or task?
[x] Is it tagged with a priority: critical, normal or minor?
[x] If it will impact requirements or requirements tests, is it tagged with requirements?
[x] If it is a defect, can it cause wrong results for users? If so an email needs to be sent to the users.
[x] Is a rationale provided? (Such as explaining why the improvement is needed or why current code is wrong.)
For Change Control Board: Issue Closure
[x] If the issue is a defect, is the defect fixed?
[x] If the issue is a defect, is the defect tested for in the regression test system? (If not explain why not.)
[x] If the issue can impact users, has an email to the users group been written (the email should specify if the defect impacts stable or master)?
[x] If the issue is a defect, does it impact the latest release branch? If yes, is there any issue tagged with release (create if needed)?
[x] If the issue is being closed without a pull request, has an explanation of why it is being closed been provided?
Thank you for the defect report
RAVEN
.Defect Description
The
ravenframework.Distributions.MultivariateNormal
class pickles successfully and appears to unpickle successfully. However, some attributes of its parent classNDimensionalDistributions
likeworkingDir
are not saved on pickling, so calling thegetInitParams
method ofMultivariateNormal
causes the unpickled distribution to error our with anAttributeError
.This bug affects the
ravenframework.TSA.VARMA
class.Steps to Reproduce
The following short script reproduces the error. I ran this from the
raven
base directory.Expected Behavior
All attributes set and stored by the parent class should also be recovered when pickling the child class. This should enable all class methods to execute properly after unpickling.
Screenshots and Input Files
See "Steps to Reproduce" for a minimum working example. The output of that example on my machine is shown in the included screenshot.
OS
MacOS
OS Version
14.3
Dependency Manager
CONDA
For Change Control Board: Issue Review
For Change Control Board: Issue Closure