Embedding matplotlib into page GUI builder

2006-01-21 Thread Madhusudan Singh
After a successful but problematic experience with the QT Designer + python combo, I decided that I needed something simpler (read completely in python) for my lab applications with python linux-gpib bindings. I am looking at PAGE, which while not pretty, seems simple and fast to work with. How do

Re: Converting 2bit hex representation to integer ?

2005-10-19 Thread Madhusudan Singh
Madhusudan Singh wrote: > Larry Bates wrote: > >> Can you give us an example. I don't know what two bit >> hex means (takes at least 4 bits to make a hex digit). > > Like 64(base 16)=100. > I am referring to 64 in the above. > >> >> Now I'm

Re: Converting 2bit hex representation to integer ?

2005-10-19 Thread Madhusudan Singh
Larry Bates wrote: > Can you give us an example. I don't know what two bit > hex means (takes at least 4 bits to make a hex digit). Like 64(base 16)=100. I am referring to 64 in the above. > > Now I'm going to try to guess: > > If the data is binary then all you need to do is to > use the str

Converting 2bit hex representation to integer ?

2005-10-19 Thread Madhusudan Singh
Hi I am using binascii.b2a_hex to convert some binary data to hex. The result is a two bit hex representation (i. e., without the leading 0x). How do I convert the resulting two bit representation into an integer ? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: List of strings to list of floats ?

2005-10-17 Thread Madhusudan Singh
Erik Max Francis wrote: > Madhusudan Singh wrote: > >> Thanks. Now, a slightly more complicated question. >> >> Say I have two lists of floats. And I wish to generate a list of floats >> that is a user defined function of the two lists. > > result = [sqrt

Re: List of strings to list of floats ?

2005-10-17 Thread Madhusudan Singh
Steve Holden wrote: > Madhusudan Singh wrote: >> [EMAIL PROTECTED] wrote: >> >> >>>Madhusudan> Is it possible to convert a very long list of strings to >>>a Madhusudan> list of floats in a single statement ? >>> >>>Mad

Re: List of strings to list of floats ?

2005-10-17 Thread Madhusudan Singh
[EMAIL PROTECTED] wrote: > > Madhusudan> Is it possible to convert a very long list of strings to a > Madhusudan> list of floats in a single statement ? > > Madhusudan> I have tried float(x) and float(x[:]) but neither work. I > Madhusudan> guess I would have to write a loop if t

List of strings to list of floats ?

2005-10-15 Thread Madhusudan Singh
Is it possible to convert a very long list of strings to a list of floats in a single statement ? I have tried float(x) and float(x[:]) but neither work. I guess I would have to write a loop if there isn't a way. -- http://mail.python.org/mailman/listinfo/python-list

Re: Length of read in in python-gpib

2005-10-15 Thread Madhusudan Singh
Further, if I use 131072 (2^17) as the length, I get an error : Traceback (most recent call last): File "takedata.py", line 74, in ? x=sr.querytrca(srs,1,0,4000,131072) File "/home/labmonkey/code/oledpmt/sr830.py", line 62, in querytrca trca=sr.read(n) File "/usr/lib/python2.3/site-p

Length of read in in python-gpib

2005-10-15 Thread Madhusudan Singh
python-gpib provides Gpib.py (see end of post) for Linux. I am trying to use the method called read. I usually use it without arguments (the default length being 512). However, I am trying to read in a string with some 16,000 comma separated floating point numbers. So, I have to pass a length par

Reading IEEE 754 format strings directly into a floating point array

2005-10-14 Thread Madhusudan Singh
I am querying an instrument in a measurement application. The values are returned as IEEE format binary floating point numbers. There are 4 bytes per point. Multiple points are not separated by any delimiter. Is it possible to read these directly into a floating point array of the size of the str

Re: Force flushing buffers

2005-10-12 Thread Madhusudan Singh
Robert Wierschke wrote: > Madhusudan Singh schrieb: >> Hi >> >> I have a python application that writes a lot of data to a bunch >> of files >> from inside a loop. Sometimes, the application has to be interrupted and >> I find that a lot of

Re: Force flushing buffers

2005-10-12 Thread Madhusudan Singh
[EMAIL PROTECTED] wrote: > > Madhusudan> How do I flush the buffer and force python to write the > Madhusudan> buffers to the files ? I intend to put this inside the > loop. > > f = open("somefile", "w") > f.write("foo") > f.flush() > > Skip Thanks !! -- http://mail.python.org/mai

Force flushing buffers

2005-10-06 Thread Madhusudan Singh
Hi I have a python application that writes a lot of data to a bunch of files from inside a loop. Sometimes, the application has to be interrupted and I find that a lot of data has not yet been writen (and hence is lost). How do I flush the buffer and force python to write the buffers to t

End or Identify (EOI) character ?

2005-09-17 Thread Madhusudan Singh
Hi I was wondering how does one detect the above character. It is returned by an instrument I am controlling via GPIB. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Equivalent for an internal write in Python ?

2005-09-01 Thread Madhusudan Singh
Hi I am looking to write a formatted string to a string variable : Say I have 1.067e-01, I need to write 106.700 to some string. In Fortran 95, this would be accomplished with a : character(len=7) :: stringvar real :: stringval ... write(stringvar,'(f7.3)') stringval How does one do somethin

Re: Precise timings ?

2005-08-31 Thread Madhusudan Singh
Fernando Perez wrote: > Madhusudan Singh wrote: > >> Madhusudan Singh wrote: >> >>> Hi >>> >>> I am using time.clock() to get the current time of the processor in >>> seconds. For my application, I need really high resolution but currently

Re: Problem with string -> int conversion ?

2005-08-31 Thread Madhusudan Singh
Fredrik Lundh wrote: >> The code is : >> >> void Form3::getNPrange() >> { > > what language is this? Its python embedded in the designer workflow. pyuic extracts stuff from it, and generates a python script from the ui.h file. > > if the callback code is Python, you should be able to add a pr

Problem with string -> int conversion ?

2005-08-30 Thread Madhusudan Singh
Hi I am working with an application that I designed with the Designer > pyuic workflow and I get the following error on trying to process the contents of a combobox : Traceback (most recent call last): File "measure.py", line 908, in acquiredata np=self.getNPrange() File "measure.py", li

Re: Precise timings ?

2005-08-30 Thread Madhusudan Singh
Bengt Richter wrote: > windows or unix? time.time and time.clock seem to reverse roles as > best-resolution time sources depending on which platform. > Linux. time.time() seems to report (using %e to format the o/p) a fixed number of the order ~1e9. > If you have a pentium with a rdtsc instru

Re: Precise timings ?

2005-08-30 Thread Madhusudan Singh
Madhusudan Singh wrote: > Hi > > I am using time.clock() to get the current time of the processor in > seconds. For my application, I need really high resolution but currently > seem to be limited to 0.01 second. Is there a way to specify the > resolution (say 1-10 microsecon

Precise timings ?

2005-08-30 Thread Madhusudan Singh
Hi I am using time.clock() to get the current time of the processor in seconds. For my application, I need really high resolution but currently seem to be limited to 0.01 second. Is there a way to specify the resolution (say 1-10 microseconds) ? My processor is a 1.4 MHz Intel processor. Surely, i

Re: Testing for presence of arguments

2005-08-18 Thread Madhusudan Singh
Peter Maas wrote: >> Thanks for the suggestion, but seems needlessly complicated for > > something very simple. > > What is "very simple"? The problem or the solution? :) If you examine The form of the solution. > this suggestion more closely you will note that it is more or less > the same as

Re: Testing for presence of arguments

2005-08-17 Thread Madhusudan Singh
Diez B. Roggisch wrote: > I still don't see why default arguments like None won't do the trick. > If The argument _can_ > be some value (let's say an int) or None, you still could go for a > default value like () or any other value > from a different domain. "None" works perfectly. Someone else o

Re: Testing for presence of arguments

2005-08-17 Thread Madhusudan Singh
Peter Decker wrote: > On 8/17/05, Madhusudan Singh <[EMAIL PROTECTED]> wrote: > >> I know how to set optional arguments in the function definition. Is there >> an intrinsic function that determines if a certain argument was actually >> passed ? Like the fortran

Re: Testing for presence of arguments

2005-08-17 Thread Madhusudan Singh
Dan Sommers wrote: > On Wed, 17 Aug 2005 11:13:03 -0400, > Madhusudan Singh <[EMAIL PROTECTED]> wrote: > >> I know how to set optional arguments in the function definition. Is >> there an intrinsic function that determines if a certain argument was >> actu

Re: Testing for presence of arguments

2005-08-17 Thread Madhusudan Singh
Benji York wrote: > Madhusudan Singh wrote: >> I know how to set optional arguments in the function definition. Is there >> an intrinsic function that determines if a certain argument was actually >> passed ? Like the fortran 95 present() logical intrinsic ? > > People

Re: Testing for presence of arguments

2005-08-17 Thread Madhusudan Singh
Diez B. Roggisch wrote: > I don't have the details ready - but in the ASPN cookbook are recipes > to e.g. figure insied a function f out how many results the caller of f > expects - and act accordingly. This boils down to inspect the > call-stack. So it ceratinly is possible. > > However, I'd say

Testing for presence of arguments

2005-08-17 Thread Madhusudan Singh
Hi I know how to set optional arguments in the function definition. Is there an intrinsic function that determines if a certain argument was actually passed ? Like the fortran 95 present() logical intrinsic ? My required functionality depends on whether a certain argument is specified at all. (Se

Dynamic autoscaling of axes with pyqwt ?

2005-08-14 Thread Madhusudan Singh
How does one enable dynamic autoscaling of the axes ? I am using setAxisAutoScale in an application which acquires data, and when the application ends, I do get correctly autoscaled axes, but not while the measurement is in progress. -- http://mail.python.org/mailman/listinfo/python-list

Re: Standalone applications ?

2005-08-14 Thread Madhusudan Singh
TPJ wrote: >> I should have added that my platform is Linux. > > In this case you shouldn't bother yourself with executables. Python is > available on any major distribution. > > My Python apps are available as pyc files for Linux (and for those > Windows users, who have Python installed) and as

Re: Standalone applications ?

2005-08-13 Thread Madhusudan Singh
Paolo Alexis Falcone wrote: > On Sat, 13 Aug 2005 23:29:27 -0400, Madhusudan Singh wrote: > >> Hi >> >> I just finished developing an application using Qt Designer in Python >> that uses pyqwt, gpib, etc. How does one create standalone executables >

Standalone applications ?

2005-08-13 Thread Madhusudan Singh
Hi I just finished developing an application using Qt Designer in Python that uses pyqwt, gpib, etc. How does one create standalone executables for applications such as these ? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using globals with classes

2005-08-13 Thread Madhusudan Singh
Scott David Daniels wrote: > Madhusudan Singh wrote: >> I am using qwtplot to display a running plot : >> > The way I'd normally accomplish this is to separate the setup and use > by defining a class: > How would one enable dynamic autoscaling of the axes ?

Re: Using globals with classes

2005-08-12 Thread Madhusudan Singh
Many thanks for an excellent solution to the problem and clearing up my mind about globals. In some sense, Python globals seem to be a little like the COMMON statement in the old Fortran 77 standard. -- http://mail.python.org/mailman/listinfo/python-list

Using globals with classes

2005-08-11 Thread Madhusudan Singh
Hi I am relatively new to Python. I am using Qt Designer to create a UI for a measurement application that I use. Everything seems to be clear but the use of globals (defined in the module that is generated using pyuic, that contains the form class). I am using qwtplot to display a running plot

Supressing argument renaming in the Qt Designer -> pyuic workflow

2005-08-11 Thread Madhusudan Singh
Hi Some of the functions I defined inside Qt Designer need to have some values passed to them. For instance : Code : void Form3::runningplot(n,plottitle,xname,x,y1name,y1,y2name,y2) is translated by pyuic to Python code : def runningplot(self,a0,a1,a2,a3,a4,a5,a6,a7): Now, while I understa

Re: Embedding a runtime graph in Qt3 designer generated UI

2005-08-09 Thread Madhusudan Singh
Phil Thompson wrote: >> 2. In the same vein, how does one embed a runtime plot in a qt3 UI ? It >> will >> need to be a python solution since I am using python libraries to acquire >> the data. > > Have a look at PyQwt which is a set of Python bindings for the Qt-based > Qwt plotting library. >

pyuic and Qt Designer plugins

2005-08-09 Thread Madhusudan Singh
Hi I managed to compile and install the FileChooser plugin (.so file) in /usr/share/qt3/plugins/designer and use it in my form in Designer. Then I tried to use pyuic which generated the .py code from the ui file. An attempt to execute the python file quits with : Traceback (most recent call last

Adding custom widgets to Qt Designer

2005-08-08 Thread Madhusudan Singh
Hi I am trying to add a QwtPlot widget to Qt Designer. I have both PyQwt and libqwt installed. I first tried to add a Custom Widget from /usr/include/qwt/qwt_plot.h as QwtPlot. But I do not know what slot to add. If I add the widget so created, and double click on it, I am asked

Embedding a runtime graph in Qt3 designer generated UI

2005-08-07 Thread Madhusudan Singh
Hi Two questions : 1. Is it possible to use an import command in a qt3 designer code ? (I know that it is possible to write python inside the braces -- but is it possible to use an import command for some rather large libraries I wrote that I need to access ?). 2. In the same vein, how does one

Re: Optional assignments ?

2005-08-07 Thread Madhusudan Singh
Robert Kern wrote: > Madhusudan Singh wrote: >> Hi >> >> Is it possible to have something like : >> >> a,b,c,d=fn(that returns 10 return values) ? > > a,b,c,d = fn()[:4] > Thanks ! -- http://mail.python.org/mailman/listinfo/python-list

Optional assignments ?

2005-08-07 Thread Madhusudan Singh
Hi Is it possible to have something like : a,b,c,d=fn(that returns 10 return values) ? -- http://mail.python.org/mailman/listinfo/python-list

Chopping off spaces at both ends

2005-08-07 Thread Madhusudan Singh
Hi I am a newbie to python and am using it to interface some of my lab equipment. How does one get rid of spaces at both ends of a string ? A little like the trim() intrinsic in fortran 95. One of my instruments is returning a string that has one or more blanks in it, a

Re: GUI programming, embedding, real time plots, etc.

2005-08-05 Thread Madhusudan Singh
[EMAIL PROTECTED] wrote: > apt-get install python-pwm > this will get you python mega widgets > one of the dependencies that apt will take care of for you is the > python2.whatever-tk. > depending on which version of debian you are using. > i run sarge with python 2.3 Thanks for the help. I trie

Point and click GUI builder for Python

2005-08-05 Thread Madhusudan Singh
Is there such a thing for python ? Like Qt Designer for instance ? -- http://mail.python.org/mailman/listinfo/python-list

GUI programming, embedding, real time plots, etc.

2005-08-05 Thread Madhusudan Singh
Hi I am still a rookie at python (can do some basic programming with the language), and have been using python gpib and matplotlib to control my instruments and do real time plots. Since I have more than one instrument to control, I was thinking of writing a GUI using Tkinter (looked at Page, but