Changeset 5d4777d in sasmodels for sasmodels/bumps_model.py
- Timestamp:
- Sep 2, 2014 1:24:38 AM (10 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:
- f4cf580
- Parents:
- ff7119b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/bumps_model.py
rff7119b r5d4777d 140 140 import matplotlib.pyplot as plt 141 141 if hasattr(data, 'qx_data'): 142 img = masked_array(iq, data.mask) 142 iq = iq[:] 143 valid = np.isfinite(iq) 143 144 if scale == 'log': 144 img[(img <= 0) | ~np.isfinite(img)] = masked 145 img = np.log10(img) 145 valid[valid] = (iq[valid] > 0) 146 iq[valid] = np.log10(iq[valid]) 147 iq[~valid|data.mask] = 0 148 #plottable = iq 149 plottable = masked_array(iq, ~valid|data.mask) 146 150 xmin, xmax = min(data.qx_data), max(data.qx_data) 147 151 ymin, ymax = min(data.qy_data), max(data.qy_data) 148 plt.imshow( img.reshape(128,128),152 plt.imshow(plottable.reshape(128,128), 149 153 interpolation='nearest', aspect=1, origin='upper', 150 154 extent=[xmin, xmax, ymin, ymax], vmin=vmin, vmax=vmax) … … 154 158 plt.plot(data.x[idx], iq[idx]) 155 159 else: 156 idx = np.isfinite(iq) & (iq>0) 160 idx = np.isfinite(iq) 161 idx[idx] = (iq[idx]>0) 157 162 plt.loglog(data.x[idx], iq[idx]) 158 163 … … 228 233 def __init__(self, data, model, cutoff=1e-5, **kw): 229 234 from bumps.names import Parameter 235 partype = model.info['partype'] 230 236 231 237 # interpret data … … 236 242 self.diq = data.err_data[self.index] 237 243 self._theory = np.zeros_like(data.data) 238 q_vectors = [data.qx_data, data.qy_data] 244 if not partype['orientation'] and not partype['magnetic']: 245 q_vectors = [np.sqrt(data.qx_data**2+data.qy_data**2)] 246 else: 247 q_vectors = [data.qx_data, data.qy_data] 239 248 else: 240 249 self.index = (data.x>=data.qmin) & (data.x<=data.qmax) & ~np.isnan(data.y) … … 258 267 setattr(self, name, Parameter.default(value, name=name, limits=limits)) 259 268 pars.append(name) 260 for name in model.info['partype']['pd-2d']:269 for name in partype['pd-2d']: 261 270 for xpart,xdefault,xlimits in [ 262 271 ('_pd', 0, limits),
Note: See TracChangeset
for help on using the changeset viewer.