Re: numpy/scipy: correlation

2006-11-12 Thread sturlamolden
Robert Kern wrote: > The difference between the two models is that the first places no restrictions > on the distribution of x. The second does; both the x and y marginal > distributions need to be normal. Under the first model, the correlation > coefficient has no meaning. That is not correct.

Re: Python component model

2006-11-12 Thread sturlamolden
[EMAIL PROTECTED] wrote: > Having never used java or .NET I'm not sure what you're looking for. There is a whole generation of computer users out there scared stiff of using the keyboard. Soon, computers will not have a keyboard at all. The trend is perhaps more pronounced among managers not wri

Re: numpy/scipy: correlation

2006-11-12 Thread sturlamolden
First, are you talking about rounding error (due to floating point arithmetics) or statistical sampling error? If you are talking about the latter, I suggest you look it up in a statistics text book. E.g. if x and y are normally distributed, then t = r * sqrt( (n-2)/(1-r**2) ) has a Student t-d

Re: numpy/scipy: correlation

2006-11-12 Thread sturlamolden
robert wrote: > > t = r * sqrt( (n-2)/(1-r**2) ) > yet too lazy/practical for digging these things from there. You obviously got > it - out of that, what would be a final estimate for an error range of r (n > big) ? > that same "const. * (1-r**2)/sqrt(n)" which I found in that other document ?

Re: numpy/scipy: correlation

2006-11-12 Thread sturlamolden
While I am at it, lets add the bootstrap estimate of the standard error as well. from numpy import mean, std, sum, sqrt, sort, corrcoef, tanh, arctanh from numpy.random import randint def bootstrap_correlation(x,y): idx = randint(len(x),size=(1000,len(x))) bx = x[idx] by = y[idx]

Re: numpy/scipy: error of correlation coefficient (clumpy data)

2006-11-15 Thread sturlamolden
robert wrote: > here the bootstrap test will as well tell us, that the confidence intervall > narrows down by a factor ~sqrt(10) - just the same as if there would be > 10-fold more of well distributed "new" data. Thus this kind of error > estimation has no reasonable basis for data which is no

Re: numpy/scipy: error of correlation coefficient (clumpy data)

2006-11-16 Thread sturlamolden
robert wrote: > Think of such example: A drunken (x,y) 2D walker is supposed to walk along a > diagonal, but he makes frequent and unpredictable pauses/slow motion. You get > x,y coordinates in 1 per second. His speed and time pattern at all do not > matter - you just want to know how well he

Re: About alternatives to Matlab

2006-11-16 Thread sturlamolden
Boris wrote: > Hi, is there any alternative software for Matlab? Although Matlab is > powerful & popular among mathematical & engineering guys, it still > costs too much & not publicly open. So I wonder if there's similar > software/lang that is open & with comparable functionality, at least > for

Re: Writing Video conference software for Windows

2006-09-21 Thread sturlamolden
Paolo Pantaleo wrote: > Well I need something like 5-10 fps. An issue is the comression > method: MPEG and friends aren't good (I think) for compressing stuff > with sharp borders. Maybe I could use A sequence of PNG images, but it > isn't a great solution. You probably want to use is VideoCaptu

Re: Questions on Using Python to Teach Data Structures and Algorithms

2006-09-28 Thread sturlamolden
efrat wrote: > 1. What exactly is a Python list? If one writes a[n], then is the > complexity Theta(n)? If this is O(1), then why was the name "list" > chosen? If this is indeed Theta(n), then what alternative should be > used? (array does not seem suited for teaching purposes.) A Python list is

Re: Questions on Using Python to Teach Data Structures and Algorithms

2006-09-28 Thread sturlamolden
Brendon Towle wrote: > > def cons(a,b) > >return [a,b] > > should be: > return [a].extend(b) I seem to remember that a cons joins two items, it doesn't grow a strait list. A lisp list is a special case of a binary tree. How would you build a tree structure with your cons? I think you ar

Re: Questions on Using Python to Teach Data Structures and Algorithms

2006-09-28 Thread sturlamolden
sturlamolden wrote: > Remember that O(1) is not neccesarily faster than O(N)! Unless your > linked list is very big, you will get something called a 'cache miss' > inside your CPU. Thus it is usually more efficient to work with dynamic > arrays. This was a bit ackwardly

Re: Questions on Using Python to Teach Data Structures and Algorithms

2006-09-28 Thread sturlamolden
Brendon Towle wrote: > ? (cons ) > > returns a single level list, with as its new first item, and > the original contents of as the remainder of the list. The > OP's code doesn't do that; it returns a list of two items, with > as the second item. That is equivalent, as is the remainder of t

Re: Questions on Using Python to Teach Data Structures and Algorithms

2006-09-29 Thread sturlamolden
MonkeeSage wrote: > > def cons(car,cdr): return (car,cdr) # or [car,cdr] > > def car(cons): return cons[0] > > def cdr(cons): return cons[1] > > I guess you were talking about implementing the _structure_ of lisp > lists in python syntax (as you seem to imply), not trying to emulate > their _behav

Re: switching to numpy and failing, a user story

2006-10-04 Thread sturlamolden
Travis E. Oliphant wrote: > Definitely not true. People in Singapore, Japan, Ghana, South Africa, > France, Germany, New Zealand, Australia, and many other countries are > using NumPy successfully. Gratefully, a few have contributed by buying > the book, but a lot more have downloaded and are s

Re: About alternatives to Matlab

2006-11-18 Thread sturlamolden
Filip Wasilewski wrote: > Actually you have not. The algorithm you presented gives completely > wrong results. Have a look at quick&dirty(TM) implementation bellow. God grief. I followed the implementation in Ingrid Daubechies' and Wim Sweldens' original wavelet lifting paper (J. Fourier Anal.

Re: About alternatives to Matlab

2006-11-18 Thread sturlamolden
sturlamolden wrote: > God grief. I followed the implementation in Ingrid Daubechies' and Wim > Sweldens' original wavelet lifting paper (J. Fourier Anal. Appl., 4: > 247-269, 1998). If you look at the factorized polyphase matrix for D4 > (which gives the inverse transform)

Re: please help me choose a proper gui library.

2006-11-18 Thread sturlamolden
krishnakant Mane wrote: > now My question is which gui toolkit should I choose? It's a matter of taste. I would recommend PyGTK (yes it runs on Windows). You can design the GUI in a fly with GLADE, and import it as an XML resource in Python with one single line of code. It will save you an awful

Re: About alternatives to Matlab

2006-11-19 Thread sturlamolden
sturlamolden wrote: > def D4_Transform(x, s1=None, d1=None, d2=None): >""" >D4 Wavelet transform in NumPy >(C) Sturla Molden >""" >C1 = 1.7320508075688772 >C2 = 0.4330127018922193 >C3 = -0.066987298107780702 >

Re: About alternatives to Matlab

2006-11-25 Thread sturlamolden
Phil Schmidt wrote: > Thanks for that list. I'm currently in the process of getting quotes > for a bunch of Matlab tools for hardware-in-the-loop simulation. Big > bucks. Yup, and better spent elsewhere... > I'd love to use Python, but I'm not comfortable with the hardware side > of that. I'm

Re: About alternatives to Matlab

2006-11-26 Thread sturlamolden
Phil Schmidt wrote: > Well, that kind of gets right to my point. Does the "added" effort with > Python to interface with data acquisition hardware really result in > less productivity? I am very familiar with Matlab, Labview, and Python, > and frankly, Python is the most productive and powerful pr

Re: About alternatives to Matlab

2006-11-27 Thread sturlamolden
Rob Purser wrote: > Anyway, I just wanted to call your attention to Data Acquisition Toolbox: > http://www.mathworks.com/products/daq/ Absolutely. If the hardware is supported by this toolbox, there is no need to reinvent the wheel. The license is expensive, but development time can be far more

Re: About alternatives to Matlab

2006-12-04 Thread sturlamolden
Filip Wasilewski wrote: > So why not use C++ instead of all others if the speed really matters? > What is your point here? If speed matters, one should consider using hand-coded assembly. Nothing really beats that. But it's painful and not portable. So lets forget about that for a moment. Contr

Re: About alternatives to Matlab

2006-12-04 Thread sturlamolden
Carl Banks wrote: > > Ok. Perhaps starting a Python JIT in something like MetaOCaml or Lisp/Scheme > > would be a good student project? > > ...and finishing would be a good project for a well-funded team of > experienced engineers. I think this is a good idea. We could use the AST from the CPyth

Re: About alternatives to Matlab

2006-12-04 Thread sturlamolden
Jon Harrop wrote: > So the super-fast BLAS routines are now iterating over the arrays many times > instead of once and the whole program is slower than a simple loop written > in C. Yes. And the biggest overhead is probably Python's function calls. Little is as efficient as well-written ISO C99

Re: About alternatives to Matlab

2006-12-14 Thread sturlamolden
Jon Harrop wrote: > Yes. The time taken is dominated by memory accesses. The amount of > arithmetic is almost irrelevant. That is extremely interesting. It would explain why I see almost the same performance in NumPy and Fortran 95 on this kind of task, using array slicing in both languages. --

Re: About alternatives to Matlab

2006-12-15 Thread sturlamolden
Jon Harrop wrote: > Yes. Non-sequential access is hugely expensive these days, and bounds > checking is virtually free. So that's one less reason to use C/C++... ;-) The lifiting scheme is sequential. -- http://mail.python.org/mailman/listinfo/python-list

Re: About alternatives to Matlab

2006-12-15 Thread sturlamolden
Jon Harrop wrote: > Can convolution be implemented efficiently in Python? numpy.convolve > Functional programming makes this easy. You just compose closures from > closures instead of arrays from arrays. Indeed. But learning yet another language is too much work. > This is what I meant by o

Re: first and last index as in matlab

2006-12-17 Thread sturlamolden
It's quite straight forward, actually. What you need to know is that -1 is the index of the last element in a sequence, and that slicing excludes the 'end' value in 'start:end'. So if you type arr[0:N], you get the subsequence [arr[0], arr[1], arr[2], ..., arr[N-1]] When comparing with Matlab, P

Re: Wow, Python much faster than MatLab

2006-12-30 Thread sturlamolden
Stef Mientki wrote: > I always thought that SPSS or SAS where thé standards. > Stef As far as SPSS is a standard, it is in the field of "religious use of statistical procedures I don't understand (as I'm a math retard), but hey p<0.05 is always significant (and any other value is proof of the op

Re: Wow, Python much faster than MatLab

2006-12-30 Thread sturlamolden
Stef Mientki wrote: > MatLab: 14 msec > Python: 2 msec I have the same experience. NumPy is usually faster than Matlab. But it very much depends on how the code is structured. I wonder if it is possible to improve the performance of NumPy by having its fundamental types in the language, instea

Re: Wow, Python much faster than MatLab

2006-12-30 Thread sturlamolden
Wensui Liu wrote: > doing. However, that is not the fault of excel/spss itself but of > people who is using it. Yes and no. I think SPSS makes it too tempting. Like children playing with fire, they may not even know it's dangerous. You can do an GLM in SPSS by just filling out a form - but how m

Re: Wow, Python much faster than MatLab

2006-12-31 Thread sturlamolden
Klaas wrote: > C/C++ do not allocate extra arrays. What you posted _might_ bear a > small resemblance to what numpy might produce (if using vectorized > code, not explicit loop code). This is entirely unrelated to the > reasons why fortran can be faster than c. Array libraries in C++ that use o

Re: Why less emphasis on private data?

2007-01-07 Thread sturlamolden
[EMAIL PROTECTED] wrote: > Coming from a C++ / C# background, the lack of emphasis on private data > seems weird to me. I've often found wrapping private data useful to > prevent bugs and enforce error checking.. > > It appears to me (perhaps wrongly) that Python prefers to leave class > data publ

Re: c# application calling Scipy

2007-01-07 Thread sturlamolden
[EMAIL PROTECTED] wrote: > Hi, > > Novice here. :) > > I'm building a c# application and I want to call functions in SciPy > from that application. > > What's the best way to call SciPy methods from a C# program? You need to: 1. Embed a Python interpreter in your C# app. That is, importing from

Re: Why less emphasis on private data?

2007-01-08 Thread sturlamolden
Jussi Salmela wrote: > To surlamolden: I don't know how you define private, but if one defines > in C an external static variable i.e. a variable outside any functions, > on the file level, the scope of the variable is that file only. Sure, in C you can hide instances inside an object image by d

Re: Why less emphasis on private data?

2007-01-09 Thread sturlamolden
[EMAIL PROTECTED] wrote: > I let the user change the internal state of the engine, I have no > assurances that my product (the engine) is doing its job... How would you proceed to protect this inner states? In C++ private members they can be accessed through a cast to void pointer. In Java it ca

Re: Execute binary code

2007-01-09 Thread sturlamolden
Jorgen Grahn wrote: > For what it's worth[1], under Unix it /is/ impossible. The only way to bring > in > new code (short of dynamic libraries) is to call exec(2) or its variations, > and all need a file system object to load the code from. The x86 processor cannot tell the difference between c

Re: Python advocacy in scientific computation

2006-03-03 Thread sturlamolden
Michael Tobis skrev: Being a scientist, I can tell you that your not getting it right. If you speak computer science or business talk no scientist are going to listen. Lets just see how you argue: > These include: source and version control and audit trails for runs, > build system management, te

Re: Python advocacy in scientific computation

2006-03-05 Thread sturlamolden
Robert Kern wrote: > 1. Write grant proposals. > > 2. Advise and teach students. Sorry I forgot the part about writing grant applications. As for teaching students, I have thankfully not been bothered with that too much. > Yes, and this is why you will keep saying, "My simulation is running t

Re: Python advocacy in scientific computation

2006-03-05 Thread sturlamolden
David Treadwell wrote: > My ability to think of data structures was stunted BECAUSE of > Fortran and BASIC. It's very difficult for me to give up my bottom-up > programming style, even though I write better, clearer and more > useful code when I write top-down. That is also the case with Matla

Re: Python advocacy in scientific computation

2006-03-05 Thread sturlamolden
Robert Kern wrote: > And you need to ask why Python is a better Matlab than Matlab? First there are a few things I don't like: 1. Intendation as a part of the syntax, really annoying. 2. The "self.something" syntax is really tedious (look to ruby)! 4. Multithreading and parallel execution is

Re: Python advocacy in scientific computation

2006-03-05 Thread sturlamolden
Dennis Lee Bieber wrote: > > 1. Can python do "pass by reference"? Are datastructures represented by > > references as in Java (I don't know yet). > > > Everything in Python is a reference to an object. I think the > question you want is more on the lines of: Can I change an object that > ha

Re: another thread on Python threading

2007-06-04 Thread sturlamolden
On Jun 4, 3:10 am, Josiah Carlson <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I've recently been working on an application[1] which does quite a bit > > of searching through large data structures and string matching, and I > > was thinking that it would help to put some of this CPU-in

Re: another thread on Python threading

2007-06-04 Thread sturlamolden
On Jun 4, 10:11 pm, Josiah Carlson <[EMAIL PROTECTED]> wrote: > lock = threading.Lock() > > with lock: > #synchronized block! > pass True, except that the lock has to be shared among the threads. This explicit initiation of an reentrant lock is avoided in a Java synchr

Re: another thread on Python threading

2007-06-04 Thread sturlamolden
On Jun 4, 10:11 pm, Josiah Carlson <[EMAIL PROTECTED]> wrote: > However, locking isn't just for refcounts, it's to make sure that thread > A isn't mangling your object while thread B is traversing it. > With > object locking (course via the GIL, or fine via object-specific locks), > you get the

Re: Matrix Multiplication

2007-06-17 Thread sturlamolden
On Jun 17, 10:52 pm, "[EMAIL PROTECTED]" wrote: > Hi, > > Is there any direct function for matrix multiplication in Python or > any of its packages? or do we have to multiply element by element? Use numpy: www.scipy.org NumPy has a matrix type that overloads the * operator. -- http://mail.py

Re: Matrix Multiplication

2007-06-18 Thread sturlamolden
On Jun 18, 11:20 am, Jeremy Sanders wrote: > > NumPy has a matrix type that overloads the * operator. > Just a tiny followup, which may be important unless you carefully read the > documentation. The "*" operator doesn't do matrix multiplication for normal > numpy arrays That's what I wrote: "

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-08 Thread sturlamolden
On Jun 20, 8:53 pm, Stephen R Laniel <[EMAIL PROTECTED]> wrote: > Reading [1], I wonder: why isn't the compiler making better > use of (purely optional) type labeling? Why not make a compiler > directive so that > > a) it will check the types of all my arguments and return >values, If that is

Re: Numpy array index handling

2007-07-13 Thread sturlamolden
>>> from numpy import * >>> from numpy.random import * >>> N = 100 >>> input = sign(randn(N)) >>> a = arange(N) >>> output = zeros(N) >>> output[input < 0] = 10 * a[input < 0] >>> output[input > 0] = 20 * a[input > 0] >>> Worked fine for me. S.M. -- http://mail.python.org/mailman/list

Re: Numpy array index handling

2007-07-13 Thread sturlamolden
On 13 Jul, 22:52, [EMAIL PROTECTED] wrote: > It seems a bit risky to use 'from scipy import *'. Maybe it's better > to use 'import scipy' and then scipy.arange, to be sure what is > actually being used? Would there be any disadvanages with that > approach, other than more use of the keyboard? Gen

Re: Pass by reference or by value?

2007-07-13 Thread sturlamolden
On Jul 13, 9:10 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > I noticed in Python all function parameters seem to be passed by > reference. This means that when I modify the value of a variable of a > function, the value of the variable externally from the function is > also modified. Pass-by-v

Lisp-like macros in Python?

2007-05-01 Thread sturlamolden
Hello The Lisp crowd always brags about their magical macros. I was wondering if it is possible to emulate some of the functionality in Python using a function decorator that evals Python code in the stack frame of the caller. The macro would then return a Python expression as a string. Granted,

Lazy evaluation: overloading the assignment operator?

2007-05-02 Thread sturlamolden
Python allows the binding behaviour to be defined for descriptors, using the __set__ and __get__ methods. I think it would be a major advantage if this could be generalized to any object, by allowing the assignment operator (=) to be overloaded. One particular use for this would be to implement "

Re: Lazy evaluation: overloading the assignment operator?

2007-05-02 Thread sturlamolden
On May 2, 9:46 pm, Stargaming <[EMAIL PROTECTED]> wrote: > > del tmp2 > > y = tmp3 # tmp3 gets evaluated as assignment is overloaded > > To allow lazy evaluation, you need overloading of the assignment > operator? No I don't. I could for example delay evaluation until some data from y is request

Re: Lazy evaluation: overloading the assignment operator?

2007-05-02 Thread sturlamolden
On May 2, 11:08 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > And AFAIK the general overhead of laziness versus eager evaluation does > not pay off - haskell is a tad slower than e.g. an ML dialect AFAIK. In the numerical Python community there is already a prototype compiler called 'numexp

Re: Microsoft's Dynamic Languages Runtime (DLR)

2007-05-02 Thread sturlamolden
On May 3, 2:15 am, Kaz Kylheku <[EMAIL PROTECTED]> wrote: > Kindly refrain from creating any more off-topic, cross-posted threads. > Thanks. The only off-topic posting in this thread is your own (and now this one). Begone. S.M. -- http://mail.python.org/mailman/listinfo/python-list

Re: Lazy evaluation: overloading the assignment operator?

2007-05-03 Thread sturlamolden
On May 3, 6:22 am, Charles Sanders <[EMAIL PROTECTED]> wrote: > y = a*b+c*d # Returns a proxy object > > x = y[4] # Computes x = a[4]*b[4] + c[4]*d[4] > > v = y.eval() # Evaluates all elements, returning Xarray > > z = ((a+b)*(c+d)).eval() # Also evaluates

Re: Towards faster Python implementations - theory

2007-05-10 Thread sturlamolden
On May 8, 5:53 pm, John Nagle <[EMAIL PROTECTED]> wrote: > The point here is that we don't need language changes or declarations > to make Python much faster. All we need are a few restrictions that > insure that, when you're doing something unusual, the compiler can > tell. Franz, CMUCL, SB

Re: Single precision floating point calcs?

2007-05-10 Thread sturlamolden
On May 9, 6:51 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > Is there any way to do single-precision floating point > calculations in Python? Yes, use numpy.float32 objects. > I know the various array modules generally support arrays of > single-precision floats. I suppose I could turn all my

Re: Towards faster Python implementations - theory

2007-05-11 Thread sturlamolden
On May 10, 4:02 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > But the relevant bit of your last paragraph is at the start: > "We should...". Sorry, bad choice of words. > see it faster. That's great. But unless people > puts their money where their mouths are, I don't I know, I know. But that doe

Re: Towards faster Python implementations - theory

2007-05-11 Thread sturlamolden
On May 10, 7:18 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > Unfortunately, native machine code depends on the machine, or at least the > machine being emulated by the hardware. Fortunately or not, the dominance > of the x386 model makes this less of a problem. CMUCL and SBCL depends on the do

Re: Optimizing numpy

2007-05-12 Thread sturlamolden
On May 12, 10:52 pm, Gerdus van Zyl <[EMAIL PROTECTED]> wrote: > I have the following, that is used to convert pixel data and thus > should be as fast as possible: > > b = numpy.ndarray (shape=(w,h,4), dtype=numpy.uint8) > > a = numpy.frombuffer(buf, numpy.uint8) > a.shape = (w, h, 3) > > b[:,:,0]

Re: Basic question

2007-05-12 Thread sturlamolden
On May 12, 6:18 pm, "Cesar G. Miguel" <[EMAIL PROTECTED]> wrote: > Am I missing something? Python for loops iterates over the elements in a container. It is similar to Java's "for each" loop. for j in range(10): print j if(True): j=j+2 print 'interno',j Is equivalent to: int[

Re: Trying to choose between python and java

2007-05-15 Thread sturlamolden
On May 15, 7:30 am, Anthony Irwin <[EMAIL PROTECTED]> wrote: > #1 Does python have something like javas .jar packages. Yes. .egg files. > #2 What database do people recommend for using with python that is > easy to distribute across linux, mac, windows. Depends on your needs: 1. Berkely DB -

Re: Trying to choose between python and java

2007-05-15 Thread sturlamolden
On May 15, 7:29 pm, Beliavsky <[EMAIL PROTECTED]> wrote: > print "Hello, world." > > a substantial fraction of Python programs in existence, including all > of my programs, will be broken. Draw your own conclusions. In the vent that your Python 2.x install will be fubar and suddenly stop working

Re: Anti-Aliasing in wxPython?

2007-05-19 Thread sturlamolden
On May 18, 8:20 pm, Alexander Dünisch <[EMAIL PROTECTED]> wrote: > i haven't found anything like this in wxPython yet. > Thanks wxPython uses native widgets, so it is OS dependent. You will have to turn it in Windows, MacOSX (on by default?) or GNOME. -- http://mail.python.org/mailman/listinfo

Re: Can't embed python in C++(Mingw[3.*] compiler)

2007-05-20 Thread sturlamolden
On May 19, 6:14 pm, Arjun Narayanan <[EMAIL PROTECTED]> wrote: > For thr program, > #include "E:\Python25\include\Python.h" Consider using #include "E:/Python25/include/Python.h" or #include "E:\\Python25\\include\\Python.h" instead. Or use #include and compile with -IE:/Python25/include

Re: writing to a file

2007-05-30 Thread sturlamolden
On May 30, 1:41 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > what i want to know is which one is faster (if there is any difference > > in speed) since i'm working with very large files. of course, if there > > is any other way to write data to a file, i'd lov

Re: writing to a file

2007-05-30 Thread sturlamolden
On May 30, 4:53 pm, sturlamolden <[EMAIL PROTECTED]> wrote: > import numpy > > byte = numpy.uint8 > desc = numpy.dtype({'names':['r','g','b'],'formats':[byte,byte,byte]}) > mm = numpy.memmap('myfile.dat', dtype

Re: writing to a file

2007-05-30 Thread sturlamolden
On May 30, 4:53 pm, sturlamolden <[EMAIL PROTECTED]> wrote: > However, numpy has a properly working memory mapped array class, > numpy.memmap. It seems that NumPy's memmap uses a buffer from mmap, which makes both of them defunct for large files. Damn. mmap must be fixe

Re: Why no maintained wrapper to Win32?

2007-07-29 Thread sturlamolden
On Jul 29, 1:29 am, Gilles Ganault <[EMAIL PROTECTED]> wrote: > Besides the total lack of documentation, You mean 'total lack of documentation' besides Mark Hammond's O'Reilly book on Windows programming in Python? Not to mention MSDN, Charles Petzold's book, and other sources of Win32 API and M

Re: Why no maintained wrapper to Win32?

2007-07-29 Thread sturlamolden
On Jul 30, 6:07 am, Gilles Ganault <[EMAIL PROTECTED]> wrote: > For people who don't konw the Win32 API and don't know C... is the > O'Reilly book above the best source of information on how to write > Win32 GUI apps in Python? Why inflict suffering on yourself with MFC when you can use wxPython

Re: Why no maintained wrapper to Win32?

2007-07-31 Thread sturlamolden
On Jul 31, 4:35 am, Gilles Ganault <[EMAIL PROTECTED]> wrote: > Because I'd like to avoid having to pack several MB + having to > install the toolkit. Considering the size of the typical Python > script, it seemed overkill. But you are happy to pack a Python runtime and PyWin32? This is really a

Re: python 3.0, pywin32 and scipy

2007-08-02 Thread sturlamolden
On Aug 2, 6:01 pm, vml <[EMAIL PROTECTED]> wrote: > - my script using pywin32 for the COM layer and scipy for the maths > won't work under 3.0 Why not? > - will we have the equivalent of pywin32 and scipy in python ? Say what? I've always thought pywin32 and scipy were Python packages. -- ht

Re: python 3.0, pywin32 and scipy

2007-08-02 Thread sturlamolden
On Aug 2, 10:53 pm, vml <[EMAIL PROTECTED]> wrote: > And I try to argue to give up vb 6 and use python. Either you have a valid argument for switching to Python or you do not. If you do not, there is not really any justification for the extra work (including teaching your staff Python). > C# is

Re: python 3.0, pywin32 and scipy

2007-08-02 Thread sturlamolden
On Aug 2, 10:53 pm, vml <[EMAIL PROTECTED]> wrote: > I hope it will be possible to switch easily to python 3. But I need to > produce something as cheap as possible and I have no means ... Python 3k is not released yet. Why do you worry about compatibility in advance? Well, you are not the only

Re: High performance binary data

2007-08-10 Thread sturlamolden
On Aug 10, 2:26 am, Steve <[EMAIL PROTECTED]> wrote: > I want to ready binary data from a udp socket effeciently as possible > in python. I know of the struct package but do people have any tips > when dealing with binary data in python? Is there a library or api > that is faster when dealing wit

Re: ctypes windll question

2007-08-15 Thread sturlamolden
On Aug 14, 11:45 am, Tzury <[EMAIL PROTECTED]> wrote: > I followed the tutorial about ctypes and I still cannot figure out how > to call a method of a calss within the dll. ctypes interfaces with C, not C++. C++ compilers do various forms of name manging, create virtual tables, etc. that are comp

Re: Can python threads take advantage of use dual core ?

2007-08-17 Thread sturlamolden
On Aug 17, 6:00 pm, nikhilketkar <[EMAIL PROTECTED]> wrote: > What are the implications of the Global Interpreter Lock in Python ? This is asked every second week or so. The GIL is similar to the Big Kernel Lock (BKL) use to support SMPs in older versions of the Linux kernel. The GIL prevents t

Re: Can python threads take advantage of use dual core ?

2007-08-17 Thread sturlamolden
On Aug 17, 6:00 pm, nikhilketkar <[EMAIL PROTECTED]> wrote: > What are the implications of the Global Interpreter Lock in Python ? This is asked every second week or so. The GIL is similar to the Big Kernel Lock (BKL) use to support SMPs in older versions of the Linux kernel. The GIL prevents t

Re: best GUI library for vector drawing program

2007-08-19 Thread sturlamolden
On Aug 17, 3:27 pm, chewie54 <[EMAIL PROTECTED]> wrote: > What would be the best cross-platform GUI library to use for a vector > based CAD program I suggest you use different toolkits for windowing (GUI widgets) and drawing the vector graphics. It does not really matter which toolkit you use fo

Re: strings (dollar.cents) into floats

2007-08-31 Thread sturlamolden
On 31 Aug, 02:12, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > I've heard (ok, read) that several times now and I understand the > argument. But what use is there for floats, then? When is it OK to use them? There are fractions that can be exactly represented by floats that cannot be exactl

Re: pyHook or SetWindowsHookEx

2007-03-03 Thread sturlamolden
On Mar 2, 7:01 pm, "abcd" <[EMAIL PROTECTED]> wrote: > :( The answer depends on which GUI library you use. E.g. if you use MFC there is an object called win32ui.PyCWnd that has methods for hooking key strokes. -- http://mail.python.org/mailman/listinfo/python-list

Re: what are Python equivalent to MATLAB persistent or C++ static?

2007-03-15 Thread sturlamolden
On Mar 15, 8:09 am, "dmitrey" <[EMAIL PROTECTED]> wrote: > Thank you in advance, > Dmitrey First, "static" can mean at least three different things in C++: static int myvar1; void foobar() { static int myvar2; } class foobar { static int myvar3; } I assume you are thinking about the seco

Re: Webcams and python

2007-03-18 Thread sturlamolden
On Mar 18, 3:41 pm, "Synt4x" <[EMAIL PROTECTED]> wrote: > The problem with adding a sleep() instrucction is that the "video > feed" looks lagged, if you know what I mean. It looks interrupted. You could try win32api.Sleep(0) instead, which will release the reminder of the time slice. -- http://

Re: Webcams and python

2007-03-18 Thread sturlamolden
On Mar 18, 8:01 pm, "Synt4x" <[EMAIL PROTECTED]> wrote: > I haven't been able to find the win32api extension, but i've read on > the web that time.sleep() calls win32api.Sleep(). I tested VideoCapture using PyGame to draw the graphics. PyGame wraps SDL which uses DirectDraw on Windows. I don't t

Re: Fortran vs Python - Newbie Question

2007-03-26 Thread sturlamolden
On Mar 26, 3:20 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I've been told that Both Fortran and Python are easy to read, and are > quite useful in creating scientific apps for the number crunching, but > then Python is a tad slower than Fortran because of its a high level > language natu

Re: Fortran vs Python - Newbie Question

2007-03-26 Thread sturlamolden
On Mar 26, 7:13 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Thanks you all for giving a little insight into what Python can > actually do, I think I've read enough to convince me that Python is > generally a very flexible, fast, powerful language that can be used in > a wide variety of ap

Re: Execute binary code

2007-01-10 Thread sturlamolden
Chris Mellon wrote: > This works fine if the binary data is "pure" asm, but the impresssion > the OP gave is that it's a compiled binary, which you can't just "jump > into" this way. You may have to offset the function pointer so the entry point becomes correct. -- http://mail.python.org/mailm

Re: Parallel Python

2007-01-10 Thread sturlamolden
robert wrote: > Thats true. IPC through sockets or (somewhat faster) shared memory - cPickle > at least - is usually the maximum of such approaches. > See > http://groups.google.de/group/comp.lang.python/browse_frm/thread/f822ec289f30b26a > > For tasks really requiring threading one can consid

Re: Parallel Python

2007-01-10 Thread sturlamolden
[EMAIL PROTECTED] wrote: >That's right. ppsmp starts multiple interpreters in separate > processes and organize communication between them through IPC. Thus you are basically reinventing MPI. http://mpi4py.scipy.org/ http://en.wikipedia.org/wiki/Message_Passing_Interface -- http://mail.p

Re: Parallel Python

2007-01-10 Thread sturlamolden
Nick Maclaren wrote: > as the ones that you have to play for threaded programs. Yes, I know > that it is a bit Irish for the best way to use a shared memory system > to be to not share memory, but that's how it is. Thank you for clearing that up. In any case, this means that Python can happily

Re: Newbie - converting csv files to arrays in NumPy - Matlab vs. Numpy comparison

2007-01-10 Thread sturlamolden
oyekomova wrote: > Thanks for your help. I compared the following code in NumPy with the > csvread in Matlab for a very large csv file. Matlab read the file in > 577 seconds. On the other hand, this code below kept running for over 2 > hours. Can this program be made more efficient? FYI - The csv

Re: Python - C# interoperability

2007-01-10 Thread sturlamolden
mc wrote: > Is there an easy way to compile a Python class (or set of classes) into > a .DLL that a C# program can call? Or otherwise to use an existing > library of Python classes from a C# program as seamlessly as possible? One way is to use IronPython if you don't need modules written for CPy

Re: Parallel Python

2007-01-11 Thread sturlamolden
robert wrote: > Thus communicated data is "serialized" - not directly used as with threads or > with custom shared memory techniques like POSH object sharing. Correct, and that is precisely why MPI code is a lot easier to write and debug than thread code. The OP used a similar technique in his

Re: What is a perl hash in python

2007-01-12 Thread sturlamolden
Karyn Williams wrote: > I am new to Pyton. I am trying to modify and understand a script someone > else wrote. I am trying to make sense of the following code snippet. I know > line 7 would be best coded with regex. I first would like to understand > what was coded originally. thelistOut looks lik

Re: Newbie - converting csv files to arrays in NumPy - Matlab vs. Numpy comparison

2007-01-13 Thread sturlamolden
oyekomova wrote: > Thanks to everyone for their excellent suggestions. I was able to > acheive the following results with all your suggestions. However, I am > unable to cross file size of 6 million rows. I would appreciate any > helpful suggestions on avoiding memory errors. None of the solutions

Re: Newbie - converting csv files to arrays in NumPy - Matlab vs. Numpy comparison

2007-01-13 Thread sturlamolden
oyekomova wrote: > Thanks for your note. I have 1Gig of RAM. Also, Matlab has no problem > in reading the file into memory. I am just running Istvan's code that > was posted earlier. You have a CSV file of about 520 MiB, which is read into memory. Then you have a list of list of floats, created b

Re: Threaded for loop

2007-01-14 Thread sturlamolden
John wrote: > I want to do something like this: > > for i = 1 in range(0,N): > for j = 1 in range(0,N): >D[i][j] = calculate(i,j) > > I would like to now do this using a fixed number of threads, say 10 > threads. Why do you want to run this in 10 threads? Do you have 10 CPUs? If you are con

<    1   2   3   4   5   6   7   8   >