From: Rich E <rea...@gm...> - 2008-12-01 19:49:52
|
Someone earlier today in my office pointed me in the same direction, so it looks like the way to go! I'll give it a try.. . thanks (especially for the article link). cheers, Rich On Mon, Dec 1, 2008 at 8:43 PM, Christopher Barker <Chr...@no...> wrote: > Rich E wrote: >> >> So I have a nice C library wrapped in python and I'd like to start >> doing some plots of things in python... the problem is the data is all >> stuck in C arrays. > >> But how would I go about returning a python list of the entire array, >> or even better, an NumPy array? > > there is a numpy.i file distributed with numpy ( or with the docs, anyway). > There was also a recent post on the numpy list with some extra hints and > examples for using it. > > This is another nice article about it: > > http://matt.eifelle.com/2008/11/04/exposing-an-array-interface-with-swig-for-a-cc-structure/ > > >> My thoughts are that I will have to convert between C arrays and >> python types (list or NumPy) quite often, probably at a refresh rate >> suitable for animation. > > the above allow a numpy array and your C-code to share the same pointer, so > it is very fast. > > -Chris > > > -- > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chr...@no... > |