Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29881 > unrolled thread

Pass numeric arrays from C extensions to Python

Started byJBT <jianbao.tao@gmail.com>
First post2012-09-23 18:39 -0700
Last post2012-09-24 14:55 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  Pass numeric arrays from C extensions to Python JBT <jianbao.tao@gmail.com> - 2012-09-23 18:39 -0700
    Re: Pass numeric arrays from C extensions to Python Terry Reedy <tjreedy@udel.edu> - 2012-09-23 22:48 -0400
    Re: Pass numeric arrays from C extensions to Python Grant Edwards <invalid@invalid.invalid> - 2012-09-24 14:55 +0000

#29881 — Pass numeric arrays from C extensions to Python

FromJBT <jianbao.tao@gmail.com>
Date2012-09-23 18:39 -0700
SubjectPass numeric arrays from C extensions to Python
Message-ID<05993015-7be1-4424-b062-1755f59f3142@googlegroups.com>
Hi,

I am looking for a way to pass numeric arrays, such as *float a[100]; double b[200];*, from C extension codes to python. The use case of this problem is that you have data stored in a particular format, NASA common data format (CDF) in my case, and there exists an official C library to read/create/edit such data, and you want to do data analysis in python. The problem comes down to how to feed the data into python.

I did some googling, but so far no luck. Can anyone help me? Thank you very much.

Cheers,
JBT

[toc] | [next] | [standalone]


#29886

FromTerry Reedy <tjreedy@udel.edu>
Date2012-09-23 22:48 -0400
Message-ID<mailman.1178.1348454915.27098.python-list@python.org>
In reply to#29881
On 9/23/2012 9:39 PM, JBT wrote:
> Hi,
>
> I am looking for a way to pass numeric arrays, such as *float a[100];
> double b[200];*, from C extension codes to python. The use case of
> this problem is that you have data stored in a particular format,
> NASA common data format (CDF) in my case, and there exists an
> official C library to read/create/edit such data, and you want to do
> data analysis in python. The problem comes down to how to feed the
> data into python.
>
> I did some googling, but so far no luck. Can anyone help me? Thank
> you very much.

I would look into numpy and scipy.

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#29911

FromGrant Edwards <invalid@invalid.invalid>
Date2012-09-24 14:55 +0000
Message-ID<k3ps99$qmg$1@reader1.panix.com>
In reply to#29881
On 2012-09-24, JBT <jianbao.tao@gmail.com> wrote:

> I am looking for a way to pass numeric arrays, such as *float a[100];
> double b[200];*, from C extension codes to python. The use case of
> this problem is that you have data stored in a particular format,
> NASA common data format (CDF) in my case, and there exists an
> official C library to read/create/edit such data, and you want to do
> data analysis in python. The problem comes down to how to feed the
> data into python.

In a addition to scipy and scientific python (two different projects),
you should probably take a look at the struct module and the ctypes
module.

-- 
Grant Edwards               grant.b.edwards        Yow! Life is a POPULARITY
                                  at               CONTEST!  I'm REFRESHINGLY
                              gmail.com            CANDID!!

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web