Changeset b89f519 in sasmodels for sasmodels/bumps_model.py
- Timestamp:
- Mar 4, 2015 2:34:25 PM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 3c56da87
- Parents:
- 12c810f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/bumps_model.py
r1353f60 rb89f519 154 154 155 155 156 def plot_data(data, iq, vmin=None, vmax=None, scale='log'):156 def plot_data(data, iq, vmin=None, vmax=None, view='log'): 157 157 """ 158 158 Plot the target value for the data. This could be the data itself, … … 166 166 iq = iq + 0 167 167 valid = np.isfinite(iq) 168 if scale== 'log':168 if view == 'log': 169 169 valid[valid] = (iq[valid] > 0) 170 170 iq[valid] = np.log10(iq[valid]) 171 elif view == 'q4': 172 iq[valid] = iq*(data.qx_data[valid]**2+data.qy_data[valid]**2)**2 171 173 iq[~valid | data.mask] = 0 172 174 #plottable = iq … … 183 185 extent=[xmin, xmax, ymin, ymax], vmin=vmin, vmax=vmax) 184 186 else: # 1D data 185 if scale == 'linear': 187 if view == 'linear' or view == 'q4': 188 #idx = np.isfinite(iq) 189 scale = data.x**4 if view == 'q4' else 1.0 190 plt.plot(data.x, scale*iq) #, '.') 191 else: 192 # Find the values that are finite and positive 186 193 idx = np.isfinite(iq) 187 plt.plot(data.x[idx], iq[idx]) 188 else: 189 idx = np.isfinite(iq) 190 idx[idx] = (iq[idx] > 0) 191 plt.loglog(data.x[idx], iq[idx]) 194 idx[idx] = iq[idx]>0 195 iq[~idx] = np.nan 196 plt.loglog(data.x, iq) 192 197 193 198 … … 207 212 mresid = masked_array((theory - data.y) / data.dy, mdata.mask) 208 213 214 scale = data.x**4 if view == 'q4' else 1.0 209 215 plt.subplot(121) 210 plt.errorbar(data.x, mdata, yerr=data.dy)211 plt.plot(data.x, mtheory, '-', hold=True)212 plt.yscale( view)216 plt.errorbar(data.x, scale*mdata, yerr=data.dy) 217 plt.plot(data.x, scale*mtheory, '-', hold=True) 218 plt.yscale('linear' if view == 'q4' else view) 213 219 plt.subplot(122) 214 220 plt.plot(data.x, mresid, 'x') … … 234 240 resid = (theory - data.data) / data.err_data 235 241 plt.subplot(131) 236 plot_data(data, data.data, scale=view)242 plot_data(data, data.data, view=view) 237 243 plt.colorbar() 238 244 plt.subplot(132) 239 plot_data(data, theory, scale=view)245 plot_data(data, theory, view=view) 240 246 plt.colorbar() 241 247 plt.subplot(133) 242 plot_data(data, resid, scale='linear')248 plot_data(data, resid, view='linear') 243 249 plt.colorbar() 244 250
Note: See TracChangeset
for help on using the changeset viewer.