Newer
Older
Master_thesis / result_evalution.ipynb
@saslie saslie on 8 Jul 2019 2 KB ...
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import re\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "Ctt = []\n",
    "Ctt_err = []\n",
    "\n",
    "NrOfSets = 0\n",
    "\n",
    "for filename in os.listdir('prelim_results'):\n",
    "    if filename.endswith(\".out\") and NrOfSets<64:\n",
    "        with open('./prelim_results/' + filename) as file:  \n",
    "            data = file.read() \n",
    "            _ = data.partition('value = ')[-1]\n",
    "#             print(_)\n",
    "            _ = _.partition('Mean Ctt error = ')\n",
    "#             print(_[-1])\n",
    "            err = _[0][:-2]\n",
    "            Ctt.append(float(err))\n",
    "#             print(err)\n",
    "            _ = _[-1].partition('\\nSimulation ended\\n')[0]\n",
    "#             print(_)\n",
    "            Ctt_err.append(float(_))\n",
    "    \n",
    "        NrOfSets+= 1\n",
    "            \n",
    "Ctt_mean = np.mean(Ctt)\n",
    "Ctt_err_mean = np.mean(Ctt_err)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ctt_mean =  -0.10645043157583486\n",
      "Ctt_err_mean =  0.14056769335900954\n",
      "Evaluated toys:  640\n"
     ]
    }
   ],
   "source": [
    "print('Ctt_mean = ', Ctt_mean)\n",
    "print('Ctt_err_mean = ', Ctt_err_mean)\n",
    "print('Evaluated toys: ', NrOfSets*10)"
   ]
  },
  {
   "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
}