{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2018-04-08T18:49+0000", "start_time": "2018-04-08T18:49+0000" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b3666d93-1a9f-47f6-b272-8c9cde5eb9eb", "version_major": 2, "version_minor": 0 }, "method": "display_data" }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "0e65aaab-812e-45f3-98df-43ed93255c5e", "version_major": 2, "version_minor": 0 }, "method": "display_data" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%classpath add jar ../build/install/trapping/lib/commons-math3-3.6.1.jar\n", "%classpath add jar ../build/install/trapping/lib/trapping-dev.jar" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2018-04-08T18:58+0000", "start_time": "2018-04-08T18:58+0000" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "8e62373b-9e28-4669-937f-06f5c908a4bd", "version_major": 2, "version_minor": 0 }, "method": "display_data" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "scatter = inr.numass.trapping.Scatter.INSTANCE\n", "\n", "def e = (1..20) // energy in keV\n", "\n", "factor = 1e-22\n", "sigmaEl = e.collect{scatter.sigmael(it*1000)/factor}\n", "sigmaIon = e.collect{scatter.sigmaion(it*1000)/factor}\n", "sigmaExc = e.collect{scatter.sigmaexc(it*1000)/factor}\n", "\n", "def plot = new Plot(logY: true, yLogBase: 10)\n", "plot << new Line(x: e, y: sigmaEl, displayName: \"Elastic\")\n", "plot << new Line(x: e, y: sigmaIon, displayName: \"Ionization\")\n", "plot << new Line(x: e, y: sigmaExc, displayName: \"Excitation\")\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "E(keV)\telastic\tion\texc\n", "12.0\t0.43948540252301355\t2.7362696996880764\t2.2754271467658227\n", "12.1\t0.4360219815420227\t2.716347129996631\t2.259247553470829\n", "12.2\t0.4326153394877464\t2.6967291910800784\t2.2433117665045716\n", "12.3\t0.42926409223681455\t2.6774088086825643\t2.227614186457129\n", "12.4\t0.42596690029168804\t2.6583791281775273\t2.212149386181278\n", "12.5\t0.4227224669965498\t2.639633506055748\t2.1969121041685504\n", "12.6\t0.41952953683810995\t2.621165501807934\t2.1818972382301722\n", "12.7\t0.4163868938266485\t2.602968870180603\t2.1670998394665926\n", "12.8\t0.4132933599529065\t2.585037553785318\t2.1525151065102723\n", "12.9\t0.4102477937167139\t2.567365676042546\t2.138138380027344\n", "13.0\t0.4072490887234942\t2.5499475344425586\t2.123965137464613\n", "13.1\t0.4042961723450181\t2.532777594106803\t2.1099909880291814\n", "13.2\t0.40138800444100226\t2.515850481634202\t2.096211667888705\n", "13.3\t0.3985235761383543\t2.4991609792177183\t2.082623035581028\n", "13.4\t0.3957019086650494\t2.4827040190174023\t2.069221067622563\n", "13.5\t0.39292205223581\t2.466474677776929\t2.0560018543054204\n", "13.6\t0.39018308498692494\t2.4504681716713828\t2.042961595673853\n", "13.7\t0.3874841119576961\t2.434679851374739\t2.0300965976711156\n", "13.8\t0.3848242641161482\t2.419105197336177\t2.0174032684483527\n", "13.9\t0.3822026974267757\t2.403739815254919\t2.00487811482759\n", "14.0\t0.3796185919582249\t2.3885794317439313\t1.9925177389113418\n", "14.1\t0.3770711510289289\t2.373619890173301\t1.9803188348317768\n", "14.2\t0.3745596003888268\t2.358857146684646\t1.9682781856327505\n", "14.3\t0.3720831874354002\t2.3442872663683785\t1.9563926602783916\n", "14.4\t0.36964118046236066\t2.32990641959609\t1.9446592107822769\n", "14.5\t0.36723286793941123\t2.315710878500726\t1.9330748694515214\n", "14.6\t0.3648575578215951\t2.3016970135976464\t1.9216367462404509\n", "14.7\t0.36251457688682004\t2.287861290540006\t1.910342026208781\n", "14.8\t0.3602032701002296\t2.274200267002247\t1.8991879670794969\n", "14.9\t0.357923000004158\t2.26071058968582\t1.8881718968918926\n", "15.0\t0.3556731461324769\t2.2473889914415754\t1.8772912117454528\n", "15.1\t0.353453104448203\t2.234232288503513\t1.8665433736304802\n", "15.2\t0.35126228680329497\t2.221237377828907\t1.8559259083415982\n", "15.3\t0.3491001204196282\t2.2084012345400286\t1.845436403470438\n", "15.4\t0.3469660473901797\t2.1957209094629615\t1.835072506474014\n", "15.5\t0.3448595241995173\t2.1831935267592297\t1.824831922815469\n", "15.6\t0.3427800212627204\t2.170816281646157\t1.8147124141740314\n", "15.7\t0.34072702248191666\t2.158586438202101\t1.8047117967211865\n", "15.8\t0.33870002481965195\t2.1465013272528792\t1.7948279394602165\n", "15.9\t0.3366985378883526\t2.134558344335901\t1.7850587626263867\n", "16.0\t0.33472208355517563\t2.122754947738674\t1.7754022361452126\n", "16.1\t0.33277019556158083\t2.111088656608532\t1.7658563781463463\n", "16.2\t0.33084241915698676\t2.0995570491305764\t1.7564192535307461\n", "16.3\t0.32893831074590485\t2.0881577607709536\t1.7470889725889123\n", "16.4\t0.3270574375479805\t2.0768884825827687\t1.7378636896680617\n", "16.5\t0.3251993772703896\t2.0657469595720115\t1.7287416018862318\n", "16.6\t0.32336371779207285\t2.054730989121034\t1.7197209478913829\n", "16.7\t0.3215500568593091\t2.043838419467228\t1.7108000066636726\n", "16.8\t0.31975800179215863\t2.0330671482346325\t1.7019770963591483\n", "16.9\t0.3179871692013229\t2.022415121016355\t1.693250573193194\n", "17.0\t0.3162371847149949\t2.011880330005736\t1.684618830362136\n", "17.1\t0.3145076827152896\t2.0014608126743285\t1.6760802970014965\n", "17.2\t0.31279830608386505\t1.991154650494809\t1.6676334371794341\n", "17.3\t0.31110870595636253\t1.9809599677070577\t1.6592767489239986\n", "17.4\t0.3094385414853119\t1.9708749301257074\t1.6510087632828718\n", "17.5\t0.3077874796111622\t1.9608977439875288\t1.6428280434143254\n", "17.6\t0.30615519484111486\t1.9510266548371218\t1.6347331837082066\n", "17.7\t0.3045413690354524\t1.9412599464494087\t1.6267228089357717\n", "17.8\t0.3029456912010658\t1.9315959397875393\t1.6187955734272899\n", "17.9\t0.3013678572919011\t1.9220329919948316\t1.6109501602763423\n", "18.0\t0.29980757001605496\t1.9125694954194674\t1.603185280569817\n", "18.1\t0.29826453864926233\t1.9032038766707016\t1.5954996726426307\n", "18.2\t0.29673847885453164\t1.8939345957053948\t1.5878921013562524\n", "18.3\t0.29522911250768985\t1.8847601449437406\t1.5803613574001418\n", "18.4\t0.2937361675286164\t1.8756790484131034\t1.5729062566152603\n", "18.5\t0.2922593777179467\t1.866689860918917\t1.565525639338836\n" ] }, { "data": { "text/plain": [ "null" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "println \"E(keV)\\telastic\\tion\\texc\"\n", "for(d = 12.0; d < 18.6; d += 0.1){\n", " def sigmaEl = scatter.sigmael(d*1000)/factor\n", " def sigmaIon = scatter.sigmaion(d*1000)/factor\n", " def sigmaExc = scatter.sigmaexc(d*1000)/factor\n", " println \"$d\\t$sigmaEl\\t$sigmaIon\\t$sigmaExc\"\n", "}" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b29b147e-ab0d-473b-b9db-909013996ad7", "version_major": 2, "version_minor": 0 }, "method": "display_data" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import com.twosigma.beakerx.table.*\n", "\n", "def list = []\n", " \n", "for(d = 12.0; d < 18.6; d += 0.1){\n", " list << [\n", " \"x\": d,\n", " \"el\": scatter.sigmael(d*1000)/factor,\n", " \"ion\": scatter.sigmaion(d*1000)/factor,\n", " \"exc\": scatter.sigmaexc(d*1000)/factor \n", " ]\n", "}\n", "beakerx[\"table\"] = new TableDisplay(list)\n", "list" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[{'x': 12.0,\n", " 'el': 0.43948540252301355,\n", " 'ion': 2.7362696996880764,\n", " 'exc': 2.2754271467658227},\n", " {'x': 12.1,\n", " 'el': 0.4360219815420227,\n", " 'ion': 2.716347129996631,\n", " 'exc': 2.259247553470829},\n", " {'x': 12.2,\n", " 'el': 0.4326153394877464,\n", " 'ion': 2.6967291910800784,\n", " 'exc': 2.2433117665045716},\n", " {'x': 12.3,\n", " 'el': 0.42926409223681455,\n", " 'ion': 2.6774088086825643,\n", " 'exc': 2.227614186457129},\n", " {'x': 12.4,\n", " 'el': 0.42596690029168804,\n", " 'ion': 2.6583791281775273,\n", " 'exc': 2.212149386181278},\n", " {'x': 12.5,\n", " 'el': 0.4227224669965498,\n", " 'ion': 2.639633506055748,\n", " 'exc': 2.1969121041685504},\n", " {'x': 12.6,\n", " 'el': 0.41952953683810995,\n", " 'ion': 2.621165501807934,\n", " 'exc': 2.1818972382301722},\n", " {'x': 12.7,\n", " 'el': 0.4163868938266485,\n", " 'ion': 2.602968870180603,\n", " 'exc': 2.1670998394665926},\n", " {'x': 12.8,\n", " 'el': 0.4132933599529065,\n", " 'ion': 2.585037553785318,\n", " 'exc': 2.1525151065102723},\n", " {'x': 12.9,\n", " 'el': 0.4102477937167139,\n", " 'ion': 2.567365676042546,\n", " 'exc': 2.138138380027344},\n", " {'x': 13.0,\n", " 'el': 0.4072490887234942,\n", " 'ion': 2.5499475344425586,\n", " 'exc': 2.123965137464613},\n", " {'x': 13.1,\n", " 'el': 0.4042961723450181,\n", " 'ion': 2.532777594106803,\n", " 'exc': 2.1099909880291814},\n", " {'x': 13.2,\n", " 'el': 0.40138800444100226,\n", " 'ion': 2.515850481634202,\n", " 'exc': 2.096211667888705},\n", " {'x': 13.3,\n", " 'el': 0.3985235761383543,\n", " 'ion': 2.4991609792177183,\n", " 'exc': 2.082623035581028},\n", " {'x': 13.4,\n", " 'el': 0.3957019086650494,\n", " 'ion': 2.4827040190174023,\n", " 'exc': 2.069221067622563},\n", " {'x': 13.5,\n", " 'el': 0.39292205223581,\n", " 'ion': 2.466474677776929,\n", " 'exc': 2.0560018543054204},\n", " {'x': 13.6,\n", " 'el': 0.39018308498692494,\n", " 'ion': 2.4504681716713828,\n", " 'exc': 2.042961595673853},\n", " {'x': 13.7,\n", " 'el': 0.3874841119576961,\n", " 'ion': 2.434679851374739,\n", " 'exc': 2.0300965976711156},\n", " {'x': 13.8,\n", " 'el': 0.3848242641161482,\n", " 'ion': 2.419105197336177,\n", " 'exc': 2.0174032684483527},\n", " {'x': 13.9,\n", " 'el': 0.3822026974267757,\n", " 'ion': 2.403739815254919,\n", " 'exc': 2.00487811482759},\n", " {'x': 14.0,\n", " 'el': 0.3796185919582249,\n", " 'ion': 2.3885794317439313,\n", " 'exc': 1.9925177389113418},\n", " {'x': 14.1,\n", " 'el': 0.3770711510289289,\n", " 'ion': 2.373619890173301,\n", " 'exc': 1.9803188348317768},\n", " {'x': 14.2,\n", " 'el': 0.3745596003888268,\n", " 'ion': 2.358857146684646,\n", " 'exc': 1.9682781856327505},\n", " {'x': 14.3,\n", " 'el': 0.3720831874354002,\n", " 'ion': 2.3442872663683785,\n", " 'exc': 1.9563926602783916},\n", " {'x': 14.4,\n", " 'el': 0.36964118046236066,\n", " 'ion': 2.32990641959609,\n", " 'exc': 1.9446592107822769},\n", " {'x': 14.5,\n", " 'el': 0.36723286793941123,\n", " 'ion': 2.315710878500726,\n", " 'exc': 1.9330748694515214},\n", " {'x': 14.6,\n", " 'el': 0.3648575578215951,\n", " 'ion': 2.3016970135976464,\n", " 'exc': 1.9216367462404509},\n", " {'x': 14.7,\n", " 'el': 0.36251457688682004,\n", " 'ion': 2.287861290540006,\n", " 'exc': 1.910342026208781},\n", " {'x': 14.8,\n", " 'el': 0.3602032701002296,\n", " 'ion': 2.274200267002247,\n", " 'exc': 1.8991879670794969},\n", " {'x': 14.9,\n", " 'el': 0.357923000004158,\n", " 'ion': 2.26071058968582,\n", " 'exc': 1.8881718968918926},\n", " {'x': 15.0,\n", " 'el': 0.3556731461324769,\n", " 'ion': 2.2473889914415754,\n", " 'exc': 1.8772912117454528},\n", " {'x': 15.1,\n", " 'el': 0.353453104448203,\n", " 'ion': 2.234232288503513,\n", " 'exc': 1.8665433736304802},\n", " {'x': 15.2,\n", " 'el': 0.35126228680329497,\n", " 'ion': 2.221237377828907,\n", " 'exc': 1.8559259083415982},\n", " {'x': 15.3,\n", " 'el': 0.3491001204196282,\n", " 'ion': 2.2084012345400286,\n", " 'exc': 1.845436403470438},\n", " {'x': 15.4,\n", " 'el': 0.3469660473901797,\n", " 'ion': 2.1957209094629615,\n", " 'exc': 1.835072506474014},\n", " {'x': 15.5,\n", " 'el': 0.3448595241995173,\n", " 'ion': 2.1831935267592297,\n", " 'exc': 1.824831922815469},\n", " {'x': 15.6,\n", " 'el': 0.3427800212627204,\n", " 'ion': 2.170816281646157,\n", " 'exc': 1.8147124141740314},\n", " {'x': 15.7,\n", " 'el': 0.34072702248191666,\n", " 'ion': 2.158586438202101,\n", " 'exc': 1.8047117967211865},\n", " {'x': 15.8,\n", " 'el': 0.33870002481965195,\n", " 'ion': 2.1465013272528792,\n", " 'exc': 1.7948279394602165},\n", " {'x': 15.9,\n", " 'el': 0.3366985378883526,\n", " 'ion': 2.134558344335901,\n", " 'exc': 1.7850587626263867},\n", " {'x': 16.0,\n", " 'el': 0.33472208355517563,\n", " 'ion': 2.122754947738674,\n", " 'exc': 1.7754022361452126},\n", " {'x': 16.1,\n", " 'el': 0.33277019556158083,\n", " 'ion': 2.111088656608532,\n", " 'exc': 1.7658563781463463},\n", " {'x': 16.2,\n", " 'el': 0.33084241915698676,\n", " 'ion': 2.0995570491305764,\n", " 'exc': 1.7564192535307461},\n", " {'x': 16.3,\n", " 'el': 0.32893831074590485,\n", " 'ion': 2.0881577607709536,\n", " 'exc': 1.7470889725889123},\n", " {'x': 16.4,\n", " 'el': 0.3270574375479805,\n", " 'ion': 2.0768884825827687,\n", " 'exc': 1.7378636896680617},\n", " {'x': 16.5,\n", " 'el': 0.3251993772703896,\n", " 'ion': 2.0657469595720115,\n", " 'exc': 1.7287416018862318},\n", " {'x': 16.6,\n", " 'el': 0.32336371779207285,\n", " 'ion': 2.054730989121034,\n", " 'exc': 1.7197209478913829},\n", " {'x': 16.7,\n", " 'el': 0.3215500568593091,\n", " 'ion': 2.043838419467228,\n", " 'exc': 1.7108000066636726},\n", " {'x': 16.8,\n", " 'el': 0.31975800179215863,\n", " 'ion': 2.0330671482346325,\n", " 'exc': 1.7019770963591483},\n", " {'x': 16.9,\n", " 'el': 0.3179871692013229,\n", " 'ion': 2.022415121016355,\n", " 'exc': 1.693250573193194},\n", " {'x': 17.0,\n", " 'el': 0.3162371847149949,\n", " 'ion': 2.011880330005736,\n", " 'exc': 1.684618830362136},\n", " {'x': 17.1,\n", " 'el': 0.3145076827152896,\n", " 'ion': 2.0014608126743285,\n", " 'exc': 1.6760802970014965},\n", " {'x': 17.2,\n", " 'el': 0.31279830608386505,\n", " 'ion': 1.991154650494809,\n", " 'exc': 1.6676334371794341},\n", " {'x': 17.3,\n", " 'el': 0.31110870595636253,\n", " 'ion': 1.9809599677070577,\n", " 'exc': 1.6592767489239986},\n", " {'x': 17.4,\n", " 'el': 0.3094385414853119,\n", " 'ion': 1.9708749301257074,\n", " 'exc': 1.6510087632828718},\n", " {'x': 17.5,\n", " 'el': 0.3077874796111622,\n", " 'ion': 1.9608977439875288,\n", " 'exc': 1.6428280434143254},\n", " {'x': 17.6,\n", " 'el': 0.30615519484111486,\n", " 'ion': 1.9510266548371218,\n", " 'exc': 1.6347331837082066},\n", " {'x': 17.7,\n", " 'el': 0.3045413690354524,\n", " 'ion': 1.9412599464494087,\n", " 'exc': 1.6267228089357717},\n", " {'x': 17.8,\n", " 'el': 0.3029456912010658,\n", " 'ion': 1.9315959397875393,\n", " 'exc': 1.6187955734272899},\n", " {'x': 17.9,\n", " 'el': 0.3013678572919011,\n", " 'ion': 1.9220329919948316,\n", " 'exc': 1.6109501602763423},\n", " {'x': 18.0,\n", " 'el': 0.29980757001605496,\n", " 'ion': 1.9125694954194674,\n", " 'exc': 1.603185280569817},\n", " {'x': 18.1,\n", " 'el': 0.29826453864926233,\n", " 'ion': 1.9032038766707016,\n", " 'exc': 1.5954996726426307},\n", " {'x': 18.2,\n", " 'el': 0.29673847885453164,\n", " 'ion': 1.8939345957053948,\n", " 'exc': 1.5878921013562524},\n", " {'x': 18.3,\n", " 'el': 0.29522911250768985,\n", " 'ion': 1.8847601449437406,\n", " 'exc': 1.5803613574001418},\n", " {'x': 18.4,\n", " 'el': 0.2937361675286164,\n", " 'ion': 1.8756790484131034,\n", " 'exc': 1.5729062566152603},\n", " {'x': 18.5,\n", " 'el': 0.2922593777179467,\n", " 'ion': 1.866689860918917,\n", " 'exc': 1.565525639338836}]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%python\n", "from beakerx.object import beakerx\n", "import pandas as pd\n", "beakerx.table" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Groovy", "language": "groovy", "name": "groovy" }, "language_info": { "codemirror_mode": "groovy", "file_extension": ".groovy", "mimetype": "", "name": "Groovy", "nbconverter_exporter": "", "version": "2.4.3" } }, "nbformat": 4, "nbformat_minor": 2 }