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


Groups > comp.lang.python > #20529

Re: format a measurement result and its error in "scientific" way

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'attribute': 0.07; 'indeed,': 0.07; 'python': 0.08; 'argument,': 0.09; 'failing': 0.09; 'received:mail-lpp01m010-f46.google.com': 0.09; 'subject:error': 0.09; '16,': 0.15; "'int'": 0.16; 'skip:) 10': 0.16; 'subject:result': 0.16; '\xa0print': 0.16; 'cc:addr:python- list': 0.16; 'wrote:': 0.18; 'simpler': 0.18; 'thanks,': 0.19; '(which': 0.19; '(most': 0.21; 'header:In-Reply-To:1': 0.22; 'feb': 0.22; 'traceback': 0.24; 'convert': 0.25; 'cc:2**0': 0.26; 'subject:" ': 0.28; 'skip:" 30': 0.28; 'message- id:@mail.gmail.com': 0.29; 'fine.': 0.29; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'subject:format': 0.30; 'error': 0.30; 'version': 0.32; 'received:209.85.215.46': 0.32; 'thu,': 0.32; 'object': 0.33; 'daniel': 0.34; 'last):': 0.34; 'two': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'think': 0.38; 'should': 0.38; 'skip:\xa0 10': 0.39; 'received:209.85.215': 0.39; 'received:209': 0.39; 'results': 0.64; '26,': 0.73; 'subject:its': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=6AcKimo8RrdAv731VJZwRTNGoUFpaRYj9BoP7EP6U0M=; b=goEJ9lij/iufflg9Jg9Fw0/JvHsRwO44g39IVYpO0MHvkvXsAf2WEVH2hSr8scInrY KUg1LZ0dZPz/62M0zSdOkYUfBzU6bIF9hVFZz0r06i2JOdVbC8Qpt8Mm7bl29CzyPtC4 FV+HLSuZH9Y9fCJOnrTAuc9oRl4RZZeZiAU6U=
MIME-Version 1.0
In-Reply-To <CADjSo4S1h_ucy2io6LqZr158FSJJMF5tFMOaTecB4-AjVTBfSg@mail.gmail.com>
References <CADjSo4QhqgpXnd5wn=_cu_i=O15wTR8i-gAK=EbMsoggsZ+NQQ@mail.gmail.com> <CALwzidk=KX42EwZBe8jCJ9YQT_FNHG8GGU_ogNhtv7myBptSjQ@mail.gmail.com> <CADjSo4RpDwohyNFvudqTCX8vdOFd-sHMUZE0adkg6P=sU8jNwQ@mail.gmail.com> <CALwzidk2i40vAecq14f=_AeQM22CjQK-L_uf+44g7JHJYjxuPg@mail.gmail.com> <CADjSo4S1h_ucy2io6LqZr158FSJJMF5tFMOaTecB4-AjVTBfSg@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 16 Feb 2012 17:29:27 -0700
Subject Re: format a measurement result and its error in "scientific" way
To Daniel Fetchinson <fetchinson@googlemail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.5905.1329438598.27778.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1329438598 news.xs4all.nl 6912 [2001:888:2000:d::a6]:55934
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:20529

Show key headers only | View raw


On Thu, Feb 16, 2012 at 3:21 PM, Daniel Fetchinson
<fetchinson@googlemail.com> wrote:
> Thanks, it's simpler indeed, but gives me an error for value=1.267, error=0.08:
>
> Traceback (most recent call last):
>  File "/home/fetchinson/bin/format_error", line 26, in <module>
>    print format_error( sys.argv[1], sys.argv[2] )
>  File "/home/fetchinson/bin/format_error", line 9, in format_error
>    error_scale += error.scaleb( -error_scale ).to_integral(  ).adjusted(  )
>  File "/usr/lib64/python2.6/decimal.py", line 3398, in scaleb
>    ans = self._check_nans(other, context)
>  File "/usr/lib64/python2.6/decimal.py", line 699, in _check_nans
>    other_is_nan = other._isnan()
> AttributeError: 'int' object has no attribute '_isnan'
>
> Which version of python are you using?

2.7.1.  At a guess, it's failing because scaleb() (which was new in
2.6) is buggily expecting a decimal argument, but adjusted() returns an int.
Convert the results of the two adjusted() calls to decimals, and I
think it should be fine.

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


Thread

Re: format a measurement result and its error in "scientific" way Ian Kelly <ian.g.kelly@gmail.com> - 2012-02-16 17:29 -0700

csiph-web