diff --git a/README.rst b/README.rst index 5471528..70026f7 100644 --- a/README.rst +++ b/README.rst @@ -8,3 +8,63 @@ XSpline ======= Advanced spline package that provides b-spline bases, their derivatives and integrals. + + +Installation +------------ + +XSpline can be install via + +.. code-block:: bash + + pip install xspline>=0.1.0 + + +Requirements +------------ + +XSpline requires python 3.10 or higher. XSpline only depends on ``numpy>=1.25.1``. + + +Usage +----- + +There are two main use-cases. + +.. code-block:: python + + import numpy as np + import matplotlib.pyplot as plt + from xspline import XSpline + + spline = XSpline(knots=[0, 0.25, 0.5, 0.75, 1], degree=3) + x = np.arange(0, 1.01, 0.01) + + +one is to use XSpline as a univariate function. In this case, user must provide +coefficients for the spline bases. + +.. code-block:: python + + np.random.seed(123) + spline.coef = np.random.randn(len(spline)) + y = spline(x) + + fig, ax = plt.subplots(figsize=(8, 3)) + ax.plot(x, y) + ax.set_title("Usecase 1", loc="left") + +.. image:: images/readme_usage_0.png + :alt: usecase_1 + +The other is to obtain the design matrix for other modeling uses. + +.. code-block:: python + + design_mat = spline.get_design_mat(x) + + fig, ax = plt.subplots(figsize=(8, 3)) + ax.plot(x, design_mat) + +.. image:: images/readme_usage_1.png + :alt: usecase_2 diff --git a/images/readme_usage_0.png b/images/readme_usage_0.png new file mode 100644 index 0000000..2a5d472 Binary files /dev/null and b/images/readme_usage_0.png differ diff --git a/images/readme_usage_1.png b/images/readme_usage_1.png new file mode 100644 index 0000000..988d692 Binary files /dev/null and b/images/readme_usage_1.png differ diff --git a/pyproject.toml b/pyproject.toml index 38d686b..97c4cb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "xspline" -version = "1.0.0" +version = "0.1.0" description = "Advanced spline package that provides b-spline bases, their derivatives and integrals" readme = "REDME.rst" requires-python = ">=3.10" @@ -12,7 +12,7 @@ license = { file = "LICENSE" } authors = [ { name = "IHME Math Sciences", email = "ihme.math.sciences@gmail.com" }, ] -dependencies = ["numpy"] +dependencies = ["numpy>=1.25.1"] [project.optional-dependencies] test = ["pytest"] @@ -25,4 +25,4 @@ github = "https://github.com/zhengp0/xspline" project = "xspline" author = "IHME Math Sciences" copyright = "2023, IHME Math Sciences" -version = "1.0.0" \ No newline at end of file +version = "0.1.0" \ No newline at end of file