Skip to content

Commit

Permalink
Fixed 4PL and 5PL model Jacobians, simplified dropna, and improved Ca…
Browse files Browse the repository at this point in the history
…lCurve.
  • Loading branch information
tylerdougan committed Jun 18, 2024
1 parent 8616bcd commit 74222c3
Show file tree
Hide file tree
Showing 14 changed files with 4,488 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build/lib/waltlabtools/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from . import mosaic
from .cal_curve import *
from .core import *
from .model import *
from .read import *
33 changes: 33 additions & 0 deletions build/lib/waltlabtools/_backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import sys
from collections.abc import Callable

_MODULES_CHECK: dict[str, bool] = {
"jax": "jax" in sys.modules,
"numba": True,
}

if _MODULES_CHECK["jax"]:
import jax.numpy as np
from jax import jit
from jax.scipy.special import gammaln

def gmean(a, axis: int = 0, dtype=None, weights=None):
"""Geometric mean."""
return np.exp(np.average(np.log(a), axis=axis, weights=weights))

import warnings

warnings.warn("JAX backend is experimental and may not work as expected.") # type: ignore
else:
import numpy as np
from scipy.special import gammaln
from scipy.stats import gmean

try:
from numba import jit # type: ignore
except ImportError:
_MODULES_CHECK["numba"] = False

def jit(fun: Callable) -> Callable:
"""Dummy jit decorator for when numba/jax not installed."""
return fun
Loading

0 comments on commit 74222c3

Please sign in to comment.