From 6ac262c3f6c03a7d7b1a3bc63aefa8780282f6bf Mon Sep 17 00:00:00 2001 From: "Ryan@SOLARIS_testStation" Date: Tue, 5 Nov 2024 13:24:07 -0500 Subject: [PATCH] add Sn, Sp, Sa to Ex plot --- PyGUIQt6/ExWindow.py | 30 ++++++++++++++++++++++++++---- PyGUIQt6/IAEANuclearData.py | 2 +- PyGUIQt6/PtolemyGUIPy.py | 5 +++-- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/PyGUIQt6/ExWindow.py b/PyGUIQt6/ExWindow.py index 23122fe..0d72732 100644 --- a/PyGUIQt6/ExWindow.py +++ b/PyGUIQt6/ExWindow.py @@ -37,6 +37,10 @@ class ExWindow(QWidget): self.maxEx = maxEx self.data = self.Iso.GetExList(ASym, maxEx) + self.Iso.PrintIso(ASym) + print(self.data) + print("=============================") + def plot_Ex_graph(self): if self.html_file and os.path.exists(self.html_file): @@ -48,15 +52,22 @@ class ExWindow(QWidget): plotWidth = 350 yMin = -1 - # Create a Plotly figure - fig = go.Figure() + A, Z = self.Iso.GetAZ(self.ASym) + Sym = self.Iso.GetSymbol(A, Z) + + Sn = self.Iso.GetSn(self.ASym) + Sp = self.Iso.GetSp(self.ASym) + Sa = self.Iso.GetSa(self.ASym) ex=self.data['energy']/1000. jp=self.data['jp'] + + # Create a Plotly figure fig = go.Figure() + fig.update_layout(plot_bgcolor='white', width=plotWidth, height = plotHeight, margin=dict(l=0, r=0, t=0, b=0)) fig.update_layout(showlegend=False) - fig.update_xaxes(showline=False, visible= False, range=[-1, 3]) + fig.update_xaxes(showline=False, visible= False, range=[-1, 2.5]) fig.update_yaxes(showline=True, visible= True, range=[yMin, self.maxEx+1]) l=ex.last_valid_index() @@ -100,7 +111,18 @@ class ExWindow(QWidget): fig.add_trace(go.Scatter(x=[1.03 + xShift,1.1 + xShift, 1.19 + xShift], y=[ex[i],ypos[i],ypos[i]],mode='lines',line=dict(color='gray', width=1))) fig.add_annotation(x=1.2 + xShift, y=ypos[i], text=("%.3f, %s" % (ex[i], jp[i])), xanchor='left', font=dict(size=fontSize), showarrow=False) - fig.add_annotation(x=0.5 + xShift, y=-0.5, text=self.ASym, font=dict(size=1.5*fontSize), showarrow=False) + if( Sn < self.maxEx ): + fig.add_trace(go.Scatter(x=[-0.6 + xShift,-0.1 + xShift], y=[Sn,Sn],mode='lines',line=dict(color='red', width=1))) + fig.add_annotation(x=-0.6 + xShift, y=Sn, text=("Sn %.3f" % Sn), xanchor='left', yanchor='bottom', font=dict(size=fontSize, color='red'), showarrow=False) + if( Sp < self.maxEx ): + fig.add_trace(go.Scatter(x=[-0.6 + xShift,-0.1 + xShift], y=[Sp,Sp],mode='lines',line=dict(color='blue', width=1))) + fig.add_annotation(x=-0.6 + xShift, y=Sp, text=("Sp %.3f" % Sp), xanchor='left', yanchor='bottom', font=dict(size=fontSize, color='blue'), showarrow=False) + if( Sa < self.maxEx ): + fig.add_trace(go.Scatter(x=[-0.6 + xShift,-0.1 + xShift], y=[Sa,Sa],mode='lines',line=dict(color='#9467bd', width=1))) + fig.add_annotation(x=-0.6 + xShift, y=Sa, text=("Sa %.3f" % Sa), xanchor='left', yanchor='bottom', font=dict(size=fontSize, color='#9467bd'), showarrow=False) + + + fig.add_annotation(x=0.5 + xShift, y=-0.6, text=("%s%s" % (A, Sym)), font=dict(size=2.5*fontSize), showarrow=False) # Save the plot as an HTML file in a temporary location timestamp = int(time.time() * 1000) # Unique timestamp in milliseconds diff --git a/PyGUIQt6/IAEANuclearData.py b/PyGUIQt6/IAEANuclearData.py index 63427ff..b6fe566 100644 --- a/PyGUIQt6/IAEANuclearData.py +++ b/PyGUIQt6/IAEANuclearData.py @@ -104,7 +104,7 @@ class IsotopeClass: def GetSymbol(self, A : int, Z : int) -> str: try: dudu = self.data[(self.data['z']==Z) & (self.data['A']==A)] - return "%d%s" % (A , dudu['symbol'].iloc[0]) + return "%s" % (dudu['symbol'].iloc[0]) except: return "0x" diff --git a/PyGUIQt6/PtolemyGUIPy.py b/PyGUIQt6/PtolemyGUIPy.py index ae61cb2..82df57b 100755 --- a/PyGUIQt6/PtolemyGUIPy.py +++ b/PyGUIQt6/PtolemyGUIPy.py @@ -286,8 +286,9 @@ class MyWindow(QMainWindow): def open_Ex_window(self): self.Ex_window.GetEx(self.leName.text(), self.sbMaXEx.value()) - self.Ex_window.plot_Ex_graph() - self.Ex_window.show() + if self.sbMaXEx.value() > 0 : + self.Ex_window.plot_Ex_graph() + self.Ex_window.show() def closeEvent(self, event):