Last active
April 21, 2020 21:36
-
-
Save astro313/4e08b24ac3fa493bc811b85626ee00a9 to your computer and use it in GitHub Desktop.
Template for .ipynb, things to import or load at the beginning
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": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import matplotlib \n", | |
"# Specify renderer\n", | |
"# matplotlib.use('Agg')\n", | |
"\n", | |
"# Boiler-plate settings for producing pub-quality figures\n", | |
"# 1 point = 1/72 inch\n", | |
"from cycler import cycler\n", | |
"matplotlib.rcParams['axes.prop_cycle'] = cycler(color='bgrcmyk')\n", | |
"matplotlib.rcParams.update({'figure.figsize': (8, 5) # inches\n", | |
" , 'font.size': 22 # points\n", | |
" , 'legend.fontsize': 16 # points\n", | |
" , 'lines.linewidth': 1.5 # points\n", | |
" , 'axes.linewidth': 1.5 # points\n", | |
" , 'text.usetex': True # Use LaTeX to layout text\n", | |
" , 'font.family': \"serif\" # Use serifed fonts\n", | |
" , 'xtick.major.size': 10 # length, points\n", | |
" , 'xtick.major.width': 1.5 # points\n", | |
" , 'xtick.minor.size': 6 # length, points\n", | |
" , 'xtick.minor.width': 1 # points\n", | |
" , 'ytick.major.size': 10 # length, points\n", | |
" , 'ytick.major.width': 1.5 # points\n", | |
" , 'ytick.minor.size': 6 # length, points\n", | |
" , \"xtick.minor.visible\": True\n", | |
" , \"ytick.minor.visible\": True\n", | |
" , 'font.weight': 'bold'\n", | |
" , 'ytick.minor.width': 1 # points\n", | |
" , 'font.serif': (\"Times\", \"Palatino\", \"Computer Modern Roman\", \"New Century Schoolbook\", \"Bookman\"), 'font.sans-serif': (\"Helvetica\", \"Avant Garde\", \"Computer Modern Sans serif\"), 'font.monospace': (\"Courier\", \"Computer Modern Typewriter\"), 'font.cursive': \"Zapf Chancery\"\n", | |
" })\n", | |
"\n", | |
"\n", | |
"import matplotlib.pyplot as plt\n", | |
"%matplotlib inline\n", | |
"%config InlineBackend.figure_format = 'retina'" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import seaborn as sns\n", | |
"sns.set_context(\"poster\")\n", | |
"sns.set(rc={'figure.figsize': (16, 9.)})\n", | |
"sns.set_style(\"whitegrid\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import sys\n", | |
"import logging\n", | |
"logging.basicConfig(level=logging.INFO, stream=sys.stdout)\n", | |
"\n", | |
"%load_ext autoreload\n", | |
"%autoreload 2\n", | |
"\n", | |
"import numpy as np\n", | |
"import scipy as sp\n", | |
"\n", | |
"# ML\n", | |
"import sklearn\n", | |
"\n", | |
"import pandas as pd\n", | |
"pd.set_option(\"display.max_rows\", 120)\n", | |
"pd.set_option(\"display.max_columns\", 120)\n", | |
"\n", | |
"#Set the display format to be scientific for ease of analysis\n", | |
"# pd.options.display.float_format = '{:,.2g}'.format" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"No repo found\n" | |
] | |
} | |
], | |
"source": [ | |
"try: \n", | |
" import subprocess\n", | |
" gitd = os.path.abspath(os.path.join(os.path.dirname(__file__),os.pardir))\n", | |
" githash = subprocess.check_output('git --git-dir={0:s} --work-tree={1:s} '\\\n", | |
" 'rev-parse HEAD'.format(gitd+'/.git',gitd),shell=True).rstrip()\n", | |
"except:\n", | |
" githash = 'No repo found'\n", | |
"\n", | |
"print(githash)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"The watermark extension is already loaded. To reload it, use:\n", | |
" %reload_ext watermark\n", | |
"Mon Apr 20 2020 \n", | |
"\n", | |
"CPython 3.6.2\n", | |
"IPython 6.1.0\n", | |
"\n", | |
"jupyerlab not installed\n", | |
"numpy 1.14.5\n", | |
"scipy 0.19.1\n", | |
"sklearn 0.21.3\n", | |
"pandas 0.24.2\n", | |
"matplotlib 2.0.2\n", | |
"\n", | |
"compiler : GCC 5.4.0\n", | |
"system : Linux\n", | |
"release : 3.10.0-1062.9.1.el7.x86_64\n", | |
"machine : x86_64\n", | |
"processor : x86_64\n", | |
"CPU cores : 40\n", | |
"interpreter: 64bit\n", | |
"host name : worker2082\n", | |
"Git hash :\n" | |
] | |
} | |
], | |
"source": [ | |
"%load_ext watermark\n", | |
"%watermark -v -h -n -g -m -p jupyerlab,numpy,scipy,sklearn,pandas,matplotlib" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (python3/3.6.2)", | |
"language": "python", | |
"name": "module-python3-3.6.2-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.6.2" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment