Re: [Numpy-discussion] numpy.random.shuffle

2006-11-22 Thread Christopher Barker
like: temp = x[i].copy() x[i], x[j] = x[j], temp work? In any case, it should raise an error if ndim > 1, rather than giving a wrong result. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Poin

Re: [Numpy-discussion] numpy.random.shuffle

2006-11-22 Thread Christopher Barker
py semantics. It truth, this means: 1) numpy arrays 2) standard python mutable sequences But it does satisfy the duck typing approach. Maybe we could specifically check for copy vs. view semantics, but that seems like overkill. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Res

Re: [Numpy-discussion] array with object

2006-11-29 Thread Christopher Barker
x27;TEM', '>f4')]) >>> a[0]['Dates'] = datetime.datetime(2006,11,29) >>> a[0]['HUM'] = 2 >>> a[0]['TEM'] = 3 >>> a array([(datetime.datetime(2006, 11, 29, 0, 0), 2.0, 3.0), (None, 0.0, 0.0)], dtype=[('Dates'

Re: [Numpy-discussion] array with object

2006-11-29 Thread Christopher Barker
Torgil Svensson wrote: > It works if you replace the strings '2','3','5','6' with numbers instead. duh! I can't believe I didn't see that! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R

Re: [Numpy-discussion] strange behavior with a numpy array as member of a list

2006-11-30 Thread Christopher Barker
array) Personally, I liked it that way -- if you can't do a rich comparison, an error is better than a meaningless result. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206)

Re: [Numpy-discussion] seting the dtype for where...

2006-12-01 Thread Christopher Barker
Robert Kern wrote: > Well, it's consistent with all of the other coercion rules: > > > In [6]: (array(5.0, dtype=float32) + 0).dtype > Out[6]: dtype('float64') duh! of course. If I use a float32 scalar for BOTH the operands, then I get a float32 array out. Tha

Re: [Numpy-discussion] problems installing NumPy on OSX

2006-12-04 Thread Christopher Barker
known error, that has to do with 64 bit G5 issues , and IIRC, it's a test error, not a real bug. Good luck! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seatt

[Numpy-discussion] Forward from PIL list...

2006-12-04 Thread Christopher Barker
or("cannot handle data-type") > typestr = typestr[:2] > if typestr == 'i4': > ... > > The error is that 'typestr = typestr[:2]' should instead be 'typestr > = typestr[1:]' that code was contributed by the numpy develo

Re: [Numpy-discussion] a==b for numpy arrays

2006-12-11 Thread Christopher Barker
on: b = where(a > 0, 10, 0) -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] __

Re: [Numpy-discussion] fromfile and tofile access with a tempfile.TemporaryFile()

2006-12-12 Thread Christopher Barker
> Numpy-discussion mailing list > Numpy-discussion@scipy.org > http://projects.scipy.org/mailman/listinfo/numpy-discussion -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voic

Re: [Numpy-discussion] empty data matrix (are they really empty ?)

2006-12-14 Thread Christopher Barker
the row you've just calculated ir=ir+nstep+1 print lev2 I may have got some of the indexing wrong, but I hope you get the idea. By the way, if you sent a complete, runnable sample, we can test out suggestions, and you'll get better answers. -Chris -- Christopher Barker, Ph.D

Re: [Numpy-discussion] Newbie Question, Probability

2006-12-21 Thread Christopher Barker
nd Apple supplies LAPACK/BLAS libs with the system. As for distributing it, the archive at: pythonmac.org/packages takes submissions from anyone -- just send a note to the pythonmac list -- that list is a great help in figuring out how to build stuff too. -Chris -- Christopher Barker,

Re: [Numpy-discussion] Newbie Question, Probability

2006-12-22 Thread Christopher Barker
default with generic LAPACK (kind of like numpy), and put installers built that way up on the web, along with instructions for those that want to re-build and optimize? For that matter, is it possible (let's say on Windows) to deliver SciPy with a set of multiple dlls for LAPACK/BLAS, an

Re: [Numpy-discussion] Newbie Question, Probability

2006-12-27 Thread Christopher Barker
abulous, they do tend to stay behind the bleeding edge a fair bit -- it would be nice to have the core packages with the latest and greatest on Windows and Linux too, all as one easy installer. (or rpm or .deb or whatever for Linux) -Chris -- Christopher Barker, Ph.D. Oceanographer Em

Re: [Numpy-discussion] Newbie Question, Probability

2006-12-27 Thread Christopher Barker
I'm not sure what else was is in libf2c. In fact, I've often wondered why scipy doesn't use f2c. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seat

Re: [Numpy-discussion] Newbie Question, Probability

2006-12-29 Thread Christopher Barker
I just discovered the: Scipy Superpack for OS X http://trichech.us/?page_id=4 Maybe this will help folks looking for an OS_X Scipy build. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Wa

Re: [Numpy-discussion] numpy install on mac os x 10.4

2006-12-30 Thread Christopher Barker
ely) 5) Put all that up on pythonmac. I'd like to do it, but I'm not the least bit sure when I'll be able to-- someone please beat me to it! -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (2

Re: [Numpy-discussion] numpy install on mac os x 10.4

2006-12-31 Thread Christopher Barker
ct me if I'm got a wrong (or outdated) impression. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception __

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-04 Thread Christopher Barker
y that I can query to see if it fits what I'm expecting. Have I got that right? If so, this would be great. By the way,, how compatible is this with the existing buffer protocol? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-04 Thread Christopher Barker
now, I suppose -- very nice. Another question -- is this new approach in response to feedback from Guido and or other Python devs? This sure seems like a good way to go -- though it seems from the last discussion I followed at python-dev, most of the devs just didn't get how useful this wo

Re: [Numpy-discussion] How do I test if an array contains NaN ?

2007-01-04 Thread Christopher Barker
ys do: for i in dir(N): if "nan" in i: print i >>> import numpy as N >>> for i in dir(N): ... if "nan" in i: print i ... isnan nan nan_to_num nanargmax nanargmin nanmax nanmin nansum -Chris -- Christopher Barker, Ph.D. Oceanographer Emergenc

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-04 Thread Christopher Barker
f code to use the array interface in PIL, but he seemed skeptical of the idea. Perhaps lobbying (or even just surveying) some of these folks would be useful. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Christopher Barker
Travis Oliphant wrote: > Christopher Barker wrote: >> wxPython -- Robin Dunn >> PIL -- Fredrik Lundh >> PyOpenGL -- Who? >> PyObjC -- would it be useful there? (Ronald Oussoren) >> MatplotLib (but maybe it's already married to numpy...) >> PyG

Re: [Numpy-discussion] Installing numpy from rpm

2007-01-07 Thread Christopher Barker
y (on without .src. in the name)for your system. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception __

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-08 Thread Christopher Barker
> data back and forth. That's the biggest issue, but I think a lot of us use a lot of small arrays as well -- and while I don't know if it's a performance hit worth worrying about, it's always bugged me that is is faster to convert to a python list, then pass i

Re: [Numpy-discussion] Where's append in NumPy?? Can't Installing NumPy.

2007-01-09 Thread Christopher Barker
o You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > ___ > Numpy-discussion mailing list > Numpy-discussion@scipy.org > http://projects.scipy.org/mailman/listinfo/numpy-discussion -

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-10 Thread Christopher Barker
ates themselves. -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] #include "Python.h" #include "Nu

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread Christopher Barker
way to go. If anyone needs other cases optimized, that can be added later. I'd still like to know if anyone knows how to efficiently loop through all the elements of a non-contiguous array in C. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-12 Thread Christopher Barker
etter than never." Tells me that we should just focus on the array data structure for the PEP now. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-12 Thread Christopher Barker
fset. Ugly and slow. > Now, it is exposed in the concept of an array iterator. Anybody > can take advantage of it as it there is a C-API call to get an array > iterator from the array Is this iterator as efficient as incrementing the index for contiguous arrays? i.e. is there any po

Re: [Numpy-discussion] recompiling needed for binary module after numpy 1.0

2007-01-17 Thread Christopher Barker
up on pythonmac.org/packages. I'm pretty sure they are linked against wxPython2.6.3.3 (which is also there). Maybe you should try those, and if you're still having problems, move this over to the MPL or pythonmac lists -- it's not a numpy issue. -Chris -- Christophe

Re: [Numpy-discussion] inplace operations

2007-01-26 Thread Christopher Barker
ncs (like log() ) take an optional parameter that is the array you want the output to go to. If you pass in the same array, the operation happens in place. By the way, it looks like your first column is an index number. As The array structure keeps track of that for you, you might just as wel

Re: [Numpy-discussion] Cutting 1.0.2 release

2007-01-30 Thread Christopher Barker
Gary Ruben wrote: > One question, which may be an issue: Should ones, zeros and empty be > generating arrays of floats by default now? >>> import numpy as N >>> N.ones((3,)).dtype dtype('float64') >>> N.zeros((3,)).dtype dtype('float64')

Re: [Numpy-discussion] Requests for NumPy Ports?

2007-01-31 Thread Christopher Barker
Travis Oliphant wrote: > I'm trying to help out the conversion to NumPy by offering patches to > various third-party packages that have used Numeric in the past. Travis, you are amazing! Thanks for doing this. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Respon

Re: [Numpy-discussion] Patch for RPy to use NumPy uploaded to www.scipy.org

2007-01-31 Thread Christopher Barker
ures in numpy: record arrays, in=place byteswap, fromfile. -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] ___

Re: [Numpy-discussion] Conversion of Numeric arrays from/to numpy arrays

2007-01-31 Thread Christopher Barker
William Hughes wrote: > Hi: > Is there a easy and efficient way to convert between > Numeric and numpy arrays? sure is: Numeric.asarray() numpy.asarray() Could it be any easier? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA

Re: [Numpy-discussion] Requests for NumPy Ports?

2007-01-31 Thread Christopher Barker
s probably using arrays as a handy and compact n-d data storage and exchange format. It might be interesting to see how it's really being used, and if the PEP would meet its needs. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R

Re: [Numpy-discussion] array copy-to-self and views

2007-02-01 Thread Christopher Barker
f it changes in the other, but that's one heck of kludge! >>> a.__array_interface__['data'][0] == b.__array_interface__['data'][0] True seems to work, but that's pretty ugly! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response D

Re: [Numpy-discussion] array copy-to-self and views

2007-02-01 Thread Christopher Barker
the difference is not in assignment or anything like that, but in the fact that a list comprehension produces a copy, which is analogous to : flipud(a).copy In numpy, you DO need to be aware of when you are getting copies, and when you are getting views, and what the consequences are. So reall

Re: [Numpy-discussion] array copy-to-self and views

2007-02-01 Thread Christopher Barker
two arrays COULD share data. I suppose to really be robust, what I'd really want to know is if a given array shares data with ANY other array, i.e. could changing this mess something up? -- but I'm pretty sure that is next to impossible -Chris -- Christopher Barker, Ph.D. Oceanog

[Numpy-discussion] SciPy '07 ???

2007-02-01 Thread Christopher Barker
Hi, Does anyone know if there will be a SciPy '07 conference, and if so, when? I'd really like to try to get there this year, but need to start planning my summer schedule. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R

Re: [Numpy-discussion] classmethods for ndarray

2007-02-01 Thread Christopher Barker
Travis Oliphant wrote: > I'm thinking that we should have several. For example all the fromXXX > functions should probably be classmethods > > ndarray.frombuffer > ndarray.fromfile would they still be accessible in their functional form in the numpy namespace? -- Chri

Re: [Numpy-discussion] classmethods for ndarray

2007-02-01 Thread Christopher Barker
handles this by having a few constructors: wx.EmptyBitmap() wx.BitmapFromImage() wx.BitmapFromBuffer() etc... but that's kind of clunky too. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point W

Re: [Numpy-discussion] New may_share_memory function

2007-02-01 Thread Christopher Barker
thanks Travis, Now I just need to remember it's there when I need it! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-63

Re: [Numpy-discussion] force column vector

2007-02-07 Thread Christopher Barker
6]]) to return: array([[1, 2], [3, 4], [5, 6]]) that's not what I would call a column vector, and if that's what you want, then what would you want: MakeColumn([[1,2,3,4],[5,6,7,8]]) to return? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency

Re: [Numpy-discussion] SciPy '07 ???

2007-02-07 Thread Christopher Barker
s earlyish in September. Nice to know. The sooner we get dates, the better, my wife needs to schedule out summer vacation now! I've missed it for various reasons for the last 3 years, I hope I can do this one! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division N

Re: [Numpy-discussion] Comparing x and x.view

2007-02-08 Thread Christopher Barker
es will help (I know they can be used to make the > who function a bit more intelligent about how many bytes are being used). > > -Travis -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE

Re: [Numpy-discussion] bug or feature?

2007-02-09 Thread Christopher Barker
)) >>> type(s) >>> s2 = 4 * s >>> type(s2) This stayed an array, as, of course, it would have to! I now the whole "how the heck should a rank-zero array" behave? has been discussed a lot, but I still wonder if this is how it should be. Maybe having a whole

Re: [Numpy-discussion] Request for porting pycdf to NumPy

2007-02-09 Thread Christopher Barker
his for netcdf4. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main receptio

Re: [Numpy-discussion] pyhdf / was: Request for porting pycdf to NumPy

2007-02-09 Thread Christopher Barker
> Andre Gosselin (the guy who wrote pycdf) also wrote an interface to HDF4 > (not 5) named pyhdf. Is he still maintaining these packages? Have you submitted the patches to him? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R

Re: [Numpy-discussion] fromstring, tostring slow?

2007-02-13 Thread Christopher Barker
use the timeit module. My results: Using lists 0.457561016083 Using tostring 0.00922703742981 Using tofile 0.00431108474731 Another note: where is the data coming from -- there may be ways to optimize this whole process if we saw that. -Chris -- Christopher Barker, Ph.D. Oceanographer

Re: [Numpy-discussion] fromstring, tostring slow?

2007-02-13 Thread Christopher Barker
Mark Janikas wrote: > I don't think I can do that because I have heterogeneous rows of > data I.e. the columns in each row are different in length. like I said, show us your whole problem... But you don't have to write.read all the data at once with from/tofile() anyway. Each of your "rows"

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Christopher Barker
than 1e-16 anyway. I wonder if there are any C math libs that do a better job than you'd expect from standard FP? (short of unlimited precision ones) -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Christopher Barker
Robert Kern wrote: > Christopher Barker wrote: >> I wonder if there are any C math libs that do a better job than you'd >> expect from standard FP? (short of unlimited precision ones) > > With respect to π and the zeros of sin() and cos()? Not really. If > numpy.s

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-22 Thread Christopher Barker
tialized by standard python literals, it would be nice to be able to do this. Oh, and here's another inconsistency: >>> N.int32("676") 676 >>> N.uint32("676") array([6, 7, 6], dtype=uint32) -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Respons

Re: [Numpy-discussion] dumb question about creating a complex array

2007-02-22 Thread Christopher Barker
1,a.shape[1],2)] >>> b array([[ 1.+2.j, 3.+4.j], [ 2.+3.j, 4.+5.j], [ 4.+5.j, 6.+7.j]]) Is that what you wanted? By the way, I think there is a trick for doing the every other column trick without using range(), but I can't find it at the moment. -Chris

Re: [Numpy-discussion] Questions about cross-compiling extensions for mac-ppc and mac-intel

2007-02-26 Thread Christopher Barker
to the PIL config script (a few > subpackages deep). Is this easy or possible? I doubt it, but there has got to be a way to tie endianess to platform. You'd want the Intel code built one way, and the PPC code another. I think distutils may take care of this for you. Good luck! And if you fin

Re: [Numpy-discussion] Questions about cross-compiling extensions for mac-ppc and mac-intel

2007-02-26 Thread Christopher Barker
taining gcc 4.0.3 with gfortran that looks like > it > might be Universal. I haven't tried to build scipy with it, yet. cool! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (2

Re: [Numpy-discussion] mac binary distributions

2007-03-01 Thread Christopher Barker
There are binaries of 1.0.1 here: http://pythonmac.org/packages/py24-fat/index.html and here: http://pythonmac.org/packages/py25-fat/index.html -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point

Re: [Numpy-discussion] when and where to use numpy arrays vs nested lists

2007-03-01 Thread Christopher Barker
Francesc Altet wrote: > Ops, this seems a bug with your numpy version: yup, it's a bug here too: >>> numpy.__version__ '1.0.1' this is the dmg for python2.5 on pythonmac.org/packages -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NO

[Numpy-discussion] Should array_equal work with non-numeric types?

2007-03-02 Thread Christopher Barker
ical_and.reduce(equal(a1,a2).ravel()) AttributeError: 'NotImplementedType' object has no attribute 'ravel' I can use: >>> numpy.all(a==b) True But I was wondering if array_equal should work. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Di

Re: [Numpy-discussion] Matlab -> NumPy translation and indexing

2007-03-05 Thread Christopher Barker
ing purposes, but I like to do it for clarities sake. In MATLAB, there is no such thing as a vector, so you only have the last two options -- not the first. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6

Re: [Numpy-discussion] Empty record arrays

2007-03-05 Thread Christopher Barker
t; try: > # Using empty array gives an error > r = rec.fromrecords([], dtype=dt) > print r > except IndexError: > print "Index Error using empty array" > > # workaround > r = array([], dtype=dt).view(recarray) > print r.name > ___

Re: [Numpy-discussion] 0/0 is 0 or nan?

2007-03-09 Thread Christopher Barker
ompleteness: >>> a = N.array(0, dtype=N.float) >>> b = N.array(0, dtype=N.float) >>> N.divide(a,b) Warning: invalid value encountered in divide nan -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6

Re: [Numpy-discussion] 0/0 is 0 or nan?

2007-03-09 Thread Christopher Barker
the OP before. It looks like I get the same as you with the defaults. There is no NaN for integers, so I guess 0 is as good as anything -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6

Re: [Numpy-discussion] matrix indexing question

2007-03-27 Thread Christopher Barker
duct of the > fundamental behavior of the matrix class -- which has been explained > and which you offered no resistance to. > > Zach > > ___ > Numpy-discussion mailing list > Numpy-discussion@scipy.org > http://projects.scipy.o

Re: [Numpy-discussion] Help with linear_least_squares

2007-03-28 Thread Christopher Barker
Numeric LinearAlgebra module with the new numpy;s arrays. Try this: >>> from numpy import linalg >>> sol=linalg.lstsq(A,b) >>> sol (array([[ 0.33898305], [ 2.57627119]]), array([ 0.30508475]), 2, array([ 4.72879916, 1.62433326])) -Chris -- Christopher Ba

Re: [Numpy-discussion] question about standalone small software and teaching

2007-04-05 Thread Christopher Barker
den by an instance attribute, then it's clearer to define it as an instance attribute in the first place: class A: def __init___(self, ...) self.x = 4 Even though it's more typing. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Divisi

Re: [Numpy-discussion] Big list of Numpy & Scipy users

2007-04-05 Thread Christopher Barker
nly for small in-house tools that we can't point anyone to a web page or anything for. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (20

[Numpy-discussion] how to run the tests.

2007-04-05 Thread Christopher Barker
versal Framework build of Python2.5. I'll submit a package to be put on the pythonmac repository. -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206)

Re: [Numpy-discussion] how to run the tests.

2007-04-05 Thread Christopher Barker
MS would supply BLAS/LAPACK. And aren't they using atlas anyway? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317

Re: [Numpy-discussion] how to run the tests.

2007-04-06 Thread Christopher Barker
Robert Kern wrote: > They are, but an older one. There have been significant improvements to the > Core > Duo 2 code in ATLAS releases, but no updates to Accelerate. Let's hope they'll be forthcoming. Thanks for the update. This may be important to me soon. -Chris --

Re: [Numpy-discussion] problem reading binary data from file

2007-04-06 Thread Christopher Barker
name, or an open file object) You may want to get fancier with the dtype to force the correct byte order. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle,

Re: [Numpy-discussion] problem reading binary data from file

2007-04-06 Thread Christopher Barker
> In fact numpy.fromfile was the first function I tried to use but I > couldn't manage to get it working with the byteorder I needed > (big-endian). a = fromfile(...) a.byteswap(True) -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R

[Numpy-discussion] numpy on WinCE / PocketPC...

2007-04-09 Thread Christopher Barker
pect it to work. -thanks, -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main receptio

Re: [Numpy-discussion] detecting shared data

2007-04-11 Thread Christopher Barker
Bill Baxter wrote: > But maybe that's pretty much what may_share_memory does? I think so. Travis added it after a discussion much like this one on the list. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959

Re: [Numpy-discussion] MacNoob

2007-04-12 Thread Christopher Barker
: pythonmac.org/packages Otherwise, you'll need to tell us more aobut your build environment: python version (what build, where did you get it?) OS version compiler version. (I'd use the latest Xcode distro.) -Chris -- Christopher Barker, Ph.D. Oceanographer Emerge

Re: [Numpy-discussion] Fastest distance matrix calc

2007-04-16 Thread Christopher Barker
.hypot(v-y) to speed this up more... -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main rec

Re: [Numpy-discussion] Fastest distance matrix calc

2007-04-17 Thread Christopher Barker
probably make a temporary v-y, so you dont' make two of them. I've been assuming that hypot is written in C, rather than just a convenience function, but it it's the later, then it won't help here. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Div

Re: [Numpy-discussion] Help using numPy to create a very large multi dimensional array

2007-04-18 Thread Christopher Barker
he files, but you can still use fromfile() or maybe fromstring() to do this. You just need to read past the text part first, then process it. using fromstring: matrix = numpy.vstack([numpy.fromstring(line.split(" ", 1)[1], sep=" ") for line in vecfile]) or something like th

Re: [Numpy-discussion] Help using numPy to create a very large multi dimensional array

2007-04-19 Thread Christopher Barker
ven't looked at pylab.load() for a while, but it could perhaps be sped up by using fromfile() and or fromstring internally. There may be some opportunity to special case the easy ones too (i.e. all columns desired, etc.) -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Resp

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Christopher Barker
e. >>> b[1] = 5 >>> a array([[ 0., 5., 0.], [ 0., 0., 0.]]) b and a share data. if you want to change the shape of a: >>> a.shape = (6,) >>> a array([ 0., 5., 0., 0., 0., 0.]) -Chris -- Christopher Barker, Ph.D. Oceanographer Emerg

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Christopher Barker
d idea for methods to sometimes return copies and sometimes views -- it's begging for subtle bugs! oh well, either the code or the docstring should change, in any case. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Christopher Barker
.reshape(), so there is a bug of some sort (probably a doc bug). if numpy.reshape() is delegating to ndarray.reshape() couldn't they share docstrings somehow? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 vo

Re: [Numpy-discussion] using the functions nonzero and where

2007-04-24 Thread Christopher Barker
e question: why does nonzero() return a tuple with an array in it, rather than just the array? Is it so you can so this? >>> a = numpy.array(((3,0,4),(5,21,0))) >>> numpy.nonzero(a) (array([0, 0, 1, 1]), array([0, 2, 0, 1])) >>> a[numpy.nonzero(a)] array([ 3, 4,

Re: [Numpy-discussion] matlab vs. python question

2007-04-25 Thread Christopher Barker
y more productive environment for interactive experimentation and quickie prototypes and scripts, but much less productive for larger projects, or for people that need to do non-numerical work too. just my $0.2 -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/

Re: [Numpy-discussion] matlab vs. python question

2007-04-25 Thread Christopher Barker
is choosing which tool to use! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [

Re: [Numpy-discussion] Questions about converting to numpy

2007-04-25 Thread Christopher Barker
stent code like: a = array(object, numpy.float32) b = array(object, numpy.float) i.e. have it all in the same namespace. I'm not sure why float_ is an alias for float64, though I'm guessing it's possible that on some platforms they are not the same. -Chris -- Christopher Ba

Re: [Numpy-discussion] matlab vs. python question

2007-04-26 Thread Christopher Barker
ut f2py looks very easy too, if you're working with Fortran. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA

Re: [Numpy-discussion] numpy endian question

2007-04-27 Thread Christopher Barker
Is there really no single method to call on an ndarray that asks: "what endian are you" I know not every two-liner should be made into a convenience method, but this seems like a good candidate to me. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Divisio

Re: [Numpy-discussion] simpliest way to check: array x is float, not integer

2007-04-30 Thread Christopher Barker
mpy.float) asarray is a no-op if the input is already of the type you've specified It's handy, as it will take *anything* that can be turned into an array of the specified type. This won't work the function needs to change the input in place, however. -Chris -- Chri

Re: [Numpy-discussion] problem: I get an array that doesn't have a length

2007-05-02 Thread Christopher Barker
array(a, dtype=N.float).reshape((-1,)) ...print b.shape ... >>> >>> test(5) (1,) >>> test((5,)) (1,) >>> test((5,6,7,8)) (4,) -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 76

Re: [Numpy-discussion] problem: I get an array that doesn't have a length

2007-05-02 Thread Christopher Barker
;t look like you can specify a data type with atleast_1d. I don't think my approach is slower, as it handles the conversion to float, and reshape doesn't copy the data if it doesn't need to. But I doubt speed makes any difference here anyway. -CHB -- Christopher Barker, Ph.D.

Re: [Numpy-discussion] Difference in the number of elements in a fromfile() between Windows and Linux

2007-05-04 Thread Christopher Barker
n short, I don't know that this is a bug. It is a missing feature, but It may be hard to get someone to write the code to account for the limited fscanf() in fromfile(). -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206)

Re: [Numpy-discussion] Difference in the number of elements in a fromfile() between Windows and Linux

2007-05-04 Thread Christopher Barker
's the same compiler as 2.5) -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main recepti

Re: [Numpy-discussion] Difference in the number of elements in a fromfile() between Windows and Linux

2007-05-04 Thread Christopher Barker
Robert Kern wrote: > "1.#INF" and "1.#QNAN" might be > accepted though since that's what ftoa() gives for those quantities. not in Python: float("1.#INF") gives a value error. That may or may not reflect what *scanf does, but I suspect it doe

Re: [Numpy-discussion] matlab vs. python question

2007-05-07 Thread Christopher Barker
tegration at some point -- it would be nice! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception

Re: [Numpy-discussion] howto make from flat array (1-dim) 2-dimensional?

2007-05-14 Thread Christopher Barker
or: a=array([1,2,3]).reshape((-1,1)) Darn, I guess there is more than one obvious way to do it! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 9

Re: [Numpy-discussion] 64-bit Numpy (ppc64)

2007-05-15 Thread Christopher Barker
#x27;ve confirmed > it > can allocate more than 4GB of memory. If you use that python to run setup.py, and it's a PPC binary, you should be all set. -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7

Re: [Numpy-discussion] 64-bit Numpy (ppc64)

2007-05-15 Thread Christopher Barker
your options: http://mail.python.org/mailman/listinfo/pythonmac-sig -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main rece

  1   2   3   4   5   6   7   8   >