[Numpy-discussion] Pretty printing an array: no ellipses?
I am not sure where to look for this, sorry if it is RTFM or JPS ("just plain stupid"): Is there a way to set a default to print the entire array, rather than an ellipses version of it? If not, why doesn't pprint.pformat(numpy.random.normal(0,1,(100, 100)), width=1000) at least give me something off the screen? Thx! - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
[Numpy-discussion] numpy.average(fooArray, axis=0): dropping nans from calculation
Could someone recommend a way to average an array along the columns without propagating the nans and without turning them into some weird number which bias the result? I guess I can just keep using an indexing array for fooArray, but if there is somehting more graceful, I would love to know. Boy missing data is a pain in the neck... Thanks again! - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] Finding indices for all rows which contain nan (or anything else)
On 7/13/06, Robert Kern <[EMAIL PROTECTED]> wrote: > Webb Sprague wrote: > > Does anyone have some vectorized code that pulls out all the row > > def is_row_nan(a): > return numpy.isnan(a).any(axis=-1) I knew there was a way, but I didn't know to check any() and all(). Thanks to all (I love free software lists!) W - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
[Numpy-discussion] Finding indices for all rows which contain nan (or anything else)
Does anyone have some vectorized code that pulls out all the row indices for any row which has an nan (or a number less than 1 or whatever). I want to subsequently be able to perform an operation with all the good rows. See the imaginary code below. a = numpy.array([[1,2],[nan,1], [2,3]]) is_row_nan(a) == array([1]) ii = numpy.negative(is_row_nan(a)) a[ii,:] # these are the ones I want. Hopefully this is array([[1,2],[2,3]]) I can imagine doing this with a loop or with (maybe) some fancy set union stuff, but I am at a loss for vectorized versions. Thanks - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
[Numpy-discussion] Does zero based indexing drive anyone else crazy?
Hi Numpeans, I have been working on a web-based scientific application for about a year, most of which had been written in either Matlab or SPLUS/R. My task has been to make it "driveable" through an online interface (if anyone cares about mortality forecasting, drop me an email and we can chat about it offline). I chose Python/Numpy for the language because Python and Numpy are both so full featured and easy to work with (except for one little thing...), and neither Matlab nor R could gracefully deal with CGI programming (misguided propaganda notwithstanding). However I have spent a huge amount of my time fixing and bending my head around off-by-one errors caused by trying to index matrices using 0 to n-1. The problem is two-fold (threefold if you count my limited IQ...): one, all the formulas in the literature use 1 to n indexing except for some small exceptions. Second and more important, it is far more natural to program if the indices are aligned with the counts of the elements (I think there is a way to express that idea in modern algebra but I can't recall it). This lets you say "how many are there? Three--ok, grab the third one and do whatever to it" etc. Or "how many? zero--ok don't do anything". With zero-based indexing, you are always translating between counts and indices, but such translation is never a problem in one-based indexing. Given the long history of python and its ancestry in C (for which zero based indexing made lots of sense since it dovetailed with thinking in memory offsets in systems programming), there is probably nothing to be done now. I guess I just want to vent, but also to ask if anyone has found any way to deal with this issue in their own scientific programming. Or maybe I am the only with this problem, and if I were a real programmer would translate into zero indexing without even noticing Anyway, thanks for listening... Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
[Numpy-discussion] Problem installing numpy on Gentoo
I am trying to install numpy on Gentoo (see my info below for version etc). It all seems to go fine, but when I try to import it and run the tests, I get the following error (in ipython): In [1]: import numpy import linalg -> failed: libg2c.so.0: cannot open shared object file: No such file or directory I have gfortran on my system, but libg2c is not part of the gcc-4.1.1 distribution anymore (maybe that is a bug with Gentoo?). I also get the same error when I run f2py from the command line. Here is the bug I filed: http://bugs.gentoo.org/show_bug.cgi?id=136988 Info that might help: cowboy ~ # ls /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/ crtbegin.o libgcc.alibgfortran.so.1 libobjc.so.1.0.0 crtbeginS.olibgcc_eh.a libgfortran.so.1.0.0 libstdc++.a crtbeginT.olibgcc_s.so libgfortranbegin.alibstdc++.so crtend.o libgcc_s.so.1 libgfortranbegin.la libstdc++.so.6 crtendS.o libgcov.a libobjc.a libstdc++.so.6.0.8 crtfastmath.o libgfortran.a libobjc.lalibstdc++_pic.a includelibgfortran.la libobjc.solibsupc++.a install-tools libgfortran.so libobjc.so.1 libsupc++.la cowboy ~ # ls /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/ SYSCALLS.c.Xlibffi.lalibobjc.la crtbegin.o libffi.solibobjc.so crtbeginS.o libfrtbegin.alibobjc.so.1 crtbeginT.o libg2c.a libobjc.so.1.0.0 crtend.olibg2c.lalibstdc++.a crtendS.o libg2c.solibstdc++.la hardened.specs libg2c.so.0 libstdc++.so hardenednopie.specs libg2c.so.0.0.0 libstdc++.so.6 hardenednopiessp.specs libgcc.a libstdc++.so.6.0.3 hardenednossp.specs libgcc_eh.a libstdc++_pic.a include libgcc_s.so libsupc++.a install-tools libgcc_s.so.1libsupc++.la libffi-2.00-beta.so libgcov.aspecs libffi.alibobjc.avanilla.specs cowboy ~ # emerge --info Portage 2.1.1_pre1-r1 (default-linux/x86/2006.0, gcc-4.1.1/vanilla, glibc-2.4-r3, 2.6.11-gentoo-r9 i686) = System uname: 2.6.11-gentoo-r9 i686 AMD Athlon(tm) Processor Gentoo Base System version 1.12.1 distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] ccache version 2.4 [enabled] dev-lang/python: 2.4.3-r1 dev-python/pycrypto: 2.0.1-r5 dev-util/ccache: 2.4-r2 dev-util/confcache: [Not Present] sys-apps/sandbox:1.2.18.1 sys-devel/autoconf: 2.13, 2.59-r7 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2 sys-devel/binutils: 2.16.1-r2 sys-devel/gcc-config: 2.0.0_rc1 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.11-r5 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS=" -march=athlon -O2 -pipe -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/X11/xkb" CONFIG_PROTECT_MASK="/etc/env.d /etc/eselect/compiler /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c" CXXFLAGS=" -march=athlon -O2 -pipe -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig ccache distlocks metadata-transfer sandbox sfperms" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"; PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="x86 X alsa apache2 apm arts avi berkdb bitmap-fonts blas cli crypt cups dba dri eds emacs emboss encode esd f77 fftw foomaticdb fortran g77 gdbm gif gnome gpm gstreamer gtk gtk2 imlib ipv6 isdnlog jpeg lapack libg++ libwww mad mikmod mime mmap motif mp3 mpeg ncurses nls nptl nptlonly objc ogg opengl oss pam pcre pdflib perl png postgres pppd python quicktime readline reflection sdl session spell spl ssl svg tcltk tcpd tidy truetype truetype-fonts type1-fonts udev unicode vorbis xml xmms xorg xv zlib elibc_glibc kernel_linux userland_GNU" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTAGE_RSYNC_EXTRA_OPTS cowboy ~ # gcc --version i686-pc-linux-gnu-gcc (GCC) 4.1.1 (Gentoo 4.1.1) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 _