Re: Python from Matlab (was: *cochlea*: inner ear models in Python) (Benjamin Schultz )

Subject: Re: Python from Matlab (was: *cochlea*: inner ear models in Python)
From:    Benjamin Schultz  <benjamin.schultz@xxxxxxxx>
Date:    Fri, 22 Aug 2014 14:53:21 +0000

Accept-Language: en-AU, en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [] Content-Type: multipart/mixed; boundary="_002_C154CA4B938C3345ADE2739C56E799F24C38ECEXMBX20105campusM_" MIME-Version: 1.0 X-PMX-VERSION:, Antispam-Engine:, Antispam-Data: 2014.8.7.165719 X-McGill-WhereFrom: Internal --_002_C154CA4B938C3345ADE2739C56E799F24C38ECEXMBX20105campusM_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi everyone, I wrote one myself (by editing a script that called a different program): a= ttached and free for all. This should do the trick until MatLab has native python support. Kind regards, Benjamin Schultz -----Original Message----- From: AUDITORY - Research in Auditory Perception [mailto:AUDITORY@xxxxxxxx= ILL.CA] On Behalf Of Alain de Cheveigne Sent: Friday, 22 August 2014 3:44 AM To: AUDITORY@xxxxxxxx Subject: Python from Matlab (was: *cochlea*: inner ear models in Python) Hi Marek,=20 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 ca= n'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 c= ode reaches critical mass. I suspect many people are in a similar position= . Alain On 21 Aug 2014, at 11:20, Marek Rudnicki <marek.rudnicki@xxxxxxxx> wrote: > Etienne Gaudrain <e.p.c.gaudrain@xxxxxxxx> writes: >=20 >> Dear Marek, >>=20 >> This looks very promising, I'm glad to finally see the first signs of=20 >> a shift from Matlab to Python. Thanks a lot for sharing this!! >=20 > Dear Etienne >=20 > I'm glad you like it. >=20 > BTW, if you still have some MATLAB legacy code that you would like to=20 > use in Python, then matlab_wrapper [1] could be helpful. It allows=20 > you to call MATLAB functions directly from Python environment (the=20 > MATLAB process is started in the background), e.g.: >=20 > matlab.workspace.sin([0.1, 0.2, 0.3]) >=20 >=20 > Cheers > Marek >=20 >=20 > [1] >=20 >=20 >=20 >> On 19/08/2014 14:50, Marek Rudnicki wrote: >>> Hi all, >>>=20 >>> we would like to announce *cochlea* -- a collection of inner ear=20 >>> models in Python. It was developed in the group of Werner Hemmert=20 >>> [1] at the Technische Universit=E4t M=FCnchen. After a few years of=20 >>> development, we decided that it is stable and would like to=20 >>> contribute it to the auditory community. >>>=20 >>>=20 >>>=20 >>> The main features of the package are: >>>=20 >>> - 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) >>>=20 >>>=20 >>>=20 >>> Currently implemented models are: >>>=20 >>> - 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). >>>=20 >>>=20 >>>=20 >>> We are really grateful to the authors of those models for allowing=20 >>> us to use their code it in *cochlea*. We release the package under=20 >>> the GNU General Public License, so that you are free to copy, use=20 >>> and modify the code. We also encourage you to contribute back your=20 >>> changes. >>>=20 >>>=20 >>> The code is distributed on GitHub [2] and the package/documentation=20 >>> are hosted on the Python Package Index [3]. Check also our demo [4]! >>>=20 >>>=20 >>> If you would like to give a feedback, have questions or found some=20 >>> problem, do not hesitate to email me or open an issue on GitHub [2]. >>>=20 >>>=20 >>> Thank you and best regards >>> Marek Rudnicki >>>=20 >>>=20 >>> [1] >>> [2] [3]=20 >>> [4]=20 >>> >>> s/cochlea_demo.ipynb ----- No virus found in this message. Checked by AVG - Version: 2014.0.4745 / Virus Database: 4007/8079 - Release Date: 08/22/14 --_002_C154CA4B938C3345ADE2739C56E799F24C38ECEXMBX20105campusM_ Content-Type: application/octet-stream; name="python.m" Content-Description: python.m Content-Disposition: attachment; filename="python.m"; size=2872; creation-date="Mon, 11 Aug 2014 13:45:44 GMT"; modification-date="Fri, 22 Aug 2014 14:46:41 GMT" Content-Transfer-Encoding: base64 ZnVuY3Rpb24gW3Jlc3VsdCxzdGF0dXNdID0gcHl0aG9uKHZhcmFyZ2luKQolcHl0aG9uIEV4ZWN1 dGUgcHl0aG9uIGNvbW1hbmQgYW5kIHJldHVybiB0aGUgcmVzdWx0LgolICAgcHl0aG9uKHB5dGhv bkZJTEUpIGNhbGxzIHB5dGhvbiBzY3JpcHQgc3BlY2lmaWVkIGJ5IHRoZSBmaWxlIHB5dGhvbkZJ TEUKJSAgIHVzaW5nIGFwcHJvcHJpYXRlIHB5dGhvbiBleGVjdXRhYmxlLgolCiUgICBweXRob24o cHl0aG9uRklMRSxBUkcxLEFSRzIsLi4uKSBwYXNzZXMgdGhlIGFyZ3VtZW50cyBBUkcxLEFSRzIs Li4uCiUgICB0byB0aGUgcHl0aG9uIHNjcmlwdCBmaWxlIHB5dGhvbkZJTEUsIGFuZCBjYWxscyBp dCBieSB1c2luZyBhcHByb3ByaWF0ZQolICAgcHl0aG9uIGV4ZWN1dGFibGUuIEFyZ3VtZW50cyBt dXN0IGJlIHN0cmluZ3MuCiUKJSAgIFJFU1VMVD1weXRob24oLi4uKSBvdXRwdXRzIHRoZSByZXN1 bHQgb2YgYXR0ZW1wdGVkIHB5dGhvbiBjYWxsLiAgSWYgdGhlCiUgICBleGl0IHN0YXR1cyBv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k9PTIKICAgICAgICAgICAgJSBUaGlzIGlzIGEgdmFsaWQgZmlsZSBvbiB0aGUg TUFUTEFCIHBhdGgKICAgICAgICAgICAgaWYgaXNlbXB0eShkaXIodGhpc0FyZykpCiAgICAgICAg ICAgICAgICAlIE5vdCBjb21wbGV0ZSBmaWxlIHNwZWNpZmljYXRpb24KICAgICAgICAgICAgICAg ICUgLSBmaWxlIGlzIG5vdCBpbiBjdXJyZW50IGRpcmVjdG9yeQogICAgICAgICAgICAgICAgJSAt IE9SIGZpbGVuYW1lIHNwZWNpZmllZCB3aXRob3V0IGV4dGVuc2lvbgogICAgICAgICAgICAgICAg JSA9PT4gZ2V0IGZ1bGwgZmlsZSBwYXRoCiAgICAgICAgICAgICAgICB0aGlzQXJnID0gd2hpY2go dGhpc0FyZyk7CiAgICAgICAgICAgIGVuZAogICAgICAgIGVsc2UKICAgICAgICAgICAgJSBGaXJz dCBpbnB1dCBhcmd1bWVudCBpcyBweXRob25GaWxlIC0gaXQgbXVzdCBiZSBhIHZhbGlkIGZpbGUK ICAgICAgICAgICAgZXJyb3IoJ01BVExBQjpweXRob246RmlsZU5vdEZvdW5kJywgJ1VuYWJsZSB0 byBmaW5kIHB5dGhvbiBmaWxlOiAlcycsIHRoaXNBcmcpOwogICAgICAgIGVuZAogICAgZW5kCiAg CiAgJSBXcmFwIHRoaXNBcmcgaW4gZG91YmxlIHF1b3RlcyBpZiBpdCBjb250YWlucyBzcGFjZXMK ICBpZiBhbnkodGhpc0FyZyA9PSAnICcpCiAgICB0aGlzQXJnID0gWyciJywgdGhpc0FyZywgJyIn XTsKICBlbmQKICAKICAlIEFkZCBhcmd1bWVudCB0byBjb21tYW5kIHN0cmluZwogIGNtZFN0cmlu ZyA9IFtjbWRTdHJpbmcsICcgJywgdGhpc0FyZ107CmVuZAoKJSBFeGVjdXRlIHB5dGhvbiBzY3Jp cHQKZXJyVHh0Tm9weXRob24gPSAnVW5hYmxlIHRvIGZpbmQgcHl0aG9uIGV4ZWN1dGFibGUuJzsK CmlmIGlzZW1wdHkoY21kU3RyaW5nKQogIGVycm9yKCdNQVRMQUI6cHl0aG9uOk5vcHl0aG9uQ29t bWFuZCcsICdObyBweXRob24gY29tbWFuZCBzcGVjaWZpZWQnKTsKZWxzZWlmIGlzcGMKICAlIFBD CiAgcHl0aG9uQ21kID0gZnVsbGZpbGUoJ2M6XHB5dGhvbjI3XCcpOwogIGNtZFN0cmluZyA9IFsn cHl0aG9uJyBjbWRTdHJpbmddOwkgCiAgcHl0aG9uQ21kID0gWydzZXQgUEFUSD0nLHB5dGhvbkNt ZCwgJzslUEFUSCUmJyBjbWRTdHJpbmddOwogIFtzdGF0dXMsIHJlc3VsdF0gPSBkb3MocHl0aG9u Q21kKTsKZWxzZQogICUgVU5JWAogIFtzdGF0dXMgaWdub3JlXSA9IHVuaXgoJ3doaWNoIHB5dGhv bicpOyAlI29rCiAgaWYgKHN0YXR1cyA9PSAwKQogICAgY21kU3RyaW5nID0gWydweXRob24nLCBj bWRTdHJpbmddOwogICAgW3N0YXR1cywgcmVzdWx0XSA9IHVuaXgoY21kU3RyaW5nKTsKICBlbHNl CiAgICBlcnJvcignTUFUTEFCOnB5dGhvbjpOb0V4ZWN1dGFibGUnLCBlcnJUeHROb3B5dGhvbik7 CiAgZW5kCmVuZAoKJSBDaGVjayBmb3IgZXJyb3JzIGluIHNoZWxsIGNvbW1hbmQKaWYgbmFyZ291 dCA8IDIgJiYgc3RhdHVzfj0wCiAgZXJyb3IoJ01BVExBQjpweXRob246RXhlY3V0aW9uRXJyb3In LCAuLi4KICAgICAgICAnU3lzdGVtIGVycm9yOiAlc0NvbW1hbmQgZXhlY3V0ZWQ6ICVzJywgcmVz dWx0LCBjbWRTdHJpbmcpOwplbmQKCg== --_002_C154CA4B938C3345ADE2739C56E799F24C38ECEXMBX20105campusM_--

This message came from the mail archive
maintained by:
DAn Ellis <>
Electrical Engineering Dept., Columbia University