Newer
Older
Master_thesis / result_evalution.ipynb
{
 "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": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "Ctt = []\n",
    "Ctt_err = []\n",
    "\n",
    "NrOfSets = 0\n",
    "\n",
    "for filename in os.listdir('prelim_results/full_q2/'):\n",
    "    if filename.endswith(\".out\"):\n",
    "        with open('./prelim_results/full_q2/' + 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": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Full q2 fit:\n",
      "Ctt_mean =  -0.14959437421626456\n",
      "Ctt_err_mean =  0.1386346922697338\n",
      "Evaluated toys:  1090\n"
     ]
    }
   ],
   "source": [
    "print(\"Full q2 fit:\")\n",
    "print('Ctt_mean = ', Ctt_mean)\n",
    "print('Ctt_err_mean = ', Ctt_err_mean)\n",
    "print('Evaluated toys: ', NrOfSets*10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "slurm-2216601.out\n",
      "slurm-2216602.out\n",
      "slurm-2216607.out\n",
      "slurm-2216610.out\n",
      "slurm-2216611.out\n"
     ]
    }
   ],
   "source": [
    "Ctt = []\n",
    "Ctt_err = []\n",
    "\n",
    "NrOfSets = 0\n",
    "\n",
    "for filename in os.listdir('prelim_results/jpsi-psi2s/'):\n",
    "    if filename.endswith(\".out\"):\n",
    "        print(filename)\n",
    "        with open('./prelim_results/jpsi-psi2s/' + 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": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Jpsi - Psi2s fit:\n",
      "Ctt_mean =  -0.1183385892203999\n",
      "Ctt_err_mean =  0.7175790414956408\n",
      "Evaluated toys:  500\n"
     ]
    }
   ],
   "source": [
    "print(\"Jpsi - Psi2s fit:\")\n",
    "print('Ctt_mean = ', Ctt_mean)\n",
    "print('Ctt_err_mean = ', Ctt_err_mean)\n",
    "print('Evaluated toys: ', NrOfSets*100)"
   ]
  },
  {
   "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
}