Newer
Older
Master_thesis / Evaluation.ipynb
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import os\n",
    "import pickle as pkl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "scenarios = ['ff1data1']#, 'ff_3data1']\n",
    "\n",
    "# print(jobs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scenario: ff1data1 (774 toys)\n",
      "Ctt mean: -0.48720672012457983\n",
      "Ctt error: 0.220275011013615\n",
      "95% sensitivity: 0.0008151541520144099\n",
      "95% sensitivity: 0.0010597003976187329 (CLs increase added) \n",
      "\n",
      "Scenario: ff_3data1 (782 toys)\n",
      "Ctt mean: -0.4443376108842471\n",
      "Ctt error: 0.21382619416763946\n",
      "95% sensitivity: 0.0007681235740452465\n",
      "95% sensitivity: 0.0009985606462588204 (CLs increase added) \n",
      "\n"
     ]
    }
   ],
   "source": [
    "for scenario in scenarios:\n",
    "    jobs = os.listdir('{}/finished'.format(scenario))\n",
    "    Ctt = np.array([])\n",
    "    Ctt_err = np.array([])\n",
    "    for job in jobs:\n",
    "        with open('{0}/finished/{1}/data/results/Ctt_list.pkl'.format(scenario, job), 'rb') as f:\n",
    "            x = pkl.load(f)\n",
    "        Ctt = np.append(Ctt, x)\n",
    "\n",
    "        with open('{0}/finished/{1}/data/results/Ctt_error_list.pkl'.format(scenario, job), 'rb') as f:\n",
    "            x = pkl.load(f)\n",
    "        Ctt_err = np.append(Ctt_err, x)\n",
    "    \n",
    "    print('Scenario: {1} ({0} toys)'.format(len(Ctt), scenario))\n",
    "\n",
    "    print(\"Ctt mean: {}\".format(np.mean(Ctt)))\n",
    "    print('Ctt error: {}'.format(np.mean(Ctt_err)))\n",
    "\n",
    "    err2 = 2*np.mean(Ctt_err)\n",
    "\n",
    "    print('95% sensitivity: {}'.format(err2**2*4.2/1000))\n",
    "    print('95% sensitivity: {} (CLs increase added) \\n'.format(err2**2*4.2/1000*1.3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "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.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}