From 5de5b8a576d4f522b12c6d7d5a0d40c1f3b1ff54 Mon Sep 17 00:00:00 2001
From: Farid Mohammadi <farid.mohammadi@iws.uni-stuttgart.de>
Date: Thu, 10 Mar 2022 11:12:43 +0100
Subject: [PATCH] [tests][beam] remove script.

---
 tests/beam/SA_Beam.py | 183 ------------------------------------------
 1 file changed, 183 deletions(-)
 delete mode 100644 tests/beam/SA_Beam.py

diff --git a/tests/beam/SA_Beam.py b/tests/beam/SA_Beam.py
deleted file mode 100644
index 9766a7a26..000000000
--- a/tests/beam/SA_Beam.py
+++ /dev/null
@@ -1,183 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-"""
-Created on Wed Jul 10 14:27:35 2019
-
-@author: farid
-"""
-import sys
-import os
-import numpy as np
-import pandas as pd
-import seaborn as sns
-
-try:
-    import cPickle as pickle
-except ModuleNotFoundError:
-    import pickle
-    
-    
-from PyLink.PyLinkForwardModel import PyLinkForwardModel
-from surrogate_models.Input import Input
-from surrogate_models.surrogate_models import aPCE
-from PostProcessing.PostProcessing import PostProcessing
-from BayesInference.BayesInference import BayesInference, Discrepancy
-
-
-
-
-
-if __name__ == "__main__":
-    
-    #=====================================================
-    #=============   COMPUTATIONAL MODEL  ================
-    #=====================================================
-    Model = PyLinkForwardModel()
-    
-    Model.Type = 'PyLink'
-    Model.Name = 'Beam9points'
-    Model.InputFile = "SSBeam_Deflection.inp"
-    Model.InputTemplate = "SSBeam_Deflection.tpl.inp"
-    
-    
-    Model.Command = "myBeam9points SSBeam_Deflection.inp"
-    Model.ExecutionPath = os.getcwd()  
-    Model.Output.Parser = 'read_Beam_Deflection'
-    Model.Output.Names = ['Deflection [m]']
-    Model.Output.FileNames = ["SSBeam_Deflection_.out"]
-    
-    # For Bayesian inversion
-    Model.MeasurementFile = 'MeasuredData.csv'
-    
-    # For Checking with the MonteCarlo refrence
-    Model.MCReferenceFile = 'MCrefs_MeanStd.csv'
-    
-    #=====================================================
-    #=========   PROBABILISTIC INPUT MODEL  ==============
-    #=====================================================
-    # Define the uncertain parameters with their mean and 
-    # standard deviation
-    Inputs = Input()
-    
-    Inputs.addMarginals()
-    Inputs.Marginals[0].Name = 'Beam width'
-    Inputs.Marginals[0].DistType = 'lognorm'
-    Inputs.Marginals[0].Moments =  [0.15, 0.0075]
-    
-    Inputs.addMarginals()
-    Inputs.Marginals[1].Name = 'Beam height'
-    Inputs.Marginals[1].DistType = 'lognorm'
-    Inputs.Marginals[1].Moments =  [0.3, 0.015]
-    
-    Inputs.addMarginals()
-    Inputs.Marginals[2].Name = 'Youngs modulus'
-    Inputs.Marginals[2].DistType = 'lognorm'
-    Inputs.Marginals[2].Moments =  [30000e+6, 4500e+6]
-    
-    Inputs.addMarginals()
-    Inputs.Marginals[3].Name = 'Uniform load'
-    Inputs.Marginals[3].DistType = 'lognorm'
-    Inputs.Marginals[3].Moments =  [10000, 2000]
-    
-    #=====================================================
-    #======  POLYNOMIAL CHAOS EXPANSION METAMODELS  ======
-    #=====================================================    
-    MetaModelOpts = aPCE(Inputs)
-
-    # Specify the max degree to be compared by the adaptive algorithm:
-    # The degree with the lowest Leave-One-Out cross-validation (LOO)
-    # error (or the highest score=1-LOO)estimator is chosen as the final 
-    # metamodel.
-    MetaModelOpts.MaxPceDegree = 10
-    
-    # Select the sparse least-square minimization method for 
-    # the PCE coefficients calculation:
-    # 1)AaPCE: Adaptive aPCE  2)BRR: Bayesian Ridge Regression 
-    # 3)LARS: Least angle regression  4)ARD: Bayesian ARD Regression (Not Working)
-    
-    MetaModelOpts.RegMethod = 'BRR'
-    
-    # Print summary of the regression results
-    #MetaModelOpts.DisplayFlag = True
-    
-    # ------ Experimental Design --------
-    # Generate an experimental design of size NrExpDesign based on a latin 
-    # hypercube sampling of the input model or user-defined values of X and/or Y:
-    MetaModelOpts.addExpDesign()
-    MetaModelOpts.ExpDesign.MCSize = 100000
-    
-    MetaModelOpts.ExpDesign.NrSamples = 75
-    MetaModelOpts.ExpDesign.SamplingMethod = 'PCM' # 1)MC 2)LHS 3)PCM 4)LSCM 5)user
-    MetaModelOpts.ExpDesign.Method = 'normal'  # 1) normal  2) sequential
-    #MetaModelOpts.ExpDesign.X = np.load('CollocationPoints.npy')
-    
-    # Sequential experimental design (needed only for sequential ExpDesign)
-    MetaModelOpts.ExpDesign.MaxNSamples = 50 #150
-    MetaModelOpts.ExpDesign.ModifiedLOOThreshold = 1e-3
-    
-    # 1)'dual annealing' 2) 'minimization' 3) MC (Alph. OptDesign:MC search)
-    MetaModelOpts.ExpDesign.SeqOptimMethod = 'MC' 
-    MetaModelOpts.ExpDesign.MaxFunItr = 100
-    
-    MetaModelOpts.ExpDesign.NCandidate = 500
-    
-    # 'dual annealing'
-    # 1)DKL (Kullback-Leibler Divergence) 2)DPP (D-Posterior-percision)
-    # 3)APP (A-Posterior-percision) 
-    MetaModelOpts.ExpDesign.UtilityFunction = 'DPP' 
-    
-    # Optimality criteria (MC search)
-    # 1)D-Opt (D-Optimality) 2)A-Opt (A-Optimality)
-    # 3)K-Opt (K-Optimality)
-    MetaModelOpts.ExpDesign.UtilityFunction = 'D-Opt'
-    
-    # >>>>>>>>>>>>>>>>>>>>>> Build Surrogate <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-    # Adaptive sparse arbitrary polynomial chaos expansion
-    PCEModel = MetaModelOpts.create_PCE(Model)
-    
-    
-    #=====================================================
-    #=========  POST PROCESSING OF METAMODELS  ===========
-    #=====================================================
-    PostPCE = PostProcessing(PCEModel)
-
-    # Compute the moments
-    PostPCE.PCEMoments(PCEModel)
-    
-    # Comparison with Monte-Carlo reference
-    # Plot Mean & Std for all Outputs
-    PostPCE.MomentLineplot(PCE_Means = PostPCE.PCEMeans,
-                           PCE_Stds = PostPCE.PCEStd,
-                           x_label = 'x [m]', SaveFig = True)
-
-    # Sensitivity analysis with Sobol indices
-    PostPCE.SobolIndicesPCE(Output='Deflection [m]', SaveFig = True, PlotType='box')
-
-    #=====================================================
-    #==============  Save class objects  =================
-    #=====================================================
-    with open('Beam_Results.pkl', 'wb') as output:
-        pickle.dump(PCEModel, output, pickle.HIGHEST_PROTOCOL)
-    
-        pickle.dump(PostPCE, output, pickle.HIGHEST_PROTOCOL)
-    
-    
-#    del PCEModel
-#    del PostPCE
-    
-    # Load the objects
-#    with open('CO2Benchmark_Results.pkl', 'rb') as input:
-#        PCEModel = pickle.load(input)
-#        PostPCE = pickle.load(input)
-    
-
-
-#    PostPCE.plotFlag = True
-#    
-#    PostPCE.ValidMetamodel(MetaModel)
-    
-    
-#    # Sensitivity analysis with Sobol indices
-#    PostPCE.SobolIndicesPCE(MetaModel)
-#    
-    
\ No newline at end of file
-- 
GitLab