{ "cells": [ { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [], "source": [ "import os\n", "import re\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 42, "metadata": {}, "outputs": [], "source": [ "Ctt = []\n", "Ctt_err = []\n", "\n", "for filename in os.listdir('prelim_results'):\n", " if filename.endswith(\".out\"):\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", "Ctt_mean = np.mean(Ctt)\n", "Ctt_err_mean = np.mean(Ctt_err)" ] }, { "cell_type": "code", "execution_count": 43, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Ctt_mean = -0.09987017193178732\n", "Ctt_err_mean = 0.14186649892786868\n" ] } ], "source": [ "print('Ctt_mean = ', Ctt_mean)\n", "print('Ctt_err_mean = ', Ctt_err_mean)" ] }, { "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 }