From 1996c8eef19a2b12a82885492938164b5e2f280a Mon Sep 17 00:00:00 2001 From: Andrea Alfonsi Date: Wed, 1 Aug 2018 07:18:40 -0600 Subject: [PATCH 1/5] dai --- scripts/conversionScripts/toBasicStatsPP.py | 25 ++++++++++--------- .../test_adaptive_sampler.xml | 2 +- .../Distributions/TestDistributions.py | 8 +----- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/scripts/conversionScripts/toBasicStatsPP.py b/scripts/conversionScripts/toBasicStatsPP.py index 0750df2cb1..ac25a4a3fb 100644 --- a/scripts/conversionScripts/toBasicStatsPP.py +++ b/scripts/conversionScripts/toBasicStatsPP.py @@ -47,18 +47,19 @@ def convert(tree,fileName=None): steps = simulation.find('Steps') postProcess = steps.findall('PostProcess') TestInfo = simulation.find('TestInfo') - revisions = TestInfo.find('revisions') - hasRev = True - if revisions is None: - revisions = ET.Element('revisions') - hasRev = False - rev = ET.Element('revision') - rev.attrib['author'] = 'wangc' - rev.attrib['date'] = '2017-12-20' - rev.text = 'convert test to use the new DataObjects with the new structure of basic statistic' - revisions.append(rev) - if not hasRev: - TestInfo.append(revisions) + if TestInfo is not None: + revisions = TestInfo.find('revisions') + hasRev = True + if revisions is None: + revisions = ET.Element('revisions') + hasRev = False + rev = ET.Element('revision') + rev.attrib['author'] = 'wangc' + rev.attrib['date'] = '2017-12-20' + rev.text = 'convert test to use the new DataObjects with the new structure of basic statistic' + revisions.append(rev) + if not hasRev: + TestInfo.append(revisions) toRemove = [] diff --git a/tests/framework/Samplers/AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml b/tests/framework/Samplers/AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml index b36bec110d..86c486f6d8 100644 --- a/tests/framework/Samplers/AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml +++ b/tests/framework/Samplers/AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml @@ -77,7 +77,7 @@ accelerated_ROM decision sampledPoints - 1e-3 + 1e-3 x1_dst diff --git a/tests/framework/unit_tests/Distributions/TestDistributions.py b/tests/framework/unit_tests/Distributions/TestDistributions.py index d1318dffce..9bd271a4cc 100644 --- a/tests/framework/unit_tests/Distributions/TestDistributions.py +++ b/tests/framework/unit_tests/Distributions/TestDistributions.py @@ -1024,29 +1024,23 @@ def getDistribution(xmlElement): checkCrowDist("NDCartesianSpline",ndCartesianSpline,{'type': 'NDCartesianSplineDistribution'}) #ND MultiVariate Normal - -ndMultiVariateNormal = ET.Element("MultivariateNormal",{"name":"test","method":"spline"}) +ndMultiVariateNormal = ET.Element("MultivariateNormal",{"name":"test","method":"pca"}) munode = createElement("mu", text="10 20") ndMultiVariateNormal.append(munode) covariancenode = createElement("covariance", text=" 4 0 \n 0 16") ndMultiVariateNormal.append(covariancenode) ndMultiVariate = getDistribution(ndMultiVariateNormal) - ## Should these be checked? initParams = ndMultiVariate.getInitParams() - marginalCDF1 = ndMultiVariate.marginalDistribution(10, 0) marginalCDF2 = ndMultiVariate.marginalDistribution(20, 1) - inverse1 = ndMultiVariate.inverseMarginalDistribution(0.5, 0) inverse2 = ndMultiVariate.inverseMarginalDistribution(0.5, 1) - checkAnswer("MultiVariate marginalDim1(3000)" , marginalCDF1, 0.501, tol=0.01, relative=True) checkAnswer("MultiVariate marginalDim2(2500)" , marginalCDF2, 0.501, tol=0.01, relative=True) checkAnswer("MultiVariate inverseMarginalDim1(0.5)" , inverse1, 10., tol=0.01, relative=True) checkAnswer("MultiVariate inverseMarginalDim2(0.5)" , inverse2, 20., tol=0.01, relative=True) - #Test Categorical CategoricalElement = ET.Element("Categorical",{"name":"test"}) From e417ae4a5edc4a6a35c45c4a42aeebaa3ceb32fd Mon Sep 17 00:00:00 2001 From: Andrea Alfonsi Date: Tue, 11 Sep 2018 18:01:36 -0600 Subject: [PATCH 2/5] Closes #780 --- framework/h5py_interface_creator.py | 7 +++++- .../LimitSurface/test_LimitSurface.xml | 23 +++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/framework/h5py_interface_creator.py b/framework/h5py_interface_creator.py index b6ea009341..1697f78bc7 100644 --- a/framework/h5py_interface_creator.py +++ b/framework/h5py_interface_creator.py @@ -186,7 +186,12 @@ def addGroup(self,rlz): @ Out, None """ parentID = rlz.get("RAVEN_parentID",[None])[0] - groupName = str(rlz.get("prefix")[0] if not isinstance(rlz.get("prefix"),basestring) else rlz.get("prefix")) + prefix = rlz.get("prefix") + if prefix is not None: + groupName = str(prefix[0] if not isinstance(prefix,basestring) else prefix) + else: + # this can happen when we want to add sample generated data (e.g. LimitSurface) in the database + groupName = str(len(self.allGroupPaths)) if parentID: #If Hierarchical structure, firstly add the root group if not self.firstRootGroup or parentID == "None": diff --git a/tests/framework/PostProcessors/LimitSurface/test_LimitSurface.xml b/tests/framework/PostProcessors/LimitSurface/test_LimitSurface.xml index 889c9574f2..a454e06236 100644 --- a/tests/framework/PostProcessors/LimitSurface/test_LimitSurface.xml +++ b/tests/framework/PostProcessors/LimitSurface/test_LimitSurface.xml @@ -4,10 +4,10 @@ framework/PostProcessors/LimitSurface.testLimitSurfacePostProcessor alfoa 2014-07-10 - Models.PostProcessors.LimitSurface, Functions.External + Models.PostProcessors.LimitSurface, Functions.External, Databases.HDF5 This test is aimed to check the capability of RAVEN to generate Limit Surfaces from a pre-generated data set (in this case, generated with - a MonteCarlo sampling), outputting the generated Limit Surface in DataObject.PointSet(s) reporting both transition boundaries (-1 1) or just + a MonteCarlo sampling), outputting the generated Limit Surface in DataObject.PointSet(s) and Databases.HDF5 reporting both transition boundaries (-1 1) or just one of them. @@ -24,12 +24,19 @@ Moved LimitSurface Postprocessor tests in a specific directory (tests/framework/PostProcessors/LimitSurface) and updated for new DataObject structure + Added an additional IOStep to check that the limit surface DataObject can be dumped into a Database of type HDF5 R-RA-1 limitSurface - FirstMRun,ComputeLimitSurfacePositive,ComputeLimitSurfaceNegative,ComputeLimitSurfacePositiveNegative + + FirstMRun, + ComputeLimitSurfacePositive, + ComputeLimitSurfaceNegative, + ComputeLimitSurfacePositiveNegative, + dumpLimitSurfacePositiveNegativeInHDF5 + 1 @@ -134,8 +141,16 @@ LimitSurfacePositiveNegative LimitSurfacePositiveNegative_dump + + LimitSurfacePositiveNegative + test_db_database + - + + + + + csv From deeefd7492a9c3eb73526b76c8f79fbf3c64f4e5 Mon Sep 17 00:00:00 2001 From: Andrea Alfonsi - INL Date: Tue, 11 Sep 2018 18:03:23 -0600 Subject: [PATCH 3/5] Update h5py_interface_creator.py --- framework/h5py_interface_creator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/h5py_interface_creator.py b/framework/h5py_interface_creator.py index 1697f78bc7..22e60487b3 100644 --- a/framework/h5py_interface_creator.py +++ b/framework/h5py_interface_creator.py @@ -190,7 +190,7 @@ def addGroup(self,rlz): if prefix is not None: groupName = str(prefix[0] if not isinstance(prefix,basestring) else prefix) else: - # this can happen when we want to add sample generated data (e.g. LimitSurface) in the database + # this can happen when we want to add sampler generated data (e.g. LimitSurface) in the database groupName = str(len(self.allGroupPaths)) if parentID: #If Hierarchical structure, firstly add the root group From 31a1b3bc6f4ad4631f2f3138a9a2bff70885bcde Mon Sep 17 00:00:00 2001 From: Andrea Alfonsi - INL Date: Tue, 11 Sep 2018 18:04:02 -0600 Subject: [PATCH 4/5] Update test_adaptive_sampler.xml --- .../AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/framework/Samplers/AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml b/tests/framework/Samplers/AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml index 86c486f6d8..a4eba7666b 100644 --- a/tests/framework/Samplers/AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml +++ b/tests/framework/Samplers/AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml @@ -77,7 +77,7 @@ accelerated_ROM decision sampledPoints - 1e-3 + 1e-3 x1_dst From 0c91776125c71d5ddfed069d83643d5285ecdf01 Mon Sep 17 00:00:00 2001 From: Andrea Alfonsi - INL Date: Tue, 11 Sep 2018 18:04:15 -0600 Subject: [PATCH 5/5] Update test_adaptive_sampler.xml --- .../AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/framework/Samplers/AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml b/tests/framework/Samplers/AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml index a4eba7666b..b36bec110d 100644 --- a/tests/framework/Samplers/AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml +++ b/tests/framework/Samplers/AdaptiveLimitSurfaceSearch/test_adaptive_sampler.xml @@ -77,7 +77,7 @@ accelerated_ROM decision sampledPoints - 1e-3 + 1e-3 x1_dst