Regex url

2011-01-15 Thread Jean-Francois
Hi,

I try to match the following url with one regex

/hello
/hello/
/hello/world
/hello/world/


world is a variable, I can put toto instead

Thanks !
-- 
http://mail.python.org/mailman/listinfo/python-list


New instance of a class : not reset?

2011-01-20 Thread Jean-Francois
Hi,

In the following example, I don't understand why attribute 'data' is
not reset when I get the new instance of Bag
It works if I make a copy (data[:]) but I want to understand why

Thanks


class Bag(object):
def __init__(self, data = []):
self.data = data
#self.data = data[:]
def add(self, x):
self.data.append(x)

bag = Bag()
print bag.data
bag.add('toto')
print bag.data
bag = Bag()  # new instance of Bag, all attributes clear?
print bag.data   # 'toto' is still there !!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New instance of a class : not reset?

2011-01-24 Thread Jean-Francois
Great thank you
-- 
http://mail.python.org/mailman/listinfo/python-list


Real time plot

2007-10-03 Thread Jean-Francois Canac
I am reading a large amount of data from a COM port (or from a file) at a
rate of 20 records per second. It is about positioning of a vehicle on a
race track. 

In each record we have time, position (lat and long) speed, course all from
GPS equipment. I would like to Produce a graph in real time with these
records to see the  vehicle moving on the track. The goal is to study the
vehicle performance and to always have its position, the application would
run around 24 hours.

 

I would like to write the application in Python and I am wondering which
plot interface would be the more appropriate, I have seen matplotlib, but I
do not know how to make real time applications with big amount of data. Is
hippodraw more suited to this use or an other interface?

Many thanks

jfc

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Real time plot

2007-10-04 Thread Jean-Francois Canac

"Hendrik van Rooyen" <[EMAIL PROTECTED]> a écrit dans le message de news: 
[EMAIL PROTECTED]
> Jean-Francois Canac  wrote:
>
>>I am reading a large amount of data from a COM port (or from a file) at a 
>>rate
> of 20 records per second. It is about >positioning of a vehicle on a race 
> track.
>>In each record we have time, position (lat and long) speed, course all 
>>from GPS
> equipment. I would like to Produce a >graph in real time with these 
> records to
> see the  vehicle moving on the track. The goal is to study the vehicle
>>performance and to always have its position, the application would run 
>>around
> 24 hours.
> >
>>I would like to write the application in Python and I am wondering which 
>>plot
> interface would be the more appropriate, I >have seen matplotlib, but I do 
> not
> know how to make real time applications with big amount of data. Is 
> hippodraw
> more >suited to this use or an other interface?
>>Many thanks
>
> I would draw dots on a suitably sized Tkinter canvas, after drawing a 
> schematic
> of the race track (laborious).
>
> 20 per second will be no problem, provided the machine is half decent.
>
> What is the speed at which the com port runs?
>
> - Hendrik
>
The com port run at 19.2 kb/s.
My pb is more the real time aspect: to see the plot changing in real time 
than the com aspect as the installation is already running with programs in 
c++.
The PC on which it is running is good enought
For me the interest is to migrate all taht on python to be able to make fast 
changes when it is of interest
Jean-Francois
> 


-- 
http://mail.python.org/mailman/listinfo/python-list

Please Help me

2007-10-05 Thread Jean-Francois Canac
I am very new in Python and I would like to write an application which takes
records from a COM port (or from a file to replay) and draw a real time
Plot.

 

But I am confused I have looked at Matplotlib, and a little at hippodraw, I
have seen that there are many plot interfaces . But I really don’t know
which I should take for producing plot with data coming from a steam



Please could you help?

 

Many thanks

Jean-François 

 

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Real time plot

2007-10-05 Thread Jean-Francois Canac

"Lawson Hanson" <[EMAIL PROTECTED]> a écrit dans le message de 
news: [EMAIL PROTECTED]
> Nicholas Bastin wrote:
>> On 10/4/07, Jean-Francois Canac <[EMAIL PROTECTED]> wrote:
>>> [EMAIL PROTECTED]
>>>> I would draw dots on a suitably sized Tkinter canvas, after drawing a
>>>> schematic
>>>> of the race track (laborious).
>>>>
>>>> 20 per second will be no problem, provided the machine is half decent.
>>>>
>>>> What is the speed at which the com port runs?
>>>>
>>>> - Hendrik
>>>>
>>> The com port run at 19.2 kb/s.
>>> My pb is more the real time aspect: to see the plot changing in real 
>>> time
>>> than the com aspect as the installation is already running with programs 
>>> in
>>> c++.
>>> The PC on which it is running is good enought
>>> For me the interest is to migrate all taht on python to be able to make 
>>> fast
>>> changes when it is of interest
>>
>> The success of this will have more to do with design than programming
>> language.  Any GUI toolkit which allows partial screen updates can be
>> made to update at least as fast as your screen refresh rate, even in
>> python.
>>
>> --
>> Nick
>
> If you are using Tkinter (probably a very good choice), just remember
> to make periodic (i.e., once per I/O processing loop) calls to:
>
> Tkinter.update_idletasks()
>
> which will update the display window, etc.
>
> Regards,
>
> Lawson
>
Finally I tried this coding and it works
#==
import time
import pylab

pylab.ion()

lat,long,vit = pylab.load(r"c:\pytst\test1.txt",usecols=(1,2,3), 
unpack=True)
lat_min=pylab.amin(lat)
lat_max=pylab.amax(lat)
long_min=pylab.amin(long)
long_max=pylab.amax(long)

print "start"


timefig = pylab.figure(1)
timesub = pylab.subplot(111)
x=[]
y=[]


lines = pylab.plot(x,y)
print lat_min,lat_max,long_min,long_max

for i in range(len(lat)):
 x.append(long[i])
 y.append(lat[i])
 lines[0].set_data(x,y)
 timesub.set_xlim(long_min,long_max)
 timesub.set_ylim(lat_min,lat_max)
 pylab.draw()

#
The kind of data I have in the text file are just below
Now I have two problems, I think my coding is not very clean as when I try 
yo close or manipulate the windows it generates an error
secondly I think it is a bit slow. I would much prefer something quicker and 
to be able to adapt the speed dynamically with a sleep instruction or 
something as that

09:25:08.50 46.863930 3.161866 56.9 Km/h
09:45:07.75 46.863907 3.161786 11.5 Km/h
09:45:08.0 46.863914 3.161794 12.4 Km/h
09:45:08.25 46.863918 3.161804 13.4 Km/h
09:45:08.50 46.863922 3.161814 14.5 Km/h
09:45:08.75 46.863930 3.161825 15.4 Km/h
09:45:09.0 46.863934 3.161837 16.1 Km/h
09:45:09.25 46.863941 3.161848 16.6 Km/h
09:45:09.50 46.863945 3.161861 17.1 Km/h
09:45:09.75 46.863953 3.161874 17.3 Km/h


-- 
http://mail.python.org/mailman/listinfo/python-list