Changeset 7ae2b7f in sasmodels
- Timestamp:
- Apr 11, 2016 10:48:41 AM (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:
- fa5fd8d
- Parents:
- f619de7
- Location:
- sasmodels
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/alignment.py
r3c56da87 r7ae2b7f 18 18 to decide whether it is really required. 19 19 """ 20 import numpy as np 20 import numpy as np # type: ignore 21 21 22 22 def align_empty(shape, dtype, alignment=128): -
sasmodels/bumps_model.py
r6d6508e r7ae2b7f 14 14 import warnings 15 15 16 import numpy as np 16 import numpy as np # type: ignore 17 17 18 18 from .data import plot_theory … … 79 79 # lazy import; this allows the doc builder and nosetests to run even 80 80 # when bumps is not on the path. 81 from bumps.names import Parameter 81 from bumps.names import Parameter # type: ignore 82 82 83 83 pars = {} # floating point parameters -
sasmodels/compare.py
r6d6508e r7ae2b7f 34 34 import traceback 35 35 36 import numpy as np 36 import numpy as np # type: ignore 37 37 38 38 from . import core … … 710 710 try: 711 711 model_info = core.load_model_info(name) 712 except ImportError ,exc:712 except ImportError as exc: 713 713 print(str(exc)) 714 714 print("Could not find model; use one of:\n " + models) … … 860 860 Explore the model using the Bumps GUI. 861 861 """ 862 import wx 863 from bumps.names import FitProblem 864 from bumps.gui.app_frame import AppFrame 862 import wx # type: ignore 863 from bumps.names import FitProblem # type: ignore 864 from bumps.gui.app_frame import AppFrame # type: ignore 865 865 866 866 problem = FitProblem(Explore(opts)) … … 883 883 """ 884 884 def __init__(self, opts): 885 from bumps.cli import config_matplotlib 885 from bumps.cli import config_matplotlib # type: ignore 886 886 from . import bumps_model 887 887 config_matplotlib() -
sasmodels/compare_many.py
r8bd7b77 r7ae2b7f 17 17 import traceback 18 18 19 import numpy as np 19 import numpy as np # type: ignore 20 20 21 21 from . import core -
sasmodels/convert.py
r6d6508e r7ae2b7f 62 62 # but only if we haven't already byteified it 63 63 if isinstance(data, dict) and not ignore_dicts: 64 return { 65 _byteify(key, ignore_dicts=True): _byteify(value, ignore_dicts=True) 66 for key, value in data.iteritems() 67 } 64 return dict((_byteify(key, ignore_dicts=True), 65 _byteify(value, ignore_dicts=True)) 66 for key, value in data.items()) 68 67 # if it's anything else, return it in its original form 69 68 return data -
sasmodels/core.py
rf619de7 r7ae2b7f 12 12 from glob import glob 13 13 14 import numpy as np 14 import numpy as np # type: ignore 15 15 16 16 from . import generate -
sasmodels/custom/__init__.py
rcd0a808 r7ae2b7f 14 14 try: 15 15 # Python 3.5 and up 16 from importlib.util import spec_from_file_location, module_from_spec 16 from importlib.util import spec_from_file_location, module_from_spec # type: ignore 17 17 def load_module_from_path(fullname, path): 18 18 spec = spec_from_file_location(fullname, path) -
sasmodels/data.py
ree8f734 r7ae2b7f 35 35 import traceback 36 36 37 import numpy as np 37 import numpy as np # type: ignore 38 38 39 39 def load_data(filename): … … 41 41 Load data using a sasview loader. 42 42 """ 43 from sas.sascalc.dataloader.loader import Loader 43 from sas.sascalc.dataloader.loader import Loader # type: ignore 44 44 loader = Loader() 45 45 data = loader.load(filename) … … 53 53 Add a beam stop of the given *radius*. If *outer*, make an annulus. 54 54 """ 55 from sas.dataloader.manipulations import Ringcut 55 from sas.dataloader.manipulations import Ringcut # type: ignore 56 56 if hasattr(data, 'qx_data'): 57 57 data.mask = Ringcut(0, radius)(data) … … 68 68 Select half of the data, either "right" or "left". 69 69 """ 70 from sas.dataloader.manipulations import Boxcut 70 from sas.dataloader.manipulations import Boxcut # type: ignore 71 71 if half == 'right': 72 72 data.mask += \ … … 81 81 Chop the top off the data, above *cutoff*. 82 82 """ 83 from sas.dataloader.manipulations import Boxcut 83 from sas.dataloader.manipulations import Boxcut # type: ignore 84 84 data.mask += \ 85 85 Boxcut(x_min=-np.inf, x_max=np.inf, y_min=-np.inf, y_max=cutoff)(data) … … 370 370 Plot the data and residuals for 1D data. 371 371 """ 372 import matplotlib.pyplot as plt 373 from numpy.ma import masked_array, masked 372 import matplotlib.pyplot as plt # type: ignore 373 from numpy.ma import masked_array, masked # type: ignore 374 374 375 375 use_data = use_data and data.y is not None … … 447 447 Plot SESANS results. 448 448 """ 449 import matplotlib.pyplot as plt 449 import matplotlib.pyplot as plt # type: ignore 450 450 use_data = use_data and data.y is not None 451 451 use_theory = theory is not None … … 490 490 Plot the data and residuals for 2D data. 491 491 """ 492 import matplotlib.pyplot as plt 492 import matplotlib.pyplot as plt # type: ignore 493 493 use_data = use_data and data.data is not None 494 494 use_theory = theory is not None … … 552 552 *scale* can be 'log' for log scale data, or 'linear'. 553 553 """ 554 import matplotlib.pyplot as plt 555 from numpy.ma import masked_array 554 import matplotlib.pyplot as plt # type: ignore 555 from numpy.ma import masked_array # type: ignore 556 556 557 557 image = np.zeros_like(data.qx_data) … … 593 593 set_beam_stop(data, 0.004) 594 594 plot_data(data) 595 import matplotlib.pyplot as plt; plt.show() 595 import matplotlib.pyplot as plt # type: ignore 596 plt.show() 596 597 597 598 -
sasmodels/details.py
r4bfd277 r7ae2b7f 1 import numpy as np 1 import numpy as np # type: ignore 2 3 try: 4 from typing import List 5 except ImportError: 6 pass 7 2 8 3 9 class CallDetails(object): 10 parts = None # type: List["CallDetails"] 4 11 def __init__(self, model_info): 5 12 parameters = model_info.parameters -
sasmodels/direct_model.py
r6d6508e r7ae2b7f 23 23 from __future__ import print_function 24 24 25 import numpy as np 26 27 from . import sesans 25 import numpy as np # type: ignore 26 27 # TODO: fix sesans module 28 from . import sesans # type: ignore 28 29 from . import weights 29 30 from . import resolution -
sasmodels/generate.py
rf619de7 r7ae2b7f 160 160 import warnings 161 161 162 import numpy as np 162 import numpy as np # type: ignore 163 163 164 164 from .modelinfo import Parameter -
sasmodels/kernel.py
rf619de7 r7ae2b7f 14 14 from .details import CallDetails 15 15 from .modelinfo import ModelInfo 16 import numpy as np 16 import numpy as np # type: ignore 17 17 except ImportError: 18 18 pass -
sasmodels/kernelcl.py
rf619de7 r7ae2b7f 52 52 import warnings 53 53 54 import numpy as np 54 import numpy as np # type: ignore 55 55 56 56 try: 57 57 raise NotImplementedError("OpenCL not yet implemented for new kernel template") 58 import pyopencl as cl 58 import pyopencl as cl # type: ignore 59 59 # Ask OpenCL for the default context so that we know that one exists 60 60 cl.create_some_context(interactive=False) … … 63 63 raise RuntimeError("OpenCL not available") 64 64 65 from pyopencl import mem_flags as mf 66 from pyopencl.characterize import get_fast_inaccurate_build_options 65 from pyopencl import mem_flags as mf # type: ignore 66 from pyopencl.characterize import get_fast_inaccurate_build_options # type: ignore 67 67 68 68 from . import generate -
sasmodels/kerneldll.py
rf619de7 r7ae2b7f 49 49 import os 50 50 import tempfile 51 import ctypes as ct 52 from ctypes import c_void_p, c_int32, c_longdouble, c_double, c_float 53 54 import numpy as np 51 import ctypes as ct # type: ignore 52 from ctypes import c_void_p, c_int32, c_longdouble, c_double, c_float # type: ignore 53 54 import numpy as np # type: ignore 55 55 56 56 from . import generate -
sasmodels/kernelpy.py
rf619de7 r7ae2b7f 7 7 :class:`kernelcl.GpuModel` and :class:`kerneldll.DllModel`. 8 8 """ 9 import numpy as np 10 from numpy import pi, cos 9 import numpy as np # type: ignore 10 from numpy import pi, cos #type: ignore 11 11 12 12 from . import details -
sasmodels/mixture.py
rf619de7 r7ae2b7f 12 12 """ 13 13 from copy import copy 14 import numpy as np 14 import numpy as np # type: ignore 15 15 16 16 from .modelinfo import Parameter, ParameterTable, ModelInfo -
sasmodels/model_test.py
rf619de7 r7ae2b7f 50 50 import unittest 51 51 52 import numpy as np 52 import numpy as np # type: ignore 53 53 54 54 from .core import list_models, load_model_info, build_model, HAVE_OPENCL -
sasmodels/modelinfo.py
rf619de7 r7ae2b7f 10 10 from os.path import abspath, basename, splitext 11 11 12 import numpy as np 12 import numpy as np # type: ignore 13 13 14 14 from .details import mono_details -
sasmodels/models/cylinder.py
rf247314 r7ae2b7f 82 82 """ 83 83 84 import numpy as np 85 from numpy import pi, inf 84 import numpy as np # type: ignore 85 from numpy import pi, inf # type: ignore 86 86 87 87 name = "cylinder" -
sasmodels/product.py
rf619de7 r7ae2b7f 11 11 *ProductModel(P, S)*. 12 12 """ 13 import numpy as np 13 import numpy as np # type: ignore 14 14 15 15 from .details import dispersion_mesh … … 109 109 effect_radius, vol_ratio = call_ER_VR(self.p_kernel.info, vol_pars) 110 110 111 p_fixed[SCALE] = s_volfraction 112 p_fixed[BACKGROUND] = 0.0 113 s_fixed[SCALE] = scale 114 s_fixed[BACKGROUND] = 0.0 115 s_fixed[2] = s_volfraction/vol_ratio 116 s_pd[0] = [effect_radius], [1.0] 117 118 p_res = self.p_kernel(p_details, p_weights, p_values, cutoff) 119 s_res = self.s_kernel(s_details, s_weights, s_values, cutoff) 111 p_details, s_details = details.parts 112 p_res = self.p_kernel(p_details, weights, values, cutoff) 113 s_res = self.s_kernel(s_details, weights, values, cutoff) 120 114 #print s_fixed, s_pd, p_fixed, p_pd 121 115 122 return p_res*s_res + background116 return values[0]*(p_res*s_res) + values[1] 123 117 124 118 def release(self): -
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() -
sasmodels/resolution2d.py
rd6f5da6 r7ae2b7f 7 7 from __future__ import division 8 8 9 import numpy as np 10 from numpy import pi, cos, sin, sqrt 9 import numpy as np # type: ignore 10 from numpy import pi, cos, sin, sqrt # type: ignore 11 11 12 12 from . import resolution -
sasmodels/sasview_model.py
r0d99a6a r7ae2b7f 21 21 import logging 22 22 23 import numpy as np 23 import numpy as np # type: ignore 24 24 25 25 from . import core -
sasmodels/sesans.py
r2684d45 r7ae2b7f 12 12 from __future__ import division 13 13 14 import numpy as np 15 from numpy import pi, exp 14 import numpy as np # type: ignore 15 from numpy import pi, exp # type: ignore 16 16 from scipy.special import jv as besselj 17 17 #import direct_model.DataMixin as model -
sasmodels/weights.py
r5c962df r7ae2b7f 3 3 """ 4 4 # TODO: include dispersion docs with the disperser models 5 from math import sqrt 6 import numpy as np 7 from scipy.special import gammaln 5 from math import sqrt # type: ignore 6 import numpy as np # type: ignore 7 from scipy.special import gammaln # type: ignore 8 8 9 9 class Dispersion(object):
Note: See TracChangeset
for help on using the changeset viewer.