Posts by: Michael Hirsch

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 […]

My Comment on Draft AGU Data Position Statement

http://sciencepolicy.agu.org/draft-data-position-statement-comment/ I like the new emphasis on documentation. I would strengthen this even further by emphasizing the provision of open-source code/API that allows at minimum recreation of all figures in published papers, and canonical registration cases. Publication of source code AND compilation instructions (example: GPL) necessary to recreate all paper figures should be an essential […]

Video Software Defined Radio lectures from WPI

At youtube, from Worcester Polytech Inst.: ECE4305 ECE5312

Matlab R2014b: X11 forwarding and OpenGL

The new plotting engine in Matlab R2014b has caused some hangups and reduced quality plots for people using Matlab over X11 forwarding. Consider starting Matlab this way: matlab -nosoftwareopengl figure set(gcf,’renderermode’,'manual’,'renderer’,'painters’) plot(randn(100,1)) If you can’t start Matlab with the -nosoftwareopengl open, omit that open and try plotting with the set(gcf….’painters’) line as shown above for […]

Matlab R2014b: installing the integrated OpenCV support

Initially it appears that to use OpenCV from Matlab R2014b, you will need to write your OpenCV calls in C++, using all the usual Mex stuff. This is not very convenient to me; it would be much more convenient to use the friendly syntax of Python. However the Python support in Matlab R2014b allows passing […]

Matlab 2014b Python: can only pass 1xN vectors!

Note that for Matlab 2014b, which is the first version of Matlab to have official support for Python, you can only to TO python a 1xN vector. You have to reshape the matrix into a 1xN vector when passing the matrix into Python, and reshape back to a matrix inside Python, but  I think Matlab […]

Matplotlib: 3-D mesh wiregrid example

Some of the Matplotlib 3-D examples out there are a little out of date. Here is a minimal working example for the current version of Matplotlib 1.4 #!/usr/bin/env python from mpl_toolkits.mplot3d import Axes3D # this line must come before the next line! from matplotlib.pyplot import figure,show from numpy import linspace,meshgrid,pi,sin #for testing ”’ key point: […]

Matplotlib: force integer labeling of axis

When plotting output of simulations with Matplotlib, sometimes we want to label an axis as say “instantiation #” or “Sample #” or “try #” or the like. To do this, you need to do: import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator …. ax = plt.figure().gca() … ax.xaxis.set_major_locator(MaxNLocator(integer=True)) This will make the x-axis have integer-only […]

Amateur Radio band plans: strong FM adjacent to weak signal modes thoughts

I was in an conversation with regard to a 902MHz enthusiast list, and we were discussing issues that may be unique to the 902MHz band due to the ARRL band plan, that was adapted to reflect reality in much of the USA with regard to easily adaptable commercial equipment. The real life ham bands where […]