{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "1d08e1d3-0f62-467e-8217-9eaf458afeb4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 48832 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "from matplotlib import pyplot as plt\n",
    "\n",
    "x = np.linspace(0, 2*2.0*np.pi, 1000)\n",
    "y = np.sin(x)\n",
    "\n",
    "\n",
    "grid_bin = np.fromfile(\"../out/grid.bin\", dtype=np.float64)\n",
    "plt.plot(grid_bin, np.zeros(len(grid_bin)))\n",
    "grid = np.loadtxt(\"../out/grid.dat\")\n",
    "plt.plot(grid, np.zeros(len(grid)), linestyle='--')\n",
    "knots = np.loadtxt(\"../out/knotpoints.dat\")\n",
    "order_k = 4\n",
    "knots_y = np.zeros(len(knots))\n",
    "y_shift = order_k-1\n",
    "for i in range(order_k-1):\n",
    "    knots_y[i] = y_shift\n",
    "    y_shift = y_shift - 1\n",
    "\n",
    "y_shift = order_k-1\n",
    "for i in range(order_k-1):\n",
    "    knots_y[len(knots)-1-i] = y_shift\n",
    "    y_shift = y_shift - 1\n",
    "    \n",
    "plt.plot(knots, knots_y, marker='o')\n",
    "\n",
    "\n",
    "#bspline0 = np.loadtxt(\"../out/bspline0.dat\")\n",
    "#plt.plot(grid, bspline0)\n",
    "#bspline1 = np.loadtxt(\"../out/bspline1.dat\")\n",
    "#plt.plot(grid, bspline1)\n",
    "#bspline2 = np.loadtxt(\"../out/bspline2.dat\")\n",
    "#plt.plot(grid, bspline2)\n",
    "#bspline3 = np.loadtxt(\"../out/bspline3.dat\")\n",
    "#plt.plot(grid, bspline3)\n",
    "\n",
    "bsplines = np.loadtxt(\"../out/bsplines.dat\")\n",
    "bspl_shape = bsplines.shape\n",
    "num_rows = bspl_shape[0]\n",
    "num_cols = bspl_shape[1]\n",
    "for i in range(num_cols):\n",
    "    bspl = bsplines[:, i]\n",
    "    plt.plot(grid, bspl)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8cda5f82-13ac-4b95-aed4-f999a8dbd185",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ce5642b3-6387-45f7-aaaf-dfb9085b3d49",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c4866585-9cb8-4eb8-a8c6-0489f831c55d",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "59ee4447-5513-48f4-88fc-a20b8430e15c",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
