Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# cogent.maths.stats.special.fix_rounding_error

All Samples(42)  |  Call(34)  |  Derive(0)  |  Import(8)

```"""
from __future__ import division
from cogent.maths.stats.special import erf, erfc, igamc, igam, betai, log1p, \
expm1, SQRTH, MACHEP, MAXNUM, PI, ndtri, incbi, igami, fix_rounding_error,\
ln_binomial
```
```    See Cephes docs for details.
"""
x = fix_rounding_error(x)
if x < 0:
raise ValueError, "chi_low: x must be >= 0 (got %s)." % x
```
```    See Cephes docs for details.
"""
x = fix_rounding_error(x)

if x < 0:
```
```    See Cephes docs for details.
"""
p = fix_rounding_error(p)
if (p < 0) or (p > 1):
raise ValueError, "Binomial p must be between 0 and 1."
```
```    See Cephes docs for details.
"""
p = fix_rounding_error(p)
if (p < 0) or (p > 1):
raise ValueError, "Binomial p must be between 0 and 1."
```

```"""
from __future__ import division
from cogent.maths.stats.special import erf, erfc, igamc, igam, betai, log1p, \
expm1, SQRTH, MACHEP, MAXNUM, PI, ndtri, incbi, igami, fix_rounding_error,\
ln_binomial
```
```    See Cephes docs for details.
"""
x = fix_rounding_error(x)
if x < 0:
raise ValueError, "chi_low: x must be >= 0 (got %s)." % x
```
```    See Cephes docs for details.
"""
x = fix_rounding_error(x)

if x < 0:
```
```    See Cephes docs for details.
"""
p = fix_rounding_error(p)
if (p < 0) or (p > 1):
raise ValueError, "Binomial p must be between 0 and 1."
```
```    See Cephes docs for details.
"""
p = fix_rounding_error(p)
if (p < 0) or (p > 1):
raise ValueError, "Binomial p must be between 0 and 1."
```

```from cogent.util.misc import extract_delimited
from cogent.maths.stats.util import Freqs
from cogent.maths.stats.special import fix_rounding_error

__author__ = "Rob Knight"
```
```        """
# all values have to be between 0 and 1
a = fix_rounding_error(self.X)
c = fix_rounding_error(self.Y)
g = fix_rounding_error(self.Z)
#u = fix_rounding_error(1-a-c-g)
if is_essentially(1, a+c+g, round_error=round_error):
u = 0.0
else:
u = fix_rounding_error(1-a-c-g)
```

```from cogent.util.misc import extract_delimited
from cogent.maths.stats.util import Freqs
from cogent.maths.stats.special import fix_rounding_error

__author__ = "Rob Knight"
```
```        """
# all values have to be between 0 and 1
a = fix_rounding_error(self.X)
c = fix_rounding_error(self.Y)
g = fix_rounding_error(self.Z)
#u = fix_rounding_error(1-a-c-g)
if is_essentially(1, a+c+g, round_error=round_error):
u = 0.0
else:
u = fix_rounding_error(1-a-c-g)
```

```from numpy import array, cross, pi, cos, arccos as acos
from cogent.util.array import norm
from cogent.maths.stats.special import fix_rounding_error

class DihedralGeometryError(Exception): pass
```
```        "Cannot calculate angle for vectors with length zero")
cosine = scalar(v1,v2)/length_product
angle = acos(fix_rounding_error(cosine))
return angle

```

```from __future__ import division
from cogent.maths.stats.util import Freqs, Numbers, UnsafeFreqs
from cogent.maths.stats.special import fix_rounding_error
from cogent.util.array import euclidean_distance
from cogent.util.misc import Delegator, FunctionWrapper, InverseDict
```
```        result = cls()
x,y,z = coords
u = fix_rounding_error((1-x-y-z)/-2)
a, c, g = z-u, x-u, y-u
result['A'] = a
```

```from numpy import array, cross, pi, cos, arccos as acos
from cogent.util.array import norm
from cogent.maths.stats.special import fix_rounding_error

class DihedralGeometryError(Exception): pass
```
```        "Cannot calculate angle for vectors with length zero")
cosine = scalar(v1,v2)/length_product
angle = acos(fix_rounding_error(cosine))
return angle

```

```from __future__ import division
from cogent.maths.stats.util import Freqs, Numbers, UnsafeFreqs
from cogent.maths.stats.special import fix_rounding_error
from cogent.util.array import euclidean_distance
from cogent.util.misc import Delegator, FunctionWrapper, InverseDict
```
```        result = cls()
x,y,z = coords
u = fix_rounding_error((1-x-y-z)/-2)
a, c, g = z-u, x-u, y-u
result['A'] = a
```