Changeset 67cc0ff in sasmodels


Ignore:
Timestamp:
Dec 18, 2017 2:19:53 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Children:
7b1dcf9
Parents:
1941ec6
Message:

update to new sasmodels api

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    r1941ec6 r67cc0ff  
    2121/.idea 
    2222.vscode 
    23 xlate.c 
    2423/sasmodels.egg-info/ 
    2524/example/Fit_*/ 
  • sasmodels/autoc.py

    r8224d24 r67cc0ff  
    4949        return 
    5050 
    51     public_methods = "Iq", "Iqxy", "form_volume" 
     51    public_methods = "Iq", "Iqac", "Iqabc", "Iqxy", "form_volume" 
    5252 
    5353    tagged = [] # type: List[str] 
     
    9898                snippets.append(define_constant(name, obj)) 
    9999            elif isinstance(obj, special.Gauss): 
    100                 #constants["GAUSS_N"] = obj.n 
    101                 #constants["GAUSS_Z"] = obj.z 
    102                 #constants["GAUSS_W"] = obj.w 
    103                 libs.append('lib/gauss%d.c'%obj.n) 
     100                for var, value in zip(("N", "Z", "W"), (obj.n, obj.z, obj.w)): 
     101                    var = "GAUSS_"+var 
     102                    constants[var] = value 
     103                    snippets.append('#line 1 "%s"'%escaped_filename) 
     104                    snippets.append(define_constant(var, value)) 
     105                #libs.append('lib/gauss%d.c'%obj.n) 
    104106                source = (source.replace(name+'.n', 'GAUSS_N') 
    105107                          .replace(name+'.z', 'GAUSS_Z') 
     
    126128    info.source = unique_libs 
    127129    info.c_code = "\n".join(snippets) 
    128     info.Iq = info.Iqxy = info.form_volume = None 
     130    info.Iq = info.Iqac = info.Iqabc = info.Iqxy = info.form_volume = None 
    129131 
    130132def define_constant(name, value): 
  • sasmodels/modelinfo.py

    r1941ec6 r67cc0ff  
    820820    info.hidden = getattr(kernel_module, 'hidden', None) # type: ignore 
    821821 
     822    info.lineno = {} 
     823    _find_source_lines(info, kernel_module) 
     824    if getattr(kernel_module, 'py2c', False): 
     825        try: 
     826            autoc.convert(info, kernel_module) 
     827        except Exception as exc: 
     828            logger.warn(str(exc) + " while converting %s from C to python"%name) 
     829 
    822830    if callable(info.Iq) and parameters.has_2d: 
    823831        raise ValueError("oriented python models not supported") 
    824  
    825     info.lineno = {} 
    826     _find_source_lines(info, kernel_module) 
    827     try: 
    828         autoc.convert(info, kernel_module) 
    829     except Exception as exc: 
    830         raise 
    831         logger.warn(str(exc)) 
    832832 
    833833    return info 
  • sasmodels/models/_cylpy.py

    r59ee4db r67cc0ff  
    138138             ] 
    139139 
     140py2c = True 
     141 
    140142def invalid(v): 
    141143    return v.radius < 0 or v.length < 0 
     
    169171    return 1.0e-4 * s * s * orient_avg_1D(q, radius, length) 
    170172 
    171 def Iqxy(qab, qc, sld, solvent_sld, radius, length): 
     173def Iqac(qab, qc, sld, solvent_sld, radius, length): 
    172174    s = (sld-solvent_sld) * form_volume(radius, length) 
    173175    form = fq(qab, qc, radius, length) 
Note: See TracChangeset for help on using the changeset viewer.