/parametric_modeling

Parametric modelling functions that can be found in MATLAB now in python

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

parametric_modeling

Parametric modelling functions that can be found in MATLAB... now in Python! (AR, ARMA, frequency response modeling) The idea is to have all the functions listed at: http://www.mathworks.es/es/help/signal/parametric-modeling.html

Note about license: All the code I wrote is BSD as stated in the LICENSE file. Any commented/inspired by MATLAB code is of their own property. Given this was a project for university I won't dig further into this issue. If you want to re-use this code, you should research under what conditions you can based on that.

Right now we have:

Also I needed to implement:

  • convmtx Convolution matrix
    • Working thanks to... me!

===================

Developed using Python 2.7, Eclipse + PyDev, MATLAB R2013a 64 bits

  • Using numpy 1.6.1 (from ubuntu debs, using Ubuntu 12.04 64 bit)
sudo apt-get install numpy
  • Using scipy 0.13.1 (upgraded it from Ubuntu debs as I needed newer functions and some bugfixes)
sudo pip install scipy
sudo pip install spectrum 

I wanted to use/integrate in: python_control, using a checkout of the most updated branch, can be found at: https://github.com/awesomebytes/python-control-code

But I don't have time for now.

  • For testing purposes using matlabpipe from python-mlabwrap

This great library lets you execute MATLAB code from Python (easily! check the tests xxxxx_matlab_vs_python.py).

https://github.com/awesomebytes/python-mlabwrap

This is a fork from the work of Filipe Fernandes which he forked from http://code.google.com/p/danapeerlab/

git clone https://github.com/awesomebytes/python-mlabwrap
cd python-mlwrap
sudo python setup.py install

Thanks to this tool I can test the behaviour of my functions versus the MATLAB functions and also give the same input data without needing to implement lots of other functions.

A MATLAB to Python code translator which doesn't do all the job but helps

I've rehosted it now in Github https://github.com/awesomebytes/libermate to give it more visibility and add it's README to it and my advice on how to use it if you ever want to translate a MATLAB script to Python.

Guide on How to translate a MATLAB file to Python

Note: I haven't tried it, but you may want to try: https://github.com/victorlei/smop for the automatic MATLAB->Python translation

  1. Use libermate for making a quick automatic translation

python libermate.py ~/my_path_to/my_matlab_script.m

If you have problems check my file: https://github.com/awesomebytes/libermate/blob/master/notes_on_using_libermate.txt

  1. Correct other errors (many mentioned in notes_on_using_libermate.txt), use http://wiki.scipy.org/NumPy_for_Matlab_Users for helping yourself

  2. Check little pieces of code executing in MATLAB the same line using https://github.com/awesomebytes/python-mlabwrap Use any of my test files as an example on how to execute code and recover variables (structs and cells have some problems).

  3. Keep a iPython open to check little doubts (numpy arrays don't behave the same as MATLAB matrices)

  4. Use some IDE on Python to ease your life looking at how to use functions and correcting coding errors, I recomend Eclipse + PyDev

Eclipse (Standard 4.3.1 as of writing) http://www.eclipse.org/downloads/

PyDev plugin (Instructions on how to install) http://pydev.org/manual_101_install.html

You may need to update Java, here you have a nice tutorial on that: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html