Re: [Python] merge 2 file in python

2011-02-09 Per discussione Marco Dalla Stella
Il 08 febbraio 2011 14:07, Enrico Franchi enrico.fran...@gmail.com ha scritto:
 Marco Beri wrote:
 http://www.lessicografia.it/MERGERENon va benissimo però... Vuoi
 'tuffare' due file?
 No, credo che l'idea sia monkey-patchare il dizionario... ;)
  
Very bad habit!

-- 
Marco Dalla Stella
web: http://thediracsea.org
twitter: http://twitter.com/kra1iz3c
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


[Python] vtkClipPolyData

2011-02-09 Per discussione mariagrazia.madas...@libero.it
Hello,

I have a 3D portion of kidney: a membrane and cells on its surface.
What I have to do is to determine the area of competence of each cells, that
is to calculate the points of the surface nearer to each cells and then
determine the value of the area formed of these points.
Cells, obviously, are a group of points.
I have calculated the barycentre of each cells and I have calculated the
distance between barycentres and points of surface.
I have created a list called 'ids' with an id for each points of surface; the
id refers to the barycentre nearer to the point.
Example: ids = [ 0, 0, 0, 1, 1, 0, 1, 0, 0, 2, 1, 1, ]  length(ids)=number
of points of surface
Then I have created an array that permits to associate a different color to
each id. In paraview I can visualize the surface with the areas of competence
of each cells with differents color.

I have done a test with one barycentre.
I have create a new list called 'ids_new' and I have associated to the points
nearer to the barycentre 0 id 0 and to the other points id 1.
In Paraview I have apllied the Clip filter with a scalar between 0 and 1,
which gives only the points with id 0 and with the filter integrateVariables I
have found the value of the area.

Now, I need to do this thing many time because I have 4 surfaces and about 200
cells for each surface.
So I think the best way is to do that by python code.

I'm not so practice of python and vtk so I ask you an help.
How can I insert in my code the part of vtkClipPolyData? I have some errors. I
can't find the way to say to the code to use a scalar instead of a function.

And then, is there any way to calculate the area from the code?
Better, is there any way to do what Paraview does with the IntegrateVariables
in python code?


Thank's 
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


Re: [Python] merge 2 file in python

2011-02-09 Per discussione Giovanni Marco Dall'Olio
va bene, grazie per aver condiviso la soluzione. (anche se a dire la veritá,
non riesco a trovare questo pypatch su Internet)

se vuoi un consiglio, la prossima volta che fai una domanda in una mailing
list, fai qualche esempio di quello che vuoi fare. Per esempio, le prime
righe dei file che vuoi unire e il risultato che ti aspetti.
Ci sono centinaia di modi diversi per 'unire' due files, è impossibile
risponderti se non spieghi meglio :-)



2011/2/8 Michele Gatti mgsoluzi...@gmail.com

 Scusatemi mi sono confuso un attimo, intendevo che avendo 2 file di codice
 python devo creare un unico file.
 Ho risolto con uno script fatto in python che si chiama pypatch.

 Grazie

 --

 Michele Gatti

 MG Soluzioni Informatiche



 ___
 Python mailing list
 Python@lists.python.it
 http://lists.python.it/mailman/listinfo/python




-- 
Giovanni Dall'Olio, phd student
Department of Biologia Evolutiva at CEXS-UPF (Barcelona, Spain)

My blog on bioinformatics: http://bioinfoblog.it
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


Re: [Python] merge 2 file in python

2011-02-09 Per discussione Enrico Franchi

Marco Dalla Stella wrote:

No, credo che l'idea sia monkey-patchare il dizionario...;)

   
Very bad habit!


Hey, non e' colpa mia se non hanno inserito ne hooks ne hanno progettato 
l'interfaccia per DIP! ;)



--
.
..: -enrico-

___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


[Python] PyCon 2011 news - going strong, sign up today!

2011-02-09 Per discussione Brian Curtin
Hello group!

PyCon 2011 looks like it may very well break every single record in the past
-
making it one of the biggest and best PyCons of all time. We've gone all out
this year - including Extreme Talks, a Startup Row, amazing talks,
tutorials,
Poster sessions.

Extreme talks:
http://us.pycon.org/2011/speaker/extreme/
Startup Row:
http://us.pycon.org/2011/blog/2011/01/19/announcing-startup-row-pycon-2011/

Also just announced - Startup Stories:
http://us.pycon.org/2011/blog/2011/02/07/pycon-2011-announcing-startup-stories/

If you haven't bought your PyCon tickets, it's time to do so. This year
we're
limited to 1500 attendees, and with a faster than average sales rate
compared
to previous years, you may not have the luxury of leaving registration until
just before the conference -- places may sell out in advance! Check out
http://us.pycon.org/2011/tickets/ for rates and details.

Not sold on the conference? Not sure what it's all about? We are confident
this
year's conference will surpass anything that has gone before, and we think
there's something for everyone.

Looking for education? This year's tutorial selection features a range of
topics and an all-star cast of presenters. From the cloud to the GUI, from
beginner to advanced, we have it. Check out courses taught by book authors
Wesley Chun and David Beazley, web framework master Jacob Kaplan-Moss, core
developer and guru Raymond Hettinger, hacker extraordinaire Zed Shaw and
many
more: http://us.pycon.org/2011/schedule/tutorials/ -- and at flat fees that
wouldn't buy you an hour of training by less-qualified instructors
elsewhere!

The conference talks are some of the best we've seen in years, coming from a
record number of submissions. We've got talks on using Python for airplane
tuning and massive telescopes. All of the major web frameworks will be
discussed. Numerous databases are covered. PyPy, IronPython and Jython are
in.
We'll be talking about IDEs, testing, security, scalability, and
documentation.
Have a look: http://us.pycon.org/2011/schedule/lists/talks/

We've also got an amazing array of poster presentations - everything from
Arduino hacking, Geospatial Python, Open Government and Microsoft Kinect
hacking. Check out: http://us.pycon.org/2011/schedule/lists/posters/

Meanwhile we've got the awesome sprints  (http://us.pycon.org/2011/sprints/
),
and open spaces (http://us.pycon.org/2011/openspaces/) everyone knows and
loves.

This is shaping up to be the best PyCon yet, and we think it's a great
value,
both cost-wise, and community-wise. We can guarantee that you'll come away
with
a head full of knowledge and amazing new friends and contacts.

Get your tickets before they are gone: http://us.pycon.org/2011/tickets/

If you have any questions, comments or concerns - feel free to email Van
Lindberg (v...@python.org) or Jesse Noller (jnol...@python.org) or
pycon-organizers (pycon-organiz...@python.org).

See you in Atlanta,

Van Lindberg
Jesse Noller
The entire PyCon 2011 team
http://us.pycon.org/2011
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


[Python] Conversione tupla in intero

2011-02-09 Per discussione Nicola Ferrari
Buonasera a tutti..
Domanda probabilmente stupida.. avendo una tupla (1,2,3,4,5,6,7),
come posso creare un intero formato dagli elementi della tupla?
(nell'esempio della tupla sopra, 1234567)?

Se ho una tupla di stringhe posso usare .join per concatenarli, ma nel
caso di un intero??
Grazie
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


Re: [Python] Conversione tupla in intero

2011-02-09 Per discussione Marco Beri
2011/2/9 Nicola Ferrari nick.fe...@gmail.com

 Buonasera a tutti..
 Domanda probabilmente stupida.. avendo una tupla (1,2,3,4,5,6,7),
 come posso creare un intero formato dagli elementi della tupla?
 (nell'esempio della tupla sopra, 1234567)?

 Se ho una tupla di stringhe posso usare .join per concatenarli, ma nel
 caso di un intero??
 Grazie


int(.join(map(str, (1,2,3,4,5,6,7

Ciao.
Marco.

-- 
http://thinkcode.tv/gratis - Capire in 15 minuti cosa può fare Python
http://stacktrace.it - Aperiodico di resistenza informatica
http://python.thinkcode.tv - Videocorso di Python
http://beri.it - Blog di una testina di vitello
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


Re: [Python] Conversione tupla in intero

2011-02-09 Per discussione Nicola Ferrari
Beata ignoranza [?]
Grazie marco

Il giorno 09 febbraio 2011 22:57, Marco Beri marcob...@gmail.com ha
scritto:



 2011/2/9 Nicola Ferrari nick.fe...@gmail.com

 Buonasera a tutti..
 Domanda probabilmente stupida.. avendo una tupla (1,2,3,4,5,6,7),
 come posso creare un intero formato dagli elementi della tupla?
 (nell'esempio della tupla sopra, 1234567)?

 Se ho una tupla di stringhe posso usare .join per concatenarli, ma nel
 caso di un intero??
 Grazie


 int(.join(map(str, (1,2,3,4,5,6,7

 Ciao.
 Marco.

 --
 http://thinkcode.tv/gratis - Capire in 15 minuti cosa può fare Python
 http://stacktrace.it - Aperiodico di resistenza informatica
 http://python.thinkcode.tv - Videocorso di Python
 http://beri.it - Blog di una testina di vitello



 ___
 Python mailing list
 Python@lists.python.it
 http://lists.python.it/mailman/listinfo/python




-- 
Nicola Ferrari
website: http://www.nicolaferrari.name

skype: nick.ferro
33F.gif___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


Re: [Python] Conversione tupla in intero

2011-02-09 Per discussione Andrea Ambu
Se la tupla si chiamasse `a`:

intero = sum(i*10**n for n, i in enumerate(a[::-1]))

2011/2/9 Nicola Ferrari nick.fe...@gmail.com:
 Buonasera a tutti..
 Domanda probabilmente stupida.. avendo una tupla (1,2,3,4,5,6,7),
 come posso creare un intero formato dagli elementi della tupla?
 (nell'esempio della tupla sopra, 1234567)?

 Se ho una tupla di stringhe posso usare .join per concatenarli, ma nel
 caso di un intero??
 Grazie

 ___
 Python mailing list
 Python@lists.python.it
 http://lists.python.it/mailman/listinfo/python





-- 
Andrea
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


Re: [Python] Conversione tupla in intero

2011-02-09 Per discussione Lorenzo Sutton

Ciao

Marco Beri wrote:



2011/2/9 Nicola Ferrari nick.fe...@gmail.com 
mailto:nick.fe...@gmail.com


Buonasera a tutti..
Domanda probabilmente stupida.. avendo una tupla (1,2,3,4,5,6,7),
come posso creare un intero formato dagli elementi della tupla?
(nell'esempio della tupla sopra, 1234567)?

Se ho una tupla di stringhe posso usare .join per concatenarli,
ma nel caso di un intero??
Grazie


int(.join(map(str, (1,2,3,4,5,6,7

o anche (molto simile ma usando le List Comprehensions [1])...

int (''.join ([(str(x)) for x in (1,2,3,4,5,6,7)]))

Super-*criptic*-fragilisti-chespiralidoso :)

Lorenzo

[1] http://docs.python.org/tutorial/datastructures.html#list-comprehensions


Ciao.
Marco.

--
http://thinkcode.tv/gratis - Capire in 15 minuti cosa può fare Python
http://stacktrace.it - Aperiodico di resistenza informatica
http://python.thinkcode.tv - Videocorso di Python
http://beri.it - Blog di una testina di vitello



___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


Re: [Python] Conversione tupla in intero

2011-02-09 Per discussione Marco Mariani
2011/2/9 Andrea Ambu andrea...@gmail.com


 intero = sum(i*10**n for n, i in enumerate(a[::-1]))


 reduce(lambda x, y: x*10+y, [2,3,5,7,8,3])
235783
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python