fix y-label for cross section

This commit is contained in:
Ryan Tang 2025-01-13 14:22:10 -05:00
parent a154a70086
commit c49095aa95
2 changed files with 11 additions and 2 deletions

View File

@ -47,6 +47,11 @@ class MatPlotLibWindow(QWidget):
layout.addWidget(self.gridline_checkbox, 1, 2)
layout.addWidget(self.canvas, 2, 0, 5, 3)
self.ylabel = 'd.s.c.[mb/sr]'
def set_ylable(self, newY_Label):
self.ylabel = newY_Label
def read_data(self,file_path):
self.headers, self.x, self.data = read_DWBA(file_path)
@ -58,8 +63,8 @@ class MatPlotLibWindow(QWidget):
for i, y in enumerate(self.data):
self.ax.plot(self.x, y, plotStyle, label=self.headers[i + 1])
self.ax.set_xlabel("Angle_CM [Deg]")
self.ax.set_ylabel(r'$\theta_{cm}$ [deg]')
self.ax.set_xlabel(r"$\theta_{cm}$ [Deg]")
self.ax.set_ylabel(self.ylabel)
self.ax.legend(loc='upper right', frameon=True)
# Apply log scale for y-axis if selected

View File

@ -382,6 +382,10 @@ class MyWindow(QMainWindow):
if isRunOK and self.chkExtracrXsec.isChecked() and self.file_exists(self.DWBAFileName + ".out") :
extract_xsec(self.DWBAFileName + ".out", self.cbXsec.currentIndex())
if self.cbXsec.currentIndex() == 1 :
self.plot_window.set_ylable(r"$(d\sigma/d\theta)$ / Ruth.")
else:
self.plot_window.set_ylable(r"$d\sigma/d\theta$ [mb/sr]")
if isRunOK and self.chkPlot.isChecked() and self.file_exists(self.DWBAFileName + ".Xsec.txt") :
self.open_plot_window()