[SciPy-user] [Timeseries] Linux installation error

josef.pktd@gmai... josef.pktd@gmai...
Thu Apr 2 20:14:34 CDT 2009


On Thu, Apr 2, 2009 at 8:21 PM, Christiaan Putter
<ceputter@googlemail.com> wrote:
> Ok, just tested the code you sent me and it works just fine  (had to
> kill numpy 1.2 though)
>
> Some simple copy / pastable examples would be great to get new users
> (that's me) going :-)
>
> Quick question:
>
> Is there any possibility to use python's decimal data type?  I saw you
> used it in your sql example on the database side, but I'm guessing
> numpy doesn't allow for this?  I sometimes have problems with equality
> testing after several divisions / multiplications, so at the moment I
> revert to the "is kind of" instead of the "is equal to" approach of
> comparison...
>

for floating point comparison it is better to use something like

numpy.allclose(a, b, rtol=1.0000000000000001e-05, atol=1e-08)
numpy.ma.allclose(a, b, masked_equal=True,
rtol=1.0000000000000001e-05, atol=1e-08, fill_value=None)

Returns True if two arrays are element-wise equal within a tolerance.
absolute(a - b) <= (atol + rtol * absolute(b))

instead of equal,

Josef


More information about the SciPy-user mailing list