{"id":2257,"date":"2019-10-07T11:56:31","date_gmt":"2019-10-07T11:56:31","guid":{"rendered":"https:\/\/isolpharm.pd.infn.it\/web\/?page_id=2257"},"modified":"2026-04-13T12:47:02","modified_gmt":"2026-04-13T10:47:02","slug":"nuclides-chart-dev","status":"publish","type":"page","link":"https:\/\/isolpharm.pd.infn.it\/?page_id=2257","title":{"rendered":"Chart of Nuclides 2.5"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"2257\" class=\"elementor elementor-2257\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-e8b721c elementor-section-full_width elementor-section-height-default elementor-section-height-default\" data-id=\"e8b721c\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-da18994\" data-id=\"da18994\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-ac13593 elementor-widget elementor-widget-html\" data-id=\"ac13593\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\n<link type=\"text\/css\" href=\".\/nuclides_style.css\" rel=\"stylesheet\"\/>\n\n<script type='text\/javascript' src=\"https:\/\/d3js.org\/d3.v6.min.js\"><\/script>\n\n<script type='text\/javascript' src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/d3-legend\/2.25.6\/d3-legend.min.js\"><\/script>\n\n\n<div id='page-content' class=\"page-content\">\n    <div id='menu' >\n    <\/div>\n    <div id='chart' > <!--\/div>style=\"background-image: linear-gradient(0deg, #000000 0%, #fff659 100%)\"-->\n    <\/div>\nRelease v2.5 2025. Developed by the ISOLPHARM team using IAEA's ENSDF data (Oct 2020). For any questions please contact us (isolpharm@lnl.infn.it)\n<\/div>\n\n\n<script>\n\/*\n    d3.selectAll('.header-wrapper').remove();\n    d3.selectAll('#mainmenu_container').remove();\n\n    var menu = d3.select('.row.basis-auto')\n        .insert('div', '.main_menu_col.col-xs')\n        .attr('class', 'center-div');\n*\/\n    String.prototype.capitalize = function() {\n        var s = this.toLowerCase()\n        return s.charAt(0).toUpperCase() + s.slice(1);\n    }\n\n    var menu = d3.select('#menu');\n\n\n    id='chart'\n\n\n    const rect_size = 7;\n\n    var transform = null;\n    var simulations = null;\n    var nuclide_data = null;\n    var viewMode = null;\n    var target = null;\n    var beam = null;\n    var intensity = 10;\n    var nuclides = null;\n\n    \/\/class=\"svg-container\"\n    \/\/ Define the SVG fot the nuclides chart\n    \/\/var width  = parseInt(d3.select(\"#chart\").style(\"width\")); \/\/window.innerWidth\n    \/\/var height = 1100;\n    var frame_width = parseInt(d3.select(\"#chart\").style(\"width\"));\n    var frame_height = parseInt(d3.select(\"#chart\").style(\"height\"));\n    var width  = 178 * rect_size;\n    var height = 119 * rect_size;\n\n\/*\n    console.log(frame_width);\n    console.log(frame_height);\n    console.log(width);\n    console.log(height);\n*\/\n\n    var svg = d3.select('#chart')\n        .append('svg')\n        \/\/.attr('preserveAspectRatio', 'xMinYMin')\n        \/\/.attr('viewBox', '0 0 '+ width + ' ' + height);\n        \/\/.classed(\"svg-content\", true);\n        .attr('width', frame_width)\n        .attr('height', height);\n\n    var defs = svg.append('defs');\n\n    var blur = defs.append('filter')\n        .attr('id', 'blur')\n        .attr('x', '0')\n        .attr('y', '0')\n        .attr('width', '200%')\n        .attr('height', '200%');\n\n    blur.append('feOffset')\n        .attr('result','offOut')\n        .attr('in', 'SourceAlpha')\n        .attr('dx', '20')\n        .attr('dy', '20');\n\n    blur.append('feGaussianBlur')\n        .attr('result', 'blurOut')\n        .attr('in', 'offOut')\n        .attr('stdDeviation', '20');\n\n    blur.append('feBlend')\n        .attr('in', 'SourceGraphic')\n        .attr('in2', 'blurOut')\n        .attr('mode', 'normal');\n\n    svg.attr('filter', 'url(#blur)');\n\n\n    var stdDeviation = 5;\n\n    \/\/ create filter with id #drop-shadow\n    \/\/ height=130% so that the shadow is not clipped\n    \/\/ filterUnits=userSpaceOnUse so that straight lines are also visible\n    var filter = defs.append(\"filter\")\n        .attr(\"id\", \"drop-shadow\")\n        .attr(\"height\", \"150%\")\n        .attr(\"filterUnits\", \"userSpaceOnUse\")\n\n    \/\/ SourceAlpha refers to opacity of graphic that this filter will be applied to\n    \/\/ convolve that with a Gaussian with stdDeviation (3px) and store result\n    \/\/ in blur\n    filter.append(\"feGaussianBlur\")\n        .attr(\"in\", \"SourceAlpha\")\n        .attr(\"stdDeviation\", stdDeviation)\n        .attr(\"result\", \"blur\");\n\n    \/\/ translate output of Gaussian blur to the right and downwards with stdDeviation\n    \/\/ store result in offsetBlur\n    filter.append(\"feOffset\")\n        .attr(\"in\", \"blur\")\n        .attr(\"dx\", 5)\n        .attr(\"dy\", 5)\n        .attr(\"result\", \"offsetBlur\");\n\n    \/\/ overlay original SourceGraphic over translated blurred opacity by using\n    \/\/ feMerge filter. Order of specifying inputs is important!\n    var feMerge = filter.append(\"feMerge\");\n\n    feMerge.append(\"feMergeNode\")\n        .attr(\"in\", \"offsetBlur\")\n    feMerge.append(\"feMergeNode\")\n        .attr(\"in\", \"SourceGraphic\");\n\n\n    defs.append('marker')\n        .attr('id', 'arrowhead')\n        .attr('markerWidth', 6)\n        .attr('markerHeight', 5)\n        .attr('refX', 0)\n        .attr('refY', 2.5)\n        .attr('orient', 'auto')\n        .append('polygon')\n            .attr('points', '0 0, 6 2.5, 0 5')\n            .attr('fill', 'black');\n\n\n    var tabColors = {};\n    tabColors['tab1'] = 'rgba(219, 224, 255, 1.0)';\n    tabColors['tab2'] = 'rgba(112, 153, 213, 1.0)';\n    tabColors['tab3'] = 'rgba(112, 153, 255, 1.0)';\n    \/\/tabColors['tab4'] = '#43aa8b';\n\n\n    for (var key in tabColors) {\n        var tabGradient = defs.append('linearGradient')\n            .attr('id', key)\n            .attr('x1', '0%')\n            .attr('y1', '0%')\n            .attr('x2', '0%')\n            .attr('y2', '65%');\n\n        tabGradient.append('stop')\n            .attr('offset', '0%')\n            .attr('stop-color', 'rgba(149, 190, 233, 1.0)');\n\n        tabGradient.append('stop')\n            .attr('offset', '100%')\n            .attr('stop-color', tabColors[key]);\n    }\n\n\n    var decayLabels = {};\n    decayLabels['A'] = \"\\u03B1\";         \/\/giallo\n    decayLabels['B-'] = \"\\u03B2-\";       \/\/azzurro\n    decayLabels['2B-'] = \"2\\u03B2-\";     \/\/blu\n    decayLabels['B-N'] = \"\\u03B2- n\";\n    decayLabels['B-\/B-N'] = \"\\u03B2-\/\\u03B2- n\";\n    decayLabels['B+P'] = \"\\u03B2+ P\";\n    decayLabels['G'] = \"\\u03B3\";         \/\/grigio\n    decayLabels['EC'] = \"EC\";            \/\/rosa\n    decayLabels['EC\/B+'] = \"EC\/\\u03B2+\"; \/\/rosso\n    decayLabels['EC\/B-'] = \"EC\/\\u03B2-\"; \/\/rosso\n    decayLabels['EC\/P'] = \"EC\/P\"; \/\/rosso\n    decayLabels['P'] = \"P\";              \/\/arancione\n    decayLabels['N'] = \"N\";              \/\/lilla\n    decayLabels['2N'] = \"2N\";              \/\/lilla\n    decayLabels['SF'] = \"SF\";            \/\/verde\n    decayLabels['SF\/B-'] = \"SF\/\\u03B2-\";\n    decayLabels['SF\/EC'] = \"SF\/EC\";\n    decayLabels['IT'] = \"IT\";            \/\/bianca\n    decayLabels['unknown'] = \"unknown\"\n    decayLabels['stable'] = \"stable\";\n    decayLabels['A\/P'] = \"\\u03B1\/P\";\n    decayLabels['A\/SF'] = \"\\u03B1\/SF\";\n    decayLabels['A\/B-'] = \"\\u03B1\/\\u03B2-\";\n    decayLabels['A\/EC'] = \"\\u03B1\/EC\";\n\n\n    var decayColors = {\n        \"unknown\":  { c1: 'white', c2: '#D3D3D3', type: 'single' },\n        \"A\":  { c1: 'white', c2: '#f0e300', type: 'single' },\n        \"B-\": { c1: 'white', c2: '#0058f2', type: 'single' },\n        \"2B-\": { c1: 'white', c2: '#00b4d8', type: 'single' },\n        \"B-N\": { c1: 'white', c2: '#90e0ef', type: 'single' },\n        \"B+P\": { c1: 'white', c2: '#90e0ef', type: 'single' },\n        \"EC\": { c1: 'white', c2: '#ff5c74', type: 'single' },\n        \"EC\/B+\": { c1: 'white', c2: '#f1301a', type: 'single' },\n        \"G\": { c1: 'white', c2: '#f1301a', type: 'single' },\n        \"P\":  { c1: 'white', c2: '#f09c00', type: 'single' },\n        \"N\":  { c1: 'white', c2: '#cc00f0', type: 'single' },\n        \"2N\":  { c1: 'white', c2: '#cc00f0', type: 'single' },\n        \"SF\": { c1: 'white', c2: '#DB7093', type: 'single' },\n        \"IT\": { c1: 'white', c2: '#e6e7d7', type: 'single' },\n        \"stable\": { c1: 'white', c2: '#000000', type: 'single' },\n        \"A\/P\": { c1: '#f0e300', c2: '#f09c00', type: 'double' },\n        \"A\/SF\": { c1: '#f0e300', c2: '#DB7093', type: 'double' },\n        \"A\/B-\": { c1: '#f0e300', c2: '#0058f2', type: 'double' },\n        \"EC\/P\": { c1: '#f09c00', c2: '#f1301a', type: 'double' },\n        \"A\/EC\": { c1: '#f0e300', c2: '#f1301a', type: 'double' },\n        \"EC\/B-\": { c1:'#f1301a', c2: '#0058f2', type: 'double' },\n        \"B-\/B-N\": { c1: '#0058f2', c2: '#90e0ef', type: 'double' },\n        \"SF\/B-\": { c1: '#0058f2', c2: '#DB7093', type: 'double' },\n        \"SF\/EC\": { c1:'#DB7093', c2: '#f1301a', type: 'double' },\n        \"Prod0\":  { c1: 'white', c2: '#ffebee', type: 'single' },\n        \"Prod1\":  { c1: 'white', c2: '#ffd6dc', type: 'single' },\n        \"Prod2\":  { c1: 'white', c2: '#ffc2cd', type: 'single' },\n        \"Prod3\":  { c1: 'white', c2: '#ffabda', type: 'single' },\n        \"Prod4\":  { c1: 'white', c2: '#ff99a8', type: 'single' },\n        \"Prod5\":  { c1: 'white', c2: '#ff8597', type: 'single' },\n        \"Prod6\":  { c1: 'white', c2: '#ff7086', type: 'single' },\n        \"Prod7\":  { c1: 'white', c2: '#ff5c74', type: 'single' },\n        \"Prod8\":  { c1: 'white', c2: '#ff4763', type: 'single' },\n        \"Prod9\":  { c1: 'white', c2: '#ff3352', type: 'single' },\n        \"Prod10\":  { c1: 'white', c2: '#ff1f40', type: 'single' },\n        \"Prod11\":  { c1: 'white', c2: '#ff0a2f', type: 'single' },\n        \"Prod12\":  { c1: 'white', c2: '#dd1331', type: 'single' },\n        \"Prod13\":  { c1: 'white', c2: '#ce142f', type: 'single' }\n    };\n\n    var halfLifeColors = d3.schemeGreens[9].reverse().concat(d3.schemeBlues[9]);\n\n    for (i=0; i<halfLifeColors.length; i++) {\n        decayColors[\"HF\"+i] = { c1: 'white', c2: halfLifeColors[i], type: 'single' };\n    }\n    \n    for (var key in decayColors) {\n        var decayGradient = defs.append('linearGradient')\n            .attr('id', key)\n            .attr('x1', decayColors[key]['type'] == \"single\"? '0': '0%')\n            .attr('y1', decayColors[key]['type'] == \"single\"? '0': '0%')\n            .attr('x2', decayColors[key]['type'] == \"single\"? '1': '100%')\n            .attr('y2', decayColors[key]['type'] == \"single\"? '1': '100%');\n\n        decayGradient.append('stop')\n            .attr('offset', '0%')\n            .attr('stop-color', \"white\");\n\n        if (decayColors[key]['type'] == \"double\") {\n            decayGradient.append('stop')\n                .attr('offset', '50%')\n                .attr('stop-color', decayColors[key]['c1']);\n\n        }\n\n        decayGradient.append('stop')\n            .attr('offset', '50%')\n            .attr('stop-color', decayColors[key]['c2']);\n    }\n\n    var halfLifeTimeScale = d3.scaleThreshold()\n        .domain([1E-6, 1E-5, 1E-4, 1E-3, 1E-2, 1E-1, 1, 10, 60, 600, 3600, 36000, 86400, 864000, 2592000, 31536000, 315360000])\n        .range([\"0\", \"1 us\", \"10 us\", \"100 us\", \"1 ms\", \"10 ms\", \"100 ms\", \"1s\", \"10 s\", \"1 min\", \"10 min\", \"1 h\", \"10 h\", \"1 d\", \"10 d\", \"30 d\", \"1 y\", \"10 y\"]);\n\n    var halfLifeColorScale = d3.scaleThreshold()\n        \/\/.domain([1E-6, 1E-5, 1E-4, 1E-3, 1E-2, 1E-1, 1E0, 1E1, 60, 1E2, 1E3, 1E4, 1E5, 1E6, 1E7, 1E14, 1E18])\n        .domain([1E-6, 1E-5, 1E-4, 1E-3, 1E-2, 1E-1, 1, 10, 60, 600, 3600, 36000, 86400, 864000, 2592000, 31536000, 315360000])\n\n        .range([\"url(#HF0)\", \"url(#HF1)\", \"url(#HF2)\", \"url(#HF3)\", \"url(#HF4)\", \"url(#HF5)\", \"url(#HF6)\", \"url(#HF7)\", \"url(#HF8)\",\n                \"url(#HF9)\", \"url(#HF10)\", \"url(#HF11)\", \"url(#HF12)\", \"url(#HF13)\", \"url(#HF14)\", \"url(#HF15)\", \"url(#HF16)\", \"url(#HF17)\"]);\n        \/\/.range(d3.schemeGreens[9].reverse().concat(d3.schemeBlues[9]));\n\n    var productionColorScale = d3.scaleThreshold()\n        .domain([1E-9, 1E-8, 1E-7, 1E-6, 1E-5, 1E-4, 1E-3, 1E-2, 1E-1, 1E0, 1E1, 1E2, 1E3].map(x => x*intensity*6.242E12))\n        .range([\"url(#Prod0)\", \"url(#Prod1)\", \"url(#Prod2)\", \"url(#Prod3)\", \"url(#Prod4)\", \"url(#Prod5)\", \"url(#Prod6)\",\n                \"url(#Prod7)\", \"url(#Prod8)\", \"url(#Prod9)\", \"url(#Prod10)\", \"url(#Prod11)\", \"url(#Prod12)\", \"url(#Prod13)\"]);\n\n        \/\/.range([\"#ffebee\", \"#ffd6dc\", \"#ffc2cd\", \"#ffabda\", \"#ff99a8\", \"#ff8597\", \"#ff7086\", \"#ff5c74\", \"#ff4763\", \"#ff3352\", \"#ff1f40\", \"#ff0a2f\", \"#8f0015\", \"#3d0009\"]);\n\n    var decayColorScale = d3.scaleOrdinal()\n        .domain([\"A\", \"B-\", \"2B-\", \"B-N\", \"EC\", \"EC\/B+\", \"IT\", \"P\", \"N\", \"2N\", \"SF\", \"A\/P\", \"A\/SF\", \"A\/B-\", \"A\/EC\", \"EC\/P\", \"EC\/B-\", \"B-\/B-N\", \"SF\/B-\", \"SF\/EC\", \"stable\", \"unknown\"])\n        .range([\"url(#A)\", \"url(#B-)\", \"url(#2B-)\", \"url(#B-N)\", \"url(#EC)\", \"url(#EC\/B+)\", \"url(#IT)\", \"url(#P)\", \"url(#N)\", \"url(#2N)\", \"url(#SF)\", \"url(#A\/P)\", \"url(#A\/SF)\",\n                \"url(#A\/B-)\", \"url(#A\/EC)\", \"url(#EC\/P)\", \"url(#EC\/B-)\", \"url(#B-\/B-N)\", \"url(#SF\/B-)\", \"url(#SF\/EC)\",  \"url(#stable)\", \"url(#unknown)\"]);\n\n\n    var container = svg.append('g');\n\n    d3.json('https:\/\/isolpharm.pd.infn.it\/wp-content\/uploads\/simulations.json').then(function(data) {\n        simulations = data;\n        mev = data[0].mev;\n\n        function dropdownMouseOver(d, i) {\n            if (d3.select(this).attr('clicked') === 'false') {\n                d3.select(this).style('background-color', '#8ccbff');\n            }\n        }\n\n        function dropdownMouseOut(d, i) {\n            if (d3.select(this).attr('clicked') === 'false') {\n                d3.select(this).style('background-color', '#f9f9f9');\n            }\n        }\n\n\/*\n        function dropdownClick(d, i) {\n            d3.select(this).selectAll(\"a[clicked='true']\")\n                .attr('clicked', 'false')\n                .style('background-color', '#f9f9f9');\n\n            d3.select(this).attr('clicked', 'true').style('background-color', 'DodgerBlue');\n\n            switch (label) {\n                case \"TARGET\":\n                    if (target !== i) { target = i;  } \/\/updateBeamDropdown(d.mev)\n                    break;\n\n                case \"BEAM ENERGY\":\n                    if (intensity !== d) { intensity = d; changeViewMode(d.mev) }\n                    break;\n\n                case \"VIEW MODE\":\n                    if (viewMode !== d) { viewMode = d; changeViewMode(d.mev) }\n                    break;\n            }\n        }\n*\/\n\n        function drawDropdown(label, data) {\n            var dropdown = menu\n                .append('div')\n                .attr('id', label)\n                .attr('class', 'dropdown');\n\n            dropdown.append('span').text(label);\n            var dropdownContent = dropdown.append('div').attr('class', 'dropdown-content');\n\n            dropdownContent.selectAll('a')\n                .data(data)\n                .enter()\n                .append('a')\n                .attr('clicked', function(d, i) { return i === 0? true: false; })\n                .attr('xlink:href', '#')\n                .style('background-color', function(d, i) { return i === 0? 'DodgerBlue': '#f9f9f9'; })\n                .on('mouseover', dropdownMouseOver)\n                .on('mouseout', dropdownMouseOut)\n                .on('click', function(d, i) {\n                    dropdownContent.selectAll(\"a[clicked='true']\")\n                        .attr('clicked', 'false')\n                        .style('background-color', '#f9f9f9');\n\n                    d3.select(this).attr('clicked', 'true').style('background-color', 'DodgerBlue');\n\n                    switch (label) {\n                        case \"TARGET\":\n                            if (target != i) { target = i; } \/\/updateBeamDropdown(d.mev)\n                            break;\n\n                        case \"BEAM ENERGY\":\n                            if (beam != i) {\n                                beam = i;\n\n                                if (viewMode == \"production\") {\n                                    nuclides.selectAll('.n_rect').style(\"fill\", fillNuclideBackground);\n                                    changeLegend(productionColorScale);\n                                }\n                               \/\/ nuclides.selectAll('.n_rect').style(\"fill\", fillNuclideBackground);\n                            }\n                            break;\n\n                        case \"BEAM INTENSITY\":\n                            if (intensity != i) {\n                                intensity = i;\n\n                                if (viewMode == \"production\") {\n                                    nuclides.selectAll('.n_rect').style(\"fill\", fillNuclideBackground);\n                                    changeLegend(productionColorScale);\n                                }\n                            }\n                            break;\n\n                        case \"VIEW MODE\":\n                            if (viewMode != i) {\n                                viewMode = i;\n\n                                switch(viewMode) {\n                                    case \"production\":\n                                        changeLegend(productionColorScale);\n                                        break;\n                                    case \"half-life\":\n                                        changeLegend(halfLifeColorScale);\n                                        break;\n                                    case \"decay\":\n                                        changeLegend(decayColorScale);\n                                        break;\n                                }\n\n                                nuclides.selectAll('.n_rect').style(\"fill\", fillNuclideBackground);\n                            }\n                            break;\n                    }\n                })\n                .append('text')\n                    .text(function(d, i) {\n                        var result = null;\n\n                        switch (label) {\n                            case \"TARGET\":\n                                if (i == 0) { target = i; }\n                                result = d.target;\n                                break;\n\n                            case \"BEAM ENERGY\":\n                                if (d == 40) {\n                                    beam = d;\n                                    dropdownContent.selectAll(\"a[clicked='true']\")\n                                        .attr('clicked', 'false')\n                                        .style('background-color', '#f9f9f9')\n                                    d3.select(this.parentNode).attr('clicked', 'true').style('background-color', 'DodgerBlue');\n                                }\n\n                                result = d + ' MeV';\n                                break;\n\n                            case \"BEAM INTENSITY\":\n                                if (d == 200) {\n                                    intensity = d;\n                                    dropdownContent.selectAll(\"a[clicked='true']\")\n                                        .attr('clicked', 'false')\n                                        .style('background-color', '#f9f9f9')\n                                    d3.select(this.parentNode).attr('clicked', 'true').style('background-color', 'DodgerBlue');\n                                }\n\n                                result = d + ' uA';\n                                break;\n\n                            case \"VIEW MODE\":\n                                if (i == 0) { viewMode = d; }\n                                result = d;\n                                break;\n                        }\n\n                        return result;\n                    });\n        }\n\n        drawDropdown('TARGET', data);\n        drawDropdown('BEAM ENERGY', data[0].mev);\n        drawDropdown('BEAM INTENSITY', [10, 20, 50, 100, 150, 200]);\n        drawDropdown('VIEW MODE', ['half-life', 'decay', 'production']);\n\/*\n            var dropdown = menu\n                .append('svg')\n                .attr('id', 'legend')\n                .attr('transform', 'translate(500,20)')\n                .append(\"rect\")\n                    .attr('id', 'aa')\n                    .attr('rx', '4')\n                    .attr('ry', '4')\n                    .attr(\"width\", 18)\n                    .attr(\"height\", 18)\n                    .style(\"fill\", \"red\")\n                    .style(\"fill-opacity\", \".5\")\n                    .style(\"stroke\", \"white\")\n                    .style(\"stroke-width\", \"1.5px\");\n  *\/\n\n        var legend = menu.append(\"div\")\n            .attr('class', 'dropdown')\n            .attr(\"id\", \"LEGEND\")\n\n\n\n\/*\n        function updateBeamDropdown(mev) {\n            beamtDropdownContent.selectAll('a').remove();\n            beamtDropdownContent.selectAll('a')\n                .data(mev)\n                .enter()\n                .append('a')\n                .attr('clicked', function(d, i) { return i === 0? true: false; })\n                .attr('xlink:href', '#')\n                .style('background-color', function(d, i) { return i === 0? 'DodgerBlue': '#f9f9f9'; })\n                .on('mouseover', dropdownMouseOver)\n                .on('mouseout', dropdownMouseOut)\n                .on('click', function(d) {\n                    beamtDropdownContent.selectAll(\"a[clicked='true']\")\n                        .attr('clicked', 'false')\n                        .style('background-color', '#f9f9f9');\n\n                    d3.select(this).attr('clicked', 'true').style('background-color', 'DodgerBlue');\n                    if (beam !== d) {\n                        beam = d;\n                        changeViewMode();\n                    }\n                })\n                .append('text')\n                .text(function(d, i) { if (i === 0) { beam = d; } return d + ' MeV'; });\n        }\n\n        updateBeamDropdown(data[0].mev);\n*\/\n        var search = menu\n            .append('input')\n            .attr('type', 'text')\n            .attr('placeholder', 'search...')\n            .attr('name', 'search')\n            .attr('title', 'e.g. 111Ag')\n            .on('input', function() {\n                svg.selectAll('#tooltip').remove();\n                const x = this.value.toLowerCase();\n                var A = 0;\n                var Z = 0;\n                var n_data;\n                var result = nuclides.filter(function(d, i) { if (d.id.toLowerCase() === x) { n_data=d; A=d.A; Z=d.Z; } return d.id.toLowerCase() === x });\n\n                if (result.node() != null) {\n                    svg.transition()\n                        .duration(4000)\n                        .call(zoom.transform, d3.zoomIdentity.translate(0,0).scale(10).translate(-(3+A-Z)*rect_size+177\/2, -height+(Z-4)*rect_size+118\/2))\n                        .on(\"end\", function() {\n                            var nuclide_rect = result.node().getBoundingClientRect();\n                            var svg_rect = svg.node().getBoundingClientRect();\n\n                            var tooltip = svg.append('g')\n                                .attr('id', 'tooltip')\n                                .attr('transform', 'translate(' + (nuclide_rect.left - svg_rect.left - 10) + ',' + (nuclide_rect.top - svg_rect.top - 10) + ')')\n                                .append(\"rect\")\n                                    .attr('id', 'tooltip_rect')\n                                    \/\/.attr(\"transform\", \"translate(-1,-1)\")\n                                    .attr('rx', '4')\n                                    .attr('ry', '4')\n                                    .attr(\"width\", 18 + nuclide_rect.width)\n                                    .attr(\"height\", 18 + nuclide_rect.height)\n                                    .style(\"fill\", \"white\")\n                                    .style(\"fill-opacity\", \".5\")\n                                    .style(\"stroke\", \"white\")\n                                    .style(\"stroke-width\", \"1.5px\");\n                        });\n                }\n            });\n    });\n\n\n    function setNuclideLabel(d, i) {\n        if (viewMode == 'production') {\n            var datasets = simulations[target].datasets;\n\n            return \"\" + datasets[d.A][d.Z][beam]*intensity*6.242E12 + \" p\/s\"\n        }\n    }\n\n    function fillNuclideBackground(d, i) {\n        svg.selectAll(\"#prod_\" + d.id.toLowerCase()).text(\"\");\n\n        if (viewMode == 'production') {\n           \/\/ d3.selectAll('#l_stable').style('fill', 'black').style('font-weight', 'bold');\n           \/\/ d3.selectAll('#r_stable').style('fill', 'black').style('stroke-width', '0.2px');\n\n            var datasets = simulations[target].datasets;\n            \/\/var extents = simulations[target].extents;\n            \/*\n            var nuclide = d3.select(this);\n            if (nuclide.datum().isomers[\"0.0\"].half_life.str == \"stable\") {\n                nuclide.select('text').style('fill', 'black').style('font-weight', 'bold');\n                nuclide.select('rect').style('fill', 'black').style('stroke-width', '0.2px');\n            }\n*\/\n            if (d.A in datasets && d.Z in datasets[d.A] && beam in datasets[d.A][d.Z]) {\n                svg.selectAll(\"#prod_\" + d.id.toLowerCase()).text(\"\" + d3.format('.2E')(datasets[d.A][d.Z][beam]*intensity*6.242E12) + \" p\/s\");\n                if (\"0.0\" in d.isomers && d.isomers[\"0.0\"].half_life.str === \"stable\") {\n                    return 'url(#stable)';\n                } else {\n                    return productionColorScale(datasets[d.A][d.Z][beam]*intensity*6.242E12);\n                }\n            } else {\n                return 'url(#unknown)';\n            }\n        } else if (viewMode == 'half-life') {\n            if (\"0.0\" in d.isomers) {\n                if (d.isomers[\"0.0\"].half_life.str === \"stable\") {\n                    return 'url(#stable)';\n                } else {\n                    return halfLifeColorScale(d.isomers[\"0.0\"].half_life.sec)\n                }\n            } else {\n                var maxHalfLife = 0;\n\n                for(var key in d.isomers) {\n                    if (d.isomers[key].half_life.sec > maxHalfLife) {\n                        maxHalfLife = d.isomers[key].half_life.sec\n                    }\n                }\n\n                return halfLifeColorScale(maxHalfLife);\n            }\n        } else {\n            var nuclide = d3.select(this).datum()\n            var isomer;\n\n            if (\"0.0\" in nuclide.isomers) {\n                isomer = nuclide.isomers[\"0.0\"];\n            } else {\n                var keys = Object.keys(nuclide.isomers);\n                if (keys.length > 0) {\n                    isomer = nuclide.isomers[keys[0]];\n                } else {\n                    return \"url(#unknown)\"\n                }\n            }\n\n            if (isomer.half_life.str == \"stable\") {\n                return \"url(#stable)\";\n\n            } else if (\"decays\" in isomer) {\n                \/\/ var decays = json2array(d.isomers[\"0.0\"].decays);\n                var decayModes = Object.keys(isomer.decays);\n\n                \/\/ console.log(json2array(decays));\n\n                if (decayModes.length == 0) {\n                    return 'url(#unknown)';\n                }\n\n                if (decayModes.length == 1) {\n                    return decayColorScale(decayModes[0]);\n\n                } else if (decayModes.length > 1) {\n                    var color = \"url(#unknown)\";\n\n                    if (decayModes.includes(\"A\")) {\n                        if (decayModes.includes(\"EC\") || decayModes.includes(\"EC\/B+\")) {\n                            color = decayColorScale(\"A\/EC\");\n                        } else if (decayModes.includes(\"B-\")) {\n                            color = decayColorScale(\"A\/B-\");\n                        } else if (decayModes.includes(\"SF\")) {\n                            color = decayColorScale(\"A\/SF\");\n                        } else if (decayModes.includes(\"P\")) {\n                            color = decayColorScale(\"A\/P\");\n                        } else {\n                            color = \"url(#unknown)\";\n                        }\n                    } else if (decayModes.includes(\"B-\")) {\n                        if (decayModes.includes(\"EC\") || decayModes.includes(\"EC\/B+\")) {\n                            color = decayColorScale(\"EC\/B-\");\n                        } else if (decayModes.includes(\"B-N\")) {\n                            color = decayColorScale(\"B-\/B-N\");\n                        } else if (decayModes.includes(\"SF\")) {\n                            color = decayColorScale(\"SF\/B-\");\n                        } else {\n                            color = \"url(#unknown)\";\n                        }\n                    } else if (decayModes.includes(\"P\") && decayModes.includes(\"EC\") || decayModes.includes(\"EC\/B+\")) {\n                        color = decayColorScale(\"ECP\");\n\n                    } else if (decayModes.includes(\"SF\")) {\n                        if (decayModes.includes(\"B-\")) {\n                            color = decayColorScale(\"SF\/B-\");\n                        } else if (decayModes.includes(\"EC\")) {\n                            color = decayModes.includes(\"SF\/EC\")\n                        } else {\n                            color = \"url(#unknown)\";\n                        }\n                    } else {\n                        color = \"url(#unknown)\";\n                    }\n\n                    return color;\n                } else {\n                    return 'url(#gradientForegroundPurple)';\n                }\n            }\n        }\n    }\n\n    \/\/read the data\n    d3.json('https:\/\/isolpharm.pd.infn.it\/wp-content\/uploads\/nuclides_db_v2.5.json').then(function(data) {\n        nuclide_data = data;\n        changeLegend(halfLifeColorScale);\n\n        var current_z = -1;\n\n        data.forEach(d => {\n            if (d.Z != current_z) {\n                current_z = d.Z;\n\n                addText(container, d.element, null, ((d.N-1) * rect_size), (height - (d.Z + 1) * rect_size + rect_size\/2 + 1), \"n_element\");\n            }\n        });\n\n        nuclides = container.selectAll('.nuclides')\n            .data(data).enter()\n            .append('g')\n                .attr('class', 'nuclides')\n                .attr('id', d => { return d.id.toLowerCase() })\n                .attr('transform', d => { return 'translate(' + (d.N * rect_size) + ',' + (height - (d.Z + 1) * rect_size) + ')';})\n                .on('mouseenter', mouseEnterNuclide)\n                .on('mouseleave', mouseLeaveNuclide)\n                .on('click', mouseClickNuclide);\n\n        nuclides.append('rect')\n            .attr('class', 'n_rect')\n            .attr('id', d => {\n                if (\"0.0\" in d.isomers && d.isomers[\"0.0\"].half_life.str === \"stable\") {\n                    return 'r_stable';\n                }\n            })\n            .attr('width', rect_size-0.2)\n            .attr('height', rect_size-0.2)\n            \/\/.attr(\"filter\", \"url(#blur)\")\n            .style('fill', fillNuclideBackground);\n\n        nuclides.append('text')\n            .attr('class', 'n_label')\n            .attr('id', d => {\n                if (d.half_life === 'stable') {\n                    return 'l_stable';\n                }\n            })\n            .attr('x', rect_size\/2)\n            .attr('y', rect_size\/2)\n            .style('fill', d => {\n                if (\"0.0\" in d.isomers && d.isomers[\"0.0\"].half_life.str === \"stable\") {\n                    return '#FFFFFF';\n                }\n            })\n            .text(d => { return d.A + d.symbol.capitalize() });\n\n        nuclides.append('text')\n            .attr('class', 'n_prod')\n            .attr('id', d => { return \"prod_\" + d.id.toLowerCase() })\n            .attr('x', rect_size\/2)\n            .attr('y', rect_size\/2 + 2)\n            .style('fill', d => {\n                if (\"0.0\" in d.isomers && d.isomers[\"0.0\"].half_life.str === \"stable\") {\n                    return '#FFFFFF';\n                }\n            });\n            \/\/.text(\"\");\n\n        function mouseEnterNuclide(d, i) {\n            if (transform && transform.k >= 3) {\n                d3.select(this).raise();\n\n                var nuclide_rect = d3.select(this).node().getBoundingClientRect();\n                \/\/var svg_rect = svg.node().getBoundingClientRect();\n\n                d3.select(this).append(\"g\")\n                    .attr('id', 'tooltip')\n                    .append(\"rect\")\n                    .attr('id', 'tooltip_rect')\n                    .attr(\"transform\", \"translate(-1,-1)\")\n                    .attr(\"rx\", \"0.5\")\n                    .attr(\"ry\", \"0.5\")\n                    .attr(\"width\", 2+nuclide_rect.width\/transform.k)\n                    .attr(\"height\", 2+nuclide_rect.height\/transform.k)\n                    .style(\"fill\", \"white\")\n                    .style(\"fill-opacity\", \".5\")\n                    .style(\"stroke\", \"white\")\n                    .style(\"stroke-width\", \"0.2px\");\n\/*\n                d3.select(this).append('text')\n                    .attr('id', 'tooltip_text')\n                    .attr('x', nuclide_rect.width\/transform.k\/2)\n                    .attr('y', nuclide_rect.width\/transform.k\/2)\n                    .attr(\"font-family\", \"sans-serif\")\n                    .attr(\"font-size\", \"5px\")\n                    .attr(\"font-weight\", \"bold\")\n                    .attr(\"text-anchor\", \"middle\")\n                    .attr('fill', 'black')\n                    .text(d3.select(this).node().id.capitalize());\n*\/            }\n        }\n\n\n        function mouseLeaveNuclide(d, i) {\n            svg.selectAll(\"#tooltip\").remove();\n            \/\/svg.selectAll(\"#tooltip_text\").remove();\n            container.selectAll('text').style('opacity', 1);\n\n        }\n\n        function drawDecay(decay, radiation, panel, lineX, lineY) {\n            var rad1 = null\n            var rad2 = null;\n\n            switch (radiation) {\n                case \"A\":\n                    rad1 = decay.alpha != null? decay.alpha[1]: null;\n                    rad2 = decay.alpha != null? decay.alpha[2]: null;\n                    break;\n                case \"B-\":\n                    rad1 = decay.beta;\n                    break;\n                case \"G\":\n                    rad1 = decay.gamma != null? decay.gamma[1]: null;\n                    rad2 = decay.gamma != null? decay.gamma[2]: null;\n                    break;\n                case \"EC\":\n                    rad1 = decay.ec != null? decay.ec[1]: null;\n                    rad2 = decay.ec != null? decay.ec[2]: null;\n                    break;\n            }\n\n            if (rad1 == null) {\n                return lineY;\n            }\n\n            addText(panel, decayLabels[radiation], null, lineX + 15, lineY, \"tab_label\");\n\n            if (radiation == \"B-\") {\n                var eav  = rad1.EAV;\n                var emax = rad1.EMAX;\n                var intensity = rad1.I;\n\n                addText(panel, intensity > 0? intensity + \" %\": \"\", null, lineX + 50, lineY, \"p_label\");\n                addText(panel, eav > 0? roundToTwo(eav) + \" keV\": \"\", null, lineX + 250, lineY, \"p_label\");\n                addText(panel, emax > 0? roundToTwo(emax) + \" keV\": \"\", null, lineX + 350, lineY, \"p_label\");\n\n            } else {\n                addText(panel, rad1 != null && rad1.I > 0? roundToTwo(rad1.I) + \" %\": \"\", null, lineX + 50, lineY, \"p_label\");\n                addText(panel, rad1 != null && rad1.E > 0? roundToTwo(rad1.E) + \" keV\": \"\", null, lineX + 150, lineY, \"p_label\");\n\n                if (rad2 != null) {\n                    addText(panel, rad2 != null && rad2.I > 0? roundToTwo(rad2.I) + \" %\": \"\", null, lineX + 50, lineY + 20, \"p_label\");\n                    addText(panel, rad2 != null && rad2.E > 0? roundToTwo(rad2.E) + \" keV\": \"\", null, lineX + 150, lineY + 20, \"p_label\");\n\n                    lineY += 20;\n                }\n            }\n\n            if (rad1 != null) {\n                lineY += 15;\n                panel.append('line')\n                    .attr('x1', lineX)\n                    .attr('y1', lineY)\n                    .attr('x2', lineX + 415)\n                    .attr('y2', lineY)\n                    .attr('stroke', '#add8e6')\n                    .attr('stroke-width', 1.5);\n            }\n\n            return lineY + 30;\n        }\n\n\n        function drawProductionChart(panel, data) {\n            var width = 290,\n                height = 260,\n                formatValue = d3.format(\".2e\"),\n                bisectDate = d3.bisector(function(d) { return d.x; }).left;\n\n            addText(panel, \"Activity (GBq)\", null, -140, 15, \"prod_label\").attr(\"transform\", \"rotate(-90)\");\n            addText(panel, \"Activity (Ci)\", null, -140, 440, \"prod_label\").attr(\"transform\", \"rotate(-90)\");\n            addText(panel, \"Time (days)\", null, 220, 300, \"prod_label\");\n            addText(panel, \"Beam: E=40MeV  I=200uA\", null, 225, 15, \"prod_label\");\n\n            \/\/ X scale and Axis\n            const xScale = d3.scaleLinear()\n                .domain(d3.extent(data, function(d) { return d.x; }))     \/\/ This is the min and the max of the data: 0 to 100 if percentages\n                .range([0, width]);       \/\/ This is the corresponding value I want in Pixel\n\n            const max = d3.max(data, function(d) { return d.y; })*1.5\n\n            \/\/ Y MBq scale and Axis\n            const yMBqScale = d3.scaleLinear()\n                .domain([0, max])          \/\/ This is the min and the max of the data: 0 to 100 if percentages\n                .range([height, 0]);       \/\/ This is the corresponding value I want in Pixel\n\n\n            \/\/ X scale and Axis\n            const ymCiScale = d3.scaleLinear()\n                .domain([0, max*0.027027027027027])\n                .range([height, 0]);       \/\/ This is the corresponding value I want in Pixel\n\n            \/\/ Define the axes\n            const xAxis = d3.axisBottom(xScale)\n            const yMBqAxis = d3.axisLeft(yMBqScale);\n            const ymCiAxis = d3.axisRight(ymCiScale);\n\n            const plot = panel.append(\"g\")\n                .attr(\"transform\", \"translate(80,0)\")\n\n            \/\/ Plot the x-axis\n            const xAxisPlot = plot.append(\"g\")\n                .attr(\"transform\", \"translate(0,260)\")\n                .call(xAxis.tickSize(15));\n\n            \/\/ Plot the y-axis\n            const yMBqAxisPlot = plot.append(\"g\")\n                .call(yMBqAxis.tickSize(15).tickFormat(d3.format(\".2e\")));\n\n\n            \/\/ Plot the y-axis\n            const ymCiAxisPlot = plot.append(\"g\")\n                .attr(\"transform\", \"translate(290, 0)\")\n                .call(ymCiAxis.tickSize(15).tickFormat(d3.format(\".2e\")));\n\n            \/\/ Add the x-axis lines\/ticks\n            xAxisPlot.selectAll(\".tick line\")\n                .attr(\"stroke-width\", 0.5)\n                .attr(\"stroke\", \"lightgray\");\n\n            \/\/ Add the y-axis lines\/ticks\n            yMBqAxisPlot.selectAll(\".tick line\")\n                .attr(\"stroke-width\", 0.5)\n                .attr(\"stroke\", \"lightgray\");\n\n            ymCiAxisPlot.selectAll(\".tick line\")\n                .attr(\"stroke-width\", 0.5)\n                .attr(\"stroke\", \"lightgray\");\n\n\n            plot.append(\"path\")\n                   .datum(data)\n                   .style(\"filter\", \"url(#drop-shadow)\")\n                   .attr(\"fill\", \"none\")\n                   .attr(\"stroke\", \"blue\")\n                   .attr(\"stroke-width\", 2)\n                   .attr(\"d\", d3.line()\n                      .x(function(d) { return xScale(d.x) })\n                      .y(function(d) { return yMBqScale(d.y) })\n                  );\n\n            var focus = plot.append(\"g\")\n                .attr(\"class\", \"focus\")\n                .style(\"display\", \"none\");\n\n            focus.append(\"circle\")\n                .attr(\"id\", \"point\")\n                .attr(\"r\", 5);\n\n            focus.append(\"rect\")\n                .attr(\"class\", \"plot_tooltip\")\n                .attr(\"width\", 140)\n                .attr(\"height\", 65)\n                .attr(\"x\", 10)\n                .attr(\"y\", -25)\n                .attr(\"rx\", 4)\n                .attr(\"ry\", 4);\n\n            addText(focus, \"time (h):\", null, 18, -5, \"plot_tooltip-text\");\n            addText(focus, \"\", \"act_time\", 70, -5, \"plot_tooltip-text-bold\");\n            addText(focus, \"act (MBq):\", null, 18, 13, \"plot_tooltip-text\");\n            addText(focus, \"\", \"act_mbq\", 82, 13, \"plot_tooltip-text-bold\");\n            addText(focus, \"act (mCi):\", null, 18, 31, \"plot_tooltip-text\");\n            addText(focus, \"\", \"act_mci\", 78, 31, \"plot_tooltip-text-bold\");\n\n\n            plot.append(\"rect\")\n                .attr(\"class\", \"overlay\")\n                .attr(\"width\", width)\n                .attr(\"height\", height)\n                .on(\"mouseover\", function() { focus.style(\"display\", null); })\n                .on(\"mouseout\", function() { focus.style(\"display\", \"none\"); })\n                .on(\"mousemove\", mousemove);\n\n            function mousemove(event) {\n                var x0 = xScale.invert(d3.pointer(event, this)[0]),\n                    i = bisectDate(data, x0, 1),\n                    d0 = data[i - 1],\n                    d1 = data[i],\n                    d = x0 - d0.x > d1.x - x0 ? d1 : d0;\n\n                var x = xScale(d.x)\n                var y = yMBqScale(d.y)\n\n                if (x + 130 > width) {\n                    x = x - 130;\n                    y = y - 2\n                    d3.select(\"#point\").attr(\"cx\", 135);\n                } else {\n                    d3.select(\"#point\").attr(\"cx\", 0);\n                }\n\n                focus.attr(\"transform\", \"translate(\" + x + \",\" + y + \")\");\n                focus.select(\"#act_time\").text(roundToTwo(d.x));\n                focus.select(\"#act_mbq\").text(roundToTwo(d.y));\n                focus.select(\"#act_mci\").text(roundToTwo(d.y*0.027027027027027));\n            }\n        }\n\n\n        function mouseClickNuclide(d) {\n            d.stopPropagation();\n\n            if (!transform || transform.k < 3) {\n                svg.selectAll(\"#tooltip\").remove();\n                return\n            }\n\n            var exit = 0;\n\n            d3.select(this).node().childNodes.forEach(function(item) {\n                if (item.nodeName === 'text') {\n                    if (item.style['opacity'] == 0) {\n                        exit = 1;\n                    } else {\n                        item.style['opacity'] = '0';\n                    }\n                }\n            });\n\n            if (exit) {\n                return;\n            }\n\n            \/*\n            var nuclide_rect = d3.select(this).node().getBoundingClientRect();\n\n            var svg_rect = svg.node().getBoundingClientRect();\n            var center = [(svg_rect.width\/2), (svg_rect.height\/2)]\n*\/\n            var n_data = this.__data__;\n            var tooltip = d3.select(\"#tooltip\")\n                \/\/.attr(\"transform\", \"scale(0.1) translate(\" + (center[0]-nuclide_rect.left-250) + \",\" + (center[1]-nuclide_rect.top-250) + \")\");\n                .attr('transform', 'scale(0.1)')\n\n            tooltip.select(\"#tooltip_rect\")\n                \/\/.transition().duration(500)\n                .attr(\"width\", 500)\n                .attr(\"height\", 500)\n                .attr(\"filter\", \"url(#blur)\")\n                .style(\"fill-opacity\", \".7\");\n\n            tooltip.append(\"rect\")\n                \/\/.attr(\"filter\", \"url(#blur)\")\n                .attr('x', 10)\n                .attr('y', 10)\n                .attr(\"rx\", \"0.5\")\n                .attr(\"ry\", \"0.5\")\n                .attr(\"width\", 480)\n                .attr(\"height\", 480)\n                .style(\"fill\", \"white\")\n                .style(\"fill-opacity\", \".4\")\n                .style(\"stroke\", \"red\")\n                .style(\"stroke-width\", \"0.2px\");\n\n            addText(tooltip, n_data.A, null, 48, 41, \"symbol_apex\");\n            addText(tooltip, n_data.Z, null, 48, 59, \"symbol_apex\");\n            addText(tooltip, n_data.symbol.capitalize(), null, 50, 55, \"symbol\")\n                .append('tspan')\n                .attr('class', 'symbol_apex')\n                .attr('dy', '4px')\n                .text(n_data.N);\n\n            addText(tooltip, n_data.element, null, 200, 55, \"element\");\n\n            var dy = 120;\n            var i = 0;\n            var count = Object.keys(n_data.isomers).length;\n\n            for (var key in n_data.isomers) {\n                tooltip.append('path')\n                    .datum(n_data.isomers[key])\n                    .style(\"stroke\", \"black\")\n                    .style(\"fill\", \"url(#tab1)\")\n                    .attr('id', 'tab-shape')\n                    .attr(\"transform\", \"translate(\" + (100 + i * 75) + \",115)\")\n                    .attr('d', \"M 0 0 c -15 -5 -2 -17 -15 -17 h -54 c -6 0 -9 0 -10 7 v 15 h 79 z\")\n                    .on(\"click\", function(event) {\n                        \/\/console.log(\"click\", d3.select(this).datum());\n                        var isomer = d3.select(this).datum();\n                        var lineX = 0;\n                        var lineY = 0;\n\n                        d3.selectAll(\"#tab-shape\")\n                            .style(\"fill\", \"url(#tab1)\");\n\n                        d3.select(this)\n                            .style(\"fill\", \"url(#tab3)\");\n\n                        tooltip.select(\"#isomer\").remove();\n\n                        var isomerPanel = tooltip.append(\"g\")\n                            .attr(\"transform\", \"translate(40,150)\")\n                            .attr(\"id\", \"isomer\");\n\n                        addText(isomerPanel, \"Energy: \" + isomer.energy.str, null, lineX, lineY, \"p_label\");\n                        addText(isomerPanel, isomer.metastable? \"State: metastable\": \"State: ground\", null, lineX, lineY + 25, \"p_label\");\n                        addText(isomerPanel, \"T\", null, lineX + 170, lineY , \"p_label\").append('tspan')\n                            .attr('class', 'symbol_apex_s')\n                            .attr('dy', '4px')\n                            .text(\"\u00bd\");\n\n                        addText(isomerPanel, \": \" + isomer.half_life.str, null, lineX + 188, lineY, \"p_label\");\n\n\n                        if (isomer.half_life.str === \"stable\" && isomer.hasOwnProperty('abundance') && isomer.abundance != null) {\n                            addText(isomerPanel, \"Abundance: \" + isomer.abundance, null, lineX + 170, lineY + 25, \"p_label\");\n\n                        } else {\n                            var i = 0;\n                            var decaysData = [];\n                            var maxBr = 0;\n\n                            for (var key in isomer.decays) {\n                                decaysData.push(isomer.decays[key]);\n\n                                if (isomer.decays[key].br > maxBr) {\n                                    maxBr = isomer.decays[key].br;\n                                }\n                            }\n\n                            if (decaysData.length > 0) {\n                                var radius = 50;\n                                var selectedDecay = null;\n\n                                var arc = d3.arc()\n                                    .innerRadius(radius-17)\n                                    .outerRadius(radius);\n\n                                var arcOver = d3.arc()\n                                    .innerRadius(radius-15)\n                                    .outerRadius(radius+3)\n\n                                \/\/var anglesRange = 0.5 * Math.PI;\n\n                                var pie = d3.pie()\n                                    .sort(null)\n                                    \/\/.startAngle(anglesRange * -1)\n                                    \/\/.endAngle(anglesRange)\n                                    .value(function(d, i) {\n                                        return d.br;\n                                    });\n\n                                var piePanel = isomerPanel.append(\"g\")\n                                    .attr(\"transform\", \"translate(370,40)\")\n                                    .attr(\"class\",\"arc\");\n\n                                var g = piePanel.selectAll(\".arc\")\n                                    .data(pie(decaysData))\n                                    .enter()\n                                    .append(\"g\")\n                                    \/\/.attr(\"transform\", \"translate(410,185)\")\n                                    .attr(\"class\",\"arc\");\n\n                                addText(piePanel, \"\", \"decay_mode\", 0, -5, \"pie_label\");\n                                addText(piePanel, \"\", \"decay_br\", 0, 10, \"pie_label\");\n\n                                g.append(\"path\")\n                                    .attr(\"id\", \"decay_path\")\n                                    .attr(\"d\", arc)\n                                    .style(\"fill\", function(d, i) {\n                                        return decayColorScale(d.data.mode);\n                                    })\n                                    .attr(\"stroke\", \"black\")\n                                    .attr(\"stroke-width\", \"1px\")\n                                    .on(\"mouseover\",function(d) {\n                                        var decay = d3.select(this);\n\n                                        decay.attr(\"d\", arcOver);\n                                        isomerPanel.select(\"#decay_mode\").text(decayLabels[decay.node().__data__.data.mode]);\n                                        isomerPanel.select(\"#decay_br\").text(roundToTwo(decay.node().__data__.data.br) + \"%\");\n                                    })\n                                    .on(\"mouseout\", function(d) {\n                                        d3.select(this).attr(\"d\", arc);\n\n                                        selectedDecay.attr(\"d\", arcOver);\n                                        isomerPanel.select(\"#decay_mode\").text(decayLabels[selectedDecay.node().__data__.data.mode]);\n                                        isomerPanel.select(\"#decay_br\").text(roundToTwo(selectedDecay.node().__data__.data.br) + \"%\");\n                                    })\n                                    .on(\"click\", function(d) {\n                                        selectedDecay = d3.select(this);\n                                        var decay = selectedDecay.node().__data__.data\n\n                                        isomerPanel.selectAll(\"#decay_path\").attr(\"d\", arc);\n                                        isomerPanel.select(\"#decay_mode\").text(decayLabels[decay.mode]);\n                                        isomerPanel.select(\"#decay_br\").text(roundToTwo(decay.br) + \"%\");\n\n                                        selectedDecay.attr(\"d\", arcOver);\n                                        isomerPanel.select(\"#decay_data\").remove();\n\n                                        var daughter = decay.daughter;\n\n                                        if (daughter == null) {\n                                            return;\n                                        }\n\n                                        var dy = 20;\n                                        var dx = 0;\n\n                                        var decayPanel = isomerPanel.append('g')\n                                            .attr(\"id\",\"decay_data\")\n                                            .attr(\"transform\", \"translate(0,50)\");\n\n                                        var decayLabel = decayPanel.append('g')\n                                            .attr(\"id\",\"decay_data\")\n                                            .attr(\"transform\", \"translate(150,0)\");\n\n                                        addText(decayLabel, n_data.A, null, dx, dy, \"symbol_apex_s\");\n                                        addText(decayLabel, n_data.Z, null, dx, dy + 18, \"symbol_apex_s\");\n                                        var symbol = addText(decayLabel, n_data.symbol.capitalize(), null, dx, dy + 14, \"symbol_s\");\n\n                                        symbol.append('tspan')\n                                            .attr('class', 'symbol_apex_s')\n                                            .attr('dy', '4px')\n                                            .text(n_data.N);\n\n                                        var symbol_b = symbol.node().getBoundingClientRect();\n\n                                        addText(decayLabel, decayLabels[decay.mode], null, symbol_b.width + 23 + dx, dy + 4, \"simbol_decay\");\n\n                                        decayLabel.append('line')\n                                            .attr('x1', symbol_b.width + 5 + dx)\n                                            .attr('y1', dy + 8)\n                                            .attr('x2', symbol_b.width + 40 + dx)\n                                            .attr('y2', dy + 8)\n                                            .attr('stroke', 'black')\n                                            .attr('stroke-width', 1.5)\n                                            .attr('marker-end', 'url(#arrowhead)');\n\n                                        if (daughter == null) {\n                                            addText(decayLabel, \"unknown\", null, symbol_b.width + 67 + dx, dy + 14, \"symbol_s\");\n                                        } else {\n                                            addText(decayLabel, daughter[0], null, symbol_b.width + 67 + dx, dy, \"symbol_apex_s\");\n\n                                            addText(decayLabel, daughter[1], null, symbol_b.width + 67 + dx, dy + 18, \"symbol_apex_s\");\n\n                                            var symbol = addText(decayLabel, daughter[2].capitalize(), null, symbol_b.width + 67 + dx, dy + 14, \"symbol_s\");\n\n                                            symbol.append('tspan')\n                                                    .attr('class', 'symbol_apex_s')\n                                                    .attr('dy', '4px')\n                                                    .text(daughter[0]-daughter[1]);\n                                        }\n\n                                        var lineX = 0;\n                                        var lineY = dy + 70;\n\n                                        var intensity = addText(decayPanel, \"I\", null, lineX + 50, lineY, \"p_tab\");\n\n                                        intensity.append('tspan')\n                                                .attr('class', 'p_tab_s')\n                                                .attr('dy', '4px')\n                                                .text(\"max\");\n\n                                        addText(decayPanel, \"E\", null, lineX + 150, lineY, \"p_tab\");\n\n                                        var eav = addText(decayPanel, \"E\", null, lineX + 250, lineY, \"p_tab\");\n\n                                        eav.append('tspan')\n                                            .attr('class', 'p_tab_s')\n                                            .attr('dy', '4px')\n                                            .text(\"eav\");\n\n                                        var emax = addText(decayPanel, \"E\", null, lineX + 350, lineY, \"p_tab\");\n\n                                        emax.append('tspan')\n                                            .attr('class', 'p_tab_s')\n                                            .attr('dy', '4px')\n                                            .text(\"max\");\n\n                                        lineY += 40;\n\n                                        lineY = drawDecay(decay, \"A\", decayPanel, lineX, lineY);\n\n                                        lineY = drawDecay(decay, \"B-\", decayPanel, lineX, lineY);\n\n                                        lineY = drawDecay(decay, \"G\", decayPanel, lineX, lineY);\n\n                                        lineY = drawDecay(decay, \"EC\", decayPanel, lineX, lineY);\n\n                                        i += 1;\n                                    })\n                                    .each(function(d) { this._current = d; });\n\n                                if (d.type == \"click\") {\n                                    d.stopPropagation();\n                                }\n\n                                d3.select('#decay_path').on('click').call(d3.select('#decay_path').node());\n                            }\n                        }\n\n                        if (event.type == \"click\") {\n                            event.stopPropagation();\n                        }\n                    })\n                    .on(\"mouseenter\", function(event) {\n                        if (d3.select(this).style(\"fill\") === \"url(\\\"#tab1\\\")\") {\n                            d3.select(this).style(\"fill\", \"url(#tab2)\");\n                        }\n                        event.stopPropagation();\n                    })\n                    .on(\"mouseleave\",  function(event) {\n                        if (d3.select(this).style(\"fill\") === \"url(\\\"#tab2\\\")\") {\n                            d3.select(this).style(\"fill\", \"url(#tab1)\");\n                        }\n                        event.stopPropagation();\n                    })\n                    .on(\"mousedown\",  function(event) {\n                        event.stopPropagation();\n                    });\n\n                    addText(tooltip, i == 0 ? 'Ground': 'M'+i, null, 30 + i * 75, 114, \"tab_label\").attr('pointer-events', 'none');\n\n                    i += 1;\n            }\n\n            if (\"production\" in n_data) {\n                tooltip.append('path')\n                    .datum(n_data.isomers[\"0.0\"])\n                    .style(\"stroke\", \"black\")\n                    .style(\"fill\", \"url(#tab1)\")\n                    .attr(\"id\", \"tab-shape\")\n                    .attr(\"transform\", \"translate(\" + (100 + i * 75) + \",115)\")\n                    .attr(\"d\", \"M 0 0 c -15 -5 -2 -17 -15 -17 h -54 c -6 0 -9 0 -10 7 v 15 h 79 z\")\n                    .on(\"click\", function(event) {\n                        \/\/console.log(\"click\", d3.select(this).datum());\n                        var isomer = d3.select(this).datum();\n                        var lineY = 160;\n\n                        d3.selectAll(\"#tab-shape\")\n                            .style(\"fill\", \"url(#tab1)\");\n\n                        d3.select(this)\n                            .style(\"fill\", \"url(#tab3)\");\n\n                        tooltip.select(\"#isomer\").remove();\n\n                        var isomerPanel = tooltip.append(\"g\")\n                            .attr(\"transform\", \"translate(25,150)\")\n                            .attr(\"id\", \"isomer\");\n\n                        drawProductionChart(isomerPanel, n_data.production)\n                    })\n                    .on(\"mouseenter\", function(event) {\n                        if (d3.select(this).style(\"fill\") === \"url(\\\"#tab1\\\")\") {\n                            d3.select(this).style(\"fill\", \"url(#tab2)\");\n                        }\n                        event.stopPropagation();\n                    })\n                    .on(\"mouseleave\",  function(event) {\n                        if (d3.select(this).style(\"fill\") === \"url(\\\"#tab2\\\")\") {\n                            d3.select(this).style(\"fill\", \"url(#tab1)\");\n                        }\n                        event.stopPropagation();\n                    })\n                    .on(\"mousedown\",  function(event) {\n                        event.stopPropagation();\n                    });\n\n                addText(tooltip, \"Production\", null, 30 + i * 75, 114, \"tab_label\").attr('pointer-events', 'none');\n            }\n\n            tooltip.append(\"rect\")\n                .attr('id', 'tab_rect')\n                .attr(\"x\", \"20\")\n                .attr(\"y\", \"120\")\n                .attr(\"rx\", \"4\")\n                .attr(\"ry\", \"4\")\n                .attr(\"width\", 460)\n                .attr(\"height\", 340)\n                .style(\"fill\", \"white\")\n                \/\/.style(\"fill-opacity\", \"0.7\")\n                .style(\"stroke\", \"black\")\n                .style(\"stroke-width\", \"1.5px\");\n\n            addText(tooltip, \"data source: www-nds.iaea.org (2020)\", null, 30, 480, \"tab_label\").attr('font-size', '0.9rem');\n\n            var tabGround = d3.select('#tab-shape');\n            tabGround.on('click').call(tabGround.node(), tabGround.datum());\n    }\n\n\/*\n      var bbox = text.node().getBBox();\n\n      rect.attr(\"width\", bbox.width);\n      rect.attr(\"height\", bbox.height);\n*\/\n\n\n    });\n\n    \/\/document.addEventListener('touchstart', handler, { passive: true });\n\n    \/* Zoom *\/\n\n    \/\/ Define the zoom behaviour\n    var zoom = d3.zoom()\n        .scaleExtent([0, 9])\n        .on('zoom', zoomed);\n\n    svg.call(zoom);\n\n    \/\/ Zoom function\n    function zoomed() {\n        \/\/ Get the transform\n        \/\/transform = d3.event.transform;\n        transform = d3.zoomTransform(this);\n        if (!transform) {\n            return;\n        }\n\n        container.attr('transform', transform.toString());\n\n        if (transform.k >= 3) {\n            container.selectAll('text').style('opacity', 1);\n        } else {\n            container.selectAll('text').style('opacity', 0);\n            svg.selectAll(\"#tooltip\").remove();\n        }\n    } \/\/ zoomed()\n\n\n    function getLegendLabel(i, j, colorScale) {\n        if (i==0) {\n            return j == 0 ? \"stable\": \"\";\n        }\n\n        if (viewMode == \"decay\") {\n            return j == 0 ? decayLabels[i]: \"\";\n        }\n\n        var result;\n\n        if (viewMode == \"half-life\") {\n            var domain = halfLifeTimeScale.domain();\n\n            switch (domain.indexOf(i)) {\n                case 0:\n                    result = j == 0 ? \"<\" + halfLifeTimeScale(i): \"\";\n                    break;\n\n                case domain.length -1:\n                    result = j == 0 ? \"\u2265\" + halfLifeTimeScale(i): \"\";\n                    break;\n\n                default:\n                    result = j == 0 ? \"\u2265 \" + halfLifeTimeScale(i): \"< \" + halfLifeTimeScale(domain[domain.indexOf(i)+1]);\n            }\n\n            return result;\n        }\n\n        var suffix = \"\";\n\n        switch (viewMode) {\n            case \"production\":\n                suffix = \" p\/s\";\n                break;\n\n            case \"half-life\":\n                suffix = \" s\";\n        }\n\n        var domain = colorScale.domain();\n\n        var result;\n        switch (domain.indexOf(i)) {\n            case 0:\n                result = j == 0 ? \"<\" + d3.format('.2E')(i) + suffix: \"\";\n                break;\n\n            case domain.length -1:\n                result = j == 0 ? \"\u2265\" + d3.format('.2E')(i) + suffix: \"\";\n                break;\n\n            default:\n                \/\/result = \"[\" +d3.format('.2E')(i) + suffix + \", \" + d3.format('.2E')(domain[domain.indexOf(i)+1]) + suffix;\n                result = j == 0 ? \"\u2265 \" +d3.format('.2E')(i) + suffix: \"< \" + d3.format('.2E')(domain[domain.indexOf(i)+1]) + suffix;\n        }\n\n        return result;\n    }\n\n    function changeLegend(colorScale) {\n        var legendDIV = d3.selectAll(\"#LEGEND\");\n        legendDIV.select(\"#legend\").remove();\n\n        var legend = legendDIV.append(\"svg\")\n            .attr(\"id\", \"legend\")\n            .attr(\"width\", colorScale.range().length * 27)\n            .attr(\"height\", 20);\n\n        legend.selectAll(\"#legend_rect\")\n            .data(colorScale.domain().concat([0]))\n            .enter().append(\"rect\")\n                .attr(\"id\", \"legend_rect\")\n                .attr(\"x\", (d, i) => i*27)\n                .attr(\"y\", 0)\n                .attr(\"width\", 25)\n                .attr(\"height\", 20)\n                .style(\"stroke\", \"black\")\n                .style(\"stroke-width\", \"0.5px\")\n                .attr(\"fill\", d => d == 0? \"url(#stable)\": colorScale(d))\n                .on(\"mouseover\", function(d, i) {\n                    var tooltip = svg.append('g')\n                        .attr('id', 'legend_tooltip')\n                        .attr('transform', 'translate(' + (d.x-75) + ',0)');\n\n                    tooltip.append(\"rect\")\n                        .attr('id', 'legend_tooltip_rect')\n                        .attr('rx', '2')\n                        .attr('ry', '2')\n                        .attr(\"width\", 160)\n                        .attr(\"height\", 39)\n                        .style(\"fill\", \"white\")\n                        .style(\"stroke\", \"black\")\n                        .style(\"stroke-width\", \"1px\");\n\n                    tooltip.append(\"rect\")\n                        .attr('x', '5')\n                        .attr('y', '5')\n                        .attr('rx', '1')\n                        .attr('ry', '1')\n                        .attr(\"width\", 40)\n                        .attr(\"height\", 30)\n                        .style(\"fill\", i==0? \"url(#stable)\": colorScale(i))\n                        .style(\"stroke\", \"black\")\n                        .style(\"stroke-width\", \"0.5px\");\n\n                    var text1 = getLegendLabel(i, 0, colorScale);\n                    var text2 = getLegendLabel(i, 1, colorScale);\n\n                    if (text2 == \"\") {\n                        addText(tooltip, text1, null, 100, 25, \"legend_label\");\n                    } else {\n                        addText(tooltip, text1, null, 100, 18, \"legend_label\");\n                        addText(tooltip, text2, null, 100, 32, \"legend_label\");\n                    }\n                })\n                .on(\"mouseout\", function() {\n                    d3.selectAll(\"#legend_tooltip\").remove();\n                })\n    }\n\n    \/\/ set an initial transform object on the zoom element\n    var initialTransform = d3.zoomIdentity.translate(0,0).scale(2);\n    svg.call(zoom.transform, initialTransform);\n\n    svg.transition()\n        .duration(4000)\n        .call(zoom.transform, d3.zoomIdentity.translate(frame_width\/2-200, 200).scale(0.3));\n\n    \/\/ Create Event Handlers for mouse\n    function handleMouseOver(d, i) {  \/\/ Add interactivity\n        \/\/ Use D3 to select element, change color and size\n        \/\/console.log(d);\n        \/\/console.log(i);\n        \/\/fisheye.focus(d3.mouse(this));\n\n        const mouseX = d3.mouse(this)[0];\n        const mouseY = d3.mouse(this)[1];\n        \/\/const r = fisheye.radius();\n        \/\/console.log('in (' + d.x + ',' + d.y + ')');\n        \/\/d => {d.fisheye = fisheye(d);}\n        \/\/console.log(d3.select('#'+d.id));\n\n        d3.select(this)\n            .attr('fill', function(d) { return 'orange'; })\n            .style('stroke', 'black')\n            .style('opacity', 1);\n\n    }\n\n    function handleMouseOut(d, i) {\n        d3.select(this)\n            .attr('fill', 'red')\n            .style('stroke', 'none')\n            .style('opacity', 1);\n    }\n\n    function roundToTwo(num) {\n        return +(Math.round(num + \"e+2\")  + \"e-2\");\n    }\n\n    function json2array(json) {\n        var result = [];\n        var keys = Object.keys(json);\n\n        keys.forEach(function(key) {\n            result.push(json[key]);\n        });\n        return result;\n    }\n\n    function addText(panel, text, id, x, y, style) {\n        return panel.append('text')\n            .attr('id', id)\n            .attr('class', style)\n            .attr('x', x)\n            .attr('y', y)\n            .text(text);\n    }\n\n    function addTSpan(panel, text, dy, style) {\n        panel.append('tspan')\n            .attr('class', style)\n            .attr('dy', dy)\n            .text(text);\n    }\n<\/script>\n<\/script>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Release v2.5 2025. Developed by the ISOLPHARM team using IAEA&#8217;s ENSDF data (Oct 2020). For any questions please contact us (isolpharm@lnl.infn.it)<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_header_footer","meta":{"footnotes":""},"class_list":["post-2257","page","type-page","status-publish","hentry"],"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"Lisa Zangrando","author_link":"https:\/\/isolpharm.pd.infn.it\/?author=3"},"rttpg_comment":0,"rttpg_category":null,"rttpg_excerpt":"Release v2.5 2025. Developed by the ISOLPHARM team using IAEA&#8217;s ENSDF data (Oct 2020). For any questions please contact us (isolpharm@lnl.infn.it)","_links":{"self":[{"href":"https:\/\/isolpharm.pd.infn.it\/index.php?rest_route=\/wp\/v2\/pages\/2257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/isolpharm.pd.infn.it\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/isolpharm.pd.infn.it\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/isolpharm.pd.infn.it\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/isolpharm.pd.infn.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2257"}],"version-history":[{"count":26,"href":"https:\/\/isolpharm.pd.infn.it\/index.php?rest_route=\/wp\/v2\/pages\/2257\/revisions"}],"predecessor-version":[{"id":4744,"href":"https:\/\/isolpharm.pd.infn.it\/index.php?rest_route=\/wp\/v2\/pages\/2257\/revisions\/4744"}],"wp:attachment":[{"href":"https:\/\/isolpharm.pd.infn.it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}