[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Python from Matlab



wohoo that sounds fancy! 

It would be interesting to have an environment which really combines the two.  Though Matlab has an interface that no other environment provides, I came to prefer something lighter for daily work, not to mention the better support for OO and external libraries in Python. 

Though not a direct solution to the questions below I highly recommend looking at iPython Notebook. 

You can seamlessly combine Python, R, Bash and whatever else through Magic extensions, passing variables between languages at will. Although plotting within iPython is almost as easy as in Matlab, I found plots generated by R much nicer and I frequently pass results from Python to R for plotting or do some stats that isn't available in Scipy. You can have code cells that are entirely written in R or just execute a single R function mixed in a Python script... 

Some basic examples: http://ipython.org/ipython-doc/dev/config/extensions/rmagic.html

Cheers,
George

On 22 Aug 2014, at 09:55, Sebastian Ewert wrote:

> Hi,
> 
> the upcoming version of matlab has native python support (at least according to the beta changelog). I have no idea how useful it is going to be...
> 
> From the pre-release documentation:
> 
> "py package for using Python functions and objects in MATLAB, and engine interface for calling MATLAB from Python"
> 
> Sebastian
> 
> 
> On 22/08/2014 08:44, Alain de Cheveigne wrote:
>> Hi Marek,
>> 
>> I am looking for the opposite: an easy, efficient  and reliable way to call Python from Matlab.  My programming environment nowdays is matlab and I can't easily change.  The best course that I see is to implement new code in Python and call it from matlab, and make the switch to Python when Python code reaches critical mass.  I suspect many people are in a similar position.
>> 
>> Alain
>> 
>> 
>> 
>> On 21 Aug 2014, at 11:20, Marek Rudnicki <marek.rudnicki@xxxxxx> wrote:
>> 
>>> Etienne Gaudrain <e.p.c.gaudrain@xxxxxxx> writes:
>>> 
>>>> Dear Marek,
>>>> 
>>>> This looks very promising, I'm glad to finally see the first signs of a
>>>> shift from Matlab to Python. Thanks a lot for sharing this!!
>>> Dear Etienne
>>> 
>>> I'm glad you like it.
>>> 
>>> BTW, if you still have some MATLAB legacy code that you would like to
>>> use in Python, then matlab_wrapper [1] could be helpful.  It allows you
>>> to call MATLAB functions directly from Python environment (the MATLAB
>>> process is started in the background), e.g.:
>>> 
>>> matlab.workspace.sin([0.1, 0.2, 0.3])
>>> 
>>> 
>>> Cheers
>>> Marek
>>> 
>>> 
>>> [1] https://github.com/mrkrd/matlab_wrapper
>>> 
>>> 
>>> 
>>>> On 19/08/2014 14:50, Marek Rudnicki wrote:
>>>>> Hi all,
>>>>> 
>>>>> we would like to announce *cochlea* -- a collection of inner ear
>>>>> models in Python.  It was developed in the group of Werner Hemmert [1]
>>>>> at the Technische Universität München.  After a few years of
>>>>> development, we decided that it is stable and would like to contribute
>>>>> it to the auditory community.
>>>>> 
>>>>> 
>>>>> 
>>>>> The main features of the package are:
>>>>> 
>>>>>   - simple to use (each model is implemented as a single Python
>>>>>     function: sound in, spikes out)
>>>>>   - fast (you can generate responses of hundreds or even thousands of
>>>>>     nerve fibers)
>>>>>   - all models have the same interface (easy to make comparisons and
>>>>>     pick the one that best suits your needs)
>>>>>   - up-to-date (recent models included)
>>>>> 
>>>>> 
>>>>> 
>>>>> Currently implemented models are:
>>>>> 
>>>>>   - Zilany, M. S., Bruce, I. C., & Carney, L. H. (2014). Updated
>>>>>     parameters and expanded simulation options for a model of the
>>>>>     auditory periphery. The Journal of the Acoustical Society of
>>>>>     America, 135(1), 283-286.
>>>>>   - Zilany, M. S., Bruce, I. C., Nelson, P. C., & Carney,
>>>>>     L. H. (2009). A phenomenological model of the synapse between the
>>>>>     inner hair cell and auditory nerve: long-term adaptation with
>>>>>     power-law dynamics. The Journal of the Acoustical Society of
>>>>>     America, 126(5), 2390-2412.
>>>>>   - Holmberg, M. (2007). Speech Encoding in the Human Auditory
>>>>>     Periphery: Modeling and Quantitative Assessment by Means of
>>>>>     Automatic Speech Recognition. PhD thesis, Technical University
>>>>>     Darmstadt.
>>>>>   - MATLAB Auditory Periphery by Meddis et al. (external model, not
>>>>>     implemented in the package, but easily accessible through
>>>>>     matlab_wrapper).
>>>>> 
>>>>> 
>>>>> 
>>>>> We are really grateful to the authors of those models for allowing us
>>>>> to use their code it in *cochlea*.  We release the package under the
>>>>> GNU General Public License, so that you are free to copy, use and
>>>>> modify the code.  We also encourage you to contribute back your
>>>>> changes.
>>>>> 
>>>>> 
>>>>> The code is distributed on GitHub [2] and the package/documentation
>>>>> are hosted on the Python Package Index [3].  Check also our demo [4]!
>>>>> 
>>>>> 
>>>>> If you would like to give a feedback, have questions or found some
>>>>> problem, do not hesitate to email me or open an issue on GitHub [2].
>>>>> 
>>>>> 
>>>>> Thank you and best regards
>>>>> Marek Rudnicki
>>>>> 
>>>>> 
>>>>> [1] http://www.imetum.tum.de/research/bai/home/?L=1
>>>>> [2] https://github.com/mrkrd/cochlea
>>>>> [3] https://pythonhosted.org/cochlea/
>>>>> [4] http://nbviewer.ipython.org/github/mrkrd/cochlea/blob/master/examples/cochlea_demo.ipynb
> 
> -- 
> Dr. Sebastian Ewert
> Centre for Digital Music, Queen Mary University of London
> s.ewert@xxxxxxxxxx
> Phone: +44 207 882 8287