Skip to content
Snippets Groups Projects
CellScript.py 2.43 KiB
Newer Older
  • Learn to ignore specific revisions
  • import numpy as np
    import matplotlib.pyplot as plt
    import sympy as sym
    import math
    import os
    import subprocess
    import fileinput
    import re
    import matlab.engine
    
    from HelperFunctions import *
    
    # from scipy.io import loadmat #not Needed anymore?
    import codecs
    import sys
    
    # ----------------------------------------------------------------------------------------------------------------------------
    
    
    InputFile  = "/inputs/cellsolver.parset"
    OutputFile = "/outputs/output.txt"
    # --------- Run  from src folder:
    path_parent = os.path.dirname(os.getcwd())
    os.chdir(path_parent)
    path = os.getcwd()
    print(path)
    InputFilePath = os.getcwd()+InputFile
    OutputFilePath = os.getcwd()+OutputFile
    print("InputFilepath: ", InputFilePath)
    print("OutputFilepath: ", OutputFilePath)
    print("Path: ", path)
    
    
    
    print('---- Input parameters: -----')
    mu1 = 10.0
    rho1 = 1.0
    alpha = 2.8
    beta = 2.0
    theta = 1.0/4.0
    gamma = 0.75
    
    lambda1= 10.0
    
    
    print('mu1: ', mu1)
    print('rho1: ', rho1)
    print('alpha: ', alpha)
    print('beta: ', beta)
    print('theta: ', theta)
    print('gamma:', gamma)
    print('----------------------------')
    
    Klaus Böhnlein's avatar
    Klaus Böhnlein committed
    print('RunCellProblem...')
    
    RunCellProblem(alpha,beta,theta,gamma,mu1,rho1,lambda1, InputFilePath)
    
    Klaus Böhnlein's avatar
    Klaus Böhnlein committed
    
    print('Read effective quantities...')
    Q, B = ReadEffectiveQuantities()
    print('Q:', Q)
    print('B:', B)
    
    
    Klaus Böhnlein's avatar
    Klaus Böhnlein committed
    # Compare symbolicMinimization with Classification 'ClassifyMin' :
    
    print('Compare_Classification...')
    Compare_Classification(alpha,beta,theta,gamma,mu1,rho1,lambda1, InputFilePath)
    
    # ------------- RUN Matlab symbolic minimization program 'symMinimization'
    
    eng = matlab.engine.start_matlab()
    
    # s = eng.genpath(path + '/Matlab-Programs')
    s = eng.genpath(path)
    
    eng.addpath(s, nargout=0)
    
    # print('current Matlab folder:', eng.pwd(nargout=1))
    eng.cd('Matlab-Programs', nargout=0)  #switch to Matlab-Programs folder
    # print('current Matlab folder:', eng.pwd(nargout=1))
    Inp = False
    
    print('Run symbolic Minimization...')
    
    #Arguments: symMinization(print_Input,print_statPoint,print_Output,make_FunctionPlot, InputPath)
    
    Klaus Böhnlein's avatar
    Klaus Böhnlein committed
    G, angle, type, kappa = eng.symMinimization(Inp,Inp,Inp,Inp, nargout=4)  #Name of program:symMinimization
    
    # G, angle, type, kappa = eng.symMinimization(Inp,Inp,Inp,Inp,path + "/outputs", nargout=4)  #Optional: add Path
    G = np.asarray(G) #cast Matlab Outout to numpy array
    # --- print Output ---
    print('Minimizer G:')
    print(G)
    print('angle:', angle)
    print('type:', type )
    print('curvature:', kappa)