Changeset 190fc2b in sasmodels


Ignore:
Timestamp:
Jan 28, 2016 10:35:57 PM (9 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
3a45c2c
Parents:
d4666ca
Message:

delint

Location:
sasmodels
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/bumps_model.py

    r37a7252 r190fc2b  
    1212""" 
    1313 
     14import warnings 
     15 
     16import numpy as np 
     17 
     18from .data import plot_theory 
     19from .direct_model import DataMixin 
     20 
    1421__all__ = [ 
    1522    "Model", "Experiment", 
    1623    ] 
    17  
    18 import warnings 
    19  
    20 import numpy as np 
    21  
    22 from .data import plot_theory 
    23 from .direct_model import DataMixin 
    2424 
    2525# CRUFT: old style bumps wrapper which doesn't separate data and model 
  • sasmodels/compare.py

    r841753c r190fc2b  
    2828 
    2929from __future__ import print_function 
     30 
     31import sys 
     32import math 
     33from os.path import basename, dirname, join as joinpath 
     34import glob 
     35import datetime 
     36import traceback 
     37 
     38import numpy as np 
     39 
     40from . import core 
     41from . import kerneldll 
     42from . import generate 
     43from .data import plot_theory, empty_data1D, empty_data2D 
     44from .direct_model import DirectModel 
     45from .convert import revert_model, constrain_new_to_old 
    3046 
    3147USAGE = """ 
     
    8096           + USAGE) 
    8197 
    82  
    83  
    84 import sys 
    85 import math 
    86 from os.path import basename, dirname, join as joinpath 
    87 import glob 
    88 import datetime 
    89 import traceback 
    90  
    91 import numpy as np 
    92  
     98kerneldll.ALLOW_SINGLE_PRECISION_DLLS = True 
     99 
     100# List of available models 
    93101ROOT = dirname(__file__) 
    94 sys.path.insert(0, ROOT)  # Make sure sasmodels is first on the path 
    95  
    96  
    97 from . import core 
    98 from . import kerneldll 
    99 from . import generate 
    100 from .data import plot_theory, empty_data1D, empty_data2D 
    101 from .direct_model import DirectModel 
    102 from .convert import revert_model, constrain_new_to_old 
    103 kerneldll.ALLOW_SINGLE_PRECISION_DLLS = True 
    104  
    105 # List of available models 
    106102MODELS = [basename(f)[:-3] 
    107103          for f in sorted(glob.glob(joinpath(ROOT, "models", "[a-zA-Z]*.py")))] 
  • sasmodels/core.py

    rd15a908 r190fc2b  
    22Core model handling routines. 
    33""" 
    4 __all__ = [ 
    5     "list_models", "load_model_definition", "precompile_dll", 
    6     "load_model", "make_kernel", "call_kernel", "call_ER", "call_VR", 
    7     ] 
    84 
    95from os.path import basename, dirname, join as joinpath 
     
    2420    HAVE_OPENCL = False 
    2521 
     22__all__ = [ 
     23    "list_models", "load_model_definition", "precompile_dll", 
     24    "load_model", "make_kernel", "call_kernel", "call_ER", "call_VR", 
     25] 
    2626 
    2727def list_models(): 
  • sasmodels/generate.py

    re66c9f9 r190fc2b  
    197197# TODO: identify model files which have changed since loading and reload them. 
    198198 
    199 __all__ = ["make", "doc", "sources", "convert_type"] 
    200  
    201199import sys 
    202200from os.path import abspath, dirname, join as joinpath, exists, basename, \ 
     
    206204 
    207205import numpy as np 
     206 
     207__all__ = ["make", "doc", "sources", "convert_type"] 
     208 
    208209C_KERNEL_TEMPLATE_PATH = joinpath(dirname(__file__), 'kernel_template.c') 
    209210 
     
    216217    F128 = None 
    217218 
    218  
    219219# Scale and background, which are parameters common to every form factor 
    220220COMMON_PARAMETERS = [ 
     
    222222    ["background", "1/cm", 0, [0, np.inf], "", "Source background"], 
    223223    ] 
    224  
    225224 
    226225# Conversion from units defined in the parameter table for each model 
     
    266265 
    267266def format_units(units): 
     267    """ 
     268    Convert units into ReStructured Text format. 
     269    """ 
    268270    return "string" if isinstance(units, list) else RST_UNITS.get(units, units) 
    269271 
     
    335337    """ 
    336338    Convert code from double precision to the desired type. 
     339 
     340    Floating point constants are tagged with 'f' for single precision or 'L' 
     341    for long double precision. 
    337342    """ 
    338343    if dtype == F16: 
     
    350355 
    351356def _convert_type(source, type_name, constant_flag): 
     357    """ 
     358    Replace 'double' with *type_name* in *source*, tagging floating point 
     359    constants with *constant_flag*. 
     360    """ 
    352361    # Convert double keyword to float/long double/half. 
    353362    # Accept an 'n' # parameter for vector # values, where n is 2, 4, 8 or 16. 
     
    625634                            %re.escape(string.punctuation)) 
    626635def _convert_section_titles_to_boldface(lines): 
     636    """ 
     637    Do the actual work of identifying and converting section headings. 
     638    """ 
    627639    prior = None 
    628640    for line in lines: 
     
    642654        yield prior 
    643655 
    644 def convert_section_titles_to_boldface(string): 
    645     return "\n".join(_convert_section_titles_to_boldface(string.split('\n'))) 
     656def convert_section_titles_to_boldface(s): 
     657    """ 
     658    Use explicit bold-face rather than section headings so that the table of 
     659    contents is not polluted with section names from the model documentation. 
     660 
     661    Sections are identified as the title line followed by a line of punctuation 
     662    at least as long as the title line. 
     663    """ 
     664    return "\n".join(_convert_section_titles_to_boldface(s.split('\n'))) 
    646665 
    647666def doc(kernel_module): 
     
    666685 
    667686def demo_time(): 
     687    """ 
     688    Show how long it takes to process a model. 
     689    """ 
    668690    from .models import cylinder 
    669691    import datetime 
     
    674696 
    675697def main(): 
     698    """ 
     699    Program which prints the source produced by the model. 
     700    """ 
    676701    if len(sys.argv) <= 1: 
    677702        print("usage: python -m sasmodels.generate modelname") 
  • sasmodels/resolution.py

    rfdc538a r190fc2b  
    55""" 
    66from __future__ import division 
     7 
     8from scipy.special import erf 
     9from numpy import sqrt, log, log10 
     10import numpy as np 
    711 
    812__all__ = ["Resolution", "Perfect1D", "Pinhole1D", "Slit1D", 
     
    1115           "interpolate", "linear_extrapolation", "geometric_extrapolation", 
    1216           ] 
    13  
    14 from scipy.special import erf 
    15 from numpy import sqrt, log, log10 
    16 import numpy as np 
    1717 
    1818MINIMUM_RESOLUTION = 1e-8 
  • sasmodels/sesans.py

    r384d114 r190fc2b  
    4343    *I* [cm$^{-1}$] is the value of the SANS model at *q* 
    4444    """ 
    45     G = np.zeros(len(SElength), 'd') 
    46     for i in range(len(SElength)): 
    47         integr = besselj(0, q*SElength[i])*Iq*q 
    48         G[i] = np.sum(integr) 
     45    G = np.zeros_like(SElength, 'd') 
     46    for i, SElength_i in enumerate(SElength): 
     47        integral = besselj(0, q*SElength_i)*Iq*q 
     48        G[i] = np.sum(integral) 
    4949 
    5050    # [m^-1] step size in q, needed for integration 
    51     dq=(q[1]-q[0])*1e10 
     51    dq = (q[1]-q[0])*1e10 
    5252 
    5353    # integration step, convert q into [m**-1] and 2 pi circle integration 
Note: See TracChangeset for help on using the changeset viewer.