From 9871bdeeaabd83d471012d6634bb7afc1c98d1f2 Mon Sep 17 00:00:00 2001 From: "Ryan@fsunuc" Date: Thu, 27 Jul 2023 00:07:05 -0400 Subject: [PATCH] added EnergyLevelsPlot --- EnergyLevelsPlot.html | 69 ++++ EnergyLevelsPlot.js | 151 ++++++++ get_nuclear_data.py | 6 +- index.html | 22 +- simpleSim.html | 4 +- test.cpp | 825 +++++++++++++++++++++++------------------- 6 files changed, 690 insertions(+), 387 deletions(-) create mode 100644 EnergyLevelsPlot.html create mode 100644 EnergyLevelsPlot.js diff --git a/EnergyLevelsPlot.html b/EnergyLevelsPlot.html new file mode 100644 index 0000000..08b9787 --- /dev/null +++ b/EnergyLevelsPlot.html @@ -0,0 +1,69 @@ + + + +Energy Levels Plot + + + + + + + + + +

Energy Levels Plot

+ + + + + + + + + + + + + + + + +
Isotopes Name
Max Ex MeV
+ +
+ +

+ + + + + \ No newline at end of file diff --git a/EnergyLevelsPlot.js b/EnergyLevelsPlot.js new file mode 100644 index 0000000..fc9f588 --- /dev/null +++ b/EnergyLevelsPlot.js @@ -0,0 +1,151 @@ +var energy = []; +var jpi = []; +var Name; + +function GetData(){ + + Name = document.getElementById('isotopes_name').value; + let maxEx = parseFloat(document.getElementById('maxEx').value); + + console.log(maxEx); + + let str = 'get_nuclear_data.py?isotopes_name=' + Name + "&maxEx=" + maxEx; + + let client = new XMLHttpRequest(); + client.onreadystatechange = function() { + let haha = client.responseText.split('\n').slice(17); + + jpi = []; + energy = []; + haha.forEach(line =>{ + // console.log(line); + if( line.includes(" fontSizeMeV) { + count++; + } + } + if (count === l) { + noOverlap = true; + } + loop++; + } + + for (let i = 0; i < l; i++) { + fig.data.push({ + x: [0, 1], + y: [energy[i], energy[i]], + mode: 'lines', + line: { color: 'black', width: 1 } + }); + + fig.data.push({ + x: [1.03, 1.1, 1.19], + y: [energy[i], ypos[i], ypos[i]], + mode: 'lines', + line: { color: 'gray', width: 1 } + }); + + // console.log(energy[i]+ ", " + ypos[i]); + + fig.layout.annotations.push({ + x: 1.2, + y: ypos[i], + text: `${energy[i].toFixed(3)}, ${jpi[i]}`, + xanchor: 'left', + font: { size: fontSize }, + showarrow: false + }); + } + + // let NameYPos = (parseFloat(maxEx) + 2*fontSizeMeV); + // console.log(NameYPos); + + fig.layout.annotations.push({ + x: 0.5, + y: (parseFloat(maxEx) + 0.5), + text: Name, + font: { size: 2 * fontSize }, + showarrow: false + }); + + // Create the plot + Plotly.newPlot('Plot_Levels', fig.data, fig.layout); + +} \ No newline at end of file diff --git a/get_nuclear_data.py b/get_nuclear_data.py index 4a71fe4..e590be3 100644 --- a/get_nuclear_data.py +++ b/get_nuclear_data.py @@ -16,8 +16,8 @@ def lc_read_csv(url): req.add_header('User-Agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0') return pd.read_csv(urllib.request.urlopen(req)) -mp = 938.27208816; #MeV/c^2 -mn = 939.56542052; +mp = 938.27208816 #MeV/c^2 +mn = 939.56542052 #=================================================== import cgi, cgitb @@ -31,7 +31,7 @@ if maxEx == "can be omitted" : maxEx = -1 query = livechart + "fields=ground_states&nuclides=" + AZ -temp = lc_read_csv(query); +temp = lc_read_csv(query) print( "Content-type:text/html\r\n\r\n") print("") diff --git a/index.html b/index.html index 6581073..60c868e 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,7 @@ +