rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
macros = [('SCIPY_DFFTW_THREADS_H',1)]
macros = [('SCIPY_DFFTW_THREADS_H',None)]
def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() incl_dir = None libs = self.get_libs(self.section+'_libs', self.libs) info = None for d in lib_dirs: r = self.check_libs(d,libs) if r is not None: info = r break if info is not None: flag = 0 for d in incl_dirs: if len(combine_paths...
macros = [('SCIPY_SFFTW_THREADS_H',1)] class djbfft_info(fftw_info):
macros = [('SCIPY_SFFTW_THREADS_H',None)] class djbfft_info(system_info):
def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() incl_dir = None libs = self.get_libs(self.section+'_libs', self.libs) info = None for d in lib_dirs: r = self.check_libs(d,libs) if r is not None: info = r break if info is not None: flag = 0 for d in incl_dirs: if len(combine_paths...
libs = ['djbfft'] includes = ['fftc8.h','fftfreq.h'] macros = [('SCIPY_DJBFFT_H',1)] def _lib_list(self, lib_dir, libs, ext): assert type(lib_dir) is type('') liblist = [] for l in libs: p = combine_paths(lib_dir, 'lib'+l+ext) if not p: p = combine_paths(lib_dir, l+ext)
def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() info = None for d in lib_dirs: p = combine_paths (d,['djbfft.a'])
def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() incl_dir = None libs = self.get_libs(self.section+'_libs', self.libs) info = None for d in lib_dirs: r = self.check_libs(d,libs) if r is not None: info = r break if info is not None: flag = 0 for d in incl_dirs: if len(combine_paths...
assert len(p)==1 liblist.append(p[0]) return liblist
info = {'extra_objects':p} break if info is None: return for d in incl_dirs: if len(combine_paths(d,['fftc8.h','fftfreq.h']))==2: dict_append(info,include_dirs=[d], define_macros=[('SCIPY_DJBFFT_H',None)]) self.set_info(**info) return
def _lib_list(self, lib_dir, libs, ext): assert type(lib_dir) is type('') liblist = [] for l in libs: p = combine_paths(lib_dir, 'lib'+l+ext) if not p: p = combine_paths(lib_dir, l+ext) if p: assert len(p)==1 liblist.append(p[0]) return liblist
generate_array_api = generate_api_func('__multiarray.h',
generate_array_api = generate_api_func('__multiarray_api.h',
def generate_api(ext,build_dir): target = join(build_dir, header_file) script = join(codegen_dir, module_name + '.py') if newer(script, target): sys.path.insert(0, codegen_dir) try: m = __import__(module_name) print 'executing',script m.generate_api(build_dir) finally: del sys.path[0] config.add_data_files((header_dir,...
_unicodesize = array('u','U').itemsize
_unicodesize = array('u','U1').itemsize
def sctype2char(sctype): sctype = obj2sctype(sctype) if sctype is None: raise ValueError, "unrecognized type" return _sctype2char_dict[sctype]
except (TypeError, AttributeError):
except (TypeError, AttributeError, ValueError):
def filled (self, fill_value=None): """A numeric array with masked values filled. If fill_value is None, use self.fill_value().
tests = doctest.DocTestFinder().find(m) runner = doctest.DocTestRunner(verbose=False) for test in tests: runner.run(test)
if sys.version[:3]<'2.4': doctest.testmod(m, verbose=False) else: tests = doctest.DocTestFinder().find(m) runner = doctest.DocTestRunner(verbose=False) for test in tests: runner.run(test)
def rundocs(self, filename=None): """ Run doc string tests found in filename. """ import doctest if filename is None: f = get_frame(1) filename = f.f_globals['__file__'] name = os.path.splitext(os.path.basename(filename))[0] path = [os.path.dirname(filename)] file, pathname, description = imp.find_module(name, path) tr...
try: return a.ravel(order) except ValueError: return a.copy(order).ravel(None)
return a.ravel(order)
def ravel(m,order='C'): """ravel(m) returns a 1d array corresponding to all the elements of it's argument. The new array is a view of m if possible, otherwise it is a copy. """ a = asarray(m) try: return a.ravel(order) except ValueError: return a.copy(order).ravel(None)
nin, ndefault = _get_nargs(pyfunc)
def __init__(self, pyfunc, otypes='', doc=None): nin, ndefault = _get_nargs(pyfunc) self.thefunc = pyfunc self.ufunc = None self.nin = nin self.nin_wo_defaults = nin - ndefault self.nout = None if doc is None: self.__doc__ = pyfunc.__doc__ else: self.__doc__ = doc if isinstance(otypes, types.StringType): self.otypes = ...
self.nin = nin self.nin_wo_defaults = nin - ndefault
nin, ndefault = _get_nargs(pyfunc) if nin == 0 and ndefault == 0: self.nin = None self.nin_wo_defaults = None else: self.nin = nin self.nin_wo_defaults = nin - ndefault
def __init__(self, pyfunc, otypes='', doc=None): nin, ndefault = _get_nargs(pyfunc) self.thefunc = pyfunc self.ufunc = None self.nin = nin self.nin_wo_defaults = nin - ndefault self.nout = None if doc is None: self.__doc__ = pyfunc.__doc__ else: self.__doc__ = doc if isinstance(otypes, types.StringType): self.otypes = ...
if (nargs > self.nin) or (nargs < self.nin_wo_defaults): raise ValueError, "mismatch between python function inputs"\ " and received arguments"
if self.nin: if (nargs > self.nin) or (nargs < self.nin_wo_defaults): raise ValueError, "mismatch between python function inputs"\ " and received arguments"
def __call__(self, *args): # get number of outputs and output types by calling # the function on the first entries of args nargs = len(args) if (nargs > self.nin) or (nargs < self.nin_wo_defaults): raise ValueError, "mismatch between python function inputs"\ " and received arguments" if self.nout is None or self.otype...
format_re = re.compile(r'(?P<repeat> *[(]?[ ,0-9]*[)]? *)(?P<dtype>[><|A-Za-z0-9.]*)')
def _reconstruct(subtype, shape, dtype): return ndarray.__new__(subtype, shape, dtype)
format_re = re.compile(r'(?P<repeat> *[(]?[ ,0-9]*[)]? *)(?P<dtype>[><|A-Za-z0-9.]*)')
def _split(input): """Split the input formats string into field formats without splitting the tuple used to specify multi-dimensional arrays.""" newlist = [] hold = '' for element in input.split(','): if hold != '': item = hold + ',' + element else: item = element left = item.count('(') right = item.count(')') # if ...
f.write('\ndef get_info(name): g=globals(); return g.get(name,g.get(name+"_info",{}))\n')
f.write('\ndef get_info(name):\n g=globals()\n return g.get(name,g.get(name+"_info",{}))\n')
f.write('\ndef get_info(name): g=globals(); return g.get(name,g.get(name+"_info",{}))\n')
argv = [sh,'-c'] + command
argv = [sh,'-c',' '.join(command)]
def _exec_command( command, use_shell=None, **env ): log.debug('_exec_command(...)') if use_shell is None: use_shell = os.name=='posix' using_command = 0 if use_shell: # We use shell (unless use_shell==0) so that wildcards can be # used. sh = os.environ.get('SHELL','/bin/sh') if type(command) is type([]): argv = [sh,...
cpu_info = 1
march_flag = 1
def get_opt(self): import cpuinfo cpu = cpuinfo.cpuinfo() opt = ' -O3 -funroll-loops '
if chk.dtype is object_ and chk.item() is None:
if not chk or (chk.dtype is object_ and chk.item() is None):
def _typedmethod(self, name, myiter, dtype): result = empty(myiter.shape, dtype=dtype) res = result.flat for k, val in enumerate(myiter): newval = [] for chk in val[1:]: if chk.dtype is object_ and chk.item() is None: break newval.append(chk) this_str = val[0].rstrip('\x00') newitem = getattr(this_str,name)(*newval) re...
if numpy.show_core_config is None:
if numpy.show_config is None:
def get_numpy_include_dirs(): # numpy_include_dirs are set by numpy/core/setup.py, otherwise [] include_dirs = Configuration.numpy_include_dirs[:] if not include_dirs: import numpy if numpy.show_core_config is None: # running from numpy_core source directory include_dirs.append(os.path.join(os.path.dirname(numpy.__file...
typename = "(%s,%d)" % (typename, arr.itemsize)
if typename == 'unicode': size = arr.itemsize >> 2 else: size = arr.itemsize; typename = "(%s,%d)" % (typename, size)
def array_repr(arr, max_line_width=None, precision=None, suppress_small=None): if arr.size > 0 or arr.shape==(0,): lst = array2string(arr, max_line_width, precision, suppress_small, ', ', "array(") else: # show zero-length shape unless it is (0,) lst = "[], shape=%s" % (repr(arr.shape),) typeless = arr.dtype.type in _t...
[log.info(" adding '%s' to sources." % (s)) for s in source]
[log.info(" adding '%s' to sources." % (s,)) for s in source]
def generate_sources(self, sources, extension): new_sources = [] func_sources = [] for source in sources: if is_string(source): new_sources.append(source) else: func_sources.append(source) if not func_sources: return new_sources if self.inplace: build_dir = self.ext_target_dir else: if is_sequence(extension): name = ex...
log.info(" adding '%s' to sources." % (source))
log.info(" adding '%s' to sources." % (source,))
def generate_sources(self, sources, extension): new_sources = [] func_sources = [] for source in sources: if is_string(source): new_sources.append(source) else: func_sources.append(source) if not func_sources: return new_sources if self.inplace: build_dir = self.ext_target_dir else: if is_sequence(extension): name = ex...
if is_sequence(sources):
if is_sequence(extension):
def template_sources(self, sources, extension): new_sources = [] if is_sequence(sources): depends = extension[1].get('depends') include_dirs = extension[1].get('include_dirs') else: depends = extension.depends include_dirs = extension.include_dirs for source in sources: (base, ext) = os.path.splitext(source) if ext == ...
def __init__ (self):
def __init__ (self, default_lib_dirs=default_lib_dirs, default_include_dirs=default_include_dirs, ):
def get_info(name): cl = {'atlas':atlas_info, 'x11':x11_info, 'fftw':fftw_info}.get(name.lower(),system_info) return cl().get_info()
for n in ['calc_info','calc_info_debian']: calc_info = getattr(self,n,None) if calc_info is None: continue for p in self.local_prefixes + prefixes: if self.verbose: print ' Looking in',p,'...' calc_info(p) if self.has_info(): break if self.has_info(): break
if hasattr(self, 'calc_info'): self.calc_info()
def get_info(self): """ Return a dictonary with items that are compatible with scipy_distutils.setup keyword arguments. """ flag = 0 if not self.has_info(): flag = 1 if self.verbose: print self.__class__.__name__ + ':' for n in ['calc_info','calc_info_debian']: calc_info = getattr(self,n,None) if calc_info is None: con...
def get_paths(self, section, key): dirs = self.cp.get(section, key).split(':') default_dirs = self.cp.get('DEFAULT', key).split(':') dirs.extend(default_dirs) return [ d for d in dirs if os.path.isdir(d) ] def get_lib_dirs(self, key='lib_dir'): return self.get_paths(self.section, key) def get_include_dirs(self, key='i...
def calc_info_template(self,prefix): """ Calculate info distionary. """
p = os.environ.get('FFTW') if p is not None: p = os.path.abspath(p) if os.path.isdir(p): self.local_prefixes.insert(0,p) def calc_info(self,prefix): lib_dirs = filter(os.path.isdir, combine_paths(prefix,'lib',['fftw*','FFTW*'])) if not lib_dirs: lib_dirs = filter(os.path.isdir, combine_paths(prefix,['fftw*','FFTW*'],'...
def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs()
def __init__(self): system_info.__init__(self) p = os.environ.get('FFTW') if p is not None: p = os.path.abspath(p) if os.path.isdir(p): self.local_prefixes.insert(0,p)
libs = ['fftw','rfftw'] opt_libs = ['fftw_threads','rfftw_threads']
libs = self.get_libs('fftw_libs', ['fftw','rfftw']) opt_libs = self.get_libs('fftw_opt_libs', ['fftw_threads','rfftw_threads'])
def calc_info(self,prefix): lib_dirs = filter(os.path.isdir, combine_paths(prefix,'lib',['fftw*','FFTW*'])) if not lib_dirs: lib_dirs = filter(os.path.isdir, combine_paths(prefix,['fftw*','FFTW*'],'lib')) if not lib_dirs: lib_dirs = filter(os.path.isdir, combine_paths(prefix,['lib','fftw*','FFTW*'])) if not lib_dirs: ...
libs = ['dfftw','drfftw'] opt_libs = ['dfftw_threads','drfftw_threads']
libs = self.get_libs('dfftw_libs', ['dfftw', 'drfftw']) opt_libs = self.get_libs('dfftw_opt_libs', ['dfftw_threads', 'drfftw_threads'])
def calc_info(self,prefix): lib_dirs = filter(os.path.isdir, combine_paths(prefix,'lib',['fftw*','FFTW*'])) if not lib_dirs: lib_dirs = filter(os.path.isdir, combine_paths(prefix,['fftw*','FFTW*'],'lib')) if not lib_dirs: lib_dirs = filter(os.path.isdir, combine_paths(prefix,['lib','fftw*','FFTW*'])) if not lib_dirs: ...
libs = ['sfftw','srfftw'] opt_libs = ['sfftw_threads','srfftw_threads']
libs = self.get_libs('sfftw_libs', ['sfftw', 'srfftw']) opt_libs = self.get_libs('sfftw_opt_libs', ['sfftw_threads', 'srfftw_threads'])
def calc_info(self,prefix): lib_dirs = filter(os.path.isdir, combine_paths(prefix,'lib',['fftw*','FFTW*'])) if not lib_dirs: lib_dirs = filter(os.path.isdir, combine_paths(prefix,['fftw*','FFTW*'],'lib')) if not lib_dirs: lib_dirs = filter(os.path.isdir, combine_paths(prefix,['lib','fftw*','FFTW*'])) if not lib_dirs: ...
def __init__(self): system_info.__init__(self) p = os.environ.get('ATLAS') if p is not None: p = os.path.abspath(p) if os.path.isdir(p): self.local_prefixes.insert(0,p) def calc_info(self, prefix): print combine_paths(prefix,'lib',['atlas*','ATLAS*']) lib_dirs = filter(os.path.isdir,combine_paths(prefix,'lib', ['atlas...
section = 'atlas' def get_paths(self, section, key): default_dirs = self.cp.get('DEFAULT', key).split(':') dirs = [] for d in self.cp.get(section, key).split(':') + default_dirs: dirs.extend([d]+combine_paths(d,['atlas*','ATLAS*'])) return [ d for d in dirs if os.path.isdir(d) ] def calc_info(self): lib_dirs = self.g...
def calc_info(self,prefix): lib_dirs = filter(os.path.isdir, combine_paths(prefix,'lib',['fftw*','FFTW*'])) if not lib_dirs: lib_dirs = filter(os.path.isdir, combine_paths(prefix,['fftw*','FFTW*'],'lib')) if not lib_dirs: lib_dirs = filter(os.path.isdir, combine_paths(prefix,['lib','fftw*','FFTW*'])) if not lib_dirs: ...
lib_dirs = filter(os.path.isdir, combine_paths(prefix,['lib','atlas*','ATLAS*'])) if not lib_dirs: lib_dirs = [prefix] h = (combine_paths(lib_dirs,'cblas.h') or [None])[0] if not h: h = (combine_paths(lib_dirs,'include','cblas.h') or [None])[0] if h: h = os.path.dirname(h) libs = ['lapack','f77blas','cblas','atlas'] ...
return atlas_libs = self.get_libs('atlas_libs', ['f77blas', 'cblas', 'atlas'])
def calc_info(self, prefix): print combine_paths(prefix,'lib',['atlas*','ATLAS*']) lib_dirs = filter(os.path.isdir,combine_paths(prefix,'lib', ['atlas*','ATLAS*'])) if lib_dirs: other_dirs = filter(os.path.isdir,combine_paths(lib_dirs,'*')) other_dirs.extend(filter(os.path.isdir,combine_paths(prefix,'lib'))) lib_dirs.e...
r = self.check_libs(d,libs,[]) if r is not None: info = r break if info is None: return
atlas = self.check_libs(d,atlas_libs,[]) if atlas is not None: dict_append(info, **atlas) break else: return
def calc_info(self, prefix): print combine_paths(prefix,'lib',['atlas*','ATLAS*']) lib_dirs = filter(os.path.isdir,combine_paths(prefix,'lib', ['atlas*','ATLAS*'])) if lib_dirs: other_dirs = filter(os.path.isdir,combine_paths(lib_dirs,'*')) other_dirs.extend(filter(os.path.isdir,combine_paths(prefix,'lib'))) lib_dirs.e...
def calc_info_debian(self,prefix): print 'Trying Debian setup' atlas = self.check_libs(os.path.join(prefix,'lib'), ['cblas','f77blas','atlas'],[]) if not atlas: return lapack = self.check_libs(os.path.join(prefix,'lib','atlas'),['lapack'],[]) if not lapack: lapack = self.check_libs(os.path.join(prefix,'lib'),['lapack']...
def calc_info_debian(self,prefix): print 'Trying Debian setup' atlas = self.check_libs(os.path.join(prefix,'lib'), ['cblas','f77blas','atlas'],[]) if not atlas: return lapack = self.check_libs(os.path.join(prefix,'lib','atlas'),['lapack'],[]) if not lapack: lapack = self.check_libs(os.path.join(prefix,'lib'),['lapack']...
def calc_info(self, prefix):
section = 'x11' def __init__(self): system_info.__init__(self, default_lib_dirs=default_x11_lib_dirs, default_include_dirs=default_x11_include_dirs) def calc_info(self):
def calc_info_debian(self,prefix): print 'Trying Debian setup' atlas = self.check_libs(os.path.join(prefix,'lib'), ['cblas','f77blas','atlas'],[]) if not atlas: return lapack = self.check_libs(os.path.join(prefix,'lib','atlas'),['lapack'],[]) if not lapack: lapack = self.check_libs(os.path.join(prefix,'lib'),['lapack']...
for x11_dir in combine_paths(prefix,['X11R6','X11']): inc_dir = None for d in combine_paths(x11_dir,['include','include/X11']): if combine_paths(d,'X.h'): inc_dir = d break if not d: return lib_dir = combine_paths(x11_dir,'lib') if not lib_dir: return info = self.check_libs(lib_dir[0],['X11'],[]) if info is None: conti...
lib_dirs = self.get_lib_dirs() include_dirs = self.get_include_dirs() x11_libs = self.get_libs('x11_libs', ['X11']) for lib_dir in lib_dirs: info = self.check_libs(lib_dir, x11_libs, []) if info is not None: break else: return inc_dir = None for d in include_dirs: if combine_paths(d, 'X11/X.h'): inc_dir = d break if in...
def calc_info(self, prefix): if sys.platform == 'win32': return for x11_dir in combine_paths(prefix,['X11R6','X11']): inc_dir = None for d in combine_paths(x11_dir,['include','include/X11']): if combine_paths(d,'X.h'): inc_dir = d break if not d: return lib_dir = combine_paths(x11_dir,'lib') if not lib_dir: return inf...
if sys.platform=='win32': from distutils.msvccompiler import MSVCCompiler ar_exe = MSVCCompiler().lib
def get_flags_arch(self): opt = [] if cpu.is_PentiumIV() or cpu.is_Xeon(): opt.extend(['-tpp7', '-xW']) return opt
if isinstance(a.dtype, NX.complexfloating):
if issubclass(a.dtype, NX.complexfloating):
def poly(seq_of_zeros): """ Return a sequence representing a polynomial given a sequence of roots. If the input is a matrix, return the characteristic polynomial. Example: >>> b = roots([1,3,1,5,6]) >>> poly(b) array([1., 3., 1., 5., 6.]) """ seq_of_zeros = atleast_1d(seq_of_zeros) sh = seq_of_zeros.shape if len(sh)...
if not isinstance(p.dtype, (NX.floating, NX.complexfloating)):
if not issubclass(p.dtype, (NX.floating, NX.complexfloating)):
def roots(p): """ Return the roots of the polynomial coefficients in p. The values in the rank-1 array p are coefficients of a polynomial. If the length of p is n+1 then the polynomial is p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] """ # If input is scalar, this makes it an array p = atleast_1d(p) if len(p.s...
if os.environ.has_key('PYTHONINCLUDE'): path_string = os.environ['PYTHONINCLUDE'] if sys.platform == "win32": extra_include_dirs = path_string.split(';') else: extra_include_dirs = path_string.split(':') include_dirs = kw.get('include_dirs',[]) kw['include_dirs'] = include_dirs + extra_include_dirs
def build_extension(module_path,compiler_name = '',build_dir = None, temp_dir = None, verbose = 0, **kw): """ Build the file given by module_path into a Python extension module. build_extensions uses distutils to build Python extension modules. kw arguments not used are passed on to the distutils extension module. Di...
axis = 0
ndim = arr.ndim; axis = ndim-1;
def deletefrom(arr, obj, axis=None): """Return a new array with sub-arrays along an axis deleted. Return a new array with the sub-arrays (i.e. rows or columns) deleted along the given axis as specified by obj obj may be a slice_object (s_[3:5:2]) or an integer or an array of integers indicated which sub-arrays to rem...
return arr.copy()
if wrap: return wrap(arr) else: return arr.copy()
def deletefrom(arr, obj, axis=None): """Return a new array with sub-arrays along an axis deleted. Return a new array with the sub-arrays (i.e. rows or columns) deleted along the given axis as specified by obj obj may be a slice_object (s_[3:5:2]) or an integer or an array of integers indicated which sub-arrays to rem...
return arr.copy()
if wrap: return wrap(new) else: return arr.copy()
def deletefrom(arr, obj, axis=None): """Return a new array with sub-arrays along an axis deleted. Return a new array with the sub-arrays (i.e. rows or columns) deleted along the given axis as specified by obj obj may be a slice_object (s_[3:5:2]) or an integer or an array of integers indicated which sub-arrays to rem...
return arr[slobj]
new = arr[slobj] if wrap: return wrap(new) else: return new
def deletefrom(arr, obj, axis=None): """Return a new array with sub-arrays along an axis deleted. Return a new array with the sub-arrays (i.e. rows or columns) deleted along the given axis as specified by obj obj may be a slice_object (s_[3:5:2]) or an integer or an array of integers indicated which sub-arrays to rem...
axis = 0
ndim = arr.ndim axis = ndim-1
def insertinto(arr, obj, values, axis=None): """Return a new array with values inserted along the given axis before the given indices If axis is None, then ravel the array first. The obj argument can be an integer, a slice, or a sequence of integers. Example: >>> a = array([[1,2,3], [4,5,6], [7,8,9]]) >>> insertint...
return arr
if wrap: return wrap(arr) else: return arr
def insertinto(arr, obj, values, axis=None): """Return a new array with values inserted along the given axis before the given indices If axis is None, then ravel the array first. The obj argument can be an integer, a slice, or a sequence of integers. Example: >>> a = array([[1,2,3], [4,5,6], [7,8,9]]) >>> insertint...
if wrap: return wrap(new)
def insertinto(arr, obj, values, axis=None): """Return a new array with values inserted along the given axis before the given indices If axis is None, then ravel the array first. The obj argument can be an integer, a slice, or a sequence of integers. Example: >>> a = array([[1,2,3], [4,5,6], [7,8,9]]) >>> insertint...
def check_array_index(self, level=rlevel): """Make sure optimization is not called in this case.""" a = N.array([1,2,3]) a2 = N.array([[1,2,3]]) assert_equal(a[N.where(a==3)], a2[N.where(a2==3)])
def check_repeat_discont(self, level=rlevel): """Ticket #352""" a = N.arange(12).reshape(4,3)[:,2] assert_equal(a.repeat(3), [2,2,2,5,5,5,8,8,8,11,11,11])
self.compiler_cxx = 'g++'
self.compiler_cxx = ['g++']
def __init__ (self, verbose=0, dry_run=0, force=0):
libs = ['fftw','rfftw']
libs = ['rfftw', 'fftw']
def _check_libs(self,lib_dir,libs, opt_libs, ext): found_libs = self._lib_list(lib_dir, libs, ext) if len(found_libs) == len(libs): found_libs = self._extract_lib_names(found_libs) info = {'libraries' : found_libs, 'library_dirs' : [lib_dir]} opt_found_libs = self._lib_list(lib_dir, opt_libs, ext) if len(opt_found_libs...
along the given axis, so that take(a,result,axis) is the sorted array.
along the given axis.
def argsort(a, axis=-1): """argsort(a,axis=-1) return the indices into a of the sorted array along the given axis, so that take(a,result,axis) is the sorted array. """ try: argsort = a.argsort except AttributeError: return _wrapit(a, 'argsort', axis) return argsort(axis)
fortran_libraries = new_attr.get('fortran_libraries',[]) if fortran_libraries:
fortran_libraries = new_attr.get('fortran_libraries',None) if fortran_libraries is not None:
def setup(**attr): distclass = Distribution cmdclass = {'build': build.build, 'build_src': build_src.build_src, 'config_fc': config_compiler.config_fc, 'build_ext': build_ext.build_ext, 'build_py': build_py.build_py, 'build_clib': build_clib.build_clib, 'sdist': ...
if not status: print 'WARNING: failed to build import library for gcc. Linking will fail.'
if status: log.warn('Failed to build import library for gcc. Linking will fail.')
cmd = 'dlltool --dllname %s --def %s --output-lib %s' % args
return sb.ndarray.__getattribute__(self,attr)
return object.__getattribute__(self,attr)
def __getattribute__(self, attr): fielddict = sb.ndarray.__getattribute__(self,'dtype').fields try: res = fielddict[attr][:2] except: return sb.ndarray.__getattribute__(self,attr) obj = self.getfield(*res) # if it has fields return a recarray, otherwise return # normal array if obj.dtype.fields: return obj if obj.dtyp...
return sb.ndarray.__setattr__(self,attr,val)
return object.__setattr__(self,attr,val)
def __setattr__(self, attr, val): fielddict = sb.ndarray.__getattribute__(self,'dtype').fields try: res = fielddict[attr][:2] except: return sb.ndarray.__setattr__(self,attr,val) return self.setfield(val,*res)
a = asarray(a)
a = asanyarray(a)
def repmat(a, m, n): """Repeat a 0-d to 2-d array mxn times """ a = asarray(a) ndim = a.ndim if ndim == 0: origrows, origcols = (1,1) elif ndim == 1: origrows, origcols = (1, a.shape[0]) else: origrows, origcols = a.shape rows = origrows * m cols = origcols * n c = a.reshape(1,a.size).repeat(m, 0).reshape(rows, origcol...
byteorder = _byteorderconv[byteorder]
byteorder = _byteorderconv[byteorder[0]]
def __new__(subtype, shape, formats, names=None, titles=None, buf=None, offset=0, strides=None, byteorder=None, aligned=0):
def check_vecobject(self,level=2):
def check_vecobject(self):
def check_vecobject(self,level=2): U_non_cont = transpose([[1.,1.],[1.,2.]]) U_cont = ascontiguousarray(U_non_cont) x = array([Vec([1.,0.]),Vec([0.,1.])]) assert_almost_equal(dot(U_cont,x), dot(U_non_cont,x))
assert_almost_equal(dot(U_cont,x), dot(U_non_cont,x))
zeros = array([Vec([0.,0.]),Vec([0.,0.])]) zeros_test = dot(U_cont,x) - dot(U_non_cont,x) assert_equal(zeros[0].array, zeros_test[0].array) assert_equal(zeros[1].array, zeros_test[1].array)
def check_vecobject(self,level=2): U_non_cont = transpose([[1.,1.],[1.,2.]]) U_cont = ascontiguousarray(U_non_cont) x = array([Vec([1.,0.]),Vec([0.,1.])]) assert_almost_equal(dot(U_cont,x), dot(U_non_cont,x))
args.extend(['-faltivec'])
if intel: args.extend(['-msse3']) else: args.extend(['-faltivec'])
def calc_info(self):
args.extend(['-faltivec', '-I/System/Library/Frameworks/vecLib.framework/Headers', ])
if intel: args.extend(['-msse3']) else: args.extend(['-faltivec']) args.extend([ '-I/System/Library/Frameworks/vecLib.framework/Headers'])
def calc_info(self):
for name, c in globals().iteritems():
_gdict_ = globals().copy() for name, c in _gdict_.iteritems():
def show_all(argv=None): import inspect if argv is None: argv = sys.argv opts, args = parseCmdLine(argv) if opts.verbose: log.set_threshold(log.DEBUG) else: log.set_threshold(log.INFO) show_only = [] for n in args: if n[-5:] != '_info': n = n + '_info' show_only.append(n) show_all = not show_only for name, c in globals...
if type(errstr) is type(()):
if isinstance(errstr, tuple):
def __call__(self, result=None): if result is None: return unittest.TestCase.__call__(self, result)
errstr = errstr.split('\n')[-2]
errstr = str(errstr).split('\n')[-2]
def __call__(self, result=None): if result is None: return unittest.TestCase.__call__(self, result)
m = re.search(r'(?P<revision>\d+)', sout.read())
m = re.match(r'(?P<revision>\d+)', sout.read())
def _get_svn_revision(self,path): """ Return path's SVN revision number. """ revision = None try: sin, sout = os.popen4('svnversion') m = re.search(r'(?P<revision>\d+)', sout.read()) if m: revision = int(m.group('revision')) return revision except: pass if sys.platform=='win32' and os.environ.get('SVN_ASP_DOT_NET_HACK'...
m = re.match(r'ATLAS version (?P<version>\d+[.]\d+[.]\d+)',o)
m = re.search(r'ATLAS version (?P<version>\d+[.]\d+[.]\d+)',o)
def atlas_version_c(extension, build_dir,magic=magic): source = os.path.join(build_dir,'atlas_version_%s.c' % (magic)) if os.path.isfile(source): from distutils.dep_util import newer if newer(source,__file__): return source f = open(source,'w') f.write(atlas_version_c_text) f.close() return source
m = umath.logical_and.accumulate(self.mask, axis)
m = umath.logical_or.accumulate(self.mask, axis)
def _cumprod(self, axis=0, dtype=None): m = self.mask if m is not nomask: m = umath.logical_and.accumulate(self.mask, axis) return MaskedArray(data = self.filled(1).cumprod(axis, dtype), mask=m)
m = umath.logical_and.accumulate(self.mask, axis)
m = umath.logical_or.accumulate(self.mask, axis)
def _cumsum(self, axis=0, dtype=None): m = self.mask if m is not nomask: m = umath.logical_and.accumulate(self.mask, axis) return MaskedArray(data=self.filled(0).cumsum(axis, dtype), mask=m)
'version' : "0.8.3.a",
'version' : "0.8.3.b",
def path(p): if WIN and ' ' in p: return '"%s"'%p else: return p
item=self.todo.GetItem(todoIndexStart+i.wx())
item=self.todo.GetItem(todoIndexStart+i.wx)
def updateTodo(self): self.todo.DeleteAllItems() todoIndex=0 self.todo.list=[] todoMax=[self.todoMax(child) for child in self.app.children]+[1] todoMax=max(todoMax) for child in self.app.children: todoIndexStart=todoIndex for task in child.todoList: line,urgency,entry=task item=self.todo.InsertStringItem(todoIndex, os....
tree.SelectItem(item)
def onClick (self, event) : tree = self.tree root = tree.GetRootItem() pt = event.GetPosition(); item, flags = tree.HitTest(pt) event.Skip() tree.SelectItem(item) try: path = tree.GetItemText(item) parent = tree.GetItemParent ( item ) while parent != root : p = tree.GetItemText( parent ) if not ...
pos = self.GetCurrentPos() self.SetSelection(pos,pos)
self.SetSelectionEnd(0)
def OnLeftDown(self,event): pos = self.GetCurrentPos() self.SetSelection(pos,pos) event.Skip()
if line.strip() != '' and line.lstrip() == line:
lstrip = line.lstrip() if line.strip() != '' and lstrip == line and \ lstrip[:4] not in ['else','elif'] and \ lstrip[:6] != 'except':
def Execute(self,text): """Replace selection with clipboard contents, run commands.""" ps1 = str(sys.ps1) ps2 = str(sys.ps2) endpos = self.GetTextLength() self.SetCurrentPos(endpos) startpos = self.promptPosEnd self.SetSelection(startpos, endpos) self.ReplaceSelection('') text = text.lstrip() text = self.fixLineEndings...
if fileName != self._fileName and not self._running:
if (hasattr(self,'_fileName') and fileName != self._fileName) and not self._running:
def LoadFile(self,fileName): if fileName != self._fileName and not self._running: GIFAnimationCtrl.LoadFile(self,info.imageFile(fileName)) self._fileName = fileName return True return False
inarg = sys.argv[1]
inarg = os.path.abspath(sys.argv[1])
def template2mak(infile,outfile): lines = infile.readlines() foreachcmd = r"###MAKTEMPLATE:FOREACH " endforeachcmd = r"###MAKTEMPLATE:ENDFOREACH" while lines: line = lines[0] if line.strip().upper().startswith(foreachcmd): filepatterns = line.strip() [ len(foreachcmd): ].split(',') lines = lines[1:] l = 0 for line in l...
if type(widget.osc_path[0]) == str:
if type(widget.osc_path[0]) == str or type(widget.osc_path[0]) == unicode:
def edit_continuous(self, widget):
names = ['name', 'value', 'min', 'max', 'osc_path', 'port', 'label', 'is_log'] values = [child.get_name(), str(child.get_value()), str(child.get_adjustment().lower), str(child.get_adjustment().upper), child.osc_path[0], str(child.port[0]), child.label.get_text(), str(child.is_log())]
if (type(child) == phat.SliderButton): names = ['name', 'value', 'min', 'max', 'osc_path', 'port', 'label'] values = [child.get_name(), str(child.get_value()), str(child.get_adjustment().lower), str(child.get_adjustment().upper), child.osc_path[0], str(child.port[0]), child.label.get_text()] else: names = ['name', 'val...
def save_widget(self, child, doc, parent_node):
gladexml.get_widget('radio_log').set_active(widget.is_log())
if(type(widget) != phat.SliderButton): gladexml.get_widget('radio_log').set_active(widget.is_log())
def edit_continuous(self, widget):
widget.set_log(gladexml.get_widget('radio_log').get_active())
if(type(widget) != phat.SliderButton): widget.set_log(gladexml.get_widget('radio_log').get_active())
def edit_okay_cb(self, button, gladexml, widget):
setup(name='Khagan',
setup(name='khagan',
def install(self):
if(type(child) == phat.HFanSlider) or (type(child) == phat.SliderButton):
if(type(child) == phat.HFanSlider) or (type(child) == phat.SliderButton) or (type(child) == phat.Knob):
def save_rec(self, doc, parent_node, child):
names = ['name', 'value', 'min', 'max', 'osc_path', 'port'] values = [child.get_name(), str(child.get_value()), str(child.get_adjustment().lower), str(child.get_adjustment().upper), child.osc_path[0], str(child.port[0])]
names = ['name', 'value', 'min', 'max', 'osc_path', 'port', 'label'] values = [child.get_name(), str(child.get_value()), str(child.get_adjustment().lower), str(child.get_adjustment().upper), child.osc_path[0], str(child.port[0]), child.label.get_text()]
def save_widget(self, child, doc, parent_node):
widget.port[0] = int(node.getElementsByTagName('port')[0].firstChild.data)
widget.port[0] = int(node.getElementsByTagName('port')[0].firstChild.data) widget.label = gtk.Label(node.getElementsByTagName('label')[0].firstChild.data)
def open_rec(self, node, parent_widget):
widget.port[0] = int(node.getElementsByTagName('port')[0].firstChild.data)
widget.port[0] = int(node.getElementsByTagName('port')[0].firstChild.data) widget.label = gtk.Label(node.getElementsByTagName('label')[0].firstChild.data) elif name == 'PhatKnob': widget = phat.phat_knob_new_with_range(float(node.getElementsByTagName('value')[0].firstChild.data), float(node.getElementsByTagName('min')[...
def open_rec(self, node, parent_widget):
self.cur_widget.port[i] = int(gladexml.get_widget(port_list[i]).get_text())
if(gladexml.get_widget(port_list[i]).get_text()): self.cur_widget.port[i] = int(gladexml.get_widget(port_list[i]).get_text()) else: self.cur_widget.port[i] = 0
def edit_okay_pad_cb(self, button, gladexml):
widget.osc_path[num] = path widget.split_path[num] = path.split(' ') i = -1 for item in widget.split_path[num]: i+=1 if item.isdigit(): widget.split_path[num][i] = int(item) if item == '%': widget.sub_index[num] = i return
if len(path) > 0: widget.osc_path[num] = path widget.split_path[num] = path.split(' ') i = -1 for item in widget.split_path[num]: i+=1 if item.isdigit(): widget.split_path[num][i] = int(item) if item == '%': widget.sub_index[num] = i else: widget.osc_path[num] = '' widget.split_path[num] = '' return
def split_path(self, widget, path, num):
widget.split_path[i][widget.sub_index[i]] = parms[i] osc.Message(widget.split_path[i][0], widget.split_path[i][1:len(widget.split_path)]).sendlocal(widget.port[i])
if len(widget.split_path[i]) > 0: widget.split_path[i][widget.sub_index[i]] = parms[i] osc.Message(widget.split_path[i][0], widget.split_path[i][1:len(widget.split_path)]).sendlocal(widget.port[i])
def osc_send_cb(self,widget):
osc.Message(widget.split_path[0][0], widget.split_path[0][1:len(widget.split_path)]).sendlocal(widget.port[0])
if len(widget.split_path[0]) > 0: osc.Message(widget.split_path[0][0], widget.split_path[0][1:len(widget.split_path)]).sendlocal(widget.port[0])
def osc_send_cb(self,widget):
print 'Quitting program'
def quit_cb(self, b): print 'Quitting program' gtk.main_quit()
print 'Saving'
def save_cb(self, b):
print 'Opening'
def open_cb(self, b):
for node in self.doc_order_iter(doc): print node
def open_cb(self, b):
print 'in osc path', child.firstChild.data
def open_rec(self, node, parent_widget):
print 'in port', child.firstChild.data
def open_rec(self, node, parent_widget):
print parms
def osc_send_cb(self,widget):
print 'osc.Message(', widget.split_path[0][0], widget.split_path[0][1:len(widget.split_path[0])], ').sendlocal(', widget.port[0], ')'
def osc_send_cb(self,widget):
self.split_path(widget, child.firstChild.data, i) print 'in osc path', child.firstChild.data
if(child.firstChild != None): self.split_path(widget, child.firstChild.data, i) print 'in osc path', child.firstChild.data else: self.split_path(widget, '', i)
def open_rec(self, node, parent_widget):
widget.port[i] = int(child.firstChild.data) print 'in port', child.firstChild.data
if(child.firstChild != None): widget.port[i] = int(child.firstChild.data) print 'in port', child.firstChild.data else: widget.port[i] = 0
def open_rec(self, node, parent_widget):
gladexml.get_widget(mins[i]).set_value(max_vals[i])
gladexml.get_widget(maxs[i]).set_value(max_vals[i])
def edit_pad(self, b):
topgroup.add_actions([('Quit', gtk.STOCK_QUIT, '_Quit me!', None, 'Quit the Program', self.quit_cb),
topgroup.add_actions([('Quit', gtk.STOCK_QUIT, None, None, 'Quit the Program', self.quit_cb),
def __init__(self): # Create the toplevel window