You can subscribe to this list here.
2000 |
Jan
(8) |
Feb
(49) |
Mar
(48) |
Apr
(28) |
May
(37) |
Jun
(28) |
Jul
(16) |
Aug
(16) |
Sep
(44) |
Oct
(61) |
Nov
(31) |
Dec
(24) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(56) |
Feb
(54) |
Mar
(41) |
Apr
(71) |
May
(48) |
Jun
(32) |
Jul
(53) |
Aug
(91) |
Sep
(56) |
Oct
(33) |
Nov
(81) |
Dec
(54) |
2002 |
Jan
(72) |
Feb
(37) |
Mar
(126) |
Apr
(62) |
May
(34) |
Jun
(124) |
Jul
(36) |
Aug
(34) |
Sep
(60) |
Oct
(37) |
Nov
(23) |
Dec
(104) |
2003 |
Jan
(110) |
Feb
(73) |
Mar
(42) |
Apr
(8) |
May
(76) |
Jun
(14) |
Jul
(52) |
Aug
(26) |
Sep
(108) |
Oct
(82) |
Nov
(89) |
Dec
(94) |
2004 |
Jan
(117) |
Feb
(86) |
Mar
(75) |
Apr
(55) |
May
(75) |
Jun
(160) |
Jul
(152) |
Aug
(86) |
Sep
(75) |
Oct
(134) |
Nov
(62) |
Dec
(60) |
2005 |
Jan
(187) |
Feb
(318) |
Mar
(296) |
Apr
(205) |
May
(84) |
Jun
(63) |
Jul
(122) |
Aug
(59) |
Sep
(66) |
Oct
(148) |
Nov
(120) |
Dec
(70) |
2006 |
Jan
(460) |
Feb
(683) |
Mar
(589) |
Apr
(559) |
May
(445) |
Jun
(712) |
Jul
(815) |
Aug
(663) |
Sep
(559) |
Oct
(930) |
Nov
(373) |
Dec
|
From: Paul F. D. <pau...@ho...> - 2000-11-03 03:01:05
|
I believe you can deduce the modules being built and the sources / include / lib directories for them by examining setup.py. When we switched to distutils we chucked our Setup file. -----Original Message----- From: num...@li... [mailto:num...@li...]On Behalf Of Sam Tannous Sent: Thursday, November 02, 2000 6:45 PM To: num...@so... Subject: [Numpy-discussion] Static linking with Python 2.0 (Setup.local) I successfully installed the latest release with the distutils package. But now I need to statically link the Numeric package into my Python 2.0 interpreter (it's easier for me to ship "frozen" python binaries for some lab machines...one file instead of hundreds). Could anyone please email me (or post) the section of your Modules/Setup.local that can do this? Something like: _numpy _numpymodule.c -L/users/stannous/lib -L/usr/lib -lm -I/users/stannous/includ e just doesn't work... TIA, Sam _______________________________________________ Numpy-discussion mailing list Num...@li... http://lists.sourceforge.net/mailman/listinfo/numpy-discussion |
From: Sam T. <sta...@ci...> - 2000-11-03 02:45:25
|
I successfully installed the latest release with the distutils package. But now I need to statically link the Numeric package into my Python 2.0 interpreter (it's easier for me to ship "frozen" python binaries for some lab machines...one file instead of hundreds). Could anyone please email me (or post) the section of your Modules/Setup.local that can do this? Something like: _numpy _numpymodule.c -L/users/stannous/lib -L/usr/lib -lm -I/users/stannous/include just doesn't work... TIA, Sam |
From: Janko H. <jh...@if...> - 2000-11-03 00:07:49
|
Use the numpyio module from Travis. With this it should be possible to read the data directly and do any typecode conversion you want with. It has fread and fwrite functions, and it can be used with any NumPy type like Int0 in your case. It's part of the signaltools package. http://oliphant.netpedia.net/signaltools_0.5.2.tar.gz HTH, __Janko |
From: Chris B. <cb...@jp...> - 2000-11-02 21:36:04
|
I have a narge array of type "1" (single bytes). I need to convert it to Int32, in the manner that fromstring() would. Right now, I am doing: Array = fromstring(Array.tostring(),'f') This works fine, but what concerns me is that I need to do this on potentially HUGE arrays, and if I understand this right, I am going to create a copy with tostring, and then another copy with fromstring, that then gets referenced to Array, at which point the first original copy gets de-referenced, and should be deleted, and the temporary one gets deleted at some point in this process. I don't know when stuff created in the middle of a statement gets deleted, so I could potentially have three copies of the data around at the same time, and at least two. Since it is exactly the same C array, I'd like to be able to do this without making any copies at all. Is it possible? It seems like it should be a simple matter of changing the typecode and shape, but is this possible? While I'm asking questions: can I byteswap in place as well? The greater problem: To give a little background, and to see if anyone has a better idea of how to do what I am doing, I thought I'd run through the task that I really need to do. I am reading a binary file full of a lot of data. I have some control over the form of the file, but it needs to be compact, so I can't just make everything the same large type. The file is essentially a whole bunch of records, each of which is a collection of a couple of different types, and which I would eventually like to get into a couple of NumPy arrays. My first cut at the problem was to read each record one at a time in a loop, and use the struct module to convert everything. This worked fine, but was pretty darn slow, so I am now doing it all with NumPy like this (one example, I have more complex ones): num_bytes = 9 # number of bytes in a record: two longs and a char # read all the data into a single byte array data = fromstring(file.read(num_bytes*num_timesteps*num_LEs),'1') # rearrange into 3-d array data.shape = (num_timesteps,num_LEs,num_bytes) # extract LE data: LEs = data[:,:,:8] # extract flag data flags = data[:,:,8] # convert LE data to longs LEs = fromstring(LEs.tostring(),Int32) if endian == 'L': # byteswap if required LEs = LEs.byteswapped() # convert to 3-d array LEs.shape = (num_timesteps,num_LEs,2) Anyone have any better ideas on how to do this? Thanks, -Chris -- Christopher Barker, Ph.D. cb...@jp... --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ |
From: Greg B. <gb...@cf...> - 2000-10-31 23:31:59
|
I think the way Gerard is interpreting this passage > Permission to use, copy, modify, and distribute this software and its > documentation for any purpose and without fee is hereby granted, is that you can DISTRIBUTE the software but you can't CHARGE A FEE. However this appears in the normal python license and many others and I am sure the correct interpretation is that you can USE, DISTRIBUTE, etc the software without PAYING A FEE (to the copyright holders.) It is free software, a XFree86 style license according to RMS, which is BSD-like but with no advertising clause. Gerard, the license is fine for distribution and as Joe said, similar to many other free software packages. -Greg Ball |
From: Paul F. D. <pau...@ho...> - 2000-10-31 23:01:24
|
Numerical 17.1.1 is available in both source and prebuilt Windows versions at: http://sourceforge.net/projects/numpy Windows users, simply extract into your top level Python 2.0 directory, typically c:\python20. Thank you to Pete Shinners for putting the Windows file together. It is too late to change for the 17 series but in future I will make releases that have whole numbers only as names and add files to that release as they become available. That makes it a little clearer that you should take the most recent file of the desired type. |
From: Joe H. <jh...@oo...> - 2000-10-31 17:34:53
|
Gerard, Could you explain why you think that the phrase you quoted is restrictive? Lots of software comes with that phrase, and it certainly hasn't inhibited its wide promulgation. All it says is that you can't pass off this software as your own, which would be lying anyway. As far as I can tell (I'm not a lawyer, etc.), it's far less restrictive than, say, GPL. It seems very like the BSD license you suggest using instead. If you include the packages in a larger work, you can just say: This work includes the blah blah package, which bears the following license: "Permission to use, copy, modify, and distribute this software for any purpose without fee is hereby granted, provided that this entire notice is included in all copies of any software which is or includes a copy or modification of this software and in all copies of the supporting documentation for such software. " Note that the notice *doesn't* say you have to *copyright* the larger package under the terms of the notice or to the owner of the included package, it just says you have to include the notice, presumably so the recipient knows that the package is in there, who the owner of that component is, and that distributing that part is allowed. If you look at the manuals to most commercial Unices, you'll find several pages of such notices from the owners of the various packages included in the system. What's the problem? --jh-- |
From: Bernd W. <be...@bp...> - 2000-10-30 14:33:57
|
Hi, I tried to install Numeric-17.1.1 under IRIX 6.3 after installing Python 2.0 without optimization and the -g workaround. I got this error message: # /usr/local/bin/python setup.py install running install running build running build_py not copying Lib/ArrayPrinter.py (output up-to-date) not copying Lib/Numeric.py (output up-to-date) not copying Lib/Precision.py (output up-to-date) not copying Lib/UserArray.py (output up-to-date) not copying Lib/numeric_version.py (output up-to-date) running build_ext building '_numpy' extension skipping Src/_numpymodule.c (build/temp.irix-6.3-2.0/Src/_numpymodule.o up-to-date) skipping Src/arrayobject.c (build/temp.irix-6.3-2.0/Src/arrayobject.o up-to-date) skipping Src/ufuncobject.c (build/temp.irix-6.3-2.0/Src/ufuncobject.o up-to-date) ld -shared -all build/temp.irix-6.3-2.0/Src/_numpymodule.o build/temp.irix-6.3-2.0/Src/arrayobject.o build/temp.irix-6.3-2.0/Src/ufuncobject.o -o build/lib.irix-6.3-2.0/_numpy.so ld: ERROR 48: Cannot access registry file ./so_locations (No locks available) - ignored. ld: FATAL 51: Can't assign virtual addresses for _numpy.so within specified range. Please check your registry file ./so_locations. error: command 'ld' failed with exit status 4 Has anybody else encountered this problem? Thanks a lot! Bernd -- Bernd Weyrauch Marie-Curie-Str. 9 D-60439 Frankfurt am Main Institute of Biophysical Chemistry Tel. +49-(0)69-798-296-72 Frankfurt J. W. Goethe University Fax +49-(0)69-798-296-32 Biocenter, N230 e-mail be...@bp... http://www.biozentrum.uni-frankfurt.de/~bernd http://www.cthulhu.onlinehome.de |
From: Gerard V. (CRTBT) <gve...@la...> - 2000-10-29 09:21:13
|
I like to propose a numpy-RPM to MandrakeSoft for future inclusion in their contrib-cdroms. Of course, MandrakeSoft requires that all license issues are cleared. I understand that the file Legal.htm applies to the packages MA and RNG. Is this true? I like to point out that the phrase "Permission to use, copy, modify, and distribute this software for any purpose without fee is hereby granted, provided that this entire notice is included in all copies of any software which is or includes a copy or modification of this software and in all copies of the supporting documentation for such software. " is very restrictive. It forbids the inclusion of MA and RNG on a commercial CD rom. Isn't it? It also forbids a consultant to use it for his business. But what about somebody getting paid for his work in a government research laboratory? Could you replace this by something more BSD-like? Best regards -- Gerard Vermeulen |
From: Janko H. <jh...@if...> - 2000-10-28 16:27:58
|
Hello, a question in the newsgroup got me thinking about the save use of the ``savespace'' flag in modules, which should be used by third party code. Think of this function as an example: def freezing(S,P): """Returns the freezing point temperature of seawater with a salinity S and at a pressure P. """ TF=(-.0575+1.710523e-3*_A.sqrt(_A.absolute(S))-2.154996e-4*S)*S-7.53e-4*P return TF This looks simple and one wants to use the savespace flag for S and P. So now the questions are rolling. What if S or P are scalars? Use asarray with the savespace flag. -> Error, this returns a copy of the array and not a reference, which is bad for array arguments. So use first asarray and then do asarray(S).savespace(1). Ok this works for the function, but we need to reset the flag at the end of the function. Also bad, what if S or P had the flag set before they entered the function? Ok I have now build a class, which actually keeps a record of these flags and has some helper methods to handle this record. The example function looks now: def freezing(S,P): SP=mkspacesaver(S,P) if not SP.isfloat(): raise ValueError, 'Arguments need to be of some float type' TF=(-.0575+1.710523e-3*_A.sqrt(_A.absolute(S))-2.154996e-4*S)*S-7.53e-4*P SP.free(); SP.clean(TF) return TF Note the test for float type, because if the user lazily entered an integer array for e.g. the pressure, the then set savespace flag would result in a very wrong answer. Although this seems to work for me, I do not know if this really presents a solution, as I actually need to put these lines into every similar function. The other way, to put the coeff. into an array has also problems, as I first need to find out of which type all arguments are and choose the highest one and it makes it more difficult to follow the coeff. in the formula. Any other suggestions, more general ways to handle argument testing? Is the savespace flag only suited for more closed environments, where one can assume more about the arguments? Class attached, __Janko class mkspacesaver: def __init__(self, *args): """Set for all arguments the savespace flag and make them to arrays. Keep track of this. At the end of the function, all flags can be reset, by a call to the method .free() """ self.refs = [] self.flags= [] for arg in args: try: arg.spacesaver() ref = arg except AttributeError: ref = afuncs.asarray(arg) self.flags.append(ref.spacesaver()) ref.savespace(1) self.refs.append(ref) def isfloat(self, index=None): """ Test if all refs have a float type, if a sequence is given for index, only the indexed refs are tested. """ if index: for i in index: if not self.refs[i].typecode() in ('f','d'): return 0 else: for i in range(len(self.refs)): if not self.refs[i].typecode() in ('f','d'): return 0 return 1 def free(self): for i in range(len(self.refs)): self.refs[i].savespace(self.flags[i]) def clean(self, *args): """Test if the arguments have the savespace flag set and set it to zero. Handle also scalars """ for arg in args: try: arg.savespace(0) except AttributeError: pass |
From: Johannes Z. <joh...@ze...> - 2000-10-24 17:04:26
|
Hello, there are three modules Numerical numpy numpy2 in the cvs repository. Could someone explain the differences please ? -- Johannes |
From: Konrad H. <hi...@cn...> - 2000-10-23 16:09:58
|
> (Addendum -- Mark Hammond suggests this may be a threading issue -- > OpenDatabase() apparently causes Python threads to be initialized. > Does NumPy or lapack lite use threads for anything?) No. > The problem is that the statement 'print linear_...' never completes. > I step through in the debugger under pythonwin, & the lapack routine > called by linear_least_squares() never returns. > > If I remove the statement 'db = engine...' it completes normally. > > If I make a call to linear_least_squares() *before* the database > stuff, the later call to linear_least_squares() works properly. I don't know how dynamic libraries work under Windows, but I could imagine that your database modules uses a symbol which is also used in Linpack or the Linpack/Python interface. There ought to be tools to verify this. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hi...@cn... Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- |
From: John L. <lu...@ac...> - 2000-10-22 16:35:49
|
(Also posted to comp.lang.python) (Addendum -- Mark Hammond suggests this may be a threading issue -- OpenDatabase() apparently causes Python threads to be initialized. Does NumPy or lapack lite use threads for anything?) I'm working on a Windows application that needs to use both Microsoft DAO and Numeric, & have run into a problem between the two. The following code illustrates the problem: from win32com.client import Dispatch engine = Dispatch("DAO.DBEngine.35") db = engine.OpenDatabase('c:\\test.mdb') from Numeric import array m = array([[1., 2.], [3., 4.]]) y = array([2., 1.]) from LinearAlgebra import linear_least_squares print linear_least_squares(m, y) print 'success!' The problem is that the statement 'print linear_...' never completes. I step through in the debugger under pythonwin, & the lapack routine called by linear_least_squares() never returns. If I remove the statement 'db = engine...' it completes normally. If I make a call to linear_least_squares() *before* the database stuff, the later call to linear_least_squares() works properly. test.mdb is an empty database created by Access 97. Using another database seems to make no difference. I am using: Python 1.52 win32all-132 NumPy 16.1 All are standard distribution builds. OS is Win98SE. DAO.DBEngine.35 resolves to DAO350.dll, dated 4/27/98. That, in turn (I believe) is using msJet35.dll dated 4/23/99. Any ideas? Thanks. Regards, John |
From: Konrad H. <hi...@cn...> - 2000-10-20 13:08:55
|
> > A look at the value of "spam" with a debugger should tell you what's > > going on. > > I have not yet figured out how to use a de-bugger with a python > extension. Does anyone know of any nifty tutorial for how to do this > (with gdb, preferably)? note that I'm a newby to C too, so I need a > really basic run through. I used gdb with gcc under Linux, and I just use it as I would on any other program: gdb /usr/bin/python run spam.py and wait for the crash. Of course your module should have been compiled with -g if you want symbolic debugging. The only difficulty with debugging extension modules built as dynamic libraries is setting breakpoints. You can't do it right away because the module isn't loaded yet, so its symbols are unknown to gdb. My solution is to start my script with the import, followed immediately by "time.sleep(5)". That gives me five seconds to press Control-C to reenter the debugger, and from then on everything works as advertised. If someone knows a more elegant solution, please let me know! Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hi...@cn... Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- |
From: Chris B. <cb...@jp...> - 2000-10-19 21:04:39
|
Konrad Hinsen wrote: > > site = PyList_GetItem(spam_list, index); > > > > if (! PyArray_Check(spam)) result = 0; > ^^^^ > > Not "site"? oops! I thought I had Pythonized everything by putting spam everywhere. > If spam is NULL, then the check will crash. If it is anything but a pointer > to a Python object, there's a good chance that it might crash. > PyArray_Check just tells you if a given Python object is of type "array". Fair enough. In this case, I was getting spam from a Python list. Is it possible for it to be anything but a pointer to a Python object? > A look at the value of "spam" with a debugger should tell you what's > going on. I have not yet figured out how to use a de-bugger with a python extension. Does anyone know of any nifty tutorial for how to do this (with gdb, preferably)? note that I'm a newby to C too, so I need a really basic run through. > > spam = (PyArrayObject *) PyList_GetItem(spam_list, index); > > > > Should I be doing this, and should PyArray_Check(spam) work either way? > > It works either way, but I am not sure that you are supposed to rely > on that. I prefer to use a cast to array objects only *after* > verifying that I have an array object, if only for clarity. That sounds like sound advice. I do feel like I'm doing something wrong if I get a warning form the compiler however. Thanks for your help. -Chris -- Christopher Barker, Ph.D. cb...@jp... --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ |
From: L. B. <bu...@ic...> - 2000-10-19 19:28:08
|
Fred - I'm forwarding your mail on to num...@li..., which I believe is the proper venue to deal with your comments. If the current Numerical Python manual directed you to su...@ic... for support-related questions, that also needs to be updated. Thank you - Lee Busby ======================================================================= From: Fred Yankowski <fr...@on...> To: su...@ic... Subject: comments on the Numerical Python manual Greetings, I'm learning NumPy by working through the "Numerical Python" manual (Oct 9, 2000 version). So far the manual has been a great introduction to the software and I really appreciate the work of the authors in providing it. I have found a couple of problems in the text, as follows: On page 4 in section 4, it seems that >>> vector1 = array((1,2,4,5)) should be the following instead: >>> vector1 = array((1,2,3,4,5)) On page 48 in section 8, the translation table used in the "brightening" function acts instead to darken the image. I found that scaling proportional to a square-root function worked well: table = (arange(256)**.5 * (255**.5)).astype('b') One side note: I'm surprised that the coordinate system used by the NumTut.view function has X axis values increasing to the left. Is that standard for some graphing systems? I've never worked with such a system before. Or am I misunderstanding what I'm seeing with view? I'm basing this on inspection of view(arange(100)**2)) and view(arange(100)**.5). -- Fred Yankowski fr...@On... tel: +1.630.879.1312 Principal Consultant www.OntoSys.com fax: +1.630.879.1370 OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA |
From: Konrad H. <hi...@cn...> - 2000-10-19 17:25:34
|
> fault and core dump. Frankly it's still mysterious, but at the moment > the problem seems to be that I have passed in a list of tuples, rather > than a list of PyArrayObjects. I don't expect this to work, but when I > put a : > > site = PyList_GetItem(spam_list, index); > > if (! PyArray_Check(spam)) result = 0; ^^^^ Not "site"? > I shouldn't get a crash!! (and it does crash at this line, as near as I > can tell) If spam is NULL, then the check will crash. If it is anything but a pointer to a Python object, there's a good chance that it might crash. PyArray_Check just tells you if a given Python object is of type "array". A look at the value of "spam" with a debugger should tell you what's going on. > which goes away if I typecast it: > > spam = (PyArrayObject *) PyList_GetItem(spam_list, index); > > Should I be doing this, and should PyArray_Check(spam) work either way? It works either way, but I am not sure that you are supposed to rely on that. I prefer to use a cast to array objects only *after* verifying that I have an array object, if only for clarity. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hi...@cn... Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- |
From: Chris B. <cb...@jp...> - 2000-10-19 00:07:00
|
I have been working on my first C extension, using NumPy arrays, and have run into a problem. I have a very mysterious set of bugs, that result in a segmentation fault and core dump. Frankly it's still mysterious, but at the moment the problem seems to be that I have passed in a list of tuples, rather than a list of PyArrayObjects. I don't expect this to work, but when I put a : site = PyList_GetItem(spam_list, index); if (! PyArray_Check(spam)) result = 0; I shouldn't get a crash!! (and it does crash at this line, as near as I can tell) Isn't that exactly what PyArray_Check is for?? Note: with: spam = PyList_GetItem(spam_list, index); I get a "warning: assignment from incompatible pointer type " which goes away if I typecast it: spam = (PyArrayObject *) PyList_GetItem(spam_list, index); Should I be doing this, and should PyArray_Check(spam) work either way? I'm using Redhat Linux 6.1, Python 1.5.2, and python-numpy-1.11-2.i386.rpm Also: is there a compelling reason to upgrade either Python of NumPy, from the NumPy perspective? How are NumPy and 2.0 working together? Thanks, -Chris -- Christopher Barker, Ph.D. cb...@jp... --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ |
From: Michael D. R. <mi...@vi...> - 2000-10-18 15:42:41
|
When attempting to install Numeric 17.0 with Python 1.5.2 and Distutils 1.0 on Red Hat 7.0, I get the following error after issuing the command 'python setup.py install' Traceback (innermost last): File "setup.py", line 15, in ? vs = map(string.atoi, v.groups()) AttributeError: 'None' object has no attribute 'groups' This error occurs regardless of whether or not I am root. I have also tried uninstalling the Red Hat Python packages and installing all from source, but I get the same error. Any help would be appreciated. Thanks. |
From: Konrad H. <hi...@cn...> - 2000-10-17 20:27:33
|
> Are people doing the kind of numeric programming with "complex > algorithms" using Python that Konrad refers to? More importantly, how > many people? At least one: me. > > Guido thinks that 2/3 returning 0 was a design mistake, > > but not that math.sqrt(-1) raising an exception is a mistake. Most Python > > users won't know what to do with a complex number, so it's "an error" to > > them. > > Guido's philosophy is clearly that Python defaults should be geared to > "Most Python users". I agree, and as I wrote in an earlier post, the It's difficult to say what "most Python users" want; it's not a static community. I'd say the basic principle is "no bad surprises". 2/3 == 0 is a bad surprise for anyone who knows elementary math but is not familiar with certain programming languages, especially since the program goes on silently with a "wrong" intermediate result. > Maybe we can have true 754 compliance in Py3k, and we can all be happy!! Py3k forever! Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hi...@cn... Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- |
From: Konrad H. <hi...@cn...> - 2000-10-17 20:27:25
|
> i have a simple array with floating values > >>> print a > array([ 0. , 0.2, 0.4, 0.6, 0.8]) There are probably many solutions, my preferred one is repeat(a[:, NewAxis], [3], 1) Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hi...@cn... Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- |
From: Janko H. <jh...@if...> - 2000-10-17 07:01:42
|
Your mail is in some windows format :-) reshape(resize(a,(1,15)),(5,3)) ,should do it, perhaps reshape makes a new copy, to circumvent this you can do it in two steps. b=resize(a,(1,15)) b.shape = (5,3) Another way is ones((5,3), a.typecode())*a[:,NewAxis] HTH, __Janko |
From: Pete S. <pe...@sh...> - 2000-10-17 03:57:28
|
i have a simple array with floating values >>> print a array([ 0. , 0.2, 0.4, 0.6, 0.8]) what i need to do is change each index into another dimension with 3 indices. hmm, kind of confusing, an example will explain better >>> b = array(zip(a,a,a)) >>> print b array([[ 0. , 0. , 0. ], [ 0.2, 0.2, 0.2], [ 0.4, 0.4, 0.4], [ 0.6, 0.6, 0.6], [ 0.8, 0.8, 0.8]]) ok, this does the job, but once i start using large arrays, the back-n-forth conversion between arrays and python lists is costing me quite a bit. is there a way i can reshape the array this way without the call to python's 'zip'? (no, 'map' doesn't count either) i've tried much fooling with NewAxis, resize, and friends. but either i haven't stumbled upon the correct combination or i'm not trying the correct tools. i'd like to keep this as quick as possible, so hopefully it can be done without anything too elaborate. thanks (doh, sorry for the previous distutils related post... hit the wrong mailing list) |
From: Pete S. <pe...@sh...> - 2000-10-17 03:24:11
|
i have a python application which has a small extension module it needs. (written in C for speed). does anyone have an example setup.py script that will build the extension, but leave the finished module in the current directory (and not intall to PYTHONHOME?) thanks |
From: Chris B. <cb...@jp...> - 2000-10-16 17:29:53
|
> >> I have not yet heard a decent response to the question of what to do > >> when a single value in a large array is bad, and causes an exception. > > I'd usually trace back and try to figure out how it got "bad" to begin with And from Konrad Hinsen >I'd like to have at least the option of raising an exception in that >case. Note that this is not what NumPy does today. Exactly. This was Huaiyu's point. The problem is that for your code to be usable for folks other than yourself, you'd have to have a lot of checks in there, and essentially revert to elementwise code, which would kill you. With the addition of the occasional "isnan" and something like Matlab's "any" ( "any(isnan(A))" returns true if any of the elements of A are NaNs) you could set up your code to raise an exception in the middle of computation. If, on the other hand the Code definiately raises an exception, than you are stuck with a lot of elementwise coding. > over/under-flows in IDL are reported but do > not stop execution. This is the best (only) possible scenario for an > interactive arrays and visualization environment. Exactly!!! ("the best (only) possible scenario" part) > IDL> print, 54/0 > 54 > % Program caused arithmetic error: Integer divide by 0 This, however, is wierd!! 54/0 == 54 ??? I'd much rather see a NaN or Inf here! > MATLAB is fine for simple interactive data processing, and its > behaviour is adapted to this task. I don't think anyone would use > MATLAB for developing complex algorithms, its programming language > isn't strong enough for that. Python is, so complex algorithms have to > be considered as well. And for that kind of application, continuing a > calculation with Infs and NaNs is a debugging nightmare. People do some pretty complex algorith develpment with MATLAB. I'm also no so sure about "continuing a calculation with Infs and NaNs is a debugging nightmare" I'm don't think it's any more of a nighmare than having your calculation on an entire array stop because of one Inf. It's just a different trade off. Sprinkle a few "isnan"'s in there and and you can get the behaviour you want, while not forcing it on all calculations. Of course, the best option is to have it switchable, but that may prove to be very difficult. Are people doing the kind of numeric programming with "complex algorithms" using Python that Konrad refers to? More importantly, how many people? > Guido thinks that 2/3 returning 0 was a design mistake, > but not that math.sqrt(-1) raising an exception is a mistake. Most Python > users won't know what to do with a complex number, so it's "an error" to > them. Guido's philosophy is clearly that Python defaults should be geared to "Most Python users". I agree, and as I wrote in an earlier post, the only users for whom the "exception raising only" option is best are the users Konrad refers to as writing "complex algorithms". I would argue that those users are few, and the group most able to deal with a less-that-optimum system. Maybe we can have true 754 compliance in Py3k, and we can all be happy!! -Chris -- Christopher Barker, Ph.D. cb...@jp... --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ |