Category: Python

Sparse Matrices in Python from Matlab R2014b

First of all, you can’t pass sparse matrices, so you have to have enough RAM to hold the full matrix and probably a copy or two of it. This is more just to show how it could be done, and hope that the Mathworks will improve the passing of variables in future releases of Matlab. […]

Matlab R2014b: passing matrices to/from Python

As noted in my earlier post, this is awkward because Matlab doesn’t understand Numpy arrays. Matlab understands lists, dicts, sets, scalars, and other less frequently used classes from Python. Let’s do an example with the “clown” image included with Matlab. All commands here are executed in Matlab R2014b. First off, here are some Python packages […]

Anaconda Python on Windows 10

Anaconda Python 64-bit also initially seems to startup and install fine on Windows 10 Technical Preview, so far.

Matplotlib TkAgg

Now that Matplotlib 1.4 has been released, BEFORE upgrading matplotlib with sudo pip3 install –upgrade matplotlib consider first installing sudo apt-get install tk-dev libpng-dev libffi-dev dvipng texlive-latex-base You may want to type sudo pip3 install cairocffi

Cohen-Sutherland line clipping in Python

Here is my version of Cohen-Sutherland line clipping for Python:

Maximum Entropy Regularization on Python

I have ported to Python the maxent.m function now called This is for maximum entropy regularization, from PC Hansen’s Regutools.

Matplotlib 3D plotting: how to import

For 3D plotting to work in Matplotlib, near the beginning of the first .py file you use to start your program, you must have imports in this order: import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt If you try importing Axes3D in a later function that actually does the 3D plotting, […]

Cygwin Python 3 pip install: Segmentation fault

Note: I get segmentation fault upon pip3.2 command, has anyone solved this? This was tested on Cygwin 1.7.31 with Python 3.2 and may be out of date when you read this Prereqs: python3-setuptools In cygwin type easy_install-3.2 pip to use pip3 type in Cygwin pip3.2

installing LLVM-Py and Numba on Ubuntu 14.04

You need LLVM 3.3 (as of Numba 0.14–thanks for comments from ThyMythos and Raul). As of July 2014, LLVM-Py will not work with the default LLVM 3.4 in Ubuntu 14.04. sudo apt-get install llvm-3.3-dev Now we install LLVM-Py: sudo LLVM_CONFIG_PATH=/usr/bin/llvm-config-3.3 pip install llvmpy Now you can run the tests (optional) python -c “import llvm; llvm.test()” […]

upgrading to Scipy 0.14 via pip

you may first need to do sudo apt-get install liblapack-dev libatlas-dev libsparskit-dev libarpack2-dev gfortran libfftw3-dev libblas-dev before sudo pip install –upgrade scipy reference: