, 2013 at 3:15 PM, Chris Angelico wrote:
> On Fri, Apr 26, 2013 at 7:36 PM, inshu chauhan
> wrote:
> >
> > On Fri, Apr 26, 2013 at 2:39 PM, Peter Otten <__pete...@web.de> wrote:
> >>
> >> f = open(...)
> >>
> >> in the code you are
On Fri, Apr 26, 2013 at 2:39 PM, Peter Otten <__pete...@web.de> wrote:
> inshu chauhan wrote:
>
> > I have this part of my code where I am trying to traverse over an image
> by
> > running a for loop for both x and y co-ordinate axis. But the loop is
> > termin
Hello everyone,
I have this part of my code where I am trying to traverse over an image by
running a for loop for both x and y co-ordinate axis. But the loop is
terminating by just reading first pixel. Can think of a reason why this is
happening ?
The code is:
for sy in xrange(0, segimage.height)
pr 23, 2013 at 12:33 PM, inshu chauhan wrote:
> zip isn't doing the required
>
>
> On Tue, Apr 23, 2013 at 12:28 PM, inshu chauhan wrote:
>
>> Yes Simultaneously means all three running at the same time, I looked up
>> zip just now, but will it not disturb my dicti
Thanks Gary.
>
> Be clearer about the problem please.
>
> Do you wish to produce a loop that:
> On pass 1, each of p,k, and t hold the first item of their respective
> lists, and
> on pass 2, each of p,k, and t hold the second item of their respective
> lists, and
> so on
> until one (or a
zip isn't doing the required
On Tue, Apr 23, 2013 at 12:28 PM, inshu chauhan wrote:
> Yes Simultaneously means all three running at the same time, I looked up
> zip just now, but will it not disturb my dictionaries ?
> And yes the dictionaries have same number of keys.
>
>
Yes Simultaneously means all three running at the same time, I looked up
zip just now, but will it not disturb my dictionaries ?
And yes the dictionaries have same number of keys.
thanks
On Tue, Apr 23, 2013 at 12:16 PM, Chris Angelico wrote:
> On Tue, Apr 23, 2013 at 4:40 PM, inshu chau
i have to implement the below line in one of my code:
for p in sorted(segments.iterkeys()) and for k in
sorted(class_count.iterkeys()) and for j in sorted(pixel_count.iterkeys()):
Its giving me a syntax error which is obvious, but how can I make all three
for loop run simultaneously or any other
Hello Everyone,
I am trying to work with lists and dictionaries together.
In the following code I have to access pixels in a segmented image through
a dictionary. But the problem is when I am trying to update the list
through dict it is giving me this error of tuple, ofcourse because list
indices
I have a prog in which a functions returns a dict but when I try to iterate
over the dict using iterkeys, It shows an error. I think its because only
address of the dictionary is returned so cannot be iterated upon.
Please suggest some way by which it can be made possible to iterate over
the dicti
Hello everyone,
Here in my part of the code where cc is a dictionary. I want to understand
what actually cc.iterkeys() and cc[k] actually doing.
I am already reading
http://docs.python.org/2/library/stdtypes.html#dict.items
and http://www.tutorialspoint.com/python/python_dictionary.htm but still
n
I have this program which is working with 2 dictionaries segments,
class_counts.. but I am getting an error mentioned below the programme.
import cv
from itertools import *
from math import floor, sqrt, ceil
from numpy import array, dot, subtract, add, outer, argmax, linalg as lin
def Computeseg
I am trying to create a dictionary with a key and its values seraching from
a data set. But something is going wrong. This is the first time I am
working with dicts.
My code is :
import cv
def Computesegclass(segimage):
num_pixel = 0
for y in xrange(0, segimage.height):
for x
On Wed, Feb 20, 2013 at 12:04 PM, Dave Angel wrote:
> On 02/20/2013 05:38 AM, inshu chauhan wrote:
>
>> On Wed, Feb 20, 2013 at 11:26 AM, Roland Koebler
>> wrote:
>>
>>
>>>
>>>
>>>
>>> If you only want to concat the files,
On Wed, Feb 20, 2013 at 11:38 AM, inshu chauhan wrote:
>
>
>
> On Wed, Feb 20, 2013 at 11:26 AM, Roland Koebler wrote:
>
>> Hi,
>>
>> On Wed, Feb 20, 2013 at 10:50:54AM +0100, inshu chauhan wrote:
>> > I have 10 simple text files with 3 columns x,y,z de
On Wed, Feb 20, 2013 at 11:26 AM, Roland Koebler wrote:
> Hi,
>
> On Wed, Feb 20, 2013 at 10:50:54AM +0100, inshu chauhan wrote:
> > I have 10 simple text files with 3 columns x,y,z delimited by "space". I
> am
> > trying to combine these 10 files to get a sin
I have 10 simple text files with 3 columns x,y,z delimited by "space". I am
trying to combine these 10 files to get a single text file.
Eg. of data in 10 files is
299 446 2
I had written this prog for merging files:
import csv
import glob
with open(r"C:\Users\inshu.chauhan\Desktop\test2.arff"
On Tue, Feb 19, 2013 at 4:54 PM, MRAB wrote:
> On 2013-02-19 15:27, inshu chauhan wrote:
>
>> Here is my attempt to merge 10 files stored in a folder into a single
>> file :
>>
>> import csv
>>
>> with open("C:\Users\inshu.chauhan\**Desktop\test.
Here is my attempt to merge 10 files stored in a folder into a single file :
import csv
with open("C:\Users\inshu.chauhan\Desktop\test.arff", "w") as w:
writer = csv.writer(w)
for f in glob.glob("C:\Users\inshu.chauhan\Desktop\For
Model_600\*.arff"):
rows = open(f, "r").readlines(
On Mon, Feb 11, 2013 at 3:22 PM, Dave Angel wrote:
> On 02/11/2013 06:00 AM, inshu chauhan wrote:
>
>> In the programme below I am trying to read two csv format files and
>> process
>> them and write a new file with some of theirs data.
>>
>> import csv
>
On Mon, Feb 11, 2013 at 2:02 PM, MRAB wrote:
> On 2013-02-11 12:44, inshu chauhan wrote:
>
>>
>> On Mon, Feb 11, 2013 at 1:26 PM, Steven D'Aprano
>>
>> <mailto:steve+comp.lang.**pyt...@pearwood.info>>
>> wrote:
>>
>> inshu cha
On Mon, Feb 11, 2013 at 1:26 PM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:
> inshu chauhan wrote:
>
> > In the programme below I am trying to read two csv format files and
> > process them and write a new file with some of theirs data.
>
In the programme below I am trying to read two csv format files and process
them and write a new file with some of theirs data.
import csv
f1_reader = csv.reader(open(r"Z:\Weka
work\Feature_Vectors_Fullset_00.arff"))
f2_reader = csv.reader(open(r"Z:\Weka
work\Feature_Vectors_Fullset_00_noxy+class.
On Tue, Feb 5, 2013 at 3:10 PM, Roy Smith wrote:
> In article ,
> inshu chauhan wrote:
>
> > Hello all,
> >
> > I am trying to run a small code of mine but I am getting a run time
> error.
> > What is actually meant by run time error ? it is saying to
Hello all,
I am trying to run a small code of mine but I am getting a run time error.
What is actually meant by run time error ? it is saying to contact
programme administrator something. Why one would get this error ? and how
to remove it ?
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Jan 30, 2013 at 2:23 PM, Dave Angel wrote:
> On 01/30/2013 05:43 AM, inshu chauhan wrote:
>
>> On Mon, Jan 28, 2013 at 6:05 PM, Dennis Lee Bieber > >wrote:
>>
>> On Mon, 28 Jan 2013 14:31:31 +0100, inshu chauhan
>>> declaimed the following in
>
On Mon, Jan 28, 2013 at 6:05 PM, Dennis Lee Bieber wrote:
> On Mon, 28 Jan 2013 14:31:31 +0100, inshu chauhan
> declaimed the following in
> gmane.comp.python.general:
>
> > In the code below I am trying to read 2 files f1 and f2 , extract some
> data
> > from them an
>>
>>
>>
> That's "zip" not "Zip"
>
> Have you tried looking at the docs? Or even typing help(zip) at the
> python interpreter prompt?
>
> In rough terms, zip takes one element (line) from each of the iterators,
> and creates a new list that holds tuples of those elements. If you use it
> in t
Your current logic tries to scan through the first file, and for each line
that has 12 elements, scans through the entire second file. It fails to
actually do it, because you never do a seek on the second file.
>
> Now it appears your requirement is entirely different. I believe you have
> two t
> In that case, Dave's suggestion to read into a list and iterate over
> the list is to be strongly considered. But I'm not entirely sure what
> your goal is here. Are you trying to make the Cartesian product of the
> two files, where you have one line in the output for each possible
> pair of matc
Yes Chris, I understand, My Original code was
for l in f1:
sp = l.split(",")
if len(sp)!= 12:
continue
else:
ix = sp[0].strip()
iy = sp[1].strip()
for s in f2:
st = s.split(",")
if len(st)!= 11:
continue
else:
In the code below I am trying to read 2 files f1 and f2 , extract some data
from them and then trying to write them into a single file that is 'nf'.
import cv
f1 = open(r"Z:\modules\Feature_Vectors_300.arff")
f2 = open(r"Z:\modules\Feature_Vectors_300_Pclass.arff")
nf = open(r"Z:\modules\trial.arf
Thanks a lot people.. :).. :)
On Thu, Jan 24, 2013 at 1:10 PM, Tobias M. wrote:
> Am 24.01.2013 13:02, schrieb Chris Angelico:
>
> On Thu, Jan 24, 2013 at 10:58 PM, Tobias M. wrote:
>>
>>> Chris Angelico wrote:
>>>
I'd not consider the performance, but the correctness. If you're
ex
a line break "\n" at the
> end.
> To remove those unwanted characters you could use the strip() function.
>
> So your code could be:
>
> if sp[9].strip() == sp[10].strip():
>
> print "Same class"
> else:
> print "Different class"
Here I have a code which basically reads a csv file, tries to compare the
last 2 items in each line of the file.
f = open(r"Z:\modules\Feature_Vectors_300_Pclass.arff")
for l in f:
sp = l.split(",")
if len(sp) != 11:
print >> of, l,
else:
#print sp[9], sp[10]
i
>
> if-else doesn't define a loop, but each of the for statements do.
>
> You have defined a classification for 8 of the possible colors, leaving
> millions of them undefined. If the first time through the loop you
> manage to hit one of those undefined ones, you'll have no value for
> classificat
In this code :
import cv
g = open("PointCloudmitClass.txt", "w")
image = cv.LoadImageM("Z:/modules/intensity_01.tif",
cv.CV_LOAD_IMAGE_UNCHANGED)
print image
for y in xrange(0,image.height):
for x in xrange(0,image.width):
color = image[y,x]
if color == (0.0,0.0,0.0):
I guess I have to use try and except as Chris suggested, this isn't working.
--
http://mail.python.org/mailman/listinfo/python-list
> >
> > def GenerateRing(x,y, N): Generates square rings around a point in data
> which has 300 columns(x) and 3000
> > rows(y)
> > indices = []
> > for i in xrange(-N, N):
> > indices.append((x+i, y-N))
> > indices.append((x+N, y+i))
> > indices.append((x-i, y+N))
>
>
> >
> >> Yes i tried "or" also but no use .
>
> Explain "no use". If you mean you still fail, then what else did you
> try? For example, did you try interchanging the two subscripts? I've
> suspected all along that the meanings of row and column, x and y, [0]
> and [1], height and width ar
I dont want error actually to come. With try nd except , the error will
come but without affecting my prog...
--
http://mail.python.org/mailman/listinfo/python-list
The catch to the approach suggested by Chris is that you DON'T want to
> break out of the whole loop when one value is out of range. You only
> want to skip that one point.
>
>
> Yes I want to skip only that one point (centre) but try and expect seems
to be the last option.. I would like to try o
>
>
> So did you read the following paragraphs? You should not be using "and"
> in that expression.
> Yes i tried "or" also but no use .
>
> >>
> >> You do not want "and" in that expression. The way you've coded it,
> >> it'll only skip items in which both indices are out of range. Change
> def GenerateRing(x,y, N): Generates square rings around a point in data
> > which has 300 columns(x) and 3000 rows(y)
> > indices = []
> > for i in xrange(-N, N):
> > indices.append((x+i, y-N))
> > indices.append((x+N, y+i))
> > indices.append((x-i, y+N))
> >
On Tue, Nov 20, 2012 at 3:00 PM, Chris Angelico wrote:
> On Wed, Nov 21, 2012 at 12:57 AM, inshu chauhan
> wrote:
> > I am using python 2.7.3 , so can it be done in that ?
>
> (Please don't top-post; just delete the couple of blank lines that
> gmail oh so kind
I am using python 2.7.3 , so can it be done in that ?
On Tue, Nov 20, 2012 at 2:48 PM, Chris Angelico wrote:
> On Wed, Nov 21, 2012 at 12:43 AM, inshu chauhan
> wrote:
> > I need help in this part as I am unable to device a method in which if
> the
> > points are out of
def distance(c, p):
dist = sqrt(
((c[0]-p[0])**2) +
((c[1]-p[1])**2) +
((c[2]-p[2])**2)
)
return dist
def GenerateRing(x,y, N): Generates square rings around a point in data
which has 300 columns(x) and 3000 rows(y)
indices = []
for
wrote:
> On 11/20/2012 07:31 AM, inshu chauhan wrote:
> > I did the following changes in this part of my programme.. now the
> > refereence error is removed but its showing me another error :
> >
> > def ComputeClasses(data):
> > radius = .5
> >
I did the following changes in this part of my programme.. now the
refereence error is removed but its showing me another error :
def ComputeClasses(data):
radius = .5
points = []
for cy in xrange(0, data.height):
for cx in xrange(0, data.width):
if data[cy,cx] ==
thanx ..I understand the problem now..
On Wed, Nov 14, 2012 at 7:48 PM, MRAB wrote:
> On 2012-11-14 15:18, inshu chauhan wrote:
>
>>
>> for this code m getting this error :
>>
>> CODE :
>> def ComputeClasses(data):
>> radius = .5
>> poi
for this code m getting this error :
CODE :
def ComputeClasses(data):
radius = .5
points = []
for cy in xrange(0, data.height):
for cx in xrange(0, data.width):
if data[cy,cx] != (0.0,0.0,0.0):
centre = data[cy, cx]
points.append(cent
No answers for my question ?? :O
--
http://mail.python.org/mailman/listinfo/python-list
Actually this one.. and its the last..
On Fri, Nov 9, 2012 at 2:59 PM, inshu chauhan wrote:
> Please Ignore the above two files attached,,, See this one
>
>
> On Fri, Nov 9, 2012 at 12:47 PM, inshu chauhan wrote:
>
>> I attached a wrong file...Right file is attached here
&
Please Ignore the above two files attached,,, See this one
On Fri, Nov 9, 2012 at 12:47 PM, inshu chauhan wrote:
> I attached a wrong file...Right file is attached here
>
>
> On Fri, Nov 9, 2012 at 11:53 AM, inshu chauhan wrote:
>
>>
>>
>>
>>
>>
I attached a wrong file...Right file is attached here
On Fri, Nov 9, 2012 at 11:53 AM, inshu chauhan wrote:
>
>
>
>
> http://www.ymlgroup.com/obscurehiddenlocation/downloads site, and
>> imported it using from notzanzibar import DataType.
>>
>
> No i haven
http://www.ymlgroup.com/obscurehiddenlocation/downloads site, and
> imported it using from notzanzibar import DataType.
>
No i haven't downloaded it.. and this site is not opening...
>
> Then you'd have instantiated it in some code like
> data = DataType(filename)
>
> and then the type of dat
Actually data is neither a zanzibar nor a class nor a list.. its a yml
image. with pixels
I am trying to access pixels of a 3D image through this programme..
On Tue, Nov 6, 2012 at 8:59 PM, woooee wrote:
> From this line, "data" appears to be a class
> if 0 < ix < data.width and 0 < iy <
I am getting this error while running my programme.. :
error: index is out of range
I cannot find a valid reason for it in my prog can somebody suggest what
may be possible reasons for this error..
The part of the code is :
def addpoints (data, points, ix, iy): # makes a list of relevant point
what is the difference between range and xrange.. both seem to work the
same. ? And which should be used where and in what situations.. ??
--
http://mail.python.org/mailman/listinfo/python-list
OK ..I got it..
On Thu, Nov 1, 2012 at 5:54 PM, Zero Piraeus wrote:
> :
>
> On 1 November 2012 11:32, inshu chauhan wrote:
> > what is the most pythonic way to do this :
> >
> >if 0 < ix < 10 and 0 < iy < 10 ???
>
> As everyon
On Thu, Nov 1, 2012 at 7:02 PM, Paul Rudin wrote:
> Zero Piraeus writes:
>
> > There aren't any rules about gmail (except the unwritten rule that to
> > be a "real" geek you need to use a mail client that takes a whole
> > weekend to configure, and another three years to properly understand).
>
what is the most pythonic way to do this :
if 0 < ix < 10 and 0 < iy < 10 ???
--
http://mail.python.org/mailman/listinfo/python-list
-- Forwarded message --
From: inshu chauhan
Date: Thu, Nov 1, 2012 at 1:26 PM
Subject: Re: python and Open cv
To: Mark Lawrence
I am sorry.. but I need to know what are the rules and what about gmail ??
Many people are using gmail to mail to the list.
On Thu, Nov 1, 2012 at
How to load a yml file in python and work with it ??
I used : import cv
data = cv.Load("Z:/data/xyz_0_
300.yml")
But when I print data.. it just gives the detail of the image like number
of rows and columns etc
I want read what is there in the pixel of the image..
I tried to
How to load a yml file in python and work with it ??
I used : import cv
data = cv.Load("Z:/data/xyz_0_300.yml")
But when I print data.. it just gives the detail of the image like number
of rows and columns etc
I want read what is there in the pixel of the image.. can somebody
On Thu, Oct 25, 2012 at 12:17 PM, David Hutto wrote:
> On Thu, Oct 25, 2012 at 6:12 AM, inshu chauhan
> wrote:
> >
> >
> > On Thu, Oct 25, 2012 at 12:04 PM, David Hutto
> > wrote:
> >>
> >> On Thu, Oct 25, 2012 at 5:58 AM, inshu chauhan
&g
On Thu, Oct 25, 2012 at 12:04 PM, David Hutto wrote:
> On Thu, Oct 25, 2012 at 5:58 AM, inshu chauhan
> wrote:
> > Yes Dave ..You are right and my problem is solved now.. Thanx to all...
> >
> >
> > On Thu, Oct 25, 2012 at 11:55 AM, David Hutto
> > wrote:
&g
Yes Dave ..You are right and my problem is solved now.. Thanx to all...
On Thu, Oct 25, 2012 at 11:55 AM, David Hutto wrote:
> On Thu, Oct 25, 2012 at 5:51 AM, inshu chauhan
> wrote:
> >
> >
> >>
> >> Is this what you mean:
> >>
> list_0 = []
> Is this what you mean:
>
> >>> list_1 = [i for i in range(0,5)]
> >>> list_2 = [i for i in range(5,11)]
> >>> for i in list_2:
> ... list_1.append(i)
> ...
> >>> list_1
> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>
>
> or would another example help you out more?
>
No but really sorry this is what I
>>
> >> or if the clist initial contents were relevant, perhaps you mean
> >>
> >>> clist += alist, blist
> >>
> >
> > But not this because it will simply concatenate the list like
> > [1,2,3,4,5,6] .. I dont want this actaully...
> >
> >>
>
> No, it won't. Try it to see
Ok but it should be cli
> > clist = alist, blist
>
This may work i guess becuase i want list within list [ [1,2,3] , [4,5,6]]
>
> or if the clist initial contents were relevant, perhaps you mean
>
> > clist += alist, blist
>
But not this because it will simply concatenate the list like
[1,2,3,4,5,6] .. I dont want thi
item
which should print:
[1,2,3]
[4,5,6]
On Tue, Oct 23, 2012 at 10:10 PM, inshu chauhan wrote:
> ok I got it guys...
>
>
> On Tue, Oct 23, 2012 at 10:08 PM, Joshua Landau <
> joshua.landau...@gmail.com> wrote:
>
>> On 23 October 2012 21:06, Joshua Landau wro
> the class is returning the list , and i want to append the list outside
the class... main problem is this
>
> What do you mean "the class is returning the list"? Do you mean that a
> class stores a list internally and you want to be able to mutate that list?
> Do you mean that you have a class m
-10-24, at 7:37 AM, inshu chauhan wrote:
> > I am having a problem,
> >
> > I have a class which return me a list. I want to append another list
> using this list outside the Class.
> > can i do it ? if yes how ?
> > And can i use Userlist function for this ??
&g
I am having a problem,
I have a class which return me a list. I want to append another list using
this list outside the Class.
can i do it ? if yes how ?
And can i use Userlist function for this ??
--
http://mail.python.org/mailman/listinfo/python-list
ok.. This was an example i was trying to run from
http://docs.python.org/tutorial/classes.html ...
On Wed, Oct 24, 2012 at 3:48 PM, Chris Angelico wrote:
> On Thu, Oct 25, 2012 at 12:02 AM, inshu chauhan
> wrote:
> > I changed the programme to this :
> > de
result is same as the number passed for
adding twice
On Wed, Oct 24, 2012 at 2:55 PM, Dave Angel wrote:
> On 10/24/2012 08:11 AM, inshu chauhan wrote:
> > I was just trying out a programme for learning classes in python
> >
> > The prog below is showing an error whi
I was just trying out a programme for learning classes in python
>>
>> The prog below is showing an error which it should not show :
>>
>> class Bag:
>> def __init__(self, x):
>> self.data = []
>>
>
> You do nothing with x here. Right so x shouldnot be in the argument.
>
Fine
*class
I was just trying out a programme for learning classes in python
The prog below is showing an error which it should not show :
class Bag:
def __init__(self, x):
self.data = []
def add(self, x):
self.data.append(x)
def addtwice(self, x):
self.add(x)
s
ok I got it guys...
On Tue, Oct 23, 2012 at 10:08 PM, Joshua Landau
wrote:
> On 23 October 2012 21:06, Joshua Landau wrote:
>
>> On 23 October 2012 21:03, Joshua Landau wrote:
>>
>>> On 23 October 2012 12:07, Jean-Michel Pichavant
>>> wrote:
>>>
- Original Message -
> Th
Thankyou.. but my problem is different than simply joining 2 lists and it
is done now :)
On Tue, Oct 23, 2012 at 11:38 AM, Joshua Landau
wrote:
> On 23/10/2012, inshu chauhan wrote:
> > can we append a list with another list in Python ? using the normal
> routine
> > syn
-- Forwarded message --
From: Zero Piraeus
Date: Tue, Oct 23, 2012 at 11:14 AM
Subject: Re: can we append a list with another list in Python ?
To: inshu chauhan
:
On 23 October 2012 05:01, inshu chauhan wrote:
> this is because this makes a single list out of 2 lists.. bu
I am new to python and have a little problem to solve .. i have an
array with x, y, z co-ordinates in it as a tuple. I am trying to find
the distance between each point and sorting the points according to
the min distance.. i have tried a prog but m stuck bcoz of this error
which I am unable to cor
in this prog I have written a code to calculate teh centre of a given 3D data..
but i want to calculate it for every 3 points not the whole data, but
instead of giving me centre for every 3 data the prog is printing the
centre 3 times...
import cv
from math import floor, sqrt, ceil
from numpy imp
84 matches
Mail list logo