• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

strawlab/pyopy: Python bindings to interesting matlab libraries for data analysi ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

strawlab/pyopy

开源软件地址(OpenSource Url):

https://github.com/strawlab/pyopy

开源编程语言(OpenSource Language):

Python 98.6%

开源软件介绍(OpenSource Introduction):

PYOPY: PYthon -> Octave/matlab -> PYthon

Pyopy helps using matlab/octave libraries from python. It provides functionality to parse matlab code and express calls to matlab functions as calls to python functions. It also provides a generic mechanism to transfer data to and run code in octave/matlab instances. Pyopy was born to provide python bindings to the HCTSA time-series feature extraction library. You can check-out this quick demo.

Installation

Pyopy is tested on linux and mac. It requires python 2.7, octave and/or matlab and the following python dependencies:

  • numpy
  • scipy
  • pandas
  • joblib
  • argh
  • whatami
  • lockfile

Pyopy design decouples command dispatching and data transfer. Pyopy relies upon the excellent oct2py (of which a slightly modified version is provided with pyopy). for generic data transfers. For communicating with octave we recommend to fully install oct2py. For communicating with matlab, we recommend the python matlab engine (available with matlab since version 2014b). If you have an earlier matlab version, a slower and less tested backend based on pymatbridge is also available.

Install example using a conda environment

  • Install dependencies.
conda install numpy scipy pandas joblib
pip install argh whatami lockfile
cd /opt/matlab/extern/engines/python  # if matlab is installed in /opt/matlab
python setup.py install  # unfortunately, pip would fail here
  • To use octave, install oct2py.
pip install oct2py
  • pip install pyopy in your environment.
# You can install the last release from pypi
pip install pyopy

# Alternatively, you can install master directly from github
pip install https://github.com/strawlab/pyopy/tarball/master


# Finally, you could also install a development version
cd wherever
git clone https://github.com/strawlab/pyopy.git
pip install -e pyopy
  • If using HCTSA: install and tweak pyopy's internal HCTSA copy.
# For HCTSA, using matlab is highly recommended.

 hctsa-cli install --engine matlab --force-download --generate-bindings

#
# This command will download or clone HCTSA from github into
#   ~/.pyopy/toolboxes/hctsa/
# Then it will patch it and mex extensions using either matlab or octave.
# This version of HCTSA will be dynamically added to the matlab/octave
# path each time "hctsa.prepare()" is called.
#

#
# The command will also regenerate the python bindings.
# This means regenerating the module:
#   "pyopy/hctsa/hctsa_bindings.py"
# Note that for the bindings to be regenerated succesfully,
# "hctsa-cli" needs write permissions on the directory where
# pyopy has been installed.
# This should not be a problem if you used "pip install -e" or
# if installed to a conda/virtualenv on your user dir.
#


# If you want to generate the mexes for the other engine, run:

 hctsa-cli install --engine octave

#
# Note not "--force-download" (otherwise the mex extensions for the
# first engine would be removed) nor ""--generate-bindings"
# (these need to be generated only once) should be specified.
# The same effect can be achieved running this command:
#   hctsa-cli install --engine all --force-download --generate-bindings
#

# As a final note, mexing can be redone when changing matlab/octave by:
 hctsa-cli mex --engine matlab
  • If all has gone well, this should work
hctsa-cli summary

Number of operators (functions in mfiles):    164
Number of operations (function + parameters): 1057
Number of features (operation + outvalue):     7778
Functions without operation: ['CO_TSTL_amutual', 'DN_Cumulants', 'DN_nlogL_norm', 'IN_AutoMutualInfo', 'IN_Initialize_MI', 'IN_MutualInfo', 'MF_GP_LearnHyperp', 'MF_ResidualAnalysis', 'NL_CaosMethod', 'PP_PreProcess', 'SB_CoarseGrain', 'SD_MakeSurrogates', 'TSTL_predict']
Operations without functions: ['DK_TheilerQ', 'DK_crinkle_statistic', 'DK_timerev_1', 'DK_timerev_2', 'DK_timerev_3', 'DK_timerev_4']
    (these are probably calls into other toolboxes)
Features without operations: []
    (usually this should be empty)

ipython
In [1]: import numpy as np

In [2]: from pyopy.hctsa import hctsa

In [3]: _ = hctsa.prepare(engine='matlab')
Starting engine
Warming up
Configuring HCTSA
Setting up HCTSA operators
Hooray, we can use HCTSA now...

In [4]: hctsa.operations.AC_1(np.arange(100))
Out[4]: 0.96999999999999975

Licenses

Code distributed with pyopy

  • PYOPY itself: Modified BSD
  • OCT2PY: Modified BSD
  • OMPC: Modified BSD

Optional matlab toolboxes

HCTSA

HCTSA must be downloaded separately (preferably using the pyopy/hctsa/hctsa_install.py script). "Operators" are GPL licensed. Pyopy bindings rely on operators only. Other parts of HCTSA are licensed as Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Other licenses in 3rd party code used by HCTSA (TOOLBOXES directory), mostly GPL, might apply.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap