Changeset 5fba4c4 in sasview
- Timestamp:
- Nov 7, 2017 11:15:20 AM (7 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- bcf1215
- Parents:
- e58eb95
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Inversion/InversionLogic.py
r57ad773 r5fba4c4 113 113 return new_plot 114 114 115 def update1DPlot(self, plot, out, pr, q=None): 116 """ 117 Create a new 1D data instance based on fitting results 118 """ 119 120 qtemp = pr.x 121 if q is not None: 122 qtemp = q 123 124 # Make a plot 125 maxq = max(qtemp) 126 127 minq = min(qtemp) 128 129 # Check for user min/max 130 if pr.q_min is not None and maxq >= pr.q_min >= minq: 131 minq = pr.q_min 132 if pr.q_max is not None and maxq >= pr.q_max >= minq: 133 maxq = pr.q_max 134 135 x = pylab.arange(minq, maxq, maxq / 301.0) 136 y = np.zeros(len(x)) 137 err = np.zeros(len(x)) 138 for i in range(len(x)): 139 value = pr.iq(out, x[i]) 140 y[i] = value 141 try: 142 err[i] = math.sqrt(math.fabs(value)) 143 except: 144 err[i] = 1.0 145 print("Error getting error", value, x[i]) 146 147 plot.x = x 148 plot.y = y 149 150 # If we have used slit smearing, plot the smeared I(q) too 151 if pr.slit_width > 0 or pr.slit_height > 0: 152 x = pylab.arange(minq, maxq, maxq / 301.0) 153 y = np.zeros(len(x)) 154 err = np.zeros(len(x)) 155 for i in range(len(x)): 156 value = pr.iq_smeared(pr.out, x[i]) 157 y[i] = value 158 try: 159 err[i] = math.sqrt(math.fabs(value)) 160 except: 161 err[i] = 1.0 162 print("Error getting error", value, x[i]) 163 164 plot.x = x 165 plot.y = y 166 167 return plot 168 115 169 def newPRPlot(self, out, pr, cov=None): 116 170 """ … … 121 175 y = np.zeros(len(x)) 122 176 dy = np.zeros(len(x)) 123 y_true = np.zeros(len(x))124 177 125 178 total = 0.0 … … 163 216 return new_plot 164 217 218 def updatePRPlot(self, plot, out, pr, cov=None): 219 x = pylab.arange(0.0, pr.d_max, pr.d_max / self._pr_n_pts) 220 221 y = np.zeros(len(x)) 222 dy = np.zeros(len(x)) 223 224 total = 0.0 225 pmax = 0.0 226 cov2 = np.ascontiguousarray(cov) 227 228 for i in range(len(x)): 229 if cov2 is None: 230 value = pr.pr(out, x[i]) 231 else: 232 (value, dy[i]) = pr.pr_err(out, cov2, x[i]) 233 total += value * pr.d_max / len(x) 234 235 # keep track of the maximum P(r) value 236 if value > pmax: 237 pmax = value 238 239 y[i] = value 240 241 # if self._normalize_output == True: 242 # y = y / total 243 # dy = dy / total 244 # elif self._scale_output_unity == True: 245 # y = y / pmax 246 # dy = dy / pmax 247 plot.x = x 248 plot.y = y 249 250 if cov2 is not None: 251 plot.dy = dy 252 253 return plot 254 165 255 def computeDataRange(self): 166 256 """
Note: See TracChangeset
for help on using the changeset viewer.