Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31716

pls help me with this prog

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <insideshoes@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; '__name__': 0.07; 'subject:help': 0.07; 'received:mail-qc0-f174.google.com': 0.09; 'teh': 0.09; 'def': 0.10; "'__main__':": 0.16; 'add,': 0.16; 'dot,': 0.16; 'numpy': 0.16; 'prog': 0.16; 'math': 0.20; 'to:name :python-list@python.org': 0.20; 'written': 0.20; 'import': 0.21; 'message-id:@mail.gmail.com': 0.27; 'points': 0.29; 'code': 0.31; 'print': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'data,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'subject:with': 0.36; 'received:209': 0.37; 'received:209.85.216': 0.37; 'data': 0.37; 'instead': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'floor,': 0.65; 'subject:this': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=S7Se9NrajxjM1JGjYRUuPPqo1auwQTPwEqsAsIc0LsQ=; b=qYoKTzbWgBOlyWRcB2/OIrgYF64a+goYtJpOJmk4QvkodOr0IlO3umI4b2OieyyCZQ pHDKfS0lPlp3hu4BIpmPMS4T+WGemYxXwMKK5iisTqxxmIqTrrCF9orsss80djMg/ZQN op5k9cHdNPxCBLdZdhpC0Bubcq68pIMqwgMLXYkHFoFN1SgZhuekUDYoPSW5+lakYr7V h7tj7kxLmx9yQXa+W/XqtloPRa85EEYbT6CuYxQh7MJVQA1bt8GT9oi2WVNKny2Ft6zk IfIFTiQu/Bie9G5Cl6OG6/G4my21FTGiICiHktTKtM0KZRYG6yiQat16YLtIbIZagUzs F7Uw==
MIME-Version 1.0
Date Fri, 19 Oct 2012 10:40:40 +0200
Subject pls help me with this prog
From inshu chauhan <insideshoes@gmail.com>
To "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2495.1350636042.27098.python-list@python.org> (permalink)
Lines 52
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1350636042 news.xs4all.nl 6958 [2001:888:2000:d::a6]:35282
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:31716

Show key headers only | View raw


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 import array, dot, subtract, add, linalg as lin




def CalcCentre(data):
    centre = array([0,0,0])
    count = 0
    n = 0
    for p in data[n:n+3]:
        centre = add(centre, array(p[:3]))
        count += 1
        centre = dot(1./count, centre)
        return centre
    n += 1
def ReadPointCloud(filename):
    f = open(filename)
    result = []
    for l in f:
        sp = l.split()
        t = tuple(map(float, sp[1:4]))
        result.append(t)
    return result

def main (data):


    j = 0
    for  i in data[:3]:
        while j != 3:
         centre = CalcCentre(data)
         j += 1
         print centre


if __name__ == '__main__':
    data = ReadPointCloud(r'Z:\data\NEHreflectance_Scanner 1_part.txt')

main(data)




PLS HELP ;;;;

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

pls help me with this prog inshu chauhan <insideshoes@gmail.com> - 2012-10-19 10:40 +0200
  Re: pls help me with this prog rusi <rustompmody@gmail.com> - 2012-10-19 06:06 -0700
  Re: pls help me with this prog Tim Roberts <timr@probo.com> - 2012-10-20 19:33 -0700
  Re: pls help me with this prog 88888 Dihedral <dihedral88888@googlemail.com> - 2012-10-21 01:09 -0700
  Re: pls help me with this prog 88888 Dihedral <dihedral88888@googlemail.com> - 2012-10-21 01:09 -0700

csiph-web