{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Sample 02\n\nThis examples computes the three most basic standard SQIs\n(kurtosis, skewness and entropy). In addition, it shows\nthe code and explains it in different sections. This is\nsimilar to  jupyter notebook. It is just an example.\n\n<div class=\"alert alert-danger\"><h4>Warning</h4><p>The ``dtw`` module seems to be loaded even though\n             we are not really using it. Instead, load it\n             only when required.</p></div>\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Main\n\n\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "First, lets import the required libraries\n\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Libraries generic\nimport numpy as np\nimport pandas as pd\n\n# Libraries specific\nfrom vital_sqi.sqi.standard_sqi import perfusion_sqi\nfrom vital_sqi.sqi.standard_sqi import kurtosis_sqi\nfrom vital_sqi.sqi.standard_sqi import skewness_sqi\nfrom vital_sqi.sqi.standard_sqi import entropy_sqi\nfrom vital_sqi.sqi.standard_sqi import signal_to_noise_sqi"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Lets create the sinusoide\n\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Create samples\nx = np.linspace(-10*np.pi, 10*np.pi, 201)\n\n# Create signal\nsignal = np.sin(x)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Lets compute the SQIs\n\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Loop computing sqis\nk = kurtosis_sqi(signal)\ns = skewness_sqi(signal)\ne = entropy_sqi(signal)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Lets display the result\n\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Create Series\nresult = pd.Series(\n    data=[k, s, e],\n    index=['kurtosis', 'skewness', 'entropy']\n)\n\n# Show\nprint(\"\\nResult:\")\nprint(result)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Plot\n\nLets plot something so it shows a thumbicon\n\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# ---------------\n# Create plot\n# ---------------\n# Library\nimport matplotlib.pyplot as plt\n\n# Plot\nplt.plot(x, signal)\n\n# Show\nplt.show()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "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.7.9"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}