[Tutor] correlation matrix

2007-07-21 Thread Beanan O Loughlin
hi all,

I am new to python, and indeed to programming, but i have a question 
regarding correlation matrices.

If i have a column vector

x=[1;2;3;4;5]

and its transpose row vector

xt=[1,2,3,4,5]

is there a simple way in python to create a 5x5 correlation matrix, 
obviously symmetric and having 1's on the diagonal?

Thank you very much in advance,

B.

_
Get the ultimate real-time chat experience - Windows Live Messenger! 
http://get.live.com/en-ie/messenger/overview

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] web browser

2007-07-21 Thread max baseman
has anyone ever written a web browser with python and Tkinter? if so  
is there any documentation on it? if not does anyone know if their  
which tutorials i should read if i wanted to write one for my apple?

i don't know vary much Tkinter so i was going to start there
then i thought i would be using the urllib and urllib2 modules which  
i know a little about
know i don't know how i would display the html i can get the html of  
any site with urllib but how to show it in Tkinter?

if anyone knows of tutorials for any of those, or has any ideas thank  
you
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] web browser

2007-07-21 Thread Kent Johnson
max baseman wrote:
> has anyone ever written a web browser with python and Tkinter? if so  
> is there any documentation on it? if not does anyone know if their  
> which tutorials i should read if i wanted to write one for my apple?
> 
> i don't know vary much Tkinter so i was going to start there
> then i thought i would be using the urllib and urllib2 modules which  
> i know a little about
> know i don't know how i would display the html i can get the html of  
> any site with urllib but how to show it in Tkinter?

There was a project to develop a Python web browser, called Grail, but 
it is long dead.

wxPython has support for displaying HTML, that might be a better place 
to start than Tkinter.

I don't know what your goal is, if it is just to learn and play then go 
for it, but if you are a beginning programmer and seriously thinking 
about creating a full-featured web browser...well, you should probably 
take on something smaller first.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] correlation matrix

2007-07-21 Thread Terry Carroll
On Sat, 21 Jul 2007, Beanan O Loughlin wrote:

> I am new to python, and indeed to programming, but i have a question 
> regarding correlation matrices.

Beanan,

I never did get this kind of math, but have you looked at Numerical 
Python (NumPy), http://numpy.scipy.org/numpydoc/numpy.html ?  Every time 
I've heard a question about matrices, it seems the answer ends up in there 
somewhere.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] correlation matrix

2007-07-21 Thread Noufal Ibrahim
Beanan O Loughlin wrote:
> hi all,
> 
> I am new to python, and indeed to programming, but i have a question 
> regarding correlation matrices.
> 
> If i have a column vector
> 
> x=[1;2;3;4;5]
> 
> and its transpose row vector
> 
> xt=[1,2,3,4,5]
> 
> is there a simple way in python to create a 5x5 correlation matrix, 
> obviously symmetric and having 1's on the diagonal?

My knowledge of matrix algebra and statistics is quite rusty but from a 
programming perspective, I'd understand this like so.

You want a 5x5 table of values (correlations in this case) computed from 
all permutations of 2 variables selected from a set of 5 elements.

so, you'd want something like
cor(1,1)   cor(1,2)   cor(1,3) 
cor(2,1)   cor(2,2)   cor(2,3) ...
.
.
.
Correct?


If so, I think this might be what you're looking for (I've put some 
comments to make it explanatory).

 >>> import Numeric
 >>> x=[1,2,3]
 >>> ret = []
 >>> for i in x:
...  ret1=[]
...  for j in x:  # Since we're correlating an array with itself.
...   ret1.append((i,j,))  # You'd need to call the actual correlation 
function here rather than just say (i,j)
...  ret.append(ret1)
...
 >>> Numeric.array(ret)
array([[[1, 1],
 [1, 2],
 [1, 3]],
[[2, 1],
 [2, 2],
 [2, 3]],
[[3, 1],
 [3, 2],
 [3, 3]]])
 >>>

The "Numeric"  module has fast implementations of matrices and other 
such constructs.
I'm quite sure that this thing which I've written above can be improved 
on but I think it would do your work for you.


-- 
~noufal
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python program design

2007-07-21 Thread Terry Carroll
On Fri, 20 Jul 2007, Doug Glenn wrote:

> I have a question on program design.  The program will be a catalog of
> portable media (DVD, CD, flash drive, floppy, etc).  I am currently in the
> preliminary stages of design and I currently would like to get input on what
> the best method would be for initially gathering the data and what format it
> should take.

Doug, I'd be interested in talking more about this.  As it happens, I'm in 
the process of doing the same thing.  

Mine's going to be centered around SQLite, and when I get the DB part 
done, using wxPython for the GUI.

For myself, I'll use it for cataloging three kinds of data collections:  
audio (MP3, etc.); images (JPG, GIF, PNG, BMP, etc.); and videos (MPG,
AVI, etc).  I plan on having the DB be extensible with separate auxiliary
tables describing attributes specific to the type of file the database
pertains to. For example, for an MP3 database, it will store the length of
the song, and perhaps certain ID3 data.  For an image database, the image
height and width.

I'm just finishing up the design and am about to start writing some code.  
The design I have so far is the database schema and the API to the module.
I'd be happy to share some of my design ideas with you if you like.

Once I have even a version up and running, I'm thinking of putting it up 
somewhere under an open source license, in case someone else can use it, 
and to get the benefits of anyone else's contributions, if any.

I currently use Elcom's Advanced Disk Catalog for my cataloging.  I'm 
switching to a homegrown version for a few reasons.  First, ADC does not 
do anything media-specific, such as I described above.  Although 
there are some open-source databases that do, they're all specific 
to a particular type of file, i.e., either MP3 or image, but not 
either/both.  

Second, I plan on storing the files' checksums, to be able to check
whether a file I have is already duplicated in the library, without having
to mount the disks.  

Third, I think it would just be a fun project, and a way to start into
both SQLite and wxPython (it's my first project using either).

Caveat: I'm no longer a programmer, and have two baby girls who take most 
of my spare time, so I am proceeding very slowly on this.  It's just a 
hobby.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] IDLE connection - was IDLE Usage

2007-07-21 Thread Sara Johnson
I am setting up an Xming/XWindows (forwarding?) and I followed what was 
instructed.  When I got ready to connect, it all looked okay, but then I got 
this message.

 'Warning: Missing charsets in String to FontSet conversion'

Anyone know?

Thanks,
Sara


- Original Message 
From: Robert H. Haener IV <[EMAIL PROTECTED]>
To: Sara Johnson <[EMAIL PROTECTED]>
Cc: Python 
Sent: Tuesday, July 17, 2007 1:49:19 PM
Subject: Re: [Tutor] IDLE Usage - was Interpreter Restarts


Sara Johnson wrote:
> That's pretty much what I was attempting.  I was advised to mark the
> "Tunneling" box (TunnelingX11 Connections), and it's checked.  I don't
> see the X Forwarding option, however.  Under that same tab I checked for
> anything else system-wise that would pertain and I don't see anything. 
> Again, I have XWin32 installed, but I probably need to renew it or
> somehow get it to work as you've described.  Anything else I should check?
>  
>>>For example, I worked on this basic Unix editor 'Pico' before I
> learned I could switch to Vi and >>have
> Sorry...I meant to say "Putty" not Pico...  Not important, just clarifying.
>  
> Thanks,
> Sara

I have never attempted to use X Forwarding in Windows, but here is a guide that 
seems to tell you all you need to know:

http://www.math.umn.edu/systems_guide/putty_xwin32.html

>>From what I can gather, you should contact whomever is in charge of the SSH 
>>server if you can't get GUI programs working after following that guide.

Also, just so we don't end up massively confusing each other:

PuTTy is your "SSH client."
The server to which you are connecting is the "SSH server."
Pico and Vim are examples of "text editors," which are sometimes called "UNIX 
editors" by Windows folks.


-Robert
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


   

Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, 
photos & more. 
http://mobile.yahoo.com/go?refer=1GNXIC___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to determine if every character in one string is in another string?

2007-07-21 Thread Alan Gauld

"Terry Carroll" <[EMAIL PROTECTED]> wrote

> Basically, I have a string s, and I want to print it out only if 
> every
> character in it is printable

Here is my attempt...

def isPrintable(s)
import string
return not filter(lambda c: c not in string.printable, s)

But thats very similar to your LC version just slightly more
readable - to me at least!

Alan G.
Just back from a weeks vacation :-)



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to determine if every character in one string is inanother string?

2007-07-21 Thread Alan Gauld

"Jerry Hill" <[EMAIL PROTECTED]> wrote 

> I like this one:
> all(char in string.printable for char in testString)

What is all?
Is that a 2.5 thing (I'm still on 2.4 here)

 testString = "qwerty\buiop"
 all(char in string.printable for char in testString)
> False
> 
> -- 
> Jerry
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] IDLE connection - was IDLE Usage

2007-07-21 Thread Robert H. Haener IV
Sara Johnson wrote:
> I am setting up an Xming/XWindows (forwarding?) and I followed what was
> instructed.  When I got ready to connect, it all looked okay, but then I
> got this message.
>  
>  'Warning: Missing charsets in String to FontSet conversion'
>  
> Anyone know?
>  
> Thanks,
> Sara

Sounds like you're missing some fonts, but that's just a guess.  I will look it 
up further later tonight/tomorrow morning, I'm in the midst of a Thin Man 
marathon.


-Robert
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] IDLE connection - was IDLE Usage

2007-07-21 Thread Sara Johnson
Okay, carry on then.  :-)

Still haven't figured it out either and I've tried reloading it.


- Original Message 
From: Robert H. Haener IV <[EMAIL PROTECTED]>
To: Sara Johnson <[EMAIL PROTECTED]>
Cc: Python 
Sent: Saturday, July 21, 2007 9:04:52 PM
Subject: Re: [Tutor] IDLE connection - was IDLE Usage


Sara Johnson wrote:
> I am setting up an Xming/XWindows (forwarding?) and I followed what was
> instructed.  When I got ready to connect, it all looked okay, but then I
> got this message.
>  
>  'Warning: Missing charsets in String to FontSet conversion'
>  
> Anyone know?
>  
> Thanks,
> Sara

Sounds like you're missing some fonts, but that's just a guess.  I will look it 
up further later tonight/tomorrow morning, I'm in the midst of a Thin Man 
marathon.


-Robert
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


   

Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor