Changes in src/sas/qtgui/Perspectives/Inversion/DMaxExplorerWidget.py [f4480f0:b0ba43e] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Inversion/DMaxExplorerWidget.py
rf4480f0 rb0ba43e 8 8 9 9 # global 10 import sys11 import os12 10 import logging 13 11 import numpy as np … … 42 40 super(DmaxWindow, self).__init__() 43 41 self.setupUi(self) 42 self.parent = parent 44 43 45 44 self.setWindowTitle("Dââ Explorer") … … 50 49 51 50 self.plot = PlotterWidget(self, self) 52 self.hasPlot = None51 self.hasPlot = False 53 52 self.verticalLayout.insertWidget(0, self.plot) 54 53 55 54 # Let's choose the Standard Item Model. 56 55 self.model = QtGui.QStandardItemModel(self) 57 self.mapper = None56 self.mapper = QtWidgets.QDataWidgetMapper(self) 58 57 59 58 # Add validators on line edits 60 59 self.setupValidators() 61 60 62 # #Connect buttons to slots.63 # #Needs to be done early so default values propagate properly.61 # Connect buttons to slots. 62 # Needs to be done early so default values propagate properly. 64 63 self.setupSlots() 65 64 … … 82 81 83 82 def setupModel(self): 83 self.model.blockSignals(True) 84 84 self.model.setItem(W.NPTS, QtGui.QStandardItem(str(self.nfunc))) 85 self.model.blockSignals(False) 86 self.model.blockSignals(True) 85 87 self.model.setItem(W.DMIN, QtGui.QStandardItem("{:.1f}".format(0.9*self.pr_state.d_max))) 88 self.model.blockSignals(False) 89 self.model.blockSignals(True) 86 90 self.model.setItem(W.DMAX, QtGui.QStandardItem("{:.1f}".format(1.1*self.pr_state.d_max))) 91 self.model.blockSignals(False) 92 self.model.blockSignals(True) 87 93 self.model.setItem(W.VARIABLE, QtGui.QStandardItem( "ϲ/dof")) 94 self.model.blockSignals(False) 88 95 89 96 def setupMapper(self): 90 self.mapper = QtWidgets.QDataWidgetMapper(self)91 97 self.mapper.setOrientation(QtCore.Qt.Vertical) 92 98 self.mapper.setModel(self.model) … … 111 117 chi2 = [] 112 118 113 xs = np.linspace(float(self.model.item(W.DMIN).text()), 114 float(self.model.item(W.DMAX).text()), 115 float(self.model.item(W.NPTS).text())) 119 try: 120 dmin = float(self.model.item(W.DMIN).text()) 121 dmax = float(self.model.item(W.DMAX).text()) 122 npts = float(self.model.item(W.NPTS).text()) 123 xs = np.linspace(dmin, dmax, npts) 124 except ValueError as e: 125 msg = ("An input value is not correctly formatted. Please check {}" 126 .format(e.message)) 127 logger.error(msg) 116 128 117 129 original = self.pr_state.d_max … … 132 144 msg = "ExploreDialog: inversion failed " 133 145 msg += "for D_max=%s\n%s" % (str(x), ex) 134 print(msg)135 146 logger.error(msg) 136 147 … … 142 153 msg = "ExploreDialog: inversion failed " 143 154 msg += "for D_max=%s\n%s" % (str(x), ex) 144 print(msg)145 155 logger.error(msg) 146 156 … … 151 161 if plotter == "ϲ/dof": 152 162 ys = chi2 153 y_label = "\ chi^2/dof"163 y_label = "\\chi^2/dof" 154 164 y_unit = "a.u." 155 165 elif plotter == "I(Q=0)": 156 166 ys = iq0 157 167 y_label = "I(q=0)" 158 y_unit = "\ AA^{-1}"168 y_unit = "\\AA^{-1}" 159 169 elif plotter == "Rg": 160 170 ys = rg 161 171 y_label = "R_g" 162 y_unit = "\ AA"172 y_unit = "\\AA" 163 173 elif plotter == "Oscillation parameter": 164 174 ys = osc … … 168 178 ys = bck 169 179 y_label = "Bckg" 170 y_unit = "\ AA^{-1}"180 y_unit = "\\AA^{-1}" 171 181 elif plotter == "Positive Fraction": 172 182 ys = pos … … 175 185 else: 176 186 ys = pos_err 177 y_label = "P^{+}_{1\ sigma}"187 y_label = "P^{+}_{1\\sigma}" 178 188 y_unit = "a.u." 179 189 … … 188 198 data._yunit = y_unit 189 199 self.plot.plot(data=data, marker="-") 200 201 def closeEvent(self, event): 202 """Override close event""" 203 self.parent.dmaxWindow = None 204 event.accept()
Note: See TracChangeset
for help on using the changeset viewer.