Re: newbie question structure of function

2008-03-13 Thread nodrogbrown
> > > resultname=""" > > > That starts a string literal. > > i am not sure if this is the right way..i used it in case > matchdistance < threshold return False.then the filename will not be > taken from the filenameslist and so returns as an empty string. >a one-tuple why not use None instea

Re: problem with join

2008-03-07 Thread nodrogbrown
> If the string is only used to open a file, and never shown to the user, > what you prefer is irrelevant, isn't it? guess thats right.. > Back to your code, try this: > > from os.path import join, normpath > folder = 'F:/brown/code/python/fgrp1' > names = ['amber1.jpg', 'amber3.jpg', 'amy1.jpg

problem with join

2008-03-07 Thread nodrogbrown
hi i am using python on WinXP..i have a string 'folder ' that i want to join to a set of imagefile names to create complete qualified names so that i can create objects out of them folder='F:/brown/code/python/fgrp1' filenms=['amber1.jpg', 'amber3.jpg', 'amy1.jpg', 'amy2.jpg'] filenameslist=[] for

Re: getting values from cache

2008-01-25 Thread nodrogbrown
also if i were to write unit test for this method ,how shd i do it? shd i be checking all values in the matrix created inside and so on? gordon -- http://mail.python.org/mailman/listinfo/python-list

getting values from cache

2008-01-25 Thread nodrogbrown
hi i am writing code to check a folder containing images and then process thir vals using PIL and do some calc to create a matrix of values .if the folder has any new imgs added the program will do all calc again and dump the values into a cachefile.If the folder contents remain unaltered the progr

Re: eucledian dist calculations

2008-01-25 Thread nodrogbrown
sorry..the last post didn't appear! > Are you sure? What happens if the vector with the smallest > sum(distance) is the first one? > initially i will set imgindex =0 so if the first one is of smallest sum..,the image will be reteived by imgindex 0 > (a) Can't you replace the inner loop with

Re: eucledian dist calculations

2008-01-21 Thread nodrogbrown
> > 1. 'temp' is not used > 2. Lose the superfluous parentheses in 'if' statements > 3. Put space around operators > 4. I've never used any of numpy & friends, but: > (a) Can't you replace the inner loop with something like this: >distance = abs(input_weight - weights[image, :]) > (b) I doubt

eucledian dist calculations

2008-01-20 Thread nodrogbrown
hi i am using python to do some image data calculations..I use the following numpy.ndarrays ,(i have given their shapes and ranks) weights=ndarray :shape(100,30),ndim=2 will have vals like 2458121847.49 (of type 'numpy.float64') input_weight=ndarray :shape(30,),ndim=1 (similar to above but diff

newbie doubt ..numpy array

2008-01-20 Thread nodrogbrown
if this is too silly a qn pls forgive I was learning numpy.ndarrays thru the tutorial. myarr=numpy.array( [ [10, 20, 30, 40],[1,2,3,4],[5,6,7,8] ] ) if i want to access the element 3 i can do it by myarr[1, 2] but then myarr[1][2] will also give the same result..is there any reason why two types