{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "#%matplotlib qt\n", "%matplotlib notebook\n", "import matplotlib.pyplot as plt\n", "#plt.rcParams[\"figure.figsize\"] = [12,12]\n", "import numpy as np\n", "import pandas as pds" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "def try_plot(df,ax,left,right):\n", " try:\n", " df[(df.index >= left) & (df.index <= right)].plot(ax=ax,subplots=True,legend=False)\n", " except:\n", " pass\n", " \n", "def make_plots(path=\"./\",left=50e-3,right=100e-3):\n", " inputSig = pds.read_csv(path+\"/input.txt\",delim_whitespace=True,header=None,names=[\"BIAS1\",\"BIAS2\",\"BIAS3\",\"BIAS4\",\"BIAS5\",\"B1\",\"B2\",\"B3\"])\n", " inputSig.index.name=\"TSTAMP\"\n", " inputSig.index*=1./98304.\n", " fXSig=[]\n", " G=[0.89,0.87,0.89]\n", " [fXSig.append(pds.read_csv(\n", " path+\"./output_f{0}.txt\".format(F),index_col=0,delim_whitespace=True,header=None,\n", " names=[\"TSTAMP\",\"BIAS1\",\"BIAS4\",\"BIAS5\",\"B1\",\"B2\",\"B3\"])) for F in range(3) ]\n", " for F in range(3):\n", " if len(fXSig[F].index):\n", " fXSig[F].index*=1e-9\n", " fXSig[F]/=G[F]\n", " axes=inputSig[(inputSig.index >= left) & (inputSig.index <= right)].filter([\"BIAS1\",\"BIAS4\",\"BIAS5\",\"B1\",\"B2\",\"B3\"]).plot(subplots=True,layout=(3,2)) \n", " [ try_plot(df,axes,left,right) for df in fXSig ]\n", " return inputSig,fXSig\n", " " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "inputSig,fXSig=make_plots(left=0)" ] } ], "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.5.2" } }, "nbformat": 4, "nbformat_minor": 1 }