diff --git a/Simulation_gateway.py b/Simulation_gateway.py index 3af7f65..40e2d6d 100755 --- a/Simulation_gateway.py +++ b/Simulation_gateway.py @@ -14,12 +14,14 @@ fn1="" fn2="" fn3="" fn4="" +fn4a="" fn5="" message1="" message2="" message3="" message4="" +message4a="" message5="" fileitem = form['filename1'] @@ -70,6 +72,18 @@ if fileitem.filename: else: message4 = 'No file was uploaded' +fileitem = form['filename4a'] +if fileitem.filename: + fn4a = os.path.basename(fileitem.filename) + if fn4a.endswith('.in') : + open('files/' + fn4a, 'wb').write(fileitem.file.read()) + message4a = 'The file "' + fn4a + '" was uploaded successfully' + else: + message4a = 'Need to be in extension file' + fn4a = "" +else: + message4a = 'No file was uploaded' + fileitem = form['filename5'] if fileitem.filename: fn5 = os.path.basename(fileitem.filename) @@ -103,11 +117,18 @@ dwbaRootFile="" isTransferOK=False #------- if only DWBA -if fn4!="" : - dwba_1 = subprocess.run(["../Cleopatra/InFileCreator", fn4, "0", "180", "0.1"] , stdout=subprocess.PIPE).stdout.decode('utf-8') +if fn4!="" or fn4a!="": + if fn4!="": + dwba_1 = subprocess.run(["../Cleopatra/InFileCreator", fn4, "0", "180", "0.1"] , stdout=subprocess.PIPE).stdout.decode('utf-8') + cmd = "../Cleopatra/ptolemy <%s.in> %s.out" % (fn4, fn4) + + if fn4a!="": + fn4 = fn4a.split('.')[0] + cmd = "../Cleopatra/ptolemy <%s> %s.out" % (fn4a, fn4) + outFile = fn4+ ".out" - cmd = "../Cleopatra/ptolemy <%s.in> %s.out" % (fn4, fn4) os.system(cmd) + isPtolemy = True if os.path.exists(outFile) : dwba_2 = outFile dwba_3 = subprocess.run(["../Cleopatra/ExtractXSec", outFile, "1"], stdout=subprocess.PIPE).stdout.decode('utf-8') @@ -148,6 +169,9 @@ print ("
") if dwbaPNG != "" : print ("" % dwbaPNG) + print ("