From a674bd3cd59c2910ef5476fc82c2d31c2bdb21e5 Mon Sep 17 00:00:00 2001 From: "Ryan@fsunuc" Date: Fri, 9 Dec 2022 17:40:02 -0500 Subject: [PATCH] can upload in file for Ptolemy --- Simulation_gateway.py | 31 ++++++++++++++++++++++++++++--- index.html | 4 ++++ 2 files changed, 32 insertions(+), 3 deletions(-) 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 ("
Downlaod the %s" % (fn4+".in", fn4+".in", fn4+".in")) + print ("
Downlaod the %s" % (fn4+".out", fn4+".out", fn4+".out")) + print ("
Downlaod the %s" % (fn4+".Xsec.txt", fn4+".Xsec.txt", fn4+".Xec.txt")) if pngName != "" : print ("" % pngName) @@ -156,6 +180,7 @@ print ("
Reaction File : %s" % message1) print ("
DetectorGeo File : %s" % message2) print ("
Ex File : %s" % message3) print ("
DWBA File : %s" % message4) +print ("
DWBA.in File : %s" % message4a) print ("
Plot Config File : %s" % message5) print ("
%s " % dwba_1) print ("
%s " % dwba_2) diff --git a/index.html b/index.html index a1dc12d..bf3bb57 100644 --- a/index.html +++ b/index.html @@ -125,6 +125,10 @@ DWBA File ^ + + DWBA.in File ^ + + Plot Config File *