Search is not available for this dataset
repo_id stringlengths 12 110 | file_path stringlengths 24 164 | content stringlengths 3 89.3M | __index_level_0__ int64 0 0 |
|---|---|---|---|
public_repos/datetime/numpy | public_repos/datetime/numpy/linalg/SConscript | # Last Change: Thu Jun 12 06:00 PM 2008 J
# vim:syntax=python
from numscons import GetNumpyEnvironment, scons_get_mathlib
from numscons import CheckF77LAPACK
from numscons import write_info
env = GetNumpyEnvironment(ARGUMENTS)
config = env.NumpyConfigure(custom_tests = {'CheckLAPACK' : CheckF77LAPACK})
use_lapack = ... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/linalg/zlapack_lite.c | /*
NOTE: This is generated code. Look in Misc/lapack_lite for information on
remaking this file.
*/
#include "f2c.h"
#ifdef HAVE_CONFIG
#include "config.h"
#else
extern doublereal dlamch_(char *);
#define EPSILON dlamch_("Epsilon")
#define SAFEMINIMUM dlamch_("Safe minimum")
#define PRECISION dlamch_("Precision"... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/linalg/dlapack_lite.c | #define MAXITERLOOPS 100
/*
NOTE: This is generated code. Look in Misc/lapack_lite for information on
remaking this file.
*/
#include "f2c.h"
#ifdef HAVE_CONFIG
#include "config.h"
#else
extern doublereal dlamch_(char *);
#define EPSILON dlamch_("Epsilon")
#define SAFEMINIMUM dlamch_("Safe minimum")
#define PRE... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/linalg/SConstruct | from numscons import GetInitEnvironment
GetInitEnvironment(ARGUMENTS).DistutilsSConscript('SConscript')
| 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/linalg/__init__.py | """
Core Linear Algebra Tools
=========================
=============== ==========================================================
Linear algebra basics
==========================================================================
norm Vector or matrix norm
inv Inverse of a square matrix
solve ... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/linalg/linalg.py | """Lite version of scipy.linalg.
Notes
-----
This module is a lite version of the linalg.py module in SciPy which
contains high-level Python interface to the LAPACK library. The lite
version only accesses the following LAPACK functions: dgesv, zgesv,
dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetr... | 0 |
public_repos/datetime/numpy/linalg | public_repos/datetime/numpy/linalg/lapack_lite/clapack_scrub.py | #!/usr/bin/env python2.4
import sys, os
from cStringIO import StringIO
import re
from Plex import *
from Plex.Traditional import re as Re
class MyScanner(Scanner):
def __init__(self, info, name='<default>'):
Scanner.__init__(self, self.lexicon, info, name)
def begin(self, state_name):
# if se... | 0 |
public_repos/datetime/numpy/linalg | public_repos/datetime/numpy/linalg/lapack_lite/wrapped_routines | dgeev
zgeev
dsyevd
zheevd
dgelsd
zgelsd
dgesv
zgesv
dgetrf
zgetrf
dpotrf
zpotrf
dgesdd
zgesdd
dgeqrf
zgeqrf
# need this b/c it's not properly declared as external in the BLAS source
dcabs1
IGNORE: dlamch
| 0 |
public_repos/datetime/numpy/linalg | public_repos/datetime/numpy/linalg/lapack_lite/README | Regenerating lapack_lite source
===============================
:Author: David M. Cooke <cookedm@physics.mcmaster.ca>
The ``numpy/linalg/blas_lite.c``, ``numpy/linalg/dlapack_lite.c``, and
``numpy/linalg/zlapack_lite.c`` are ``f2c``'d versions of the LAPACK routines
required by the ``LinearAlgebra`` module, and wrapp... | 0 |
public_repos/datetime/numpy/linalg | public_repos/datetime/numpy/linalg/lapack_lite/make_lite.py | #!/usr/bin/env python
import sys, os
import fortran
import clapack_scrub
try: set
except NameError:
from sets import Set as set
# Arguments to pass to f2c. You'll always want -A for ANSI C prototypes
# Others of interest: -a to not make variables static by default
# -C to check array subscrip... | 0 |
public_repos/datetime/numpy/linalg | public_repos/datetime/numpy/linalg/lapack_lite/fortran.py | import re
import itertools
def isBlank(line):
return not line
def isLabel(line):
return line[0].isdigit()
def isComment(line):
return line[0] != ' '
def isContinuation(line):
return line[5] != ' '
COMMENT, STATEMENT, CONTINUATION = 0, 1, 2
def lineType(line):
"""Return the type of a line of Fortan... | 0 |
public_repos/datetime/numpy/linalg | public_repos/datetime/numpy/linalg/tests/test_linalg.py | """ Test functions for linalg module
"""
import numpy as np
from numpy.testing import *
from numpy import array, single, double, csingle, cdouble, dot, identity
from numpy import multiply, atleast_2d, inf, asarray, matrix
from numpy import linalg
from numpy.linalg import matrix_power, norm, matrix_rank
def ifthen(a, ... | 0 |
public_repos/datetime/numpy/linalg | public_repos/datetime/numpy/linalg/tests/test_regression.py | """ Test functions for linalg module
"""
from numpy.testing import *
import numpy as np
from numpy import linalg, arange, float64, array, dot, transpose
rlevel = 1
class TestRegression(TestCase):
def test_eig_build(self, level = rlevel):
"""Ticket #652"""
rva = array([1.03221168e+02 +0.j,
... | 0 |
public_repos/datetime/numpy/linalg | public_repos/datetime/numpy/linalg/tests/test_build.py | from subprocess import call, PIPE, Popen
import sys
import re
import numpy as np
from numpy.linalg import lapack_lite
from numpy.testing import TestCase, dec
from numpy.compat import asbytes_nested
class FindDependenciesLdd:
def __init__(self):
self.cmd = ['ldd']
try:
st = call(self.... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/fft/setup.py |
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('fft',parent_package,top_path)
config.add_data_dir('tests')
# Configure fftpack_lite
config.add_extension('fftpack_lite',
sources=['fftpack_lite... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/fft/setupscons.py | def configuration(parent_package = '', top_path = None):
from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
config = Configuration('fft', parent_package, top_path)
config.add_data_dir('tests')
config.add_sconscript('SConstruct',
source_files = ['fftpa... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/fft/info.py | """
Discrete Fourier Transform (:mod:`numpy.fft`)
=============================================
.. currentmodule:: numpy.fft
Standard FFTs
-------------
.. autosummary::
:toctree: generated/
fft Discrete Fourier transform.
ifft Inverse discrete Fourier transform.
fft2 Discrete Fourier t... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/fft/fftpack_litemodule.c | #include "fftpack.h"
#include "Python.h"
#include "numpy/arrayobject.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char fftpack_cfftf__doc__[] = "";
PyObject *
fftpack_cfftf(PyObject *NPY_UNUSED(self), PyObject *args)
{
PyObject *op1, *op2;
PyArrayObject... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/fft/helper.py | """
Discrete Fourier Transforms - helper.py
"""
# Created by Pearu Peterson, September 2002
__all__ = ['fftshift','ifftshift','fftfreq']
from numpy.core import asarray, concatenate, arange, take, \
integer, empty
import numpy.core.numerictypes as nt
import types
def fftshift(x,axes=None):
"""
Shift the z... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/fft/fftpack.c | /*
fftpack.c : A set of FFT routines in C.
Algorithmically based on Fortran-77 FFTPACK by Paul N. Swarztrauber (Version 4, 1985).
*/
/* isign is +1 for backward and -1 for forward transforms */
#include <math.h>
#include <stdio.h>
#define DOUBLE
#ifdef DOUBLE
#define Treal double
#else
#define Treal float
#endif
... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/fft/SConscript | # Last Change: Thu Jun 12 06:00 PM 2008 J
# vim:syntax=python
from numscons import GetNumpyEnvironment
env = GetNumpyEnvironment(ARGUMENTS)
env.NumpyPythonExtension('fftpack_lite',
source = ['fftpack_litemodule.c', 'fftpack.c'])
| 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/fft/fftpack.py | """
Discrete Fourier Transforms
Routines in this module:
fft(a, n=None, axis=-1)
ifft(a, n=None, axis=-1)
rfft(a, n=None, axis=-1)
irfft(a, n=None, axis=-1)
hfft(a, n=None, axis=-1)
ihfft(a, n=None, axis=-1)
fftn(a, s=None, axes=None)
ifftn(a, s=None, axes=None)
rfftn(a, s=None, axes=None)
irfftn(a, s=None, axes=None... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/fft/fftpack.h | /*
* This file is part of tela the Tensor Language.
* Copyright (c) 1994-1995 Pekka Janhunen
*/
#ifdef __cplusplus
extern "C" {
#endif
#define DOUBLE
#ifdef DOUBLE
#define Treal double
#else
#define Treal float
#endif
extern void cfftf(int N, Treal data[], const Treal wrk[]);
extern void cfftb(int N, Treal data[... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/fft/SConstruct | from numscons import GetInitEnvironment
GetInitEnvironment(ARGUMENTS).DistutilsSConscript('SConscript')
| 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/fft/__init__.py | # To get sub-modules
from info import __doc__
from fftpack import *
from helper import *
from numpy.testing import Tester
test = Tester().test
bench = Tester().bench
| 0 |
public_repos/datetime/numpy/fft | public_repos/datetime/numpy/fft/tests/test_fftpack.py | from numpy.testing import *
import numpy as np
def fft1(x):
L = len(x)
phase = -2j*np.pi*(np.arange(L)/float(L))
phase = np.arange(L).reshape(-1,1) * phase
return np.sum(x*np.exp(phase),axis=1)
class TestFFTShift(TestCase):
def test_fft_n(self):
self.assertRaises(ValueError,np.fft.fft,[1,2... | 0 |
public_repos/datetime/numpy/fft | public_repos/datetime/numpy/fft/tests/test_helper.py | #!/usr/bin/env python
# Copied from fftpack.helper by Pearu Peterson, October 2005
""" Test functions for fftpack.helper module
"""
from numpy.testing import *
from numpy.fft import fftshift,ifftshift,fftfreq
from numpy import pi
def random(size):
return rand(*size)
class TestFFTShift(TestCase):
def test_de... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/user_array.py | """
Standard container-class for easy multiple-inheritance.
Try to inherit from the ndarray instead of using this class as this is not
complete.
"""
from numpy.core import array, asarray, absolute, add, subtract, multiply, \
divide, remainder, power, left_shift, right_shift, bitwise_and, \
bitwise_or, bitwis... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/arraysetops.py | """
Set operations for 1D numeric arrays based on sorting.
:Contains:
ediff1d,
unique,
intersect1d,
setxor1d,
in1d,
union1d,
setdiff1d
:Deprecated:
unique1d,
intersect1d_nu,
setmember1d
:Notes:
For floating point arrays, inaccurate results may appear due to usual round-off
and floating point com... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/scimath.py | """
Wrapper functions to more user-friendly calling of certain math functions
whose output data-type is different than the input data-type in certain
domains of the input.
For example, for functions like log() with branch cuts, the versions in this
module provide the mathematically valid answers in the complex plane:
... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/setup.py | from os.path import join
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('lib',parent_package,top_path)
config.add_include_dirs(join('..','core','include'))
config.add_extension('_compiled_base',
... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/twodim_base.py | """ Basic functions for manipulating 2d arrays
"""
__all__ = ['diag','diagflat','eye','fliplr','flipud','rot90','tri','triu',
'tril','vander','histogram2d','mask_indices',
'tril_indices','tril_indices_from','triu_indices','triu_indices_from',
]
from numpy.core.numeric import asanyarr... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/setupscons.py | from os.path import join
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('lib',parent_package,top_path)
config.add_sconscript('SConstruct',
source_files = [join('src', '_compiled_base.c')])
config... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/_iotools.py | """A collection of functions designed to help I/O with ascii files."""
__docformat__ = "restructuredtext en"
import sys
import numpy as np
import numpy.core.numeric as nx
from __builtin__ import bool, int, long, float, complex, object, unicode, str
from numpy.compat import asbytes, bytes, asbytes_nested
if sys.versi... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/_datasource.py | """A file interface for handling local and remote data files.
The goal of datasource is to abstract some of the file system operations when
dealing with data files so the researcher doesn't have to know all the
low-level details. Through datasource, a researcher can obtain and use a
file with one function call, regard... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/info.py | """
Basic functions used by several sub-packages and
useful to have in the main name-space.
Type Handling
-------------
================ ===================
iscomplexobj Test for complex object, scalar result
isrealobj Test for real object, scalar result
iscomplex Test for complex elements, array res... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/financial.py | # Some simple financial calculations
# patterned after spreadsheet computations.
# There is some complexity in each function
# so that the functions behave like ufuncs with
# broadcasting and being able to be called with scalars
# or arrays (or other sequences).
import numpy as np
__all__ = ['fv', 'pmt', 'nper', ... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/shape_base.py | __all__ = ['column_stack','row_stack', 'dstack','array_split','split','hsplit',
'vsplit','dsplit','apply_over_axes','expand_dims',
'apply_along_axis', 'kron', 'tile', 'get_array_wrap']
import numpy.core.numeric as _nx
from numpy.core.numeric import asarray, zeros, newaxis, outer, \
concatena... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/recfunctions.py | """
Collection of utilities to manipulate structured arrays.
Most of these functions were initially implemented by John Hunter for matplotlib.
They have been rewritten and extended for convenience.
"""
import sys
import itertools
import numpy as np
import numpy.ma as ma
from numpy import ndarray, recarray
from nump... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/stride_tricks.py | """
Utilities that manipulate strides to achieve desirable effects.
An explanation of strides can be found in the "ndarray.rst" file in the
NumPy reference guide.
"""
import numpy as np
__all__ = ['broadcast_arrays']
class DummyArray(object):
""" Dummy object that just exists to hang __array_interface__ diction... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/ufunclike.py | """
Module of functions that are like ufuncs in acting on arrays and optionally
storing results in an output array.
"""
__all__ = ['fix', 'isneginf', 'isposinf']
import numpy.core.numeric as nx
def fix(x, y=None):
"""
Round to nearest integer towards zero.
Round an array of floats element-wise to nearest... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/utils.py | import os
import sys
import types
import re
from numpy.core.numerictypes import issubclass_, issubsctype, issubdtype
from numpy.core import product, ndarray
__all__ = ['issubclass_', 'get_numpy_include', 'issubsctype', 'issubdtype',
'deprecate', 'deprecate_with_doc', 'get_numarray_include',
'get_inclu... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/polynomial.py | """
Functions to operate on polynomials.
"""
__all__ = ['poly', 'roots', 'polyint', 'polyder', 'polyadd',
'polysub', 'polymul', 'polydiv', 'polyval', 'poly1d',
'polyfit', 'RankWarning']
import re
import warnings
import numpy.core.numeric as NX
from numpy.core import isscalar, abs, finfo, atleas... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/index_tricks.py | __all__ = ['unravel_index',
'mgrid',
'ogrid',
'r_', 'c_', 's_',
'index_exp', 'ix_',
'ndenumerate','ndindex',
'fill_diagonal','diag_indices','diag_indices_from']
import sys
import numpy.core.numeric as _nx
from numpy.core.numeric import ( asarray, Scalar... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/type_check.py | ## Automatically adapted for numpy Sep 19, 2005 by convertcode.py
__all__ = ['iscomplexobj','isrealobj','imag','iscomplex',
'isreal','nan_to_num','real','real_if_close',
'typename','asfarray','mintypecode','asscalar',
'common_type', 'datetime_data']
import numpy.core.numeric as _nx
fr... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/function_base.py | __docformat__ = "restructuredtext en"
__all__ = ['select', 'piecewise', 'trim_zeros',
'copy', 'iterable', 'percentile',
'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', 'disp',
'extract', 'place', 'nansum', 'nanmax', 'nanargmax',
'nanargmin', 'nanmin', 'vectorize', 'asa... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/format.py | """
Define a simple format for saving numpy arrays to disk with the full
information about them.
The ``.npy`` format is the standard binary file format in NumPy for
persisting a *single* arbitrary NumPy array on disk. The format stores all
of the shape and dtype information necessary to reconstruct the array
correctly... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/arrayterator.py | """
A buffered iterator for big arrays.
This module solves the problem of iterating over a big file-based array
without having to read it into memory. The `Arrayterator` class wraps
an array object, and when iterated it will return sub-arrays with at most
a user-specified number of elements.
"""
from __future__ impo... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/SConscript | # Last Change: Thu Jun 12 06:00 PM 2008 J
# vim:syntax=python
from numscons import GetNumpyEnvironment
env = GetNumpyEnvironment(ARGUMENTS)
env.Prepend(CPPPATH=["#$build_prefix/numpy/core/src/private"])
env.NumpyPythonExtension('_compiled_base', source = ['src/_compiled_base.c'])
| 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/SConstruct | from numscons import GetInitEnvironment
GetInitEnvironment(ARGUMENTS).DistutilsSConscript('SConscript')
| 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/npyio.py | __all__ = ['savetxt', 'loadtxt', 'genfromtxt', 'ndfromtxt', 'mafromtxt',
'recfromtxt', 'recfromcsv', 'load', 'loads', 'save', 'savez',
'packbits', 'unpackbits', 'fromregex', 'DataSource']
import numpy as np
import format
import sys
import os
import sys
import itertools
import warnings
from operator imp... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/lib/__init__.py | from info import __doc__
from numpy.version import version as __version__
from type_check import *
from index_tricks import *
from function_base import *
from shape_base import *
from stride_tricks import *
from twodim_base import *
from ufunclike import *
import scimath as emath
from polynomial import *
#import conv... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/benchmarks/bench_arraysetops.py | import numpy as np
import time
from numpy.lib.arraysetops import *
def bench_unique1d( plot_results = False ):
exponents = np.linspace( 2, 7, 9 )
ratios = []
nItems = []
dt1s = []
dt2s = []
for ii in exponents:
nItem = 10 ** ii
print 'using %d items:' % nItem
a = np.fix... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/src/_compiled_base.c | #include "Python.h"
#include "structmember.h"
#include "numpy/noprefix.h"
#include "npy_config.h"
static intp
incr_slot_(double x, double *bins, intp lbins)
{
intp i;
for ( i = 0; i < lbins; i ++ ) {
if ( x < bins [i] ) {
return i;
}
}
return lbins;
}
static intp
decr_slot... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_shape_base.py | from numpy.testing import *
from numpy.lib import *
from numpy.core import *
from numpy import matrix, asmatrix
class TestApplyAlongAxis(TestCase):
def test_simple(self):
a = ones((20,10),'d')
assert_array_equal(apply_along_axis(len,0,a),len(a)*ones(shape(a)[1]))
def test_simple101(self,level=... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_stride_tricks.py | import numpy as np
from numpy.testing import *
from numpy.lib.stride_tricks import broadcast_arrays
def assert_shapes_correct(input_shapes, expected_shape):
""" Broadcast a list of arrays with the given input shapes and check the
common output shape.
"""
inarrays = [np.zeros(s) for s in input_shapes]
... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_index_tricks.py | from numpy.testing import *
import numpy as np
from numpy import ( array, ones, r_, mgrid, unravel_index, zeros, where,
ndenumerate, fill_diagonal, diag_indices,
diag_indices_from )
class TestUnravelIndex(TestCase):
def test_basic(self):
assert unravel_index(2,(2,2))... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test__datasource.py | import os
from tempfile import mkdtemp, mkstemp, NamedTemporaryFile
from shutil import rmtree
from urlparse import urlparse
from urllib2 import URLError
import urllib2
from numpy.testing import *
from numpy.compat import asbytes
import numpy.lib._datasource as datasource
def urlopen_stub(url, data=None):
'''Stu... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_regression.py | from numpy.testing import *
from numpy.testing.utils import _assert_valid_refcount
import numpy as np
rlevel = 1
class TestRegression(TestCase):
def test_poly1d(self,level=rlevel):
"""Ticket #28"""
assert_equal(np.poly1d([1]) - np.poly1d([1,0]),
np.poly1d([-1,1]))
def tes... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_io.py | import numpy as np
import numpy.ma as ma
from numpy.ma.testutils import *
from numpy.testing import assert_warns
import sys
import gzip
import os
import threading
from tempfile import mkstemp, NamedTemporaryFile
import time
from datetime import datetime
from numpy.lib._iotools import ConverterError, ConverterLockEr... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_format.py | r''' Test the .npy file format.
Set up:
>>> import sys
>>> if sys.version_info[0] >= 3:
... from io import BytesIO as StringIO
... else:
... from cStringIO import StringIO
>>> from numpy.lib import format
>>>
>>> scalars = [
... np.uint8,
... np.int8,
... ... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_ufunclike.py | from numpy.testing import *
import numpy.core as nx
import numpy.lib.ufunclike as ufl
from numpy.testing.decorators import deprecated
class TestUfunclike(TestCase):
def test_isposinf(self):
a = nx.array([nx.inf, -nx.inf, nx.nan, 0.0, 3.0, -3.0])
out = nx.zeros(a.shape, bool)
tgt = nx.array... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_function_base.py | import warnings
from numpy.testing import *
import numpy.lib
from numpy.lib import *
from numpy.core import *
from numpy import matrix, asmatrix
import numpy as np
class TestAny(TestCase):
def test_basic(self):
y1 = [0, 0, 1, 0]
y2 = [0, 0, 0, 0]
y3 = [1, 0, 1, 0]
assert(any(y1))
... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_twodim_base.py | """ Test functions for matrix module
"""
from numpy.testing import *
from numpy import ( arange, rot90, add, fliplr, flipud, zeros, ones, eye,
array, diag, histogram2d, tri, mask_indices, triu_indices,
triu_indices_from, tril_indices, tril_indices_from )
import numpy as np
fr... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_financial.py | from numpy.testing import *
import numpy as np
class TestFinancial(TestCase):
def test_rate(self):
assert_almost_equal(np.rate(10,0,-3500,10000),
0.1107, 4)
def test_irr(self):
v = [-150000, 15000, 25000, 35000, 45000, 60000]
assert_almost_equal(np.irr(v),
... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_polynomial.py | """
>>> import numpy.core as nx
>>> from numpy.lib.polynomial import poly1d, polydiv
>>> p = poly1d([1.,2,3])
>>> p
poly1d([ 1., 2., 3.])
>>> print(p)
2
1 x + 2 x + 3
>>> q = poly1d([3.,2,1])
>>> q
poly1d([ 3., 2., 1.])
>>> print(q)
2
3 x + 2 x + 1
>>> print(poly1d([1.89999+2j, -3j, -5.12345678, 2+1j]))
... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_recfunctions.py | import sys
import numpy as np
import numpy.ma as ma
from numpy.ma.testutils import *
from numpy.ma.mrecords import MaskedRecords
from numpy.lib.recfunctions import *
get_names = np.lib.recfunctions.get_names
get_names_flat = np.lib.recfunctions.get_names_flat
zip_descr = np.lib.recfunctions.zip_descr
class TestRecF... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_arrayterator.py | from operator import mul
import numpy as np
from numpy.random import randint
from numpy.lib import Arrayterator
import sys
if sys.version_info[0] >= 3:
from functools import reduce
def test():
np.random.seed(np.arange(10))
# Create a random array
ndims = randint(5)+1
shape = tuple(randint(10)+1 ... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_arraysetops.py | """ Test functions for 1D array set operations.
"""
from numpy.testing import *
import numpy as np
from numpy.lib.arraysetops import *
import warnings
class TestAso(TestCase):
def test_unique( self ):
a = np.array( [5, 7, 1, 2, 1, 5, 7] )
ec = np.array( [1, 2, 5, 7] )
c = unique( a )
... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_utils.py | from numpy.testing import *
import numpy.lib.utils as utils
from numpy.lib import deprecate
from StringIO import StringIO
def test_lookfor():
out = StringIO()
utils.lookfor('eigenvalue', module='numpy', output=out,
import_modules=False)
out = out.getvalue()
assert 'numpy.linalg.eig' ... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test__iotools.py | import sys
if sys.version_info[0] >= 3:
from io import BytesIO
def StringIO(s=""):
return BytesIO(asbytes(s))
else:
from StringIO import StringIO
from datetime import date
import time
import numpy as np
from numpy.lib._iotools import LineSplitter, NameValidator, StringConverter,\
... | 0 |
public_repos/datetime/numpy/lib | public_repos/datetime/numpy/lib/tests/test_type_check.py | from numpy.testing import *
from numpy.lib import *
from numpy.core import *
from numpy.compat import asbytes
def assert_all(x):
assert(all(x)), x
class TestCommonType(TestCase):
def test_basic(self):
ai32 = array([[1,2],[3,4]], dtype=int32)
af32 = array([[1,2],[3,4]], dtype=float32)
... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/tests/test_ctypeslib.py | import sys
import numpy as np
from numpy.ctypeslib import ndpointer, load_library
from numpy.testing import *
try:
cdll = load_library('multiarray', np.core.multiarray.__file__)
_HAS_CTYPE = True
except ImportError:
_HAS_CTYPE = False
class TestLoadLibrary(TestCase):
@dec.skipif(not _HAS_CTYPE, "ctyp... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/matrixlib/defmatrix.py | __all__ = ['matrix', 'bmat', 'mat', 'asmatrix']
import sys
import numpy.core.numeric as N
from numpy.core.numeric import concatenate, isscalar, binary_repr, identity, asanyarray
from numpy.core.numerictypes import issubdtype
# make translation table
_numchars = '0123456789.-+jeEL'
if sys.version_info[0] >= 3:
cl... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/matrixlib/setup.py | #!/usr/bin/env python
import os
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('matrixlib', parent_package, top_path)
config.add_data_dir('tests')
return config
if __name__ == "__main__":
from numpy.distutils.core imp... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/matrixlib/setupscons.py | #!/usr/bin/env python
import os
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('matrixlib', parent_package, top_path)
config.add_data_dir('tests')
return config
if __name__ == "__main__":
from numpy.distutils.core imp... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/matrixlib/__init__.py | from defmatrix import *
__all__ = defmatrix.__all__
from numpy.testing import Tester
test = Tester().test
bench = Tester().bench
| 0 |
public_repos/datetime/numpy/matrixlib | public_repos/datetime/numpy/matrixlib/tests/test_regression.py | from numpy.testing import *
import numpy as np
rlevel = 1
class TestRegression(TestCase):
def test_kron_matrix(self,level=rlevel):
"""Ticket #71"""
x = np.matrix('[1 0; 1 0]')
assert_equal(type(np.kron(x,x)),type(x))
def test_matrix_properties(self,level=rlevel):
"""Ticket #12... | 0 |
public_repos/datetime/numpy/matrixlib | public_repos/datetime/numpy/matrixlib/tests/test_multiarray.py | import numpy as np
from numpy.testing import *
class TestView(TestCase):
def test_type(self):
x = np.array([1,2,3])
assert(isinstance(x.view(np.matrix),np.matrix))
def test_keywords(self):
x = np.array([(1,2)],dtype=[('a',np.int8),('b',np.int8)])
# We must be specific about the... | 0 |
public_repos/datetime/numpy/matrixlib | public_repos/datetime/numpy/matrixlib/tests/test_defmatrix.py | from numpy.testing import *
from numpy.core import *
from numpy import matrix, asmatrix, bmat
from numpy.matrixlib.defmatrix import matrix_power
from numpy.matrixlib import mat
import numpy as np
class TestCtor(TestCase):
def test_basic(self):
A = array([[1,2],[3,4]])
mA = matrix(A)
assert ... | 0 |
public_repos/datetime/numpy/matrixlib | public_repos/datetime/numpy/matrixlib/tests/test_numeric.py | from numpy.testing import assert_equal, TestCase
from numpy.core import ones
from numpy import matrix
class TestDot(TestCase):
def test_matscalar(self):
b1 = matrix(ones((3,3),dtype=complex))
assert_equal(b1*1.0, b1)
| 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/polynomial/polytemplate.py | """
Template for the Chebyshev and Polynomial classes.
This module houses a Python string module Template object (see, e.g.,
http://docs.python.org/library/string.html#template-strings) used by
the `polynomial` and `chebyshev` modules to implement their respective
`Polynomial` and `Chebyshev` classes. It provides a m... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/polynomial/setup.py |
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('polynomial',parent_package,top_path)
config.add_data_dir('tests')
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
setup(configuration... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/polynomial/chebyshev.py | """
Objects for dealing with Chebyshev series.
This module provides a number of objects (mostly functions) useful for
dealing with Chebyshev series, including a `Chebyshev` class that
encapsulates the usual arithmetic operations. (General information
on how this module represents and works with such polynomials is in... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/polynomial/polynomial.py | """
Objects for dealing with polynomials.
This module provides a number of objects (mostly functions) useful for
dealing with polynomials, including a `Polynomial` class that
encapsulates the usual arithmetic operations. (General information
on how this module represents and works with polynomial objects is in
the do... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/polynomial/polyutils.py | """
Utililty objects for the polynomial modules.
This module provides: error and warning objects; a polynomial base class;
and some routines used in both the `polynomial` and `chebyshev` modules.
Error objects
-------------
- `PolyError` -- base class for this sub-package's errors.
- `PolyDomainError` -- raised when ... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/polynomial/__init__.py | """
A sub-package for efficiently dealing with polynomials.
Within the documentation for this sub-package, a "finite power series,"
i.e., a polynomial (also referred to simply as a "series") is represented
by a 1-D numpy array of the polynomial's coefficients, ordered from lowest
order term to highest. For example, a... | 0 |
public_repos/datetime/numpy/polynomial | public_repos/datetime/numpy/polynomial/tests/test_chebyshev.py | """Tests for chebyshev module.
"""
from __future__ import division
import numpy as np
import numpy.polynomial.chebyshev as ch
from numpy.testing import *
def trim(x) :
return ch.chebtrim(x, tol=1e-6)
T0 = [ 1]
T1 = [ 0, 1]
T2 = [-1, 0, 2]
T3 = [ 0, -3, 0, 4]
T4 = [ 1, 0, -8, 0, 8]
T5 = [ 0, 5, ... | 0 |
public_repos/datetime/numpy/polynomial | public_repos/datetime/numpy/polynomial/tests/test_polynomial.py | """Tests for polynomial module.
"""
from __future__ import division
import numpy as np
import numpy.polynomial.polynomial as poly
from numpy.testing import *
def trim(x) :
return poly.polytrim(x, tol=1e-6)
T0 = [ 1]
T1 = [ 0, 1]
T2 = [-1, 0, 2]
T3 = [ 0, -3, 0, 4]
T4 = [ 1, 0, -8, 0, 8]
T5 = [ 0... | 0 |
public_repos/datetime/numpy/polynomial | public_repos/datetime/numpy/polynomial/tests/test_polyutils.py | """Tests for polyutils module.
"""
from __future__ import division
import numpy as np
import numpy.polynomial.polyutils as pu
from numpy.testing import *
class TestMisc(TestCase) :
def test_trimseq(self) :
for i in range(5) :
tgt = [1]
res = pu.trimseq([1] + [0]*5)
as... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/testing/nulltester.py | ''' Null tester to signal nose tests disabled
Merely returns error reporting lack of nose package or version number
below requirements.
See pkgtester, nosetester modules
'''
class NullTester(object):
def test(self, labels=None, *args, **kwargs):
raise ImportError, \
'Need nose >=0.10 for t... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/testing/numpytest.py | import os
import sys
import traceback
__all__ = ['IgnoreException', 'importall',]
DEBUG=0
get_frame = sys._getframe
class IgnoreException(Exception):
"Ignoring this exception due to disabled feature"
def output_exception(printstream = sys.stdout):
try:
type, value, tb = sys.exc_info()
info ... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/testing/decorators.py | """
Decorators for labeling and modifying behavior of test objects.
Decorators that merely return a modified version of the original
function object are straightforward. Decorators that return a new
function object need to use
::
nose.tools.make_decorator(original_function)(decorator)
in returning the decorator, i... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/testing/setup.py | #!/usr/bin/env python
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('testing',parent_package,top_path)
config.add_data_dir('tests')
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/testing/setupscons.py | #!/usr/bin/env python
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('testing',parent_package,top_path)
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
setup(maintainer = "NumPy Develope... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/testing/noseclasses.py | # These classes implement a doctest runner plugin for nose, a "known failure"
# error class, and a customized TestProgram for NumPy.
# Because this module imports nose directly, it should not
# be used except by nosetester.py to avoid a general NumPy
# dependency on nose.
import os
import doctest
import nose
from no... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/testing/nosetester.py | """
Nose test running.
This module implements ``test()`` and ``bench()`` functions for NumPy modules.
"""
import os
import sys
def get_package_name(filepath):
"""
Given a path where a package is installed, determine its name.
Parameters
----------
filepath : str
Path to a file. If the de... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/testing/utils.py | """
Utility function to facilitate testing.
"""
import os
import sys
import re
import operator
import types
import warnings
from nosetester import import_nose
__all__ = ['assert_equal', 'assert_almost_equal','assert_approx_equal',
'assert_array_equal', 'assert_array_less', 'assert_string_equal',
... | 0 |
public_repos/datetime/numpy | public_repos/datetime/numpy/testing/__init__.py | """Common test support for all numpy test scripts.
This single module should provide all the common functionality for numpy tests
in a single location, so that test scripts can just import it and work right
away.
"""
from unittest import TestCase
import decorators as dec
from utils import *
from numpytest import *
f... | 0 |
public_repos/datetime/numpy/testing | public_repos/datetime/numpy/testing/tests/test_decorators.py | import numpy as np
from numpy.testing import *
from numpy.testing.noseclasses import KnownFailureTest
import nose
def test_slow():
@dec.slow
def slow_func(x,y,z):
pass
assert(slow_func.slow)
def test_setastest():
@dec.setastest()
def f_default(a):
pass
@dec.setastest(True)
... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.