def itsTester(): # Some aplications of itsme functions and objects its() # test list folder = 'itsme_test_cases' testList = os.listdir('./' + folder) print(testList) for case in testList: try: its(folder + '/' + case) except: print('Fail case: ', case) testList2 = [ '/caseEarthRotating.its', '/caseMoon.its', '/caseMu150h500NStag4.its' ] for case in testList2: try: con = initialize(folder + case).result() problem(con, model).solveForFineTune() except: print('Fail case: ', case)
def its(*arg): # arguments analisys if len(arg) == 0: fname = 'default.its' elif len(arg) == 1: fname = arg[0] else: raise Exception('itsme saying: too many arguments on its') print("itsme: Inital Trajectory Setup Module") print("Opening case: ", fname) con = initialize(fname).resultShow() problem1 = problem(con, model) solution1 = problem1.solveForInitialGuess() solution1.displayResults() solution2 = problem1.solveForFineTune() solution2.displayResults() if not solution2.converged(): print('itsme saying: solution has not converged :(') return solution2
def sgra(fname: str): # arguments analisys print("itsme: Inital Trajectory Setup Module") print("Opening case: ", fname) con = initializeSGRA(fname).result() solution = problem(con, model).solveForFineTune() solution.basic.displayInfo() solution.basic.orbitResults() print('Initial states:', solution.basic.traj.xx[0]) print('Final states:', solution.basic.traj.xx[-1]) if not solution.converged(): print('itsme saying: solution has not converged :(') return solution.sgra()
def itsTester(): # Some aplications of itsme functions and objects its() # test list folder = 'itsme_test_cases' testList = os.listdir('./' + folder) print(testList) for case in testList: if not its(folder + '/' + case).converged(): print(case) raise Exception('itsme saying: solution did not converge') con = initialize(folder + '/caseEarthRotating.its').result() problem(con, model).solveForFineTune() con = initialize(folder + '/caseMoon.its').result() problem(con, model).solveForFineTune() con = initialize(folder + '/caseMu150h500NStag4.its').result() problem(con, model).solveForFineTune() #sgra('teste.its') class initialize(): def __init__(self, fileAdress): # TODO: solve the codification problem on configuration files configuration = problemConfiguration(fileAdress) configuration.environment() configuration.initialState()