From singer@itl.atr.co.jp Tue Dec 2 04:28:42 1997 From: singer@itl.atr.co.jp (Harald Singer) Date: Tue, 02 Dec 1997 13:28:42 +0900 Subject: [MATRIX-SIG] [Q] casting double to char in NumPy1.0b3 Message-ID: <9712020428.AA05139@atrh16.itl.atr.co.jp> Hi, I am trying to map an array of doubles to an array of char (values between 0 and 63) as entries into a colormap. In an older version of NumPy this worked without any problems but in the latest version I get: >>> from Numeric import * >>> x = array([1.,2.,3.]) >>> y = array(x,Int8) Traceback (innermost last): File "", line 1, in ? TypeError: Array can not be safely cast to required type >>> x = array([1,2,3]) >>> y = array(x,Float64) >>> y = array(x,Float32) Traceback (innermost last): File "", line 1, in ? TypeError: Array can not be safely cast to required type So what is an efficient way of doing this type of operation? Up to now, I have been doing something like ScaleOffset = min(yy.flat) ScaleFactor = 63.0/(max(yy.flat)-ScaleOffset) yyy = array(((yy-ScaleOffset)*ScaleFactor)[:,:fftorder/2],Int8) where yy is a 2-dimensional array of doubles (time, frequency bins) and yyy is the same thing but mapped to 8bit values between 0 and 63, which I use as entries into a colormap. BTW, the moment I get a solution, I will post my spectrogram display python script to the image-sig and matrix-sig mailing lists. /harry _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From jhauser@ifm.uni-kiel.de Tue Dec 2 14:43:47 1997 From: jhauser@ifm.uni-kiel.de (Janko Hauser) Date: Tue, 2 Dec 1997 15:43:47 +0100 (CET) Subject: [MATRIX-SIG] [Q] casting double to char in NumPy1.0b3 In-Reply-To: <9712020428.AA05139@atrh16.itl.atr.co.jp> References: <9712020428.AA05139@atrh16.itl.atr.co.jp> Message-ID: Hi, try this, it should work :0) >>> a=arange(10,typecode=Float32) >>> a array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],'f') >>> a.astype(Int8) array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9],'1') >>> Now, we are eager to see the new great NumPy application :-) __Janko, only speaking for himself. _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From busby@icf.llnl.gov Wed Dec 3 19:58:28 1997 From: busby@icf.llnl.gov (L. Busby) Date: Wed, 3 Dec 97 11:58:28 PST Subject: [MATRIX-SIG] Python-1.5b1 + LLNL extensions available Message-ID: <9712031958.AA18761@icf.llnl.gov.llnl.gov> I've done a quick, hopefully not too dirty, transfer of most of the LLNL Python extensions to Python-1.5b1. See ftp://ftp-icf.llnl.gov/pub/python/Python-1.5b1+LLNL.tgz. Apologies in advance for the size of this file. I stress that this is an initial release for those early adopters who need our extensions. Our future plans per NumPy stewardship, unbundling of extensions, etc. are unchanged. (They're still in the future. :-) All our extensions save for the C++ changes are in the above file. We're investigating if those can be added to Python-1.5 without changes to the core code. If you need that extension *now* in Python-1.5b1, see the file ftp://ftp-icf.llnl.gov/pub/python/diffs-1.4-to-llnl. This file is diff output for those files in Python-1.4 modified by LLNL. A motivated patcher could add our C++ extensions to 1.5b1 in fairly short order by inspecting those differences. Lee Busby _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From m.hadfield@niwa.cri.nz Sun Dec 7 22:55:47 1997 From: m.hadfield@niwa.cri.nz (Mark Hadfield) Date: Mon, 8 Dec 1997 11:55:47 +1300 Subject: [MATRIX-SIG] Subscription request Message-ID: <01bd0363$41a1a480$b638cb83@gust.niwa.cri.nz> This is a multi-part message in MIME format. ------=_NextPart_000_0011_01BD03D0.389AEC80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable subscribe ---- Mark Hadfield, m.hadfield@niwa.cri.nz, http://gust.niwa.cri.nz/ National Institute for Water and Atmospheric Research PO Box 14-901, Wellington, New Zealand ------=_NextPart_000_0011_01BD03D0.389AEC80 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
subscribe
----
Mark Hadfield,  m.hadfield@niwa.cri.nz,  = http://gust.niwa.cri.nz/
Nationa= l=20 Institute for Water and Atmospheric Research
PO Box 14-901, = Wellington, New=20 Zealand
 
 
------=_NextPart_000_0011_01BD03D0.389AEC80-- _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From V4N14Zu8X@le1ttrbox.com Sun Dec 7 04:11:50 1997 From: V4N14Zu8X@le1ttrbox.com (V4N14Zu8X@le1ttrbox.com) Date: 07 Dec 97 4:11:50 AM Subject: [MATRIX-SIG] We bulk Email for You Message-ID: <37nIU707a4xWEsTM> LET US DO YOUR BULK MAILINGS!!! ...$350 PER MILLION ADDRESSES SENT ...$250 PER 1/2 MILLION ADDRESSES SENT THE WAY OF THE FUTURE FOR SUCCESS IN YOUR BUSINESS! Our company will do bulk emailing for your product/service. DON'T BE LEFT IN THE DUST OF YOUR COMPETORS, ADVERTISE TODAY!!! Addresses are extracted daily by 6 of our computers, which run 24 hours a day 7 days a week, scanning the net for new addresses. Estimated 60-80,000 addresses extracted daily. They are fresh! Over 40 million addresses on file. More computers with cable modems are being added due to increasing responses. All ads can not be more than 2 pages (50 lines) and 68 characters wide. More than 50 lines, there will be an additional charge of $50 per page or 25 lines or less. No porn, no foul language or sex relative material will be sent. ->->->->->->->-> TARGETED MAILINGS <-<-<-<-<-<-<-<- ->-> $150 per 50,000 addresses extracted or less ->-> This price includes mailing of material ->-> Allow 3-7 days for extracting of addresses ->-> Mailings to US only (general addresses) $500 per 500,000 ->-> Many targeted list on file ->-> Purchased target list $150 per 50,000 or less If you have your own list, we will email your list for $200 per 500,000 or less. All list must be in text format and each address must be on individual lines. ***Mailings are done all at once, not broken down into multiple mailings.*** Addrsses are processed against our remove list of those individuals who have asked to be elimated from any of our mailings. All mailings are de-duped for duplicates. No .mil, .gov or .edu included. There are no lower prices on the net. Your mailing can be done in a matter of hours. Turn around time for mailings range from 3 to 5 days. This time varies according to the demand of mailings. For the fastest service, cheapest prices and cleanest mailings call our processing and new accounts office at 904-282-0945, Monday - Friday 9 - 5 EST (English only). If the line is busy or no repsonse, please keep trying, as bulk mailing is growing fast and we are busy responding to those who are interested in advertsing on the internet. We DO want to work with you to advertise your product/service. No collect calls. Our computers are working 24 hours a day to better serve YOU! To have your name removed, call our processing office. Any negative responses will be dealt with accordingly. _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From pa@tekla.fi Mon Dec 8 12:23:46 1997 From: pa@tekla.fi (Harri Pasanen) Date: Mon, 8 Dec 1997 14:23:46 +0200 Subject: [MATRIX-SIG] NumPy with Python 1.5 for Win32 Message-ID: <9712081223.AA26012@tahma.tekla.fi> How's the progress on getting NumPy to work on Win32? I took a quick stab at compiling it myself, but it failed. Is somebody working on it actively, with an expected date when it will be done? If not, I will do it, I just don't want to do duplicated work. Harri _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From caceres@myna.com Sun Dec 14 22:00:46 1997 From: caceres@myna.com (CACERES) Date: Sun, 14 Dec 1997 17:00:46 -0500 Subject: [MATRIX-SIG] openGL Message-ID: <3494570E.387D265C@myna.com> can i open gl in win95??? i have a mystique220 .4meg!! thanx! _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From da@skivs.ski.org Mon Dec 15 04:22:42 1997 From: da@skivs.ski.org (David Ascher) Date: Sun, 14 Dec 1997 20:22:42 -0800 (PST) Subject: [MATRIX-SIG] openGL In-Reply-To: <3494570E.387D265C@myna.com> Message-ID: On Sun, 14 Dec 1997, CACERES wrote: > can i open gl in win95??? > > i have a mystique220 .4meg!! Yes. See http://starship.skyport.net/~da/PyOpenGL.html. Let me know if you have problems. I'll make a version for Python 1.5 once 1.5final is released. --da _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Mon Dec 15 17:38:10 1997 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 15 Dec 1997 18:38:10 +0100 Subject: [MATRIX-SIG] NumPy and 1.5, and NumPy and MacPython Message-ID: Folks, two remarks, - as you are probably already aware the NumPy test suite fails inder 1.5 because of the new exception handling. - The download page page for NumPy mentions the windows- and unix-distributions, but not the mac distribution. As of 1.5 NumPy is included in the standard MacPython distribution as an optional install option, and NumPy for MacPython 1.4 is available through http://www.cwi.nl/~jack/macpython. Is a new NumPy release planned for the near future (I'm using 1.0b3 at the moment, which still seems to be the latest release)? Please cc me on any replies since I'm not a member of the matrix-sig, -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From acannon@geog.ubc.ca Tue Dec 16 06:47:44 1997 From: acannon@geog.ubc.ca (Alex Cannon) Date: Mon, 15 Dec 1997 22:47:44 -0800 (PST) Subject: [MATRIX-SIG] NumPy and 1.5, and NumPy and MacPython In-Reply-To: Message-ID: On Mon, 15 Dec 1997, Jack Jansen wrote: > Folks, two remarks, > - as you are probably already aware the NumPy test suite fails inder > 1.5 because of the new exception handling. > - The download page page for NumPy mentions the windows- and > unix-distributions, but not the mac distribution. As of 1.5 NumPy is > included in the standard MacPython distribution as an optional > install option, and NumPy for MacPython 1.4 is available through > http://www.cwi.nl/~jack/macpython. Has anyone successfully gotten 1.4 (CFM68K) with NumPy up and running? The core Numeric functions seem to work fine but certain functions in other modules cause the interpreter to die (RandomArray.random, FFT.fft etc); others seem to work fine though (RandomArray.randint for instance). Any ideas? A quick search for the 1.5b2 Mac version came up empty; I'm assuming the betas aren't available for the Mac? Alex _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Tue Dec 16 10:31:13 1997 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Tue, 16 Dec 1997 11:31:13 +0100 Subject: [MATRIX-SIG] NumPy and 1.5, and NumPy and MacPython In-Reply-To: Message by Alex Cannon , Mon, 15 Dec 1997 22:47:44 -0800 (PST) , Message-ID: > A quick search for the 1.5b2 Mac version came up empty; I'm assuming the > betas aren't available for the Mac? Expect it shortly, I'm working on it. It'll contain NumPy, but the cfm68k version will again be only lightly tested, if at all, so feedback is very welcome. I'll announce it to macpython-sig and comp.lang.python/python-list. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From busby@icf.llnl.gov Tue Dec 16 19:31:55 1997 From: busby@icf.llnl.gov (L. Busby) Date: Tue, 16 Dec 97 11:31:55 PST Subject: [MATRIX-SIG] NumPy and 1.5, and NumPy and MacPython Message-ID: <9712161931.AA11313@icf.llnl.gov.llnl.gov> [Jack Jansen wrote ] >Folks, two remarks, >- as you are probably already aware the NumPy test suite fails inder > 1.5 because of the new exception handling. >- The download page page for NumPy mentions the windows- and > unix-distributions, but not the mac distribution. As of 1.5 NumPy is > included in the standard MacPython distribution as an optional > install option, and NumPy for MacPython 1.4 is available through > http://www.cwi.nl/~jack/macpython. > >Is a new NumPy release planned for the near future (I'm using 1.0b3 at >the moment, which still seems to be the latest release)? [ "Paul F. Dubois" replied ] >We (LLNL) will release a 1.5-compatible NumPy when we have one and can >compile it on Windows. We'll send it to you first so you can see if it works >on the Mac. Let's (matrix-sig) talk a little more about the release process for NumPy. The most direct answer I can give now to Jack's question is that I want to put out a release of NumPy as soon as we practically can after Python-1.5 is officially released. Here's some questions that occur to me: 1) How do we ``release'' NumPy? a) Which site has the ``master'' copy? b) Which are the mirror sites? c) Who takes care of mirroring? d) How do we accomodate our 3 primary architectures in the release? + UNIX + WINDOWS + MACINTOSH 2) What goes into NumPy-1.0? a) Compatible with Python-1.5 (and 1.4, ...). b) What else? I would appreciate all comments to help me structure the release to be simple and accessible. I'll use your comments and requests to develop a release procedure, then post it for your review. Thanks - Lee Busby _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From pa@tekla.fi Wed Dec 17 07:49:01 1997 From: pa@tekla.fi (Harri Pasanen) Date: Wed, 17 Dec 1997 09:49:01 +0200 Subject: [MATRIX-SIG] NumPy and 1.5, and NumPy and MacPython In-Reply-To: <9712161931.AA11313@icf.llnl.gov.llnl.gov> References: <9712161931.AA11313@icf.llnl.gov.llnl.gov> Message-ID: <9712170749.AA23734@tahma.tekla.fi> L. Busby writes: > [Jack Jansen wrote ] > >Folks, two remarks, > >- as you are probably already aware the NumPy test suite fails inder > > 1.5 because of the new exception handling. Should be noted, that it is the test_items.py that needs fixing, not NumPy itself. > >- The download page page for NumPy mentions the windows- and > > unix-distributions, but not the mac distribution. As of 1.5 NumPy is > > included in the standard MacPython distribution as an optional > > install option, and NumPy for MacPython 1.4 is available through > > http://www.cwi.nl/~jack/macpython. > > > >Is a new NumPy release planned for the near future (I'm using 1.0b3 at > >the moment, which still seems to be the latest release)? > > [ "Paul F. Dubois" replied ] > >We (LLNL) will release a 1.5-compatible NumPy when we have one and can > >compile it on Windows. We'll send it to you first so you can see if it works > >on the Mac. > > Let's (matrix-sig) talk a little more about the release process for > NumPy. The most direct answer I can give now to Jack's question is > that I want to put out a release of NumPy as soon as we practically can > after Python-1.5 is officially released. Here's some questions that > occur to me: > > 1) How do we ``release'' NumPy? > a) Which site has the ``master'' copy? I think www.python.org is the logical place for the master copy, it gets automatically mirrored. But about any place is fine, provided it is prominently displayed and has links from the web pages at www.python.org. > b) Which are the mirror sites? > c) Who takes care of mirroring? > d) How do we accomodate our 3 primary architectures in the release? > + UNIX > + WINDOWS > + MACINTOSH > > 2) What goes into NumPy-1.0? > a) Compatible with Python-1.5 (and 1.4, ...). > b) What else? > > I would appreciate all comments to help me structure the release to be > simple and accessible. I'll use your comments and requests to develop > a release procedure, then post it for your review. > > Thanks - Lee Busby > I have a compiled NumPy on NT for Python 1.5. It is based on Konrad Hinsen's NumPy release, which is a bit modified presumably for easier installation on Unix systems. As it is, Konrad's release modifies the C API slightly, so that old NumPy.dll is no longer compatible, and is in fact replaced by _numpy.pyd, which is an internally imported python extension module. I haven't done much with it so far, but I've verified that the test_all.py script passes without errors (meaning I have fixed test_items.py to comply with Python 1.5). It should be possible to do test_*.py scripts that run properly under both Python 1.4 and 1.5, but I did not bother. Note that the sources could use some cleanup, they compile with tons of warnings, but without errors. Also I'm not sure how widely people use the C API directly, and if Konrad's changes are acceptable to everyone. I've made some changes to sources (mainly .def files), but the distribution should still compile without added problems on Unix. I've packaged the binaries to an installer so that it drops in place on top of Python 1.5 binary distribution, much as the old numpy did. If anyone would like to try this, drop me a line. Also, I can provide the source + project workspace if there is interest. I don't know what version to stamp on those, and I'm not looking to be a maintainer, so I'll gladly donate these to the 'central authority', which shall be LLNL if I've understood correctly? Thanks, Harri _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From hinsen@ibs.ibs.fr Wed Dec 17 10:47:25 1997 From: hinsen@ibs.ibs.fr (Konrad Hinsen) Date: Wed, 17 Dec 1997 11:47:25 +0100 Subject: [MATRIX-SIG] NumPy and 1.5, and NumPy and MacPython In-Reply-To: <9712170749.AA23734@tahma.tekla.fi> (message from Harri Pasanen on Wed, 17 Dec 1997 09:49:01 +0200) Message-ID: <199712171047.LAA29556@lmspc1.ibs.fr> > > 1) How do we ``release'' NumPy? > > a) Which site has the ``master'' copy? > > I think www.python.org is the logical place for the master copy, it gets > automatically mirrored. I agree. Of course LLNL's site would be another obvious choice, but at least for me it's practically inaccessible (2 bytes/second!). > > d) How do we accomodate our 3 primary architectures in the release? > > + UNIX > > + WINDOWS > > + MACINTOSH I'd prefer a general source distribution for all platforms, plus binaries for Windows/Intel and the Mac. That should cover most needs. > > 2) What goes into NumPy-1.0? > > a) Compatible with Python-1.5 (and 1.4, ...). > > b) What else? In the long run, I'd like to see a package structure for NumPy. Maybe that's not doable sufficiently fast, but at least a new release should be structured to take into account an eventual package version. > I have a compiled NumPy on NT for Python 1.5. It is based on Konrad > Hinsen's NumPy release, which is a bit modified presumably for easier > installation on Unix systems. As it is, Konrad's release modifies the > C API slightly, so that old NumPy.dll is no longer compatible, and is The C API is not modified at the source code level, but to the linker it looks very different. Nevertheless, modules compiled with the "traditional" arrayobject.h should continue to work with a DLL made from my modified version, but inversely it wouldn't work. > Note that the sources could use some cleanup, they compile with tons > of warnings, but without errors. Also I'm not sure how widely people > use the C API directly, and if Konrad's changes are acceptable to > everyone. I've made some changes to sources (mainly .def files), but > the distribution should still compile without added problems on Unix. I don't know whether my API modification is necessary or advantageous under Windows. If the old one is better, a simple system-dependent modification in arrayobject.h would be sufficient. For Unix, the API modifications are essential to permit uniform installation of other C extension modules on all machines. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr Laboratoire de Dynamique Moleculaire | Tel.: +33-4.76.88.99.28 Institut de Biologie Structurale | Fax: +33-4.76.88.54.94 41, av. des Martyrs | Deutsch/Esperanto/English/ 38027 Grenoble Cedex 1, France | Nederlands/Francais ------------------------------------------------------------------------------- _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Wed Dec 17 13:02:22 1997 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 17 Dec 1997 14:02:22 +0100 Subject: [MATRIX-SIG] NumPy and 1.5, and NumPy and MacPython In-Reply-To: Message by busby@icf.llnl.gov (L. Busby) , Tue, 16 Dec 97 11:31:55 PST , <9712161931.AA11313@icf.llnl.gov.llnl.gov> Message-ID: Recently, busby@icf.llnl.gov (L. Busby) said: > > Let's (matrix-sig) talk a little more about the release process for > NumPy. The most direct answer I can give now to Jack's question is > that I want to put out a release of NumPy as soon as we practically can > after Python-1.5 is officially released. Here's some questions that > occur to me: > > 1) How do we ``release'' NumPy? > a) Which site has the ``master'' copy? > b) Which are the mirror sites? > c) Who takes care of mirroring? > d) How do we accomodate our 3 primary architectures in the release? > + UNIX > + WINDOWS > + MACINTOSH I've included NumPy as an optional part in the core Python distribution after a lot of demand for it in the python-mac SIG: NumPy and PIL are used so often that people felt it would be handy if they were included. Also, it would point newcomers immedeately at two large and hady extension packages. There is however the question of non-synchronicity between releases of MacPython and NumPy. First, I would like to release MacPython 1.5 as soon as possible after Guido releases Unix-Python 1.5, so I don't want to delay too long waiting for NumPy. Second, if new releases of NumPy come available between major releases of MacPython there's a 99% chance that mac-users will never notice this (and possibly continue struggling against bugs that have long been solved in the new release). I am unsure what the right answer is. I am tempted to say that the advantage of immedeately giving people installing Python a number of fun/useful packages is the more important one, but I'd like to hear what other people think. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From npat@ariadne.di.uoa.gr Wed Dec 17 21:38:24 1997 From: npat@ariadne.di.uoa.gr (Nick Patavalis) Date: Wed, 17 Dec 1997 23:38:24 +0200 (EET) Subject: [MATRIX-SIG] Float32 and type conversions. Message-ID: <199712172138.XAA29306@ariadne.di.uoa.gr> Hi, I'm trying to do something like this and it fails: a = ones([5,5], Float32) a[2:4] = a[2:4] * 0.5 Python prints the error message: TypeError: Array can not be safely cast to required type Of course I understaind what goes wrong! Is there any way around this problem? Is there any way to make python or NumPy tread 0.5 (or any other number for that matter) as a float and not as a double? I'm asking this because it is really important for my application to use 'float' and not 'double' arrays. (It interfaces to a lot of C-code, the arrays are _huge_, and so on...) Thanks in advance. Nick Patavalis (npat@ariadne.di.uoa.gr) University of Athens Athens, Dec 17 1997 P.S. Please also send your answers to my personal address, since I not a member of the list (yet!) I'm using NumPy v1.0b3 and Python v1.4 _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From hinsen@ibs.ibs.fr Thu Dec 18 10:44:28 1997 From: hinsen@ibs.ibs.fr (Konrad Hinsen) Date: Thu, 18 Dec 1997 11:44:28 +0100 Subject: [MATRIX-SIG] Float32 and type conversions. In-Reply-To: <199712172138.XAA29306@ariadne.di.uoa.gr> (message from Nick Patavalis on Wed, 17 Dec 1997 23:38:24 +0200 (EET)) Message-ID: <199712181044.LAA02530@lmspc1.ibs.fr> > I'm trying to do something like this and it fails: > > a = ones([5,5], Float32) > a[2:4] = a[2:4] * 0.5 > > Python prints the error message: > > TypeError: Array can not be safely cast to required type > > Of course I understaind what goes wrong! Is there any way > around this problem? Is there any way to make python or NumPy > tread 0.5 (or any other number for that matter) as a float and > not as a double? I'm asking this because it is really important Plain numbers don't exist as float in Python. You have two choices: 1) Put the factor 0.5 into an array of shape (1,) of type float: a = ones([5,5], Float32) half = array([0.5], Float32) a[2:4] = a[2:4] * half 2) Cast the result of the multiplication back to float: a = ones([5,5], Float32) a[2:4] = (a[2:4] * 0.5).astype(Float32) The second method produces a double intermediary, which may be a problem if your arrays are very big. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr Laboratoire de Dynamique Moleculaire | Tel.: +33-4.76.88.99.28 Institut de Biologie Structurale | Fax: +33-4.76.88.54.94 41, av. des Martyrs | Deutsch/Esperanto/English/ 38027 Grenoble Cedex 1, France | Nederlands/Francais ------------------------------------------------------------------------------- _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From jhauser@ifm.uni-kiel.de Thu Dec 18 13:31:03 1997 From: jhauser@ifm.uni-kiel.de (Janko Hauser) Date: Thu, 18 Dec 1997 14:31:03 +0100 (CET) Subject: [MATRIX-SIG] Final NumPy 1.0 Message-ID: Hello, I welcome the decision to build to a final NumPy ver. 1.0. I would like to raise some questions regarding this. I think this package will be something for a pythoneer, who want's to build some numbercrunching programs. We are currently not on the way to a real integrated development enviroment for scientific computation. But I also think, something like this is very doable. But there is the question, if this is wanted. This is especially important for the documentation of the hole package (not the different functions). So, should somebody without knowlege of python be able to grab a tar ball and install a working NumPy, or do we focus currently only a pythoneer who wants to install an extension? Do we help people, if we include more code, which are wrappers over the more general functions (sum, cumsum vs. add.reduce)? For the further extensibility we need e repository with more code. It's important to have the code at one place and don't have links to various locations, so a homogeneous representation to the public is possible. I think there should be included some code to read and write some ascii-data. Everybody has some data lying around, with which he/she wants to work. And Timothy Hochberg has perhaps the currently better implementation of a UserArray class at his starship side. And at the end, I thank you for your efforts to do this work. OK, that's it :-) __Janko _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From owner-matrix-sig@python.org Thu Dec 18 17:13:56 1997 From: owner-matrix-sig@python.org (owner-matrix-sig@python.org) Date: Thu, 18 Dec 1997 12:13:56 -0500 (EST) Subject: No subject Message-ID: <199712181713.MAA25040@python.org> From jhauser@ifm.uni-kiel.de Thu Dec 18 18:22:20 1997 From: jhauser@ifm.uni-kiel.de (Janko Hauser) Date: Thu, 18 Dec 1997 19:22:20 +0100 (CET) Subject: [MATRIX-SIG] Final NumPy 1.0 In-Reply-To: References: Message-ID: I understand that sys.input is something to facilitate the reading from standard in to build command line tools and scripts which get used in pipes. I use currently this code, which unfortunatly needs sscanfmodule. But it's the fastes way to read ``trusted'' data (No testing for to big, equally formated) def read_table(fname,header=0): """read_table(filename,header=number_of_header_lines) Reads from filename number_of_fields numbers per line to end of file. If number of num_fields per line doesn't match, skip line""" from sscanf import sscanf import string try: fp=open(fname,'r') except: print "Can't open file or wrong filename in function read_table" return scanline='%f' lines = fp.readlines() n=len(string.split(lines[header])) new_table=ones((len(lines)-header,n),typecode = Float) while n-1: n=n-1 scanline=scanline+' %f' for item in xrange(len(lines)-header): a=array(sscanf(lines[item],scanline)) new_table[item,:] = a return(new_table) Has someone something faster, or really sophisticated? (sscanf is much faster with the conversion of string to float, I tested this only with 1.4 not 1.5, where the string handling should be faster) __Janko Mike Miller writes: > >>>>> "janko" == Janko Hauser writes: > > I think there should be included some code to read and > > write some ascii-data. Everybody has some data lying > > around, with which he/she wants to work. > > There was a discussion about this on comp.lang.python a few weeks > ago. The subject was "Proposal: sys.input()". Some code was > posted there... > > Mike _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From pa@tekla.fi Thu Dec 18 22:58:59 1997 From: pa@tekla.fi (Harri Pasanen) Date: 19 Dec 1997 00:58:59 +0200 Subject: [MATRIX-SIG] ANNOUNCE: unofficial NumPy binaries for Python 1.5 on NT Message-ID: The following message is a courtesy copy of an article that has been posted to comp.lang.python as well. For the impatient http://starship.skyport.net/crew/harri_pasanen/NumPy10-15.exe Drops on place on top of Python 1.5b2, (probably works on 1.5b1 as 1.5 final as well). Regards, Harri.Pasanen@iki.fi _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From pa@tekla.fi Thu Dec 18 22:58:59 1997 From: pa@tekla.fi (Harri Pasanen) Date: 19 Dec 1997 00:58:59 +0200 Subject: [MATRIX-SIG] ANNOUNCE: unofficial NumPy binaries for Python 1.5 on NT Message-ID: The following message is a courtesy copy of an article that has been posted to comp.lang.python as well. For the impatient http://starship.skyport.net/crew/harri_pasanen/NumPy10-15.exe Drops on place on top of Python 1.5b2, (probably works on 1.5b1 as 1.5 final as well). Regards, Harri.Pasanen@iki.fi _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From pa@tekla.fi Fri Dec 19 08:44:57 1997 From: pa@tekla.fi (Harri Pasanen) Date: 19 Dec 1997 10:44:57 +0200 Subject: [MATRIX-SIG] Re: ANNOUNCE: unofficial NumPy binaries for Python 1.5 on NT In-Reply-To: Harri Pasanen's message of 19 Dec 1997 00:58:59 +0200 References: Message-ID: The following message is a courtesy copy of an article that has been posted to comp.lang.python as well. Harri Pasanen writes: > For the impatient > > http://starship.skyport.net/crew/harri_pasanen/NumPy10-15.exe > > Drops on place on top of Python 1.5b2, (probably works on 1.5b1 as 1.5 > final as well). > Oops,... Installer puts the wrong path at HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\1.5.0\PythonPath\NumPy You have three choices: 1) Use regedit to fix it to point to NumPy under your Python tree. 2) Uninstall it from control-panel -> Add/Remove programs. 3) Uninstall and wait for a fixed version, ETA 24 hours, probably sooner. Sorry for the confusion, thanks for the prompt feedback. Harri _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From jhauser@ifm.uni-kiel.de Sun Dec 21 16:28:08 1997 From: jhauser@ifm.uni-kiel.de (Janko Hauser) Date: Sun, 21 Dec 1997 17:28:08 +0100 (CET) Subject: [MATRIX-SIG] Get array elements in c? Message-ID: I need to copy an array to this struct: typedef float Matrix[4][4]; For this I try to write a function: #define A_DATA(a) (((PyArrayObject *)a)->data) #define GET_ARR(ap,op,type,dim) \ Py_Try(ap=(PyArrayObject *)PyArray_ContiguousFromObject(op,type,dim,dim)) static void cp_to_Matrix(PyObject *arg, Matrix mat) { PyArrayObject *arr; int i, j; double *data; GET_ARR(arr, arg, PyArray_FLOAT, 2); data = (double *)A_DATA(arr); for (i=0; i<4; i++){ for (j=0; j<4; j++){ mat[i][j] = data[i][j]; /* this is wrong. right? */ } } return; } Must I address data here linearly? Or is there another way to get the NumPyArray into the Matrix? Something similar for typedef float Vector[4]; does function, with some warnings. Sorry for my C ignorance (that's why I use Python), __Janko _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From bsd@scripps.edu Tue Dec 23 20:01:44 1997 From: bsd@scripps.edu (Bruce Duncan) Date: Tue, 23 Dec 1997 12:01:44 -0800 (PST) Subject: [MATRIX-SIG] ** problems with Float32 Message-ID: <199712232001.MAA03491@sheba.scripps.edu> Greetings, I'm not sure if I'm using the most up to date version of Numeric but... num_array ** 2 doesn't work if num_array is Float32 (Float64 works fine). Has this been fixed in a more recent release? -bsd- _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From robert@directed.edu Wed Dec 24 17:47:17 1997 From: robert@directed.edu (robert@directed.edu) Date: Wed, 24 Dec 1997 12:47:17 -0500 Subject: [MATRIX-SIG] P R E S S R E L E A S E Message-ID: DirectED - The New Way to Learn! DirectED is a distance education school that will revolutionize the way people will think about education in the future. Students can now study in the comfort of their own home to earn their diploma. What is unique about DirectED is that it is completely Internet based. Students attend classes in a virtual campus that has an employment center, library, cafeteria, computer lab, book store, faculty lounge, business office, student residence, and virtual classrooms. You can visit the campus at http://www.directed.edu. All DirectED Students will receive: Acer Multimedia Computer Lexmark Color Printer Windows 95 Office 97 Professional Books Prepaid Internet Connection for 1 Year Access to DirectED Web Site Toll Free Support for 1 Year DirectED programs are certified and registered with Department of Training and Advanced Education. DirectED is a member of the Better Business Bureau. DirectED partners include the Toronto Dominion Bank, MTS Sympatico, Acer, Course Technology, Microsoft, and Computer Associates. To find out more about THE NEW WAY TO LEARN please visit DirectED's business office at http://www.directed.edu/bus.html _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From hinsen@ibs.ibs.fr Fri Dec 26 08:49:12 1997 From: hinsen@ibs.ibs.fr (Konrad Hinsen) Date: Fri, 26 Dec 1997 09:49:12 +0100 Subject: [MATRIX-SIG] Get array elements in c? In-Reply-To: (message from Janko Hauser on Sun, 21 Dec 1997 17:28:08 +0100 (CET)) Message-ID: <199712260849.JAA09449@lmspc1.ibs.fr> > I need to copy an array to this struct: > > typedef float Matrix[4][4]; The data layout of this type is just 16 floats, as for a NumPy array of Float32. As always, there are several ways to do what you want. Perhaps the clearest is to cast array->data to Matrix and copy as if you had two Matrix variables. Or just copy 16 floats linearly. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr Laboratoire de Dynamique Moleculaire | Tel.: +33-4.76.88.99.28 Institut de Biologie Structurale | Fax: +33-4.76.88.54.94 41, av. des Martyrs | Deutsch/Esperanto/English/ 38027 Grenoble Cedex 1, France | Nederlands/Francais ------------------------------------------------------------------------------- _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________ From hinsen@ibs.ibs.fr Fri Dec 26 08:51:34 1997 From: hinsen@ibs.ibs.fr (Konrad Hinsen) Date: Fri, 26 Dec 1997 09:51:34 +0100 Subject: [MATRIX-SIG] ** problems with Float32 In-Reply-To: <199712232001.MAA03491@sheba.scripps.edu> (message from Bruce Duncan on Tue, 23 Dec 1997 12:01:44 -0800 (PST)) Message-ID: <199712260851.JAA09460@lmspc1.ibs.fr> > I'm not sure if I'm using the most up to date version of Numeric but... > num_array ** 2 doesn't work if num_array is Float32 (Float64 works fine). > Has this been fixed in a more recent release? It works for me, and I can't remember that it didn't work. However, it is always worth checking that you have the most recent version, since there were important changes. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr Laboratoire de Dynamique Moleculaire | Tel.: +33-4.76.88.99.28 Institut de Biologie Structurale | Fax: +33-4.76.88.54.94 41, av. des Martyrs | Deutsch/Esperanto/English/ 38027 Grenoble Cedex 1, France | Nederlands/Francais ------------------------------------------------------------------------------- _______________ MATRIX-SIG - SIG on Matrix Math for Python send messages to: matrix-sig@python.org administrivia to: matrix-sig-request@python.org _______________