Changes in / [9ed43f4:34a9e4e] in sasmodels
- Files:
-
- 3 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
example/oriented_usans.py
r1cd24b4 rea75043 19 19 scale=0.08, background=0, 20 20 sld=.291, sld_solvent=7.105, 21 r adius_polar=1800, radius_polar_pd=0.222296, radius_polar_pd_n=0,22 r adius_equatorial=2600, radius_equatorial_pd=0.28, radius_equatorial_pd_n=0,21 r_polar=1800, r_polar_pd=0.222296, r_polar_pd_n=0, 22 r_equatorial=2600, r_equatorial_pd=0.28, r_equatorial_pd_n=0, 23 23 theta=60, theta_pd=0, theta_pd_n=0, 24 24 phi=60, phi_pd=0, phi_pd_n=0, … … 26 26 27 27 # SET THE FITTING PARAMETERS 28 model.r adius_polar.range(1000, 10000)29 model.r adius_equatorial.range(1000, 10000)28 model.r_polar.range(1000, 10000) 29 model.r_equatorial.range(1000, 10000) 30 30 model.theta.range(0, 360) 31 31 model.phi.range(0, 360) -
sasmodels/data.py
r09e9e13 ra769b54 450 450 if view is 'log': 451 451 mtheory[mtheory <= 0] = masked 452 plt.plot(data.x, scale*mtheory, '-' )452 plt.plot(data.x, scale*mtheory, '-', hold=True) 453 453 all_positive = all_positive and (mtheory > 0).all() 454 454 some_present = some_present or (mtheory.count() > 0) … … 457 457 plt.ylim(*limits) 458 458 459 plt.xscale('linear' if not some_present or non_positive_x 460 else view if view is not None 461 else 'log') 459 plt.xscale('linear' if not some_present or non_positive_x else view) 462 460 plt.yscale('linear' 463 461 if view == 'q4' or not some_present or not all_positive 464 else view if view is not None 465 else 'log') 462 else view) 466 463 plt.xlabel("$q$/A$^{-1}$") 467 464 plt.ylabel('$I(q)$') 468 title = ("data and model" if use_theory and use_data469 else "data" if use_data470 else "model")471 plt.title(title)472 465 473 466 if use_calc: … … 489 482 if num_plots > 1: 490 483 plt.subplot(1, num_plots, use_calc + 2) 491 plt.plot(data.x, mresid, ' .')484 plt.plot(data.x, mresid, '-') 492 485 plt.xlabel("$q$/A$^{-1}$") 493 486 plt.ylabel('residuals') 494 plt.xscale('linear') 495 plt.title('(model - Iq)/dIq') 487 plt.xscale('linear' if not some_present or non_positive_x else view) 496 488 497 489 … … 520 512 if theory is not None: 521 513 if is_tof: 522 plt.plot(data.x, np.log(theory)/(data.lam*data.lam), '-' )514 plt.plot(data.x, np.log(theory)/(data.lam*data.lam), '-', hold=True) 523 515 else: 524 plt.plot(data.x, theory, '-' )516 plt.plot(data.x, theory, '-', hold=True) 525 517 if limits is not None: 526 518 plt.ylim(*limits) -
sasmodels/models/onion.py
rbccb40f r925ad6e 1 1 r""" 2 2 This model provides the form factor, $P(q)$, for a multi-shell sphere where 3 the scattering length density (SLD) of each shell is described by an3 the scattering length density (SLD) of the each shell is described by an 4 4 exponential, linear, or constant function. The form factor is normalized by 5 5 the volume of the sphere where the SLD is not identical to the SLD of the … … 142 142 143 143 For $A = 0$, the exponential function has no dependence on the radius (so that 144 $\rho_\text{out}$ is ignored inthis case) and becomes flat. We set the constant144 $\rho_\text{out}$ is ignored this case) and becomes flat. We set the constant 145 145 to $\rho_\text{in}$ for convenience, and thus the form factor contributed by 146 146 the shells is … … 346 346 # flat shell 347 347 z.append(z_current + thickness[k]) 348 rho.append(sld_ in[k])348 rho.append(sld_out[k]) 349 349 else: 350 350 # exponential shell … … 357 357 z.append(z_current+z_shell) 358 358 rho.append(slope*exp(A[k]*z_shell/thickness[k]) + const) 359 359 360 360 # add in the solvent 361 361 z.append(z[-1]) -
sasmodels/models/spherical_sld.py
r63a7fe8 r3330bb4 199 199 category = "shape:sphere" 200 200 201 SHAPES = [ "erf(|nu|*z)", "Rpow(z^|nu|)", "Lpow(z^|nu|)",202 "Rexp(-|nu|z)", "Lexp(-|nu|z)"]201 SHAPES = [["erf(|nu|*z)", "Rpow(z^|nu|)", "Lpow(z^|nu|)", 202 "Rexp(-|nu|z)", "Lexp(-|nu|z)"]] 203 203 204 204 # pylint: disable=bad-whitespace, line-too-long … … 209 209 ["thickness[n_shells]", "Ang", 100.0, [0, inf], "volume", "thickness shell"], 210 210 ["interface[n_shells]", "Ang", 50.0, [0, inf], "volume", "thickness of the interface"], 211 ["shape[n_shells]", "", 0, [SHAPES],"", "interface shape"],211 ["shape[n_shells]", "", 0, SHAPES, "", "interface shape"], 212 212 ["nu[n_shells]", "", 2.5, [0, inf], "", "interface shape exponent"], 213 213 ["n_steps", "", 35, [0, inf], "", "number of steps in each interface (must be an odd integer)"], -
sasmodels/rst2html.py
rf2f5413 rc4e3215 155 155 return frame 156 156 157 def view_html_wxapp(html, url=""):158 import wx # type: ignore159 app = wx.App()160 frame = wxview(html, url)161 app.MainLoop()162 163 def view_url_wxapp(url):164 import wx # type: ignore165 from wx.html2 import WebView166 app = wx.App()167 frame = wx.Frame(None, -1, size=(850, 540))168 view = WebView.New(frame)169 view.LoadURL(url)170 frame.Show()171 app.MainLoop()172 173 157 def qtview(html, url=""): 174 158 try: … … 183 167 return helpView 184 168 169 def view_html_wxapp(html, url=""): 170 import wx # type: ignore 171 app = wx.App() 172 frame = wxview(html, url) 173 app.MainLoop() 174 185 175 def view_html_qtapp(html, url=""): 186 176 import sys … … 193 183 sys.exit(app.exec_()) 194 184 195 def view_url_qtapp(url): 196 import sys 197 try: 198 from PyQt5.QtWidgets import QApplication 199 except ImportError: 200 from PyQt4.QtGui import QApplication 201 app = QApplication([]) 202 try: 203 from PyQt5.QtWebKitWidgets import QWebView 204 from PyQt5.QtCore import QUrl 205 except ImportError: 206 from PyQt4.QtWebkit import QWebView 207 from PyQt4.QtCore import QUrl 208 frame = QWebView() 209 frame.load(QUrl(url)) 210 frame.show() 211 sys.exit(app.exec_()) 212 213 def view_help(filename, qt=False): 185 def view_rst_app(filename, qt=False): 214 186 import os 215 url="file:///"+os.path.abspath(filename).replace("\\","/") 216 if filename.endswith('.rst'): 217 html = load_rst_as_html(filename) 218 if qt: 219 view_html_qtapp(html, url) 220 else: 221 view_html_wxapp(html, url) 187 html = load_rst_as_html(filename) 188 url="file://"+os.path.abspath(filename)+"/" 189 if qt: 190 view_html_qtapp(html, url) 222 191 else: 223 if qt: 224 view_url_qtapp(url) 225 else: 226 view_url_wxapp(url) 192 view_html_wxapp(html, url) 227 193 228 194 if __name__ == "__main__": 229 195 import sys 230 view_ help(sys.argv[1], qt=True)196 view_rst_app(sys.argv[1], qt=True) 231 197
Note: See TracChangeset
for help on using the changeset viewer.