Package mvpa :: Package clfs :: Package libsmlr
[hide private]
[frames] | no frames]

Source Code for Package mvpa.clfs.libsmlr

 1  #emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*- 
 2  #ex: set sts=4 ts=4 sw=4 et: 
 3  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## 
 4  # 
 5  #   See COPYING file distributed along with the PyMVPA package for the 
 6  #   copyright and license terms. 
 7  # 
 8  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## 
 9  """Wraper for the stepwise_regression function for SMLR.""" 
10   
11  if __debug__: 
12      from mvpa.misc import debug 
13      debug('INIT', 'mvpa.clfs.libsmlr') 
14   
15  import numpy as N 
16  import ctypes as C 
17  import os 
18  import sys 
19   
20  from mvpa.clfs.libsmlr.ctypes_helper import extend_args, c_darray 
21   
22  # connect to library that's in this directory 
23  if sys.platform == 'win32': 
24      # on windows things get tricky as we compile this lib as an extension 
25      # so it get a .pyd name suffix instead of .dll 
26      smlrlib = C.cdll[os.path.join(os.path.dirname(__file__), 'smlrc.pyd')] 
27  else: 
28      smlrlib = N.ctypeslib.load_library('smlrc', os.path.dirname(__file__)) 
29   
30  # wrap the stepwise function 
31 -def stepwise_regression(*args):
32 func = smlrlib.stepwise_regression 33 func.argtypes = [C.c_int, C.c_int, c_darray, 34 C.c_int, C.c_int, c_darray, 35 C.c_int, C.c_int, c_darray, 36 C.c_int, C.c_int, c_darray, 37 C.c_int, C.c_int, c_darray, 38 C.c_int, c_darray, 39 C.c_int, c_darray, 40 C.c_int, c_darray, 41 C.c_int, 42 C.c_int, 43 C.c_double, 44 C.c_float, 45 C.c_float, 46 C.c_int64] 47 func.restype = C.c_long 48 49 # get the new arglist 50 arglist = extend_args(*args) 51 return func(*arglist)
52 53 if __debug__: 54 debug('INIT', 'mvpa.clfs.libsmlr end') 55