Changeset 7ae2b7f in sasmodels for sasmodels/resolution.py
- Timestamp:
- Apr 11, 2016 12:48:41 PM (8 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:
- fa5fd8d
- Parents:
- f619de7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/resolution.py
r6d6508e r7ae2b7f 6 6 from __future__ import division 7 7 8 from scipy.special import erf 9 from numpy import sqrt, log, log10 10 import numpy as np 8 from scipy.special import erf # type: ignore 9 from numpy import sqrt, log, log10, exp, pi # type: ignore 10 import numpy as np # type: ignore 11 11 12 12 __all__ = ["Resolution", "Perfect1D", "Pinhole1D", "Slit1D", … … 35 35 smeared theory I(q). 36 36 """ 37 q = None 38 q_calc = None 37 q = None # type: np.ndarray 38 q_calc = None # type: np.ndarray 39 39 def apply(self, theory): 40 40 """ … … 489 489 *q0* is the center, *dq* is the width and *q* are the points to evaluate. 490 490 """ 491 from numpy import exp, pi492 491 return exp(-0.5*((q-q0)/dq)**2)/(sqrt(2*pi)*dq) 493 492 … … 500 499 that make it slow to evaluate but give it good accuracy. 501 500 """ 502 from scipy.integrate import romberg 501 from scipy.integrate import romberg # type: ignore 503 502 504 503 par_set = set([p.name for p in form.info.parameters.call_parameters]) … … 555 554 that make it slow to evaluate but give it good accuracy. 556 555 """ 557 from scipy.integrate import romberg 556 from scipy.integrate import romberg # type: ignore 558 557 559 558 par_set = set([p.name for p in form.info.parameters.call_parameters]) … … 752 751 #tol = 0.001 753 752 ## The default 3 sigma and no extra points gets 1% 754 q_calc, tol = None, 0.01 753 q_calc = None # type: np.ndarray 754 tol = 0.01 755 755 resolution = Pinhole1D(q, q_width, q_calc=q_calc) 756 756 output = self._eval_sphere(pars, resolution) 757 757 if 0: # debug plot 758 import matplotlib.pyplot as plt 758 import matplotlib.pyplot as plt # type: ignore 759 759 resolution = Perfect1D(q) 760 760 source = self._eval_sphere(pars, resolution) … … 1028 1028 """ 1029 1029 import sys 1030 import xmlrunner 1030 import xmlrunner # type: ignore 1031 1031 1032 1032 suite = unittest.TestSuite() … … 1076 1076 Iq_romb = romberg_pinhole_1d(resolution.q, dq, model, pars) 1077 1077 1078 import matplotlib.pyplot as plt 1078 import matplotlib.pyplot as plt # type: ignore 1079 1079 plt.loglog(resolution.q_calc, theory, label='unsmeared') 1080 1080 plt.loglog(resolution.q, Iq, label='smeared', hold=True) … … 1111 1111 Run the resolution demos. 1112 1112 """ 1113 import matplotlib.pyplot as plt 1113 import matplotlib.pyplot as plt # type: ignore 1114 1114 plt.subplot(121) 1115 1115 demo_pinhole_1d()
Note: See TracChangeset
for help on using the changeset viewer.