Re: How to combine Mathematica graphics and Python code?
- To: mathgroup at smc.vnet.net
- Subject: [mg113377] Re: How to combine Mathematica graphics and Python code?
- From: hrh1818 <hrhan at att.net>
- Date: Tue, 26 Oct 2010 05:33:30 -0400 (EDT)
- References: <email@example.com>
On Oct 25, 5:42 am, kj <no.em... at please.post> wrote: > I have been given the task of developing a data visualization system > for a large academic experimental biology lab. In this lab they > generate a lot of specialized high-throughput data, and they need > a custom system for organizing, analyzing, and visualizing it. > (Many such systems already exist, of course, but for a wide variety > of reasons the lab's directors decided to go with a custom, home-grown > alternative.) > > I have decided to develop the system primarily in Python, for a > couple of reasons. The big downside of Python, however, is that > it does not have, in my opinion, a sufficiently good support for > scientific graphics. > > In my experience Mathematica is the gold standard for scientific > graphics, and wondered if there was some way in which I could > combine Python code with Mathematica graphics. > > The absolute ideal system would be something that looked likei a > (highly stripped down) Mathematica GUI, but receiving Python code > instead of Mathematica code. I.e. basically a cross between the > standard Python interactive text-based interpreter and a Mathematica > graphics-enabled GUI. > > A less attractive possibility (but still adequate) would be for > the Python system to generate the necessary Mathematica code on > the fly, and somehow get Mathematica to generate and display a > figure for it. > > A third alternative would be to build a Python interpreter that > could be run within Mathematica, but this is pushing beyond my > level of expertise, both with Python and with Mathematica. > > At this stage I'm interested in finding out of similar attempts to > use Mathematica's graphics capabilities in a non-Mathematica app, > and perhaps learn from their experience. > > Technical issues aside, there are also thorny licensing issues. > If anyone has any experience with that, I would love to read your > comments. > > TIA! > > ~kj > >  The choice of Python is motivated by two reasons: 1) the lab > already has a significant code base in Python that I can re-use > for this project; and 2) I expect that in certain special cases > not covered by the system's base functionality, its users (most of > whom have no programming experience at all) may need to write very > simple scripts, and I find Python is particularly easy to teach to > people with no programming background. > >  The best Python for scientific graphics is matplotlib, which > is loosely based on another system. matplotlib is adequate for relativ= ely > simple graphics tasks, but it is not flexible enough for the type > of visualization that I think will be needed. (I think this > inflexibility is the result of some pretty fundamental design flaws > in matplotlib.) If you do a Google search on "Python Mathematica" you will find a few interesting hits. PYML a Python Mathematica interface http://library.wolfram.com/infocenter/MathSource/585/ Pythonika. Enabling Python scripting within Mathematica http://library.wolfram.com/infocenter/MathSource/6622/ And you can use MathLink to create your own interface to Mathematica http://reference.wolfram.com/mathematica/guide/MathLinkAPI.html Howard