{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy\n",
    "import scienceplots\n",
    "from h5py import File\n",
    "\n",
    "import plt_utils\n",
    "\n",
    "\n",
    "%load_ext autoreload\n",
    "%autoreload 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "with File(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/ACL/BORG2_0.25.hdf5\", 'r') as f:\n",
    "    voxel_acl = f['voxel_acl'][...].flatten()\n",
    "    voxel_dist = f['voxel_dist'][...].flatten()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 48472 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "bins = numpy.linspace(0, 100, 10)\n",
    "\n",
    "\n",
    "plt.figure()\n",
    "\n",
    "mask = voxel_dist < 20\n",
    "plt.hist(voxel_acl[mask], bins=\"auto\", histtype='step', density=1, label=r\"$0 < R / (\\mathrm{Mpc} / h)  < 20$\")\n",
    "\n",
    "mask = (voxel_dist > 20) & (voxel_dist < 40)\n",
    "plt.hist(voxel_acl[mask], bins=\"auto\", histtype='step', density=1, label=r\"$20 < R / (\\mathrm{Mpc} / h)  < 40$\")\n",
    "\n",
    "mask = (voxel_dist > 40) & (voxel_dist < 60)\n",
    "plt.hist(voxel_acl[mask], bins=\"auto\", histtype='step', density=1, label=r\"$40 < R / (\\mathrm{Mpc} / h)  < 60$\")\n",
    "\n",
    "# plt.scatter(voxel_dist.flatten(), voxel_acl.flatten(), s=0.1)\n",
    "plt.legend()\n",
    "plt.title(\"ACL of individual voxels\")\n",
    "plt.xlabel(r\"$\\mathrm{ACL}$\")\n",
    "plt.ylabel(r\"Normalized bin counts\")\n",
    "\n",
    "plt.tight_layout()\n",
    "plt.savefig(\"../plots/BORG_Stephen_ACL.png\", dpi=450)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "venv_csiborg",
   "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.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
