Skip to content

Commit

Permalink
remove remaining pyerf references
Browse files Browse the repository at this point in the history
  • Loading branch information
cgevans committed Feb 2, 2024
1 parent b00f5ec commit 9c4e30c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
27 changes: 20 additions & 7 deletions src/scikits/bootstrap/bootstrap.py
Expand Up @@ -66,36 +66,49 @@

def _ncdf_py(x: float) -> float:
return 0.5 * (1 + cast(float, erf(x / s2)))
ncdf = np.vectorize(_ncdf_py, [float])


ncdf = np.vectorize(_ncdf_py, [float])

# fmt: off
def nppf(p):
p = np.asarray(p)
out = np.empty_like(p, dtype=float)
ix1 = (p < 0.02425) & (p > 0)
oix1 = np.sqrt(-2 * np.log(p[ix1]))
out[ix1] = (
(((((-7.784894002430293e-03 * oix1 - 3.223964580411365e-01) * oix1 - 2.400758277161838e00) * oix1 - 2.549732539343734e00) * oix1 + 4.374664141464968e00) * oix1 + 2.938163982698783e00)
/ ((((7.784695709041462e-03 * oix1 + 3.224671290700398e-01) * oix1 + 2.445134137142996e00) * oix1 + 3.754408661907416e00) * oix1 + 1)
(((((-7.784894002430293e-03 * oix1 - 3.223964580411365e-01) * oix1
- 2.400758277161838e00) * oix1 - 2.549732539343734e00) * oix1
+ 4.374664141464968e00) * oix1 + 2.938163982698783e00)
/ ((((7.784695709041462e-03 * oix1 + 3.224671290700398e-01) * oix1
+ 2.445134137142996e00) * oix1 + 3.754408661907416e00) * oix1 + 1)
)

ix2 = (0.02425 <= p) & (p <= 0.97575)
oix2 = (p[ix2] - 0.5)
sq = oix2 * oix2
out[ix2] = (
(((((-3.969683028665376e01 * sq + 2.209460984245205e02) * sq - 2.759285104469687e02) * sq + 1.383577518672690e02) * sq - 3.066479806614716e01) * sq + 2.506628277459239e00) * oix2
) / (((((-5.447609879822406e01 * sq + 1.615858368580409e02) * sq - 1.556989798598866e02) * sq + 6.680131188771972e01) * sq - 1.328068155288572e01) * sq + 1)
(((((-3.969683028665376e01 * sq + 2.209460984245205e02) * sq
- 2.759285104469687e02) * sq + 1.383577518672690e02) * sq
- 3.066479806614716e01) * sq + 2.506628277459239e00) * oix2
) / (((((-5.447609879822406e01 * sq + 1.615858368580409e02) * sq
- 1.556989798598866e02) * sq + 6.680131188771972e01) * sq
- 1.328068155288572e01) * sq + 1)

ix3 = (p > 0.97575) & (p < 1)
oix3 = np.sqrt(-2 * np.log(1 - p[ix3]))
out[ix3] = -(
(((((-7.784894002430293e-03 * oix3 - 3.223964580411365e-01) * oix3 - 2.400758277161838e00) * oix3 - 2.549732539343734e00) * oix3 + 4.374664141464968e00) * oix3 + 2.938163982698783e00)
/ ((((7.784695709041462e-03 * oix3 + 3.224671290700398e-01) * oix3 + 2.445134137142996e00) * oix3 + 3.754408661907416e00) * oix3 + 1)
(((((-7.784894002430293e-03 * oix3 - 3.223964580411365e-01) * oix3
- 2.400758277161838e00) * oix3 - 2.549732539343734e00) * oix3
+ 4.374664141464968e00) * oix3 + 2.938163982698783e00)
/ ((((7.784695709041462e-03 * oix3 + 3.224671290700398e-01) * oix3
+ 2.445134137142996e00) * oix3 + 3.754408661907416e00) * oix3 + 1)
)
out[p == 0] = -np.inf
out[p == 1] = np.inf

return out
# fmt: on

__version__ = "1.1.0"

Expand Down
1 change: 0 additions & 1 deletion tox.ini
Expand Up @@ -11,7 +11,6 @@ commands =
pytest --cov --cov-report=xml --cov-report=term-missing {posargs:-vv}
deps =
numpy
pyerf
pytest
pytest-cov
!pypy3-pandas: pandas
Expand Down

0 comments on commit 9c4e30c

Please sign in to comment.