{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Populating the interactive namespace from numpy and matplotlib\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 31264 characters]\n",
      "text/plain": [
       "<Figure size 576x504 with 4 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "%pylab inline\n",
    "from pycheops.funcs import xyz_planet\n",
    "from numpy import linspace\n",
    "t = linspace(0,1,1000)\n",
    "sini = 0.998\n",
    "ecc = 0.34\n",
    "omdeg = 45\n",
    "\n",
    "x, y, z = xyz_planet(t,0,1,sini,ecc,omdeg)\n",
    "\n",
    "fig, ax = subplots(2,2,figsize=(8,7))\n",
    "\n",
    "ax[0][0].plot(x, y)\n",
    "ax[0][0].scatter(x[0], y[0])\n",
    "ax[0][0].set_xlabel('x')\n",
    "ax[0][0].set_ylabel('y')\n",
    "ax[0][0].set_xlim(-1.5,1.5)\n",
    "ax[0][0].set_ylim(-1.5,1.5)\n",
    "\n",
    "\n",
    "ax[0][1].plot(x, z)\n",
    "ax[0][1].scatter(x[0], z[0])\n",
    "ax[0][1].set_xlabel('x')\n",
    "ax[0][1].set_ylabel('z')\n",
    "ax[0][1].set_xlim(-1.5,1.5)\n",
    "ax[0][1].set_ylim(-1.5,1.5)\n",
    "\n",
    "ax[1][0].plot(z, y)\n",
    "ax[1][0].scatter(z[0], y[0])\n",
    "ax[1][0].set_xlabel('z')\n",
    "ax[1][0].set_ylabel('y')\n",
    "ax[1][0].set_xlim(-1.5,1.5)\n",
    "ax[1][0].set_ylim(-1.5,1.5)\n",
    "\n",
    "r = sqrt(x**2+y**2+z**2)\n",
    "ax[1][1].plot(t, r)\n",
    "ax[1][1].set_xlabel('t')\n",
    "ax[1][1].set_ylabel('r')\n",
    "ax[1][1].set_xlim(0,1)\n",
    "ax[1][1].set_ylim(0,1.5)\n",
    "\n",
    "fig.tight_layout()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "### Lambertian phase function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 23156 characters]\n",
      "text/plain": [
       "<Figure size 576x252 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax = subplots(1,2,figsize=(8,3.5))\n",
    "\n",
    "bet = arccos(z/r)\n",
    "ax[0].plot(t, bet)\n",
    "ax[0].set_xlabel('t')\n",
    "ax[0].set_ylabel(r'$\\beta$')\n",
    "ax[0].set_xlim(0,1)\n",
    "ax[0].set_ylim(0,pi)\n",
    "\n",
    "Phi_L = (sin(bet) + (pi-bet)*cos(bet))/pi\n",
    "ax[1].plot(t, Phi_L)\n",
    "ax[1].set_xlabel('t')\n",
    "ax[1].set_ylabel(r'$\\Phi_L$')\n",
    "ax[1].set_xlim(0,1)\n",
    "ax[1].set_ylim(0,1)\n",
    "\n",
    "fig.tight_layout()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "pyvenv",
   "language": "python",
   "name": "pyvenv"
  },
  "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.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
