Re: [Numpy-discussion] how to get info about internals of an array object ?

2006-09-15 Thread Sebastian Haase
On Friday 15 September 2006 12:49, Travis Oliphant wrote:
> Sebastian Haase wrote:
> >On Friday 15 September 2006 10:00, Travis Oliphant wrote:
> >>Sebastian Haase wrote:
> >>>Hi,
> >>>
> >>>what I'm asking is if numpy has an equivalent to numarray's info()
> >
> >function:
> >>na.arange(10).info()
> >>
> >>numpy.numarray.info(numpy.arange(10))
> >>
> >>(get recent SVN as there were some bugs just fixed.
> >>
> >>-Travis
> >
> >Thanks,
> >
> >should this maybe also be added somewhere in the numpy module itself !?
> >I guess the question is, what the original intent was for numarray to put
> > it in (only for debugging ?) -- then we could decide if this would also
> > make sense for numpy.
> >
> >I have never used numpy.info(obj) - I don't know what is does (compared to
> >__doc__)
>
> It prints the doc string of an object searching for it better than help
> seems to do and without a "pager".
>
> Compare numpy.info(numpy.sin) versus help(numpy.sin)
In PyShell I would miss the output of numpy.info(numpy.sin) since it goes to 
the (C) stdout and not to the (sometimes redirected ) python sys.stdout.
So it seems it prints N.sin.__doc__

The output from help(...) goes to the (python) sys.stdout (or stderr !?)  and 
is quite long (and mostly just generec info about ufuncs ...)

>
> I don't know what the info method was for other than debugging.
>
> What about having the __doc__ attribute of an ndarray return the info?
>
Maybe,
but honestly I would *not* expect any kind of "live inspection" to be done by 
__doc__
I would expect more like 
"ndarray is an efficient way to handle large data sets in python - it is the 
bases for Numerical Python, see www.scipy.org "

Maybe info() should just be an array attribute - just like it was it numarray.

-Sebastian


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] how to get info about internals of an array object ?

2006-09-15 Thread Travis Oliphant
Sebastian Haase wrote:

>On Friday 15 September 2006 10:00, Travis Oliphant wrote:
>  
>
>>Sebastian Haase wrote:
>>
>>
>>>Hi,
>>>
>>>what I'm asking is if numpy has an equivalent to numarray's info() 
>>>  
>>>
>function:
>  
>
>>na.arange(10).info()
>>
>>
>>numpy.numarray.info(numpy.arange(10))
>>
>>(get recent SVN as there were some bugs just fixed.
>>
>>-Travis
>>
>>
>
>Thanks,
>
>should this maybe also be added somewhere in the numpy module itself !?
>I guess the question is, what the original intent was for numarray to put it 
>in (only for debugging ?) -- then we could decide if this would also make 
>sense for numpy.
>
>I have never used numpy.info(obj) - I don't know what is does (compared to 
>__doc__)   
>
It prints the doc string of an object searching for it better than help 
seems to do and without a "pager".

Compare numpy.info(numpy.sin) versus help(numpy.sin)

I don't know what the info method was for other than debugging.  

What about having the __doc__ attribute of an ndarray return the info?


-Travis


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] how to get info about internals of an array object ?

2006-09-15 Thread Sebastian Haase
On Friday 15 September 2006 10:00, Travis Oliphant wrote:
> Sebastian Haase wrote:
> > Hi,
> >
> > what I'm asking is if numpy has an equivalent to numarray's info() 
function:
>  na.arange(10).info()
>
> numpy.numarray.info(numpy.arange(10))
>
> (get recent SVN as there were some bugs just fixed.
>
> -Travis

Thanks,

should this maybe also be added somewhere in the numpy module itself !?
I guess the question is, what the original intent was for numarray to put it 
in (only for debugging ?) -- then we could decide if this would also make 
sense for numpy.

I have never used numpy.info(obj) - I don't know what is does (compared to 
__doc__)   but maybe it could be extended like
if isinstance( obj , N.ndarray):
print  N.numarray.info( obj )

right now it prints nothings (and returns None)

Thanks,
Sebastian Haase

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Experience with Visit?

2006-09-15 Thread Rob Hetland

I have looked at it, and I even know somebody who is using python to  
put in a data reader for FVCOM (a finite volume ocean model).  He has  
a prototype working.  I have no experience with the python bindings  
personally.

I looked into compiling it from source (for an intel mac), but it was  
daunting so I gave up.

I also contacted them to try to put in lower level python bindings,  
so that we could create 3D graphics from the command line, but they  
didn't seem too interested in that.

Otherwise, it is a very nice workable app.

-Rob


On Sep 15, 2006, at 11:23 AM, O'Keefe, Michael wrote:

> I haven't tried VisIT before but thanks for the link. I also  
> downloaded and am checking it out.
>
> Along this same line of discussion, has anyone tried OOF2 which is  
> an FEA package that also has some strong python connections?
>
> http://www.ctcms.nist.gov/oof/oof2.html
>
> I'm working on a Windows machine and it the current code-base  
> doesn't seem to support Windows out of the box (if at all). Looks  
> like you can put it together for *nix or Mac OS X, though...
>
> --Michael
>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On
>> Behalf Of Robert Cimrman
>> Sent: Friday, September 15, 2006 8:29
>> To: Discussion of Numerical Python
>> Subject: Re: [Numpy-discussion] Experience with Visit?
>>
>> Travis Oliphant wrote:
>>> Has anybody had any experience with the 3-D visualization software
>>> VISIT?   It has Python bindings and seems to be pretty
>> sophisticated.
>>> I'm wondering why I haven't heard more about it.
>>>
>>> http://www.llnl.gov/visit/
>>
>> No reaction up to now, so...
>>
>> I have just tried the 'getting started' part and was quite impressed,
>> thanks for posting the link! Up to now I have used ParaView
>> and was very
>> satisfied, but the Python bindings of VisIt are a great lure.
>>
>> r.
>>
>> --
>> ---
>> Using Tomcat but need to do more? Need to support web
>> services, security?
>> Get stuff done quickly with pre-integrated technology to make
>> your job easier
>> Download IBM WebSphere Application Server v.1.0.1 based on
>> Apache Geronimo
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&;
>> dat=121642
>> ___
>> Numpy-discussion mailing list
>> Numpy-discussion@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>>
>
> -- 
> ---
> Using Tomcat but need to do more? Need to support web services,  
> security?
> Get stuff done quickly with pre-integrated technology to make your  
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache  
> Geronimo
> http://sel.as-us.falkag.net/sel? 
> cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Rob Hetland, Associate Professor
Dept. of Oceanography, Texas A&M University
http://pong.tamu.edu/~rob
phone: 979-458-0096, fax: 979-845-6331



-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] buggy buggy bugyy: format and casting ?

2006-09-15 Thread Robert Kern
Eric Emsellem wrote:
> Hi,
> 
> I am facing a rather frustrating problem with numpy/scipy: after
> upgrading to svn numpy and scipy, and trying to remove most of the now
> unnecessary casting (floats) the program I wrote does not give me the
> right answer. It seems that the answer is somewhat scaled down (but not
> in a simple way). I had this kind of behaviour some time ago when scipy
> and numpy were not fully compatible and then I had to cast the floats
> explicitely in my program to make it work. But now it SHOULD be fully
> compatible as far as I understand the issue. So my question is:
> is there any remaining flaws in terms of casts/format between scipy and
> numpy? I am specifically using the scipy functions:
> - special.erf, special.erfc, orthogonal.ps_roots, integrate.quad...
> and the numpy functions : sum, sqrt, exp, sin, cos, arctan.
> I am doing all the calculations using numpy.float32.

Could you give us a short piece of code that demonstrates the problem? You 
don't 
state what flaws you were working around before. Note that some of those 
functions in scipy are unavoidably implemented in double precision at the 
C/FORTRAN level.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailingunused bytes

2006-09-15 Thread Martin Wiechert
On Friday 15 September 2006 20:27, Travis Oliphant wrote:
> Martin Wiechert wrote:
> > On Friday 15 September 2006 19:14, Travis Oliphant wrote:
> >> Martin Wiechert wrote:
> >>> Thanks Albert! Do you also know the corresponding C-API function? It
> >>> cannot be PyArray_DescrConverter (PyObject *, PyArray_Descr **), whose
> >>> signature has no "align", right?
> >>
> >> The DescrConverter function is meant for "O&"-style conversions.  It
> >> can't accept an align function.  We could possibly add something to the
> >> converter to allow specification of alignment through the object to be
> >> converted.
> >
> > I begin to see the light
> >
> > For dictionaries one could maybe just add an optional key "align".
> > Also an optional key "elsize" or "itemsize" to force the total size of
> > the record may sometimes be useful. E.g. one may want to faithfully map a
> > given C struct. (That's why I was asking for trailing unused bytes.)
> >
> > But I understand that other things have higher priority.
> >
> >> Or, you can just call the __new__ method of the PyArrayDescr_Type object
> >>
> >> res = PyObject_CallMethod((PyObject *)&PyArrayDescr_Type, "__new__",
> >> "Oi", dict_object, 1))
> >>
> >> or call the tp->new method directly:
> >>
> >> args = Py_BuildValue("Oi", dict_object, 1);
> >> PyArrayDescr_Type->tp_new(&PyArrayDescr_Type, args, NULL);
> >> Py_DECREF(args);
> >
> > Thank you! I'll try this.
> >
> >> (I think passing in NULL for the keywords is O.K., but I haven't checked
> >> it).
> >>
> >> -Travis
> >
> > One final question. To me the repr of a dtype with gaps is a little bit
> >
> > puzzling:
>  dtype ({'names': ['a', 'b', 'c'], 'formats': [' >
> > 'offsets': [0, 16, 24]})
> > dtype([('a', '|S4'), ('', '|V12'), ('b', ' > ' >
> > There should be no gap between "b" and "c" but still the repr has ('',
> > '|V12') between them. Am I missing something?
>
> There was a bug I just fixed in the representation of these structures
> with gaps.  It should be fixed in SVN, now.
>
>
> -Travis
>
>

Thanks again.

> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailingunused bytes

2006-09-15 Thread Travis Oliphant
Martin Wiechert wrote:
> On Friday 15 September 2006 19:14, Travis Oliphant wrote:
>   
>> Martin Wiechert wrote:
>> 
>>> Thanks Albert! Do you also know the corresponding C-API function? It
>>> cannot be PyArray_DescrConverter (PyObject *, PyArray_Descr **), whose
>>> signature has no "align", right?
>>>   
>> The DescrConverter function is meant for "O&"-style conversions.  It
>> can't accept an align function.  We could possibly add something to the
>> converter to allow specification of alignment through the object to be
>> converted.
>>
>> 
>
> I begin to see the light
>
> For dictionaries one could maybe just add an optional key "align".
> Also an optional key "elsize" or "itemsize" to force the total size of the 
> record may sometimes be useful. E.g. one may want to faithfully map a given C 
> struct. (That's why I was asking for trailing unused bytes.)
>
> But I understand that other things have higher priority.
>
>   
>> Or, you can just call the __new__ method of the PyArrayDescr_Type object
>>
>> res = PyObject_CallMethod((PyObject *)&PyArrayDescr_Type, "__new__",
>> "Oi", dict_object, 1))
>>
>> or call the tp->new method directly:
>>
>> args = Py_BuildValue("Oi", dict_object, 1);
>> PyArrayDescr_Type->tp_new(&PyArrayDescr_Type, args, NULL);
>> Py_DECREF(args);
>>
>> 
>
> Thank you! I'll try this.
>
>   
>> (I think passing in NULL for the keywords is O.K., but I haven't checked
>> it).
>>
>> -Travis
>>
>> 
>
> One final question. To me the repr of a dtype with gaps is a little bit 
> puzzling:
>
>   
 dtype ({'names': ['a', 'b', 'c'], 'formats': ['>>> 
> 'offsets': [0, 16, 24]})
> dtype([('a', '|S4'), ('', '|V12'), ('b', '
> There should be no gap between "b" and "c" but still the repr has ('', 
> '|V12') 
> between them. Am I missing something?
>   
There was a bug I just fixed in the representation of these structures 
with gaps.  It should be fixed in SVN, now.


-Travis


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] PyArray_DescrConverter - alignment/ trailingunused bytes

2006-09-15 Thread Albert Strasheim
Argh

> > 
> 
> > One final question. To me the repr of a dtype with gaps is a little bit
> > puzzling:
> >
> > >>> dtype ({'names': ['a', 'b', 'c'], 'formats': [' > 'offsets': [0, 16, 24]})
> > dtype([('a', '|S4'), ('', '|V12'), ('b', ' > ' >
> > There should be no gap between "b" and "c" but still the repr has ('',
> > '|V12')
> > between them. Am I missing something?

I see you're not specifying align=True here. Ignore my last message.

Cheers,

Albert


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailingunused bytes

2006-09-15 Thread Albert Strasheim
Hello all

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:numpy-
> [EMAIL PROTECTED] On Behalf Of Martin Wiechert
> Sent: 15 September 2006 19:53
> To: Discussion of Numerical Python
> Subject: Re: [Numpy-discussion]PyArray_DescrConverter - alignment /
> trailingunused bytes
> 
> On Friday 15 September 2006 19:14, Travis Oliphant wrote:
> > Martin Wiechert wrote:
> > > Thanks Albert! Do you also know the corresponding C-API function? It
> > > cannot be PyArray_DescrConverter (PyObject *, PyArray_Descr **), whose
> > > signature has no "align", right?
> >
> > The DescrConverter function is meant for "O&"-style conversions.  It
> > can't accept an align function.  We could possibly add something to the
> > converter to allow specification of alignment through the object to be
> > converted.
> >

> 

> One final question. To me the repr of a dtype with gaps is a little bit
> puzzling:
> 
> >>> dtype ({'names': ['a', 'b', 'c'], 'formats': [' 'offsets': [0, 16, 24]})
> dtype([('a', '|S4'), ('', '|V12'), ('b', ' ' 
> There should be no gap between "b" and "c" but still the repr has ('',
> '|V12')
> between them. Am I missing something?

For performance reasons, compilers will typically align integers (and
probably floats) on 4-byte boundaries and apparently, doubles on 16-byte
boundaries.

Because compilers align like this, so does NumPy. This allows you to:

1. Take any kind of C struct definition
2. Convert it to a dtype
3. Create a NumPy array with this dtype
4. Pass the array's data pointer to C code
5. Cast the data pointer to a pointer to your C struct
6. Operate on the pointer to struct as if it were allocated in C

Cheers,

Albert


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailing unused bytes

2006-09-15 Thread Martin Wiechert
On Friday 15 September 2006 20:05, Travis Oliphant wrote:
> Martin Wiechert wrote:
> > Hi list,
> >
> > I'm using PyArray_DescrConverter with a dict object to create a
> > "struct-like" dtype from C.
> > As the struct contains different data types I run into "unaligned access"
> > problems.
> > Is there a way to force alignment or to get trailing unused bytes in the
> > dtpye?
>
> Besides calling the tp_new function (or the method __new__),  I added
> PyArray_DescrAlignConverter to the C-API.
>
> It is at the end and so does not require re-compilation of extension
> modules (unless you want to use it...)
>

Thanks Travis. I appreciate your work.

> -Travis
>
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailing unused bytes

2006-09-15 Thread Travis Oliphant
Martin Wiechert wrote:
> Hi list,
>
> I'm using PyArray_DescrConverter with a dict object to create a "struct-like" 
> dtype from C.
> As the struct contains different data types I run into "unaligned access" 
> problems.
> Is there a way to force alignment or to get trailing unused bytes in the 
> dtpye?
>   
Besides calling the tp_new function (or the method __new__),  I added 
PyArray_DescrAlignConverter to the C-API.

It is at the end and so does not require re-compilation of extension 
modules (unless you want to use it...)

-Travis


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] PyArray_DescrConverter - alig nment / trailingunused bytes

2006-09-15 Thread Martin Wiechert
On Friday 15 September 2006 19:14, Travis Oliphant wrote:
> Martin Wiechert wrote:
> > Thanks Albert! Do you also know the corresponding C-API function? It
> > cannot be PyArray_DescrConverter (PyObject *, PyArray_Descr **), whose
> > signature has no "align", right?
>
> The DescrConverter function is meant for "O&"-style conversions.  It
> can't accept an align function.  We could possibly add something to the
> converter to allow specification of alignment through the object to be
> converted.
>

I begin to see the light

For dictionaries one could maybe just add an optional key "align".
Also an optional key "elsize" or "itemsize" to force the total size of the 
record may sometimes be useful. E.g. one may want to faithfully map a given C 
struct. (That's why I was asking for trailing unused bytes.)

But I understand that other things have higher priority.

> Or, you can just call the __new__ method of the PyArrayDescr_Type object
>
> res = PyObject_CallMethod((PyObject *)&PyArrayDescr_Type, "__new__",
> "Oi", dict_object, 1))
>
> or call the tp->new method directly:
>
> args = Py_BuildValue("Oi", dict_object, 1);
> PyArrayDescr_Type->tp_new(&PyArrayDescr_Type, args, NULL);
> Py_DECREF(args);
>

Thank you! I'll try this.

> (I think passing in NULL for the keywords is O.K., but I haven't checked
> it).
>
> -Travis
>

One final question. To me the repr of a dtype with gaps is a little bit 
puzzling:

>>> dtype ({'names': ['a', 'b', 'c'], 'formats': ['
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailingunused bytes

2006-09-15 Thread Travis Oliphant
Martin Wiechert wrote:
> Thanks Albert! Do you also know the corresponding C-API function? It cannot 
> be 
> PyArray_DescrConverter (PyObject *, PyArray_Descr **), whose signature has no 
> "align", right?
>   
The DescrConverter function is meant for "O&"-style conversions.  It 
can't accept an align function.  We could possibly add something to the 
converter to allow specification of alignment through the object to be 
converted.

Or, you can just call the __new__ method of the PyArrayDescr_Type object

res = PyObject_CallMethod((PyObject *)&PyArrayDescr_Type, "__new__", 
"Oi", dict_object, 1))

or call the tp->new method directly:

args = Py_BuildValue("Oi", dict_object, 1);
PyArrayDescr_Type->tp_new(&PyArrayDescr_Type, args, NULL);
Py_DECREF(args);

(I think passing in NULL for the keywords is O.K., but I haven't checked 
it).

-Travis


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] how to get info about internals of an array object ?

2006-09-15 Thread Travis Oliphant
Sebastian Haase wrote:
> Hi,
> what I'm asking is if numpy has an equivalent to numarray's info() function:
>   
 na.arange(10).info()
 
numpy.numarray.info(numpy.arange(10))

(get recent SVN as there were some bugs just fixed.

-Travis



-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] buggy buggy bugyy: format and casting ?

2006-09-15 Thread Eric Emsellem
Hi,

I am facing a rather frustrating problem with numpy/scipy: after
upgrading to svn numpy and scipy, and trying to remove most of the now
unnecessary casting (floats) the program I wrote does not give me the
right answer. It seems that the answer is somewhat scaled down (but not
in a simple way). I had this kind of behaviour some time ago when scipy
and numpy were not fully compatible and then I had to cast the floats
explicitely in my program to make it work. But now it SHOULD be fully
compatible as far as I understand the issue. So my question is:
is there any remaining flaws in terms of casts/format between scipy and
numpy? I am specifically using the scipy functions:
- special.erf, special.erfc, orthogonal.ps_roots, integrate.quad...
and the numpy functions : sum, sqrt, exp, sin, cos, arctan.
I am doing all the calculations using numpy.float32.

Did anybody witness weird behaviour recently in this context?
(I don't really know what to do now since I already spent hours trying
to find the problem: the point is that the final answer is wrong for
sure, but the intermediate calculations are not easily checked since I
do not know what to really expect there. The program was working before
I touched the casting + upgraded numpy/scipy)

thanks for any help here, and cheers.

Eric

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] how to get info about internals of an arrayobject ?

2006-09-15 Thread Travis Oliphant
Albert Strasheim wrote:
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:numpy-
>> [EMAIL PROTECTED] On Behalf Of Sebastian Haase
>> Sent: 15 September 2006 03:21
>> To: numpy-discussion
>> Subject: [Numpy-discussion] how to get info about internals of an
>> arrayobject ?
>>
>> Hi,
>> what I'm asking is if numpy has an equivalent to numarray's info()
>> function:
>> 
>
>   
>> 
>> 
>
>   
>> This was always helpful to me when debugging C binding code.
>>
>> Especially I'm asking if there is any way to get the memory address of an
>> array - for debugging purposes only - of course ;-)
>> 
>
> numpy.array([]).__array_interface__['data'][0]
>   

Or

numpy.ctypes._as_parameter_

(should work even if you don't have ctypes installed)

-Travis


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Experience with Visit?

2006-09-15 Thread O'Keefe, Michael
I haven't tried VisIT before but thanks for the link. I also downloaded and am 
checking it out.

Along this same line of discussion, has anyone tried OOF2 which is an FEA 
package that also has some strong python connections?

http://www.ctcms.nist.gov/oof/oof2.html

I'm working on a Windows machine and it the current code-base doesn't seem to 
support Windows out of the box (if at all). Looks like you can put it together 
for *nix or Mac OS X, though...

--Michael 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Robert Cimrman
> Sent: Friday, September 15, 2006 8:29
> To: Discussion of Numerical Python
> Subject: Re: [Numpy-discussion] Experience with Visit?
> 
> Travis Oliphant wrote:
> > Has anybody had any experience with the 3-D visualization software 
> > VISIT?   It has Python bindings and seems to be pretty 
> sophisticated.  
> > I'm wondering why I haven't heard more about it.
> > 
> > http://www.llnl.gov/visit/
> 
> No reaction up to now, so...
> 
> I have just tried the 'getting started' part and was quite impressed, 
> thanks for posting the link! Up to now I have used ParaView 
> and was very 
> satisfied, but the Python bindings of VisIt are a great lure.
> 
> r.
> 
> --
> ---
> Using Tomcat but need to do more? Need to support web 
> services, security?
> Get stuff done quickly with pre-integrated technology to make 
> your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on 
> Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&;
> dat=121642
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
> 

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailingunused bytes

2006-09-15 Thread Martin Wiechert
On Friday 15 September 2006 17:53, Albert Strasheim wrote:
> Hello all
>
> In [1]: import numpy as N
>
> In [3]: N.dtype({'names' : ['x', 'y'],
>  'formats' : [N.intc, N.float64]},
> align=True)
> Out[3]: dtype([('x', '
> The reason you might not have discovered this:
>
> In [2]: N.dtype?
> Type:   type
> Base Class: 
> String Form:
> Namespace:  Interactive
> File:   c:\python24\lib\site-packages\numpy\__init__.py
> Docstring:
> 
>

Thanks Albert! Do you also know the corresponding C-API function? It cannot be 
PyArray_DescrConverter (PyObject *, PyArray_Descr **), whose signature has no 
"align", right?

> Cheers,
>
> Albert
>
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:numpy-
> > [EMAIL PROTECTED] On Behalf Of Martin Wiechert
> > Sent: 15 September 2006 16:14
> > To: numpy-discussion
> > Subject: [Numpy-discussion] PyArray_DescrConverter - alignment /
> > trailingunused bytes
> >
> > Hi list,
> >
> > I'm using PyArray_DescrConverter with a dict object to create a "struct-
> > like"
> > dtype from C.
> > As the struct contains different data types I run into "unaligned access"
> > problems.
> > Is there a way to force alignment or to get trailing unused bytes in the
> > dtpye?
> >
> > Thanks, Martin
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailingunused bytes

2006-09-15 Thread Albert Strasheim
Hello all

In [1]: import numpy as N

In [3]: N.dtype({'names' : ['x', 'y'],
 'formats' : [N.intc, N.float64]},
align=True)
Out[3]: dtype([('x', '
String Form:
Namespace:  Interactive
File:   c:\python24\lib\site-packages\numpy\__init__.py
Docstring:


Cheers,

Albert

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:numpy-
> [EMAIL PROTECTED] On Behalf Of Martin Wiechert
> Sent: 15 September 2006 16:14
> To: numpy-discussion
> Subject: [Numpy-discussion] PyArray_DescrConverter - alignment /
> trailingunused bytes
> 
> Hi list,
> 
> I'm using PyArray_DescrConverter with a dict object to create a "struct-
> like"
> dtype from C.
> As the struct contains different data types I run into "unaligned access"
> problems.
> Is there a way to force alignment or to get trailing unused bytes in the
> dtpye?
> 
> Thanks, Martin


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailing unused bytes

2006-09-15 Thread Martin Wiechert

On Friday 15 September 2006 16:40, Francesc Altet wrote:
> A Divendres 15 Setembre 2006 16:13, Martin Wiechert va escriure:
> > Hi list,
> >
> > I'm using PyArray_DescrConverter with a dict object to create a
> > "struct-like" dtype from C.
> > As the struct contains different data types I run into "unaligned access"
> > problems.
> > Is there a way to force alignment or to get trailing unused bytes in the
> > dtpye?
>
> One possible solution is to declare void ('V' charcode) types for filling
> the gaps. For example:
>
>
> In [118]: ra=numpy.rec.array("1"*300,
> dtype=[('sval','
> In [119]: ra['sval']
> Out[119]:
> recarray([, ],
>   dtype='|S4')
>
> In [120]: ra['dval']
> Out[120]: array([  9.73041595e-72,   9.73041595e-72])
>

Hm, not exactly elegant but should work. Thanks Francesc!

Note that all but trailing gaps can be controlled using a dictionary 
descriptor with an offsets key:

>>> ra = zeros ((10,), dtype = {'names': ['sval', 'dval'], 'formats': ['>> ra.dtype
dtype([('sval', '|S4'), ('', '|V4'), ('dval', ' You can still access the empty spaces if you want (although it is
> nonsense):
>
> In [121]: ra['unused']
> Out[121]:
> recarray([, ],
>   dtype='|V4')
>
> Cheers,

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailing unused bytes

2006-09-15 Thread Francesc Altet
A Divendres 15 Setembre 2006 16:13, Martin Wiechert va escriure:
> Hi list,
>
> I'm using PyArray_DescrConverter with a dict object to create a
> "struct-like" dtype from C.
> As the struct contains different data types I run into "unaligned access"
> problems.
> Is there a way to force alignment or to get trailing unused bytes in the
> dtpye?

One possible solution is to declare void ('V' charcode) types for filling the 
gaps. For example:


In [118]: ra=numpy.rec.array("1"*300, dtype=[('sval','0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Experience with Visit?

2006-09-15 Thread Robert Cimrman
Travis Oliphant wrote:
> Has anybody had any experience with the 3-D visualization software 
> VISIT?   It has Python bindings and seems to be pretty sophisticated.  
> I'm wondering why I haven't heard more about it.
> 
> http://www.llnl.gov/visit/

No reaction up to now, so...

I have just tried the 'getting started' part and was quite impressed, 
thanks for posting the link! Up to now I have used ParaView and was very 
satisfied, but the Python bindings of VisIt are a great lure.

r.

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailing unused bytes

2006-09-15 Thread Martin Wiechert
On Friday 15 September 2006 16:13, Martin Wiechert wrote:
> Hi list,
>
> I'm using PyArray_DescrConverter with a dict object to create a
> "struct-like" dtype from C.
> As the struct contains different data types I run into "unaligned access"
> problems.

on IA64 I should have mentioned

> Is there a way to force alignment or to get trailing unused bytes in the
> dtpye?
>
> Thanks, Martin
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] PyArray_DescrConverter - alignment / trailing unused bytes

2006-09-15 Thread Martin Wiechert
Hi list,

I'm using PyArray_DescrConverter with a dict object to create a "struct-like" 
dtype from C.
As the struct contains different data types I run into "unaligned access" 
problems.
Is there a way to force alignment or to get trailing unused bytes in the 
dtpye?

Thanks, Martin

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] recarray

2006-09-15 Thread Francesc Altet
A Divendres 15 Setembre 2006 15:57, Robert Kern va escriure:
> Lionel Roubeyrie wrote:
> > Hi all,
> > I try to use recarray with rec.fromrecords on time-series, datas come
> > from a file where they are stored in csv format, with after each data
> > colum there is one column meanning the state of the data, and the first
> > column is for dates. Then, is it possible to directly transform column of
> > strings to a integer one (or datetime one), and to remove a not used
> > column?
>
> When I import CSV files into record arrays, I usually read in all of the
> data and transpose the list of rows to get a list of columns. Then I can
> remove columns and transform them _en masse_, usually with map().

Another possibility is to play with columns directly from the initial 
recarray. The next is an example:

In [101]: ra=numpy.rec.array("1"*36, dtype="a4,i4,f4", shape=3)
In [102]: ra
Out[102]:
recarray([('', 825307441, 2.5784852031307537e-09),
   ('', 825307441, 2.5784852031307537e-09),
   ('', 825307441, 2.5784852031307537e-09)],
  dtype=[('f0', '|S4'), ('f1', '0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] recarray

2006-09-15 Thread Robert Kern
Lionel Roubeyrie wrote:
> Hi all,
> I try to use recarray with rec.fromrecords on time-series, datas come from a 
> file where they are stored in csv format, with after each data colum there is 
> one column meanning the state of the data, and the first column is for dates.
> Then, is it possible to directly transform column of strings to a integer one 
> (or datetime one), and to remove a not used column?

When I import CSV files into record arrays, I usually read in all of the data 
and transpose the list of rows to get a list of columns. Then I can remove 
columns and transform them _en masse_, usually with map().

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] degree matrix construction

2006-09-15 Thread Charles R Harris
On 9/15/06, Satya Upadhya <[EMAIL PROTECTED]> wrote:
Dear Friends,my question is the following:Suppose i have the following code:>>> from LinearAlgebra import *>>> from Numeric import *>>> A = [1,2,1,3,1,3,4,1,2]
>>> B = reshape(A,(3,3))>>> C = sum(B,1)>>> Carray([4, 7, 7])>>> Now, my problem is to construct a degree matrix D which is a 3 * 3 matrix with diagonal elements 4,7,7 (obtained from the elements of C) and all off-diagonal elements equal to 0.
Is this what you want to do?In [2]: a = array([4, 7, 7])
In [3]: diagflat(a)Out[3]:
array([[4, 0, 0],   [0, 7, 0],
   [0, 0, 7]])Chuck 
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] degree matrix construction

2006-09-15 Thread Joris De Ridder

Forgot the link to the NEL:  http://www.scipy.org/Numpy_Example_List

J.

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] degree matrix construction

2006-09-15 Thread Joris De Ridder
Hi,

   [SU]: Now, my problem is to construct a degree matrix D which is a 3 * 3 
matrix with diagonal elements 4,7,7 

You might have a look at the Numpy Example List, at the function diag().

Ciao,
Joris


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] degree matrix construction

2006-09-15 Thread Satya Upadhya
Dear Friends,my question is the following:Suppose i have the following code:>>> from LinearAlgebra import *>>> from Numeric import *>>> A = [1,2,1,3,1,3,4,1,2]>>> B = reshape(A,(3,3))>>> C = sum(B,1)>>> Carray([4, 7, 7])>>> Now, my problem is to construct a degree matrix D which is a 3 * 3 matrix with diagonal elements 4,7,7 (obtained from the elements of C) and all off-diagonal elements equal to 0.Could some kind soul kindly tell me how to do this.I've looked at the help for the diagonal function and i am unable to do what i wish to. Furthermore i dont understand the meaning of axis1 and axis2:>>> help (diagonal)Help on function diagonal in module Numeric:diagonal(a, offset=0, axis1=0, axis2=1)    diagonal(a, offset=0, axis1=0, axis2=1) returns all offset diagonals    defined by the
 given dimensions of the array.>>>Thanking you,Satya 
	

	
		 
Find out what India is talking about on  - Yahoo! Answers India  
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] recarray

2006-09-15 Thread Lionel Roubeyrie
Hi all,
I try to use recarray with rec.fromrecords on time-series, datas come from a 
file where they are stored in csv format, with after each data colum there is 
one column meanning the state of the data, and the first column is for dates.
Then, is it possible to directly transform column of strings to a integer one 
(or datetime one), and to remove a not used column?
thanks

--
Lionel

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] how to get info about internals of an arrayobject ?

2006-09-15 Thread Albert Strasheim
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:numpy-
> [EMAIL PROTECTED] On Behalf Of Sebastian Haase
> Sent: 15 September 2006 03:21
> To: numpy-discussion
> Subject: [Numpy-discussion] how to get info about internals of an
> arrayobject ?
> 
> Hi,
> what I'm asking is if numpy has an equivalent to numarray's info()
> function:

> 

> This was always helpful to me when debugging C binding code.
> 
> Especially I'm asking if there is any way to get the memory address of an
> array - for debugging purposes only - of course ;-)

numpy.array([]).__array_interface__['data'][0]

Cheers,

Albert


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion