Changeset 8b10fdf in sasmodels


Ignore:
Timestamp:
Oct 6, 2016 8:43:28 AM (8 years ago)
Author:
wojciech
Children:
3a8d205
Parents:
9acbd37
Message:

Import clean-ups in kerneldll

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kerneldll.py

    r9acbd37 r8b10fdf  
    7474import ctypes as ct  # type: ignore 
    7575import _ctypes as _ct 
    76 from ctypes import c_void_p, c_int32, c_longdouble, c_double, c_float  # type: ignore 
    7776import logging 
    7877 
     
    112111    compiler = "unix" 
    113112 
    114 ARCH = "" if ct.sizeof(c_void_p) > 4 else "x86"  # 4 byte pointers on x86 
     113ARCH = "" if ct.sizeof(ct.c_void_p) > 4 else "x86"  # 4 byte pointers on x86 
    115114if compiler == "unix": 
    116115    # Generic unix compile 
     
    242241    if not os.path.exists(dll): 
    243242        need_recompile = True 
    244     #elif getattr(sys, 'frozen', None) is not None: 
    245     #    # TODO: don't suppress time stamp 
    246     #    # Currently suppressing recompile when running in a frozen environment 
    247     #    need_recompile = False 
    248243    else: 
    249244        dll_time = os.path.getmtime(dll) 
     
    308303            raise 
    309304 
    310         float_type = (c_float if self.dtype == generate.F32 
    311                       else c_double if self.dtype == generate.F64 
    312                       else c_longdouble) 
     305        float_type = (ct.c_float if self.dtype == generate.F32 
     306                      else ct.c_double if self.dtype == generate.F64 
     307                      else ct.c_longdouble) 
    313308 
    314309        # int, int, int, int*, double*, double*, double*, double*, double 
    315         argtypes = [c_int32]*3 + [c_void_p]*4 + [float_type] 
     310        argtypes = [ct.c_int32]*3 + [ct.c_void_p]*4 + [float_type] 
    316311        names = [generate.kernel_name(self.info, variant) 
    317312                 for variant in ("Iq", "Iqxy", "Imagnetic")] 
     
    407402        #print("returned",self.q_input.q, self.result) 
    408403        pd_norm = self.result[self.q_input.nq] 
    409         scale = values[0]/(pd_norm if pd_norm!=0.0 else 1.0) 
     404        scale = values[0]/(pd_norm if pd_norm != 0.0 else 1.0) 
    410405        background = values[1] 
    411406        #print("scale",scale,background) 
Note: See TracChangeset for help on using the changeset viewer.