本文整理汇总了Python中scipy.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python scipy.__version__方法的具体用法?Python scipy.__version__怎么用?Python scipy.__version__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scipy
的用法示例。
在下文中一共展示了scipy.__version__方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _show_system_info
# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import __version__ [as 别名]
def _show_system_info(self):
nose = import_nose()
import numpy
print("NumPy version %s" % numpy.__version__)
relaxed_strides = numpy.ones((10, 1), order="C").flags.f_contiguous
print("NumPy relaxed strides checking option:", relaxed_strides)
npdir = os.path.dirname(numpy.__file__)
print("NumPy is installed in %s" % npdir)
if 'scipy' in self.package_name:
import scipy
print("SciPy version %s" % scipy.__version__)
spdir = os.path.dirname(scipy.__file__)
print("SciPy is installed in %s" % spdir)
pyversion = sys.version.replace('\n', '')
print("Python version %s" % pyversion)
print("nose version %d.%d.%d" % nose.__versioninfo__)
示例2: _plot
# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import __version__ [as 别名]
def _plot(cls, ax, y, style=None, bw_method=None, ind=None,
column_num=None, stacking_id=None, **kwds):
from scipy.stats import gaussian_kde
from scipy import __version__ as spv
y = remove_na_arraylike(y)
if LooseVersion(spv) >= '0.11.0':
gkde = gaussian_kde(y, bw_method=bw_method)
else:
gkde = gaussian_kde(y)
if bw_method is not None:
msg = ('bw_method was added in Scipy 0.11.0.' +
' Scipy version in use is {spv}.'.format(spv=spv))
warnings.warn(msg)
y = gkde.evaluate(ind)
lines = MPLPlot._plot(ax, ind, y, style=style, **kwds)
return lines
示例3: test_rank_methods_series
# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import __version__ [as 别名]
def test_rank_methods_series(self):
pytest.importorskip('scipy.stats.special')
rankdata = pytest.importorskip('scipy.stats.rankdata')
import scipy
xs = np.random.randn(9)
xs = np.concatenate([xs[i:] for i in range(0, 9, 2)]) # add duplicates
np.random.shuffle(xs)
index = [chr(ord('a') + i) for i in range(len(xs))]
for vals in [xs, xs + 1e6, xs * 1e-6]:
ts = Series(vals, index=index)
for m in ['average', 'min', 'max', 'first', 'dense']:
result = ts.rank(method=m)
sprank = rankdata(vals, m if m != 'first' else 'ordinal')
expected = Series(sprank, index=index)
if LooseVersion(scipy.__version__) >= LooseVersion('0.17.0'):
expected = expected.astype('float64')
tm.assert_series_equal(result, expected)
示例4: test_rank_methods_frame
# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import __version__ [as 别名]
def test_rank_methods_frame(self):
pytest.importorskip('scipy.stats.special')
rankdata = pytest.importorskip('scipy.stats.rankdata')
import scipy
xs = np.random.randint(0, 21, (100, 26))
xs = (xs - 10.0) / 10.0
cols = [chr(ord('z') - i) for i in range(xs.shape[1])]
for vals in [xs, xs + 1e6, xs * 1e-6]:
df = DataFrame(vals, columns=cols)
for ax in [0, 1]:
for m in ['average', 'min', 'max', 'first', 'dense']:
result = df.rank(axis=ax, method=m)
sprank = np.apply_along_axis(
rankdata, ax, vals,
m if m != 'first' else 'ordinal')
sprank = sprank.astype(np.float64)
expected = DataFrame(sprank, columns=cols)
if (LooseVersion(scipy.__version__) >=
LooseVersion('0.17.0')):
expected = expected.astype('float64')
tm.assert_frame_equal(result, expected)
示例5: status
# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import __version__ [as 别名]
def status(self, status, **kwargs):
if self.server:
try:
conn = HTTPConnection(self.server, self.port)
conn.request('GET', '/version/')
resp = conn.getresponse()
if not resp.read().startswith('Experiment'):
raise RuntimeError()
HTTPConnection(self.server, self.port).request('POST', '', str(dict({
'id': self.id,
'version': __version__,
'status': status,
'hostname': self.hostname,
'cwd': self.cwd,
'script_path': self.script_path,
'script': self.script,
'comment': self.comment,
'time': self.time,
}, **kwargs)))
except:
warn('Unable to connect to \'{0}:{1}\'.'.format(self.server, self.port))
示例6: find_class
# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import __version__ [as 别名]
def find_class(self, module, name):
"""
Helps Unpickler to find certain Numpy modules.
"""
try:
numpy_version = StrictVersion(numpy.__version__)
if numpy_version >= StrictVersion('1.5.0'):
if module == 'numpy.core.defmatrix':
module = 'numpy.matrixlib.defmatrix'
except ValueError:
pass
return Unpickler.find_class(self, module, name)
示例7: _show_system_info
# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import __version__ [as 别名]
def _show_system_info(self):
nose = import_nose()
import numpy
print("NumPy version %s" % numpy.__version__)
npdir = os.path.dirname(numpy.__file__)
print("NumPy is installed in %s" % npdir)
if 'scipy' in self.package_name:
import scipy
print("SciPy version %s" % scipy.__version__)
spdir = os.path.dirname(scipy.__file__)
print("SciPy is installed in %s" % spdir)
pyversion = sys.version.replace('\n', '')
print("Python version %s" % pyversion)
print("nose version %d.%d.%d" % nose.__versioninfo__)
示例8: add_preconfigured_np
# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import __version__ [as 别名]
def add_preconfigured_np(doctest_namespace):
"""
Fixture executed for every doctest.
Injects pre-configured numpy into each test's namespace.
Note that even with this, doctests might fail due to the lack of full
compatibility when using ``numpy.set_printoptions(legacy='1.13')``.
Some of the whitespace issues can be fixed by ``NORMALIZE_WHITESPACE``
doctest option, which is currently set in ``pytest.ini``.
See: https://github.com/numpy/numpy/issues/10383
"""
current_version = pkg_resources.parse_version(numpy.__version__)
doctest_namespace['np'] = numpy
示例9: _check_modules
# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import __version__ [as 别名]
def _check_modules():
"""Checks whether all dependencies are installed"""
# [issue #110] bug in line: if numpy.__version__ < "1.6.0":
# e.g. "1.11.0" < "1.6.0" (False)
# --- FIX
# Just replace "X.XX.X" --> distutils.version.LooseVersion("X.XX.X")
from distutils.version import LooseVersion
try:
import numpy
if LooseVersion(numpy.__version__) < LooseVersion("1.6.0"):
logger.warning("WARNING: You are using a numpy %s < 1.6.0. This "
"might not work", numpy.__version__)
except:
raise ImportError("Numpy cannot be imported. Are you sure that it's installed?")
try:
import scipy
if LooseVersion(scipy.__version__) < LooseVersion("0.12.0"):
logger.warning("WARNING: You are using a scipy %s < 0.12.0. "
"This might not work", scipy.__version__)
except:
raise ImportError("Scipy cannot be imported. Are you sure that it's installed?")
示例10: _plot
# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import __version__ [as 别名]
def _plot(cls, ax, y, style=None, bw_method=None, ind=None,
column_num=None, stacking_id=None, **kwds):
from scipy.stats import gaussian_kde
from scipy import __version__ as spv
y = remove_na_arraylike(y)
if LooseVersion(spv) >= '0.11.0':
gkde = gaussian_kde(y, bw_method=bw_method)
else:
gkde = gaussian_kde(y)
if bw_method is not None:
msg = ('bw_method was added in Scipy 0.11.0.' +
' Scipy version in use is %s.' % spv)
warnings.warn(msg)
y = gkde.evaluate(ind)
lines = MPLPlot._plot(ax, ind, y, style=style, **kwds)
return lines
示例11: test_rank_methods_series
# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import __version__ [as 别名]
def test_rank_methods_series(self):
pytest.importorskip('scipy.stats.special')
rankdata = pytest.importorskip('scipy.stats.rankdata')
import scipy
xs = np.random.randn(9)
xs = np.concatenate([xs[i:] for i in range(0, 9, 2)]) # add duplicates
np.random.shuffle(xs)
index = [chr(ord('a') + i) for i in range(len(xs))]
for vals in [xs, xs + 1e6, xs * 1e-6]:
ts = Series(vals, index=index)
for m in ['average', 'min', 'max', 'first', 'dense']:
result = ts.rank(method=m)
sprank = rankdata(vals, m if m != 'first' else 'ordinal')
expected = Series(sprank, index=index)
if LooseVersion(scipy.__version__) >= '0.17.0':
expected = expected.astype('float64')
tm.assert_series_equal(result, expected)