{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "94dcfc9a",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import os\n",
    "import qp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d479510b",
   "metadata": {},
   "outputs": [],
   "source": [
    "QP_DIR = os.path.abspath(os.path.dirname(qp.__file__))\n",
    "data_file = os.path.join(QP_DIR, 'data', 'test.hdf5')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4d493280",
   "metadata": {},
   "outputs": [],
   "source": [
    "ens = qp.read(data_file)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f2928f6b",
   "metadata": {},
   "outputs": [],
   "source": [
    "itr = qp.iterator(data_file, 10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bef60c76",
   "metadata": {},
   "outputs": [],
   "source": [
    "ens.npdf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d908b02b",
   "metadata": {},
   "outputs": [],
   "source": [
    "test_vals = np.linspace(0., 1., 11)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d00c68fe",
   "metadata": {},
   "outputs": [],
   "source": [
    "for start, end, ens_i in itr:\n",
    "    print(start, end, np.max(ens[start:end].pdf(test_vals) - ens_i.pdf(test_vals)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d9d7b748",
   "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.10.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
