Created
March 31, 2015 12:58
-
-
Save betatim/7c96b269e0db894d6c62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"import random\n", | |
"import matplotlib as mpl\n", | |
"import numpy as np\n", | |
"import matplotlib.pyplot as plt\n", | |
"\n", | |
"import seaborn as sns\n", | |
"\n", | |
"from sklearn import datasets\n", | |
"from sklearn.tree import DecisionTreeClassifier\n", | |
"from sklearn.ensemble import AdaBoostClassifier\n", | |
"from sklearn.metrics import classification_report, roc_auc_score\n", | |
"from root_numpy import root2array, rec2array\n", | |
"from sklearn.cross_validation import train_test_split\n", | |
"\n", | |
"\n", | |
"from sklearn import grid_search\n", | |
"\n", | |
"import pandas as pd\n", | |
"import pandas.core.common as com\n", | |
"from pandas.core.index import Index\n", | |
"\n", | |
"from pandas.tools import plotting\n", | |
"from pandas.tools.plotting import scatter_matrix\n", | |
"\n", | |
"branch_names = [ \"D_MM\", \"D_IPCHI2_OWNPV\"]\n", | |
"data = root2array(\"D0.root\", \"MC12_D2K3Pi/DecayTree\", branch_names)\n", | |
"signal = rec2array(data)\n", | |
"\n", | |
"\n", | |
"import pandas.core.common as com\n", | |
"from pandas.core.index import Index\n", | |
"\n", | |
"from pandas.tools import plotting\n", | |
"from pandas.tools.plotting import scatter_matrix\n", | |
"\n", | |
"\n", | |
"fig = plt.figure()\n", | |
"\n", | |
"\n", | |
"\n", | |
"df= pd.DataFrame(signal, columns = branch_names)\n", | |
"\n", | |
"fig, axes = plotting._subplots(naxes=2, squeeze=False)\n", | |
"\n", | |
"\n", | |
"\n", | |
"_axes = plotting._flatten(axes)\n", | |
"ax1 = _axes[0]\n", | |
"ax2 = _axes[1]\n", | |
"\n", | |
"n, bins, patches = ax1.hist(df[\"D_MM\"], 100, histtype='stepfilled')\n", | |
"ax1.set_xlabel(\"D0 mass\")\n", | |
"ax1.set_ylabel(\"Number of events\")\n", | |
"ax2.set_yscale('log')\n", | |
"\n", | |
"n, bins, patches = ax2.hist(df[\"D_IPCHI2_OWNPV\"], 100, range=[0.0, 20.0], histtype='stepfilled')\n", | |
"\n", | |
"fig.savefig(\"mylittleD0.png\")\n", | |
"#fig.show()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 2", | |
"language": "python", | |
"name": "python2" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 2 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython2", | |
"version": "2.7.6" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment