{ "metadata": { "name": "", "signature": "sha256:0b7c52517003e84372400c5ba6b57fc1b066ff138177ed39267a97c95c5f9a8e" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "%matplotlib inline\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from ipywidgets import StaticInteract, RangeWidget, RadioWidget" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 2 }, { "cell_type": "code", "collapsed": false, "input": [ "h=6.6244e-34 # Planck constant in Js\n", "c=2.998e+08 # speed of light in m/s\n", "k=1.38e-23 #Boltzmann constant in J/K%\n", "\n", "def bbrad(lamda, T):\n", " return (2*h*c*c)/(((lamda*1e-10)**5)*(np.exp(h*c/(lamda*1e-10*k*T))-1))\n", "\n", "def plot(T):\n", " fig, ax = plt.subplots(figsize=(4, 3),\n", " subplot_kw={'axisbg':'#EEEEEE',\n", " 'axisbelow':True})\n", " ax.grid(color='w', linewidth=2, linestyle='solid')\n", " lamda = np.linspace(1000, 10000, 100)\n", " ax.plot(lamda, bbrad(lamda,T), lw=5, alpha=0.4)\n", "# ax.set_xlim(-50, 50)\n", "# ax.set_ylim(-2.5, 2.5)\n", " return fig" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [ "StaticInteract(plot,T=RangeWidget(3000., 10000., 1000.))" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", " T: \n", "
\n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 4, "text": [ "" ] } ], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "h=6.6244e-34 # Planck constant in Js\n", "c=2.998e+08 # speed of light in m/s\n", "k=1.38e-23 #Boltzmann constant in J/K%\n", "\n", "def wrad(lamda, T):\n", " return (2*h*c*c)/(((lamda*1e-10)**5)*(np.exp(h*c/(lamda*1e-10*k*T))))\n", "\n", "def wplot(T):\n", " fig, ax = plt.subplots(figsize=(4, 3),\n", " subplot_kw={'axisbg':'#EEEEEE',\n", " 'axisbelow':True})\n", " ax.grid(color='w', linewidth=2, linestyle='solid')\n", " lamda = np.linspace(1000, 10000, 100)\n", " ax.plot(lamda, wrad(lamda,T), lw=5, alpha=0.4)\n", "# ax.set_xlim(-50, 50)\n", "# ax.set_ylim(-2.5, 2.5)\n", " return fig" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 7 }, { "cell_type": "code", "collapsed": false, "input": [ "StaticInteract(wplot,T=RangeWidget(3000., 10000., 1000.))" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", " T: \n", "
\n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 8, "text": [ "" ] } ], "prompt_number": 8 }, { "cell_type": "code", "collapsed": false, "input": [ "h=6.6244e-34 # Planck constant in Js\n", "c=2.998e+08 # speed of light in m/s\n", "k=1.38e-23 #Boltzmann constant in J/K%\n", "\n", "def rjrad(lamda, T):\n", " return (2*h*c*c)/(((lamda*1e-10)**5)*((h*c/(lamda*1e-10*k*T))))\n", "\n", "def rjplot(T):\n", " fig, ax = plt.subplots(figsize=(4, 3),\n", " subplot_kw={'axisbg':'#EEEEEE',\n", " 'axisbelow':True})\n", " ax.grid(color='w', linewidth=2, linestyle='solid')\n", " lamda = np.linspace(1000, 10000, 100)\n", " ax.plot(lamda, rjrad(lamda,T)/max(rjrad(lamda,T)), '--')\n", "# ax.set_xlim(-50, 50)\n", "# ax.set_ylim(-2.5, 2.5)\n", " return fig" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 17 }, { "cell_type": "code", "collapsed": false, "input": [ "StaticInteract(rjplot,T=RangeWidget(3000., 10000., 1000.))" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", " T: \n", "
\n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 18, "text": [ "" ] } ], "prompt_number": 18 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }