{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "ename": "ImportError", "evalue": "No module named healpy", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mhealpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mH\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0msys\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mpylab\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpyplot\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mImportError\u001b[0m: No module named healpy" ] } ], "source": [ "import healpy as H\n", "import sys\n", "import numpy as np\n", "from pylab import *\n", "import matplotlib.pyplot as plt\n", "import matplotlib.colors as clrs\n", "import subprocess\n", "import pickle\n", "import matplotlib.tri as mtri\n", "import matplotlib.lines as lines\n", "import ternary\n", "\n", "rc('text', usetex=True)\n", "rc('font',**{'family':'serif','serif':['Palatino']})" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#### Boundary and Gridlines\n", "scale = 20\n", "figure, tax = ternary.figure(scale=scale)\n", "figure.set_size_inches(6, 5.6)\n", "figure.set_dpi(300)\n", "\n", "plt.axis('off')\n", "\n", "tax.gridlines(color=\"gray\", multiple=0.1 * scale, linewidth=0.35, ls='-', alpha=0.5)\n", "\n", "# Set Axis labels and Title\n", "fontsize = 7.25\n", "tax.left_axis_label(r'$f_{\\tau,\\oplus}$', fontsize=fontsize, offset=0.175)\n", "tax.right_axis_label(r'$f_{\\mu,\\oplus}$', fontsize=fontsize, offset=0.175)\n", "tax.bottom_axis_label(r'$f_{e,\\oplus}$', fontsize=fontsize, offset=0.175)\n", "\n", "tax.boundary(linewidth=1.0)\n", "\n", "fe = 3.0/3.\n", "fmu = 0.0/3.\n", "A4 = []\n", "\n", "steps = 360\n", "for chi in arange(0.0,2*np.pi,2*np.pi/(1.*steps)) :\n", " \n", " L = []\n", " \n", " for dchi in arange(-np.pi/2.+2.*np.pi/(1.*steps),np.pi/2.,2.*np.pi/(1.*steps)) :\n", " omega = chi+dchi\n", " x = (1.-fe-2.*fmu)*np.sin(omega)\n", " y = (1.-2.*fe-fmu)*np.cos(omega)\n", " z = (fmu-fe)*(np.cos(omega)-np.sin(omega))\n", " \n", " B = [0.0,(x+y+z)/3.,x/2.,y/2.,z/2.]\n", " \n", " if x**2 >= (y-z)**2/9. :\n", " B.append(((3.*x+y+z)**2-4.*y*z)/24./x)\n", " if y**2 >= (z-x)**2/9. :\n", " B.append(((3.*y+z+x)**2-4.*z*x)/24./y)\n", " if z**2 >= (x-y)**2/9. :\n", " B.append(((3.*z+x+y)**2-4.*x*y)/24./z)\n", "\n", " L.append(max(B)/np.cos(dchi))\n", " \n", " A4.append([fe+np.cos(chi)*min(L),fmu+np.sin(chi)*min(L)])\n", " \n", "A4 = np.array(A4) \n", "tax.plot(A4*scale, linewidth=1, marker=None, color='red', linestyle='solid')\n", "\n", "r = plt.plot(np.array([[-1000, -1000], [-1000, -1000]]) * scale, linewidth=4., marker=None, color = 'red', label='$(1:0:0)_s$')\n", "g = plt.plot(np.array([[-1000, -1000], [-1000, -1000]]) * scale, linewidth=4., marker=None, color = 'green', label='$(0:1:0)_s$')\n", "b = plt.plot(np.array([[-1000, -1000], [-1000, -1000]]) * scale, linewidth=4., marker=None, color = 'blue', label='$(1:2:0)_s$')\n", "\n", "black = plt.plot(np.array([[-1000, 0], [-1000, 0]]) * scale, linewidth=1., marker=None, color='black', label='This work')\n", "dotted = plt.plot(np.array([[-1000, 0], [-1000, 0]]) * scale, linewidth=0.4, marker=None, color='black', linestyle='dashed', label='Xu+, 2014')\n", "\n", "handles1 = [black[0], dotted[0]]\n", "handles2 = [r[0], g[0], b[0]]\n", "\n", "tax.clear_matplotlib_ticks() # Remove default Matplotlib Axes\n", "\n", "tax.set_axis_limits({'b': [0., 1.], 'l': [0., 1.], 'r': [0., 1.]})\n", "\n", "tax.get_ticks_from_axis_limits(multiple=10.)\n", "tax.set_custom_ticks(fontsize=3.5, multiple=10., offset=0.022, linewidth=0.5, tick_formats= {'b': \"%.1f\", 'l': \"%.1f\", 'r': \"%.1f\"})\n", "\n", "first_legend = plt.legend(handles=handles2, bbox_to_anchor=(0.75, 0.85), loc='center left', borderaxespad=0.,fancybox=True,framealpha=0.0,frameon=True,numpoints=1, scatterpoints = 1,handlelength=0.6, fontsize=4.5)\n", "tax.ax.set_aspect('equal')\n", "\n", "ax = plt.gca().add_artist(first_legend)\n", "\n", "tax.legend(handles=handles1, bbox_to_anchor=(0, 0.90), loc='center left', borderaxespad=0.,fancybox=True,framealpha=0.0,frameon=True,numpoints=1, scatterpoints = 1,handlelength=0.6, fontsize=4.5)\n", "tax.ax.set_aspect('equal')\n", "\n", "#ternary.plt.tight_layout()\n", "tax._redraw_labels()\n", "\n", "ternary.plt.show()" ] } ], "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.15" } }, "nbformat": 4, "nbformat_minor": 2 }