Created
May 26, 2020 11:21
-
-
Save altavir/986013a078040ccc9def0393eeaf8ae6 to your computer and use it in GitHub Desktop.
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": 8, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/html": [ | |
| " <div id=\"6Ch9fs\"></div>\n", | |
| " <script type=\"text/javascript\">\n", | |
| " if(!window.letsPlotCallQueue) {\n", | |
| " window.letsPlotCallQueue = [];\n", | |
| " }; \n", | |
| " window.letsPlotCall = function(f) {\n", | |
| " window.letsPlotCallQueue.push(f);\n", | |
| " };\n", | |
| " (function() {\n", | |
| " var script = document.createElement(\"script\");\n", | |
| " script.type = \"text/javascript\";\n", | |
| " script.src = \"https://dl.bintray.com/jetbrains/lets-plot/lets-plot-1.0.0.min.js\";\n", | |
| " script.onload = function() {\n", | |
| " window.letsPlotCall = function(f) {f();};\n", | |
| " window.letsPlotCallQueue.forEach(function(f) {f();});\n", | |
| " window.letsPlotCallQueue = [];\n", | |
| " \n", | |
| " \n", | |
| " };\n", | |
| " script.onerror = function(event) {\n", | |
| " window.letsPlotCall = function(f) {};\n", | |
| " window.letsPlotCallQueue = [];\n", | |
| " var div = document.createElement(\"div\");\n", | |
| " div.style.color = 'darkred';\n", | |
| " div.textContent = 'Error loading Lets-Plot JS';\n", | |
| " document.getElementById(\"6Ch9fs\").appendChild(div);\n", | |
| " };\n", | |
| " var e = document.getElementById(\"6Ch9fs\");\n", | |
| " e.appendChild(script);\n", | |
| " })();\n", | |
| " </script>" | |
| ] | |
| }, | |
| "metadata": {}, | |
| "output_type": "display_data" | |
| } | |
| ], | |
| "source": [ | |
| "%use lets-plot\n", | |
| "%use kmath-commons" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 9, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "import org.apache.commons.math3.analysis.function.Gaussian\n", | |
| "import org.apache.commons.math3.analysis.integration.SimpsonIntegrator\n", | |
| "\n", | |
| "//defined thedefault integrator\n", | |
| "val integrator: SimpsonIntegrator = SimpsonIntegrator()\n", | |
| "\n", | |
| "// pre-define function to create a kernel\n", | |
| "fun gauss(sigma: Double) = Gaussian(0.0, sigma)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "## Creating class hierarchy to work with peaks" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 4, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "import org.apache.commons.math3.analysis.UnivariateFunction\n", | |
| "\n", | |
| "/**\n", | |
| " * Pre-define sealed hierarchi for two different types of peaks\n", | |
| " */\n", | |
| "sealed class Peak(val amplitude: Double){\n", | |
| " class Delta(amplitude: Double, val position: Double): Peak(amplitude)\n", | |
| " class Wide(amplitude: Double, val function: UnivariateFunction): Peak(amplitude)\n", | |
| "}\n", | |
| "\n", | |
| "/**\n", | |
| " * Define invoke operation for [UnivariateFunction]\n", | |
| " */\n", | |
| "operator fun UnivariateFunction.invoke(arg: Double) = value(arg)\n", | |
| "\n", | |
| "/**\n", | |
| " * Additional function to scale function. Probably should be removed to avoid additional object creation\n", | |
| " */\n", | |
| "operator fun UnivariateFunction.times(d: Double): UnivariateFunction = UnivariateFunction{arg: Double -> [email protected](arg)*d }\n", | |
| "\n", | |
| "\n", | |
| "/**\n", | |
| " * An extension to performe actual convolution\n", | |
| " */\n", | |
| "fun UnivariateFunction.convolve(range: ClosedFloatingPointRange<Double>, function: UnivariateFunction): UnivariateFunction{\n", | |
| " return UnivariateFunction{ x: Double ->\n", | |
| " val integrand = UnivariateFunction{y: Double -> \n", | |
| " this@convolve(x - y) * function(y)\n", | |
| " }\n", | |
| " integrator.integrate(100000, integrand, range.start, range.endInclusive)\n", | |
| " }\n", | |
| "}\n", | |
| "\n", | |
| "/**\n", | |
| " * An extension to create convolution depending on a peak type\n", | |
| " */\n", | |
| "fun Peak.convolve(range: ClosedFloatingPointRange<Double>, kernel: UnivariateFunction): UnivariateFunction {\n", | |
| " return when(this){\n", | |
| " is Peak.Delta -> UnivariateFunction{arg -> kernel.value(arg - position) * amplitude}\n", | |
| " is Peak.Wide -> function.convolve(range, kernel) * amplitude\n", | |
| " }\n", | |
| "}" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 10, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "import jetbrains.letsPlot.intern.Plot\n", | |
| "\n", | |
| "class Spectrum(val peaks: List<Peak>){\n", | |
| " companion object{\n", | |
| " fun of(vararg peaks: Peak) = Spectrum(peaks.toList())\n", | |
| " }\n", | |
| "}\n", | |
| "\n", | |
| "/**\n", | |
| " * Convolve a spectrum with the [kernel] to produce a function. \n", | |
| " * It is also possible to produce a spectrum with separate lines instead.\n", | |
| " */\n", | |
| "fun Spectrum.convolve(range: ClosedFloatingPointRange<Double>, kernel: UnivariateFunction) = UnivariateFunction{arg: Double ->\n", | |
| " peaks.sumByDouble { peak ->\n", | |
| " peak.convolve(range,kernel).value(arg)\n", | |
| " }\n", | |
| "}\n", | |
| "\n", | |
| "/**\n", | |
| " * Display a plot\n", | |
| " */\n", | |
| "fun UnivariateFunction.show(range: ClosedFloatingPointRange<Double>, points: Int = 1000): Plot{\n", | |
| " val x: List<Double> = List(points){i -> range.start + i*(range.endInclusive - range.start)/(points) - 1}\n", | |
| " val y = x.map{value(it)}\n", | |
| " \n", | |
| " val data = mapOf<String, Any>(\n", | |
| " \"x\" to x,\n", | |
| " \"y\" to y\n", | |
| " )\n", | |
| " \n", | |
| " var p = lets_plot(data)\n", | |
| " p += geom_area{\n", | |
| " this.x = \"x\"\n", | |
| " this.y = \"y\"\n", | |
| " }\n", | |
| " return p\n", | |
| "}" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "## Define actual spectrum" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 6, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "import kotlin.math.*\n", | |
| "\n", | |
| "val k_base_prob = 0.864\n", | |
| "val k_base_energy = 112.0\n", | |
| "val k_ext_prob = 0.096\n", | |
| "val k_ext_energy = 83.0\n", | |
| "val l_base_prob = 0.036\n", | |
| "val l_base_energy = 55.0\n", | |
| "val l_ext_prob = 0.004 \n", | |
| "\n", | |
| "val ext_width = 28.0\n", | |
| "\n", | |
| "val spectrum = Spectrum.of(\n", | |
| " Peak.Delta(k_base_prob, k_base_energy),\n", | |
| " Peak.Delta(l_base_prob,l_base_energy),\n", | |
| " Peak.Wide(k_ext_prob){ x ->\n", | |
| " if(abs(x - k_ext_energy) > ext_width){\n", | |
| " 0.0\n", | |
| " } else{\n", | |
| " cos( (x - k_ext_energy)/ext_width * PI/2.0) /2.0 *k_ext_prob\n", | |
| " }\n", | |
| " }\n", | |
| ")" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 7, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/html": [ | |
| " <div id=\"oMx0yd\"></div>\n", | |
| " <script type=\"text/javascript\">\n", | |
| " (function() {\n", | |
| " var plotSpec={\n", | |
| "'mapping':{\n", | |
| "},\n", | |
| "'data':{\n", | |
| "'x':[-1.0,-0.87,-0.74,-0.61,-0.48,-0.35,-0.21999999999999997,-0.08999999999999997,0.040000000000000036,0.16999999999999993,0.30000000000000004,0.42999999999999994,0.56,0.69,0.8200000000000001,0.95,1.08,1.21,1.3399999999999999,1.4700000000000002,1.6,1.73,1.8599999999999999,1.9900000000000002,2.12,2.25,2.38,2.51,2.64,2.77,2.9,3.0300000000000002,3.16,3.29,3.42,3.55,3.6799999999999997,3.8099999999999996,3.9400000000000004,4.07,4.2,4.33,4.46,4.59,4.72,4.85,4.98,5.11,5.24,5.37,5.5,5.63,5.76,5.89,6.02,6.15,6.28,6.41,6.54,6.67,6.8,6.93,7.0600000000000005,7.1899999999999995,7.32,7.449999999999999,7.58,7.710000000000001,7.84,7.970000000000001,8.1,8.23,8.36,8.49,8.62,8.75,8.88,9.01,9.14,9.27,9.4,9.53,9.66,9.79,9.92,10.05,10.18,10.31,10.44,10.57,10.7,10.83,10.96,11.09,11.22,11.35,11.48,11.61,11.74,11.87,12.0,12.13,12.26,12.39,12.52,12.65,12.78,12.91,13.04,13.17,13.3,13.43,13.56,13.69,13.82,13.95,14.08,14.21,14.34,14.47,14.6,14.73,14.86,14.99,15.120000000000001,15.25,15.379999999999999,15.510000000000002,15.64,15.77,15.899999999999999,16.03,16.16,16.29,16.42,16.55,16.68,16.81,16.94,17.07,17.2,17.33,17.46,17.59,17.72,17.85,17.98,18.11,18.24,18.37,18.5,18.63,18.76,18.89,19.02,19.15,19.28,19.41,19.54,19.67,19.8,19.93,20.06,20.19,20.32,20.45,20.58,20.71,20.84,20.97,21.1,21.23,21.36,21.49,21.62,21.75,21.88,22.01,22.14,22.27,22.4,22.53,22.66,22.79,22.92,23.05,23.18,23.31,23.44,23.57,23.7,23.83,23.96,24.09,24.22,24.35,24.48,24.61,24.74,24.87,25.0,25.13,25.26,25.39,25.52,25.65,25.78,25.91,26.04,26.17,26.3,26.43,26.56,26.69,26.82,26.95,27.08,27.21,27.34,27.47,27.6,27.73,27.86,27.99,28.12,28.25,28.38,28.51,28.64,28.77,28.9,29.03,29.16,29.29,29.42,29.55,29.68,29.81,29.94,30.07,30.2,30.33,30.46,30.59,30.72,30.85,30.98,31.11,31.240000000000002,31.369999999999997,31.5,31.630000000000003,31.759999999999998,31.89,32.02,32.15,32.28,32.41,32.54,32.67,32.8,32.93,33.06,33.19,33.32,33.45,33.58,33.71,33.84,33.97,34.1,34.23,34.36,34.49,34.62,34.75,34.88,35.01,35.14,35.27,35.4,35.53,35.66,35.79,35.92,36.05,36.18,36.31,36.44,36.57,36.7,36.83,36.96,37.09,37.22,37.35,37.48,37.61,37.74,37.87,38.0,38.13,38.26,38.39,38.52,38.65,38.78,38.91,39.04,39.17,39.3,39.43,39.56,39.69,39.82,39.95,40.08,40.21,40.34,40.47,40.6,40.73,40.86,40.99,41.12,41.25,41.38,41.51,41.64,41.77,41.9,42.03,42.16,42.29,42.42,42.55,42.68,42.81,42.94,43.07,43.2,43.33,43.46,43.59,43.72,43.85,43.98,44.11,44.24,44.37,44.5,44.63,44.76,44.89,45.02,45.15,45.28,45.41,45.54,45.67,45.8,45.93,46.06,46.19,46.32,46.45,46.58,46.71,46.84,46.97,47.1,47.23,47.36,47.49,47.62,47.75,47.88,48.01,48.14,48.27,48.4,48.53,48.66,48.79,48.92,49.05,49.18,49.31,49.44,49.57,49.7,49.83,49.96,50.09,50.22,50.35,50.48,50.61,50.74,50.87,51.0,51.13,51.26,51.39,51.52,51.65,51.78,51.91,52.04,52.17,52.3,52.43,52.56,52.69,52.82,52.95,53.08,53.21,53.34,53.47,53.6,53.73,53.86,53.99,54.12,54.25,54.38,54.51,54.64,54.77,54.9,55.03,55.16,55.29,55.42,55.55,55.68,55.81,55.94,56.07,56.2,56.33,56.46,56.59,56.72,56.85,56.98,57.11,57.24,57.37,57.5,57.63,57.76,57.89,58.02,58.15,58.28,58.41,58.54,58.67,58.8,58.93,59.06,59.19,59.32,59.45,59.58,59.71,59.84,59.97,60.1,60.23,60.36,60.49,60.62,60.75,60.88,61.01,61.14,61.27,61.4,61.53,61.66,61.79,61.92,62.05,62.18,62.31,62.44,62.57,62.7,62.83,62.96,63.09,63.22,63.349999999999994,63.480000000000004,63.61,63.739999999999995,63.870000000000005,64.0,64.13,64.26,64.39,64.52,64.65,64.78,64.91,65.04,65.17,65.3,65.43,65.56,65.69,65.82,65.95,66.08,66.21,66.34,66.47,66.6,66.73,66.86,66.99,67.12,67.25,67.38,67.51,67.64,67.77,67.9,68.03,68.16,68.29,68.42,68.55,68.68,68.81,68.94,69.07,69.2,69.33,69.46,69.59,69.72,69.85,69.98,70.11,70.24,70.37,70.5,70.63,70.76,70.89,71.02,71.15,71.28,71.41,71.54,71.67,71.8,71.93,72.06,72.19,72.32,72.45,72.58,72.71,72.84,72.97,73.1,73.23,73.36,73.49,73.62,73.75,73.88,74.01,74.14,74.27,74.4,74.53,74.66,74.79,74.92,75.05,75.18,75.31,75.44,75.57,75.7,75.83,75.96,76.09,76.22,76.35,76.48,76.61,76.74,76.87,77.0,77.13,77.26,77.39,77.52,77.65,77.78,77.91,78.04,78.17,78.3,78.43,78.56,78.69,78.82,78.95,79.08,79.21,79.34,79.47,79.6,79.73,79.86,79.99,80.12,80.25,80.38,80.51,80.64,80.77,80.9,81.03,81.16,81.29,81.42,81.55,81.68,81.81,81.94,82.07,82.2,82.33,82.46,82.59,82.72,82.85,82.98,83.11,83.24,83.37,83.5,83.63,83.76,83.89,84.02,84.15,84.28,84.41,84.54,84.67,84.8,84.93,85.06,85.19,85.32,85.45,85.58,85.71,85.84,85.97,86.1,86.23,86.36,86.49,86.62,86.75,86.88,87.01,87.14,87.27,87.4,87.53,87.66,87.79,87.92,88.05,88.18,88.31,88.44,88.57,88.7,88.83,88.96,89.09,89.22,89.35,89.48,89.61,89.74,89.87,90.0,90.13,90.26,90.39,90.52,90.65,90.78,90.91,91.04,91.17,91.3,91.43,91.56,91.69,91.82,91.95,92.08,92.21,92.34,92.47,92.6,92.73,92.86,92.99,93.12,93.25,93.38,93.51,93.64,93.77,93.9,94.03,94.16,94.29,94.42,94.55,94.68,94.81,94.94,95.07,95.2,95.33,95.46,95.59,95.72,95.85,95.98,96.11,96.24,96.37,96.5,96.63,96.76,96.89,97.02,97.15,97.28,97.41,97.54,97.67,97.8,97.93,98.06,98.19,98.32,98.45,98.58,98.71,98.84,98.97,99.1,99.23,99.36,99.49,99.62,99.75,99.88,100.01,100.14,100.27,100.4,100.53,100.66,100.79,100.92,101.05,101.18,101.31,101.44,101.57,101.7,101.83,101.96,102.09,102.22,102.35,102.48,102.61,102.74,102.87,103.0,103.13,103.26,103.39,103.52,103.65,103.78,103.91,104.04,104.17,104.3,104.43,104.56,104.69,104.82,104.95,105.08,105.21,105.34,105.47,105.6,105.73,105.86,105.99,106.12,106.25,106.38,106.51,106.64,106.77,106.9,107.03,107.16,107.29,107.42,107.55,107.68,107.81,107.94,108.07,108.2,108.33,108.46,108.59,108.72,108.85,108.98,109.11,109.24,109.37,109.5,109.63,109.76,109.89,110.02,110.15,110.28,110.41,110.54,110.67,110.8,110.93,111.06,111.19,111.32,111.45,111.58,111.71,111.84,111.97,112.1,112.23,112.36,112.49,112.62,112.75,112.88,113.01,113.14,113.27,113.4,113.53,113.66,113.79,113.92,114.05,114.18,114.31,114.44,114.57,114.7,114.83,114.96,115.09,115.22,115.35,115.48,115.61,115.74,115.87,116.0,116.13,116.26,116.39,116.52,116.65,116.78,116.91,117.04,117.17,117.3,117.43,117.56,117.69,117.82,117.95,118.08,118.21,118.34,118.47,118.6,118.73,118.86,118.99,119.12,119.25,119.38,119.51,119.64,119.77,119.9,120.03,120.16,120.29,120.42,120.55,120.68,120.81,120.94,121.07,121.2,121.33,121.46,121.59,121.72,121.85,121.98,122.11,122.24,122.37,122.5,122.63,122.76,122.89,123.02,123.15,123.28,123.41,123.54,123.67,123.8,123.93,124.06,124.19,124.32,124.45,124.58,124.71,124.84,124.97,125.1,125.23,125.36,125.49,125.62,125.75,125.88,126.01,126.14,126.27,126.4,126.53,126.66,126.79,126.92,127.05000000000001,127.18,127.31,127.44,127.57,127.69999999999999,127.83000000000001,127.96000000000001,128.09,128.22,128.35,128.48,128.61,128.74,128.87],\n", | |
| "'y':[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.5E-323,1.966E-321,2.8389E-319,4.032956E-317,5.633209885E-315,7.73657616204E-313,1.04472527323065E-310,1.387125705487609E-308,1.8108812087181918E-306,2.3244731157105076E-304,2.9337257740375277E-302,3.640616460112698E-300,4.442124879802002E-298,5.329261389554657E-296,6.286424496242849E-294,7.291230178362286E-292,8.314925014815904E-290,9.32344232381996E-288,1.0279089875195193E-285,1.1142777571372684E-283,1.1876615117775626E-281,1.2446645696000335E-279,1.2825443593089842E-277,1.2994299907157464E-275,1.2944753962346321E-273,1.267929591995057E-271,1.221115935227884E-269,1.1563227834125554E-267,1.0766181328384216E-265,9.856091364619449E-264,8.871727107343782E-262,7.851851035678428E-260,6.832762919064661E-258,5.846299709045937E-256,4.918426915500141E-254,4.0684763198298283E-252,3.309007762398104E-250,2.646209368005106E-248,2.0807075472244442E-246,1.6086379333727866E-244,1.2228297386054919E-242,9.139745476188299E-241,6.716803366475841E-239,4.8534615200899905E-237,3.44826766852121E-235,2.408855633556324E-233,1.654554201504287E-231,1.117407669706501E-229,7.419979756281756E-228,4.844558628885031E-226,3.1100411478872486E-224,1.963082164366511E-222,1.2183476859031698E-220,7.434716821508822E-219,4.460854349974372E-217,2.631673932575726E-215,1.526534195216695E-213,8.70645618786783E-212,4.8824378522746866E-210,2.6921078362722396E-208,1.4595151376194998E-206,7.78009998810088E-205,4.0777648363028856E-203,2.1014525961782987E-201,1.0648230467653494E-199,5.305126085562771E-198,2.598809233755538E-196,1.2517382272042532E-194,5.928066311727993E-193,2.760406325098603E-191,1.2638437873675135E-189,5.6895013560072376E-188,2.5183462174245135E-186,1.0960164934421789E-184,4.690068294971199E-183,1.9733388546562775E-181,8.163654019051611E-180,3.320686966715937E-178,1.3281028471802904E-176,5.222709874446328E-175,2.019391471387272E-173,7.67724778223947E-172,2.8697959659964734E-170,1.0547679069029189E-168,3.8117395367796845E-167,1.3544093703812444E-165,4.731916865058374E-164,1.6254914345199935E-162,5.490257172935954E-161,1.8233125192941024E-159,5.953741344418257E-158,1.91152171320751E-156,6.034328256172554E-155,1.8730054895768776E-153,5.716228651984488E-152,1.7153018575722627E-150,5.060948834308776E-149,1.4681950605422704E-147,4.187897019986491E-146,1.1745422737113451E-144,3.238931282845536E-143,8.782036526910399E-142,2.3412574233183653E-140,6.1371045080760586E-139,1.5817516409220498E-137,4.008422504252686E-136,9.987783343132386E-135,2.446950350914932E-133,5.894427431684923E-132,1.3961063948266167E-130,3.251290916329937E-129,7.444809137745183E-128,1.6761455526054198E-126,3.710481863480309E-125,8.076241937004575E-124,1.7284178829264772E-122,3.6370444172939606E-121,7.525041198884384E-120,1.5308392272484512E-118,3.0620389162379273E-117,6.022159485863451E-116,1.1645394973054074E-114,2.2141988268134467E-113,4.139419421300756E-112,7.608913953455812E-111,1.3752014955771638E-109,2.4438267957441726E-108,4.2700693854663036E-107,7.336009160351109E-106,1.2392108895544362E-104,2.0582162397482575E-103,3.3612220448049432E-102,5.397141808207553E-101,8.521006142178648E-100,1.3227517683640282E-98,2.018953174604981E-97,3.02994374607655E-96,4.470985976514898E-95,6.486829351840946E-94,9.253841612026186E-93,1.2979921736619307E-91,1.790121501950089E-90,2.4274671841989902E-89,3.2365673546669787E-88,4.2430324613278315E-87,5.4692589052660296E-86,6.93172036120365E-85,8.638016094600475E-84,1.0583940919879159E-82,1.275091140482542E-81,1.5104121578382059E-80,1.7591794395413705E-79,2.0145833096691504E-78,2.268405783640322E-77,2.5114045889449034E-76,2.733839689832641E-75,2.9261044753701954E-74,3.079406596146399E-73,3.1864320838808423E-72,3.2419231834481552E-71,3.2431063997996154E-70,3.1899222480842005E-69,3.0850302100321675E-68,2.9335883216415377E-67,2.7428328245133246E-66,2.5215055683546897E-65,2.2791921907601432E-64,2.025640577076598E-63,1.770126285711398E-62,1.5209205840150456E-61,1.2848997579309267E-60,1.0673144278378105E-59,8.717178446561487E-59,7.000352604960808E-58,5.527443582092975E-57,4.291302646004656E-56,3.2757774850966834E-55,2.4586690032902046E-54,1.8144548327266222E-53,1.316596452963298E-52,9.393330930117831E-52,6.589416945567865E-51,4.545009309724629E-50,3.0823573665347532E-49,2.0553776245741872E-48,1.3475990087586417E-47,8.687406923479248E-47,5.506556119078821E-46,3.4318665986100015E-45,2.1030090876855956E-44,1.2671041816783321E-43,7.506611195682128E-43,4.3725616706496427E-42,2.504311731814145E-41,1.410266714936588E-40,7.808624640938163E-40,4.2511679333775125E-39,2.2756339206846532E-38,1.197724572358276E-37,6.19829074064099E-37,3.1538958740301766E-36,1.5779134627024646E-35,7.762103608753983E-35,3.754361714959329E-34,1.7854726945938028E-33,8.348928398122377E-33,3.838563093148157E-32,1.7352699795183194E-31,7.7130446748503386E-31,3.3708937472109314E-30,1.4485206917810802E-29,6.120188049511865E-29,2.5425251229784894E-28,1.0385470168406242E-27,4.171070164708768E-27,1.64713521258749E-26,6.395454758758867E-26,2.441597287414226E-25,9.165096872992714E-25,3.382676831789786E-24,1.2275646718608067E-23,4.380146910922486E-23,1.5367152319367454E-22,5.301008959400623E-22,1.797976883433133E-21,5.99611691656753E-21,1.966149351732646E-20,6.339037773251296E-20,2.0095119731370885E-19,6.26351728010624E-19,1.9195807448964816E-18,5.784354658600739E-18,1.713814704321749E-17,4.992674345439038E-17,1.4300889057237552E-16,4.0276642371667106E-16,1.1153313338585862E-15,3.0367914719077796E-15,8.129923559012236E-15,2.1400226823058277E-14,5.5387366220205895E-14,1.4094947899618511E-13,3.526766111004582E-13,8.676613781273681E-13,2.098863992059935E-12,4.9920479789950884E-12,1.1674374687902219E-11,2.6844104957610043E-11,6.069105008871079E-11,1.3491517426833882E-10,2.94888182525246E-10,6.337447318434881E-10,1.3391578727285963E-9,2.7823362798682112E-9,5.683919020520063E-9,1.1416857180177672E-8,2.2547878083211847E-8,4.3784985561527684E-8,8.360160370171216E-8,1.5695812552133859E-7,2.897440397934093E-7,5.258975542822913E-7,9.38519703793579E-7,1.6468056773500597E-6,2.8411835501170954E-6,4.819647121395742E-6,8.038795548391425E-6,1.3183389406048989E-5,2.1258075578074237E-5,3.3704035276444866E-5,5.2541346987151106E-5,8.053452173257033E-5,1.2137374926956298E-4,1.7985788529376834E-4,2.620574292312718E-4,3.754274497090227E-4,5.288328639701654E-4,7.324434124911064E-4,9.974551297374948E-4,0.0013356012120414656,0.0017584295457052112,0.0022763475426960333,0.0028974665251929304,0.0036263151837614576,0.004462529906712639,0.005399663143074556,0.0064242719903369995,0.0075154517202604045,0.008644957854639168,0.009778013826111882,0.010874832443120413,0.011892794496818007,0.012789138912624579,0.01352393832735321,0.01406307677801789,0.014380921646900349,0.014462399846181,0.014304243336999119,0.013915261686575269,0.013315609535116232,0.012535133293335374,0.011610987137787411,0.010584781387050681,0.009499568345396994,0.008396966326048695,0.007314681214789302,0.006284619391450181,0.005331692619133636,0.004473337334434176,0.0037196777072851035,0.003074215829259306,0.0025348982696532262,0.0020953762984210972,0.0017463228188189556,0.0014766698788097792,0.001274677242518325,0.0011287825848637937,0.0010282144475067655,9.633803661290664E-4,9.260603937857932E-4,9.094465262466854E-4,9.080694509041089E-4,9.176644139431623E-4,9.349887722257528E-4,9.576420411884463E-4,9.83888672564954E-4,0.0010125030695567413,0.0010426400353753219,0.001073727917809633,0.0011053891567825002,0.0011373789882793486,0.0011695418964775845,0.0012017808237918212,0.001234036084813222,0.0012662714683014725,0.0012984650978907662,0.0013306037265619756,0.0013626791683097586,0.001394686149942228,0.0014266210413787744,0.0014584811219282554,0.0014902641651672493,0.0015219682090257072,0.001553591431104077,0.0015851320824587021,0.001616588453168234,0.0016479588548063782,0.0016792416117191534,0.0017104350567924045,0.0017415375294623026,0.0017725473748236142,0.001803462943264367,0.0018342825903478607,0.0018650046768085447,0.001895627568599201,0.0019261496369606926,0.001956569258501388,0.0019868848152805223,0.002017094694893042,0.002047197290554887,0.0020771910011882617,0.002107074231506725,0.002136845392100001,0.002166502899518517,0.002196045176357617,0.0022254706513414498,0.0022547777594065545,0.0022839649417850942,0.002313030646087755,0.002341973326386331,0.0023707914432959365,0.00239948346405688,0.002428047862616196,0.0024564831197088095,0.002484787722938332,0.0025129601668575155,0.00254099895304832,0.0025689025902016,0.0025966695941964345,0.0026242984881790633,0.0026517878026414343,0.002679136075499353,0.002706341852170264,0.0027334036856506115,0.002760320136592787,0.002787089773381707,0.002813711172210944,0.0028401829171584487,0.0028665036002618774,0.002892671821593467,0.0029186861893344836,0.0029445453198492723,0.0029702478377588346,0.0029957923760139753,0.0030211775759680323,0.0030464020874491253,0.003071464568831958,0.0030963636871092046,0.003121098117962387,0.003145666545832309,0.0031700676639890473,0.003194300174601437,0.003218362788806097,0.0032422542267760007,0.0032659732177885256,0.0032895185002930535,0.003312888821978059,0.003336082939837723,0.003359099620238048,0.0033819376389824622,0.003404595781376935,0.003427072842294595,0.0034493676262398027,0.0034714789474117607,0.003493405629767573,0.003515146507084788,0.003536700423023442,0.003558066231187552,0.0035792427951860883,0.0036002289886934258,0.003621023695509239,0.003641625809617877,0.0036620342352471857,0.003682247886926796,0.0037022656895458464,0.0037220865784101677,0.003741709499298927,0.0037611334085206716,0.0037803572729688643,0.0037993800701768207,0.003818200788372091,0.003836818426530276,0.0038552319944282674,0.0038734405126969215,0.003891443012873137,0.003909238537451373,0.00392682613993458,0.003944204884884536,0.003961373847971593,0.003978332116023859,0.003995078787075749,0.004011612970415959,0.0040279337866348615,0.00404404036767125,0.004059931856858526,0.004075607408970271,0.004091066190265171,0.004106307378531394,0.004121330163130306,0.004136133745039585,0.004150717336895724,0.004165080163035907,0.0041792214595392655,0.004193140474267507,0.004206836466904923,0.004220308708997759,0.004233556483992965,0.004246579087276301,0.004259375826209826,0.004271946020168714,0.004284289000577483,0.0042964041109455325,0.00430829070690207,0.004319948156230385,0.004331375838901474,0.004342573147107005,0.004353539485291672,0.00436427427018485,0.004374776930831615,0.004385046908623133,0.004395083657326349,0.004404886643113052,0.004414455344588264,0.004423789252817971,0.004432887871356191,0.004441750716271389,0.0044503773161722,0.004458767212232508,0.004466919958215858,0.0044748351204991705,0.004482512278095831,0.004489951022678057,0.004497150958598628,0.004504111702911931,0.004510832885394316,0.004517314148563805,0.004523555147699091,0.004529555550857875,0.004535315038894529,0.004540833305477063,0.0045461100571034235,0.004551145013117092,0.004555937905722034,0.004560488479996922,0.004564796493908701,0.004568861718325466,0.004572683937028644,0.0045762629467245,0.004579598557054932,0.004582690590607625,0.004585538882925459,0.004588143282515275,0.004590503650855922,0.004592619862405627,0.004594491804608676,0.004596119377901399,0.004597502495717459,0.004598641084492466,0.004599535083667883,0.004600184445694247,0.004600589136033712,0.004600749133161858,0.00460066442856886,0.004600335026759933,0.004599760945255094,0.004598942214588222,0.004597878878305444,0.004596570992962814,0.00459501862812331,0.004593221866353118,0.0045911808032172725,0.0045888955472745355,0.004586366220071648,0.004583592956136858,0.0045805759029727685,0.004577315221048481,0.004573811083791079,0.004570063677576383,0.0045660732017190585,0.004561839868461997,0.004557363902965034,0.004552645543292983,0.004547685040402956,0.00454248265813103,0.0045370386731782095,0.004531353375095704,0.0045254270662695335,0.004519260061904448,0.004512852690007157,0.004506205291368885,0.004499318219547243,0.004492191840847435,0.004484826534302759,0.00447722269165446,0.004469380717330889,0.004461301028425994,0.004452984054677131,0.0044444302384422174,0.004435640034676192,0.0044266139109068285,0.004417352347209864,0.004407855836183458,0.004398124882922008,0.00438816000498927,0.004377961732390839,0.004367530607545957,0.004356867185258665,0.004345972032688287,0.00433484572931928,0.004323488866930392,0.004311902049563205,0.004300085893489998,0.004288041027180969,0.004275768091270812,0.004263267738524647,0.004250540633803288,0.004237587454027899,0.0042244088881439636,0.004211005637084679,0.00419737841373364,0.004183527942886945,0.004169454961214633,0.00415516021722151,0.004140644471207334,0.0041259084952263835,0.004110953073046385,0.004095779000106822,0.0040803870834766505,0.004064778141811347,0.004048953005309382,0.004032912515668058,0.004016657526038748,0.004000188900981504,0.003983507516419095,0.003966614259590402,0.003949510029003232,0.003932195734386532,0.003914672296642002,0.003896940647795111,0.0038790017309455315,0.0038608565002169718,0.003842505920706433,0.0038239509684328734,0.0038051926302853094,0.003786231903970303,0.0037670697979589186,0.003747707331433075,0.003728145534231336,0.003708385446794136,0.0036884281201084545,0.0036682746156518984,0.003647926005336251,0.003627383371450473,0.0036066478066031156,0.003585720413664228,0.0035646023057066814,0.0035432946059469872,0.0035217984476855384,0.003500114974246336,0.0034782453389161894,0.0034561907048833635,0.0034339522451757158,0.003411531142598311,0.0033889285896705063,0.0033661457885625174,0.0033431839510314966,0.003320044298357064,0.0032967280612763586,0.003273236479918586,0.0032495708037390443,0.003225732291452677,0.0032017222109671293,0.0031775418393153016,0.003153192462587435,0.0031286753758627073,0.0031039918831403447,0.00307914329727027,0.0030541309398832814,0.003028956141320748,0.003003620240563856,0.00297812458516239,0.002952470531163074,0.0029266594430374256,0.002900692693609195,0.0028745716639813545,0.002848297743462626,0.0028218723294935943,0.002795296827572387,0.0027685726511799138,0.00274170122170468,0.0027146839683672044,0.0026875223281439876,0.0026602177456910843,0.002632771673267281,0.0026051855706568324,0.00257746090509183,0.0025495991511741752,0.0025216017907971223,0.002493470313066485,0.002465206214221424,0.002436810997554869,0.0024082861733335523,0.0023796332587177047,0.0023508537776803368,0.0023219492609261984,0.0022929212458103515,0.002263771276256426,0.0022345009026744724,0.002205111681878519,0.0021756051770037694,0.002145982957423452,0.002116246598665352,0.0020863976823280303,0.002056437795996674,0.002026368533158678,0.0019961914931188895,0.0019659082809145366,0.0019355205072298632,0.00190502978831048,0.0018744377458773903,0.001843746007040775,0.0018129562042135487,0.001782069975024757,0.0017510889622331328,0.001720014813641465,0.0016888491820134294,0.0016575937249972323,0.0016262501050664261,0.0015948199895029712,0.0015633050504817395,0.0015317069653931884,0.0015000274177143862,0.0014682680991175865,0.0014364307143176166,0.001404516991861704,0.0013725287075590047,0.0013404677342617865,0.0013083361454850307,0.0012761364267966369,0.001243871900924408,0.0012115475654085786,0.001179171660368722,0.0011467586963300966,0.0011143349644370756,0.0010819484629570916,0.001049686789010262,0.0010177070271249879,9.862881670848571E-4,9.559155531542597E-4,9.274190235473382E-4,9.02189375298284E-4,8.825267334367246E-4,8.72114552609856E-4,8.767908675504561E-4,9.055813984104184E-4,9.721553310174037E-4,0.0010967701795045266,0.0013087888864209292,0.0016498102092926386,0.0021773947438561187,0.0029692674674871617,0.004127734523962198,0.005783883663161785,0.00810093458763801,0.011275920808884683,0.015538719682501017,0.02114738526038066,0.028378803040936727,0.0375139378131798,0.04881740405560709,0.06251176512532357,0.07874780853879369,0.09757297051246344,0.11890095592414922,0.1424862669641194,0.16790763171982787,0.1945640907378582,0.2216866616815174,0.2483670792171752,0.2736032184828309,0.29635868121527853,0.3156319542274033,0.33052887806008835,0.34033118902725673,0.34455383934685474,0.3429847297982293,0.33570232341445266,0.3230691035134516,0.3057016348745977,0.28442067009397376,0.26018692059026477,0.23402947986132744,0.20697428428693412,0.17997942614010035,0.15388274952900108,0.1293652331660761,0.10693152174463263,0.08690693418845678,0.0694486174559815,0.0545673995664657,0.04215638658219369,0.032022405862008725,0.023916905543981213,0.01756371838715804,0.012682018529549447,0.009003694269436202,0.006285119376133012,0.004313867033244493,0.002911256083387194,0.0019317658855125136,0.0012603437232787489,8.085072891031248E-4,5.099637450535724E-4,3.162678814639675E-4,1.9285517829592695E-4,1.1562931506086096E-4,6.816556426835045E-5,3.951141093354262E-5,2.251855226523881E-5,1.2618822072228343E-5,6.952765642409169E-6,3.7666631920362735E-6,2.0063948698927053E-6,1.050839653476627E-6,5.411490739970844E-7,2.740045723242642E-7,1.364140564924762E-7,6.677607071683708E-8,3.213978894548631E-8,1.520987356424436E-8,7.0773163806059045E-9,3.237964182440132E-9,1.456585202129121E-9,6.442585189826411E-10,2.8018499250965327E-10,1.1980915149588765E-10,5.037273580943611E-11,2.0823873075056836E-11,8.464238666411417E-12,3.3827874959082745E-12,1.3292967892849416E-12,5.13605443753426E-13,1.951181654162833E-13,7.288299532578672E-14,2.6767952012607586E-14,9.666394169199556E-15,3.4322133737370124E-15,1.1982418429053692E-15,4.1131552903719636E-16,1.3882451180641775E-16,4.606993787751556E-17,1.503244147225412E-17,4.822828735529013E-18,1.5213690655803112E-18,4.718758444158687E-19,1.4390680599762075E-19,4.315144520239519E-20,1.2722421502562401E-20,3.6881165566481894E-21,1.0512352586213966E-21,2.9461552124661243E-22,8.11842439629491E-23,2.1996232495182514E-23,5.859833489794601E-24,1.5349091421020189E-24,3.953124510209976E-25,1.0010568395301826E-25,2.4925128404173208E-26,6.102060295148375E-27,1.4688451318829623E-27,3.4764496602742963E-28,8.090144993306236E-29,1.8511307219640813E-29,4.164647950843612E-30,9.212551423555576E-31,2.0037428155493707E-31,4.2851344670247606E-32,9.010468115902391E-33,1.8629048661009562E-33,3.7869923104862382E-34,7.569350097672425E-35,1.4875897777538376E-35,2.874538973660107E-36,5.461521409643168E-37,1.020280304010603E-37,1.8740699138253456E-38,3.384640115847524E-39,6.010348156353949E-40,1.0494148009560188E-40,1.8015866869635313E-41,3.0410500360279976E-42,5.047221810445932E-43,8.236479836663185E-44,1.321573468578917E-44,2.0849776616352267E-45,3.234237621020418E-46,4.93290629897805E-47,7.397657679683409E-48,1.0908022343338024E-48,1.5814600669362879E-49,2.2543994232277993E-50,3.159831487111601E-51,4.354691598543893E-52,5.900805607896492E-53,7.861865964232933E-54,1.0299126350413518E-54,1.3265864597020125E-55,1.6800846251904033E-56,2.092122827174757E-57,2.5615546268107457E-58,3.083759419034575E-59,3.650209401636524E-60,4.2483030857063894E-61,4.861537384983283E-62,5.470061257823567E-63]\n", | |
| "},\n", | |
| "'kind':\"plot\",\n", | |
| "'scales':[],\n", | |
| "'layers':[{\n", | |
| "'stat':\"identity\",\n", | |
| "'mapping':{\n", | |
| "'x':\"x\",\n", | |
| "'y':\"y\"\n", | |
| "},\n", | |
| "'data':{\n", | |
| "},\n", | |
| "'position':\"stack\",\n", | |
| "'geom':\"area\"\n", | |
| "}]\n", | |
| "};\n", | |
| " var plotContainer = document.getElementById(\"oMx0yd\");\n", | |
| " window.letsPlotCall(function() {{\n", | |
| " LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n", | |
| " }});\n", | |
| " })(); \n", | |
| " </script>" | |
| ] | |
| }, | |
| "execution_count": 7, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "val width = 1.0\n", | |
| "\n", | |
| "val convolved = spectrum.convolve(-5*width..5*width, gauss(0.0, width))\n", | |
| "\n", | |
| "convolved.show(0.0..130.0)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Kotlin", | |
| "language": "kotlin", | |
| "name": "kotlin" | |
| }, | |
| "language_info": { | |
| "codemirror_mode": "text/x-kotlin", | |
| "file_extension": ".kt", | |
| "mimetype": "text/x-kotlin", | |
| "name": "kotlin", | |
| "pygments_lexer": "kotlin", | |
| "version": "1.4.0-dev-7568" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 4 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment