[SciPy-user] LiberMate was Re: Automating Matlab

Stef Mientki s.mientki@ru...
Thu Feb 26 05:33:32 CST 2009


hi Eric,

Eric Schug wrote:
> Eric Schug wrote:
>   
>> Is there strong interest in automating matlab to numpy conversion?
>>
>> I have a working version of a matlab to python translator.
>> It allows translation of matlab scripts into numpy constructs, 
>> supporting most of the matlab language.  The parser is nearly 
>> complete.  Most of the remaining work involves providing a robust 
>> translation. Such as
>>    * making sure that copies on assign are done when needed.
>>    * correct indexing a(:) becomes a.flatten(1) when on the left hand 
>> side (lhs) of equals
>>       and a[:] when on the right hand side
>>
>>
>> I've seen a few projects attempt to do this, but for one reason or 
>> another have stopped it.
>>
>>
>>     
>
>   
Such a translator would be very welcome.
We just tried the translator with a simple script,
attached the m-file and the hand-corrected py-file (where you can 
changes the corrections).
These are our findings

    * show() command is not needed in Matlab.
    * Case-Senitive function calls are automatically translated in Matlab
    * Complex number i is transformed in a function 1j()
    * product of 2 numbers is changed in a (ugly) dot-product.
    * can't handle unicode e.g. "reëel"
    * matdiv is not found
    * graphs are nicer, but axis are uglier
    * subplot needs integer values

the resulting graphs from both Matlab and Python, can be seen here
(we might not have used the latest MatPlotLib).

good luck and cheers,
Stef

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: HPF_graph.m
Url: http://projects.scipy.org/pipermail/scipy-user/attachments/20090226/feba875f/attachment.pl 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HPF_graph.py
Type: text/x-python
Size: 1025 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20090226/feba875f/attachment.py 


More information about the SciPy-user mailing list