diff --git a/custom-analytics-example/custom-analytics-example-dev.bkr b/custom-analytics-example/custom-analytics-example-dev.bkr index 782443a569bbcd204aca10328adf1614a15cce46..955c57ab5935392075cfe13920c2bb6af4da2cf0 100644 --- a/custom-analytics-example/custom-analytics-example-dev.bkr +++ b/custom-analytics-example/custom-analytics-example-dev.bkr @@ -100,7 +100,7 @@ " ", " <sup>1</sup> Fritz Haber Institute of the Max Planck Society, Faradayweg 4-6, D-14195 Berlin, Germany <br>", " <sup>2</sup> Engineering Laboratory, University of Cambridge, Trumpington Street, Cambridge CB2 1PZ, UK", - " <span class=\"nomad--last-updated\" data-version=\"v1.0.0\">[Last updated: January 19, 2018]</span>", + " <span class=\"nomad--last-updated\" data-version=\"v1.0.1\">[Last updated: January 30, 2018]</span>", " </p>", "</div>" ], @@ -111,7 +111,7 @@ "result": { "type": "BeakerDisplay", "innertype": "Html", - "object": "<script>\nvar beaker = bkHelper.getBeakerObject().beakerObj;\n</script>\n<div class=\"nomad--header\">\n <h2>NOMAD Analytics Toolkit</h2>\n <h3>On-the-fly data analysis for the NOMAD Archive</h3>\n <p class=\"nomad--description\">\n created by:\n <a href=\"mailto:ziletti@fhi-berlin.mpg.de\">Angelo Ziletti</a><sup> 1</sup>,\n Carl Poelking<sup>2</sup>, \n Fawzi Mohamed<sup>1</sup>, \n Gábor Csányi<sup>2</sup>, \n and Luca Ghiringhelli<sup>1</sup> <br><br>\n \n <sup>1</sup> Fritz Haber Institute of the Max Planck Society, Faradayweg 4-6, D-14195 Berlin, Germany <br>\n <sup>2</sup> Engineering Laboratory, University of Cambridge, Trumpington Street, Cambridge CB2 1PZ, UK\n <span class=\"nomad--last-updated\" data-version=\"v1.0.0\">[Last updated: January 19, 2018]</span>\n </p>\n</div>" + "object": "<script>\nvar beaker = bkHelper.getBeakerObject().beakerObj;\n</script>\n<div class=\"nomad--header\">\n <h2>NOMAD Analytics Toolkit</h2>\n <h3>On-the-fly data analysis for the NOMAD Archive</h3>\n <p class=\"nomad--description\">\n created by:\n <a href=\"mailto:ziletti@fhi-berlin.mpg.de\">Angelo Ziletti</a><sup> 1</sup>,\n Carl Poelking<sup>2</sup>, \n Fawzi Mohamed<sup>1</sup>, \n Gábor Csányi<sup>2</sup>, \n and Luca Ghiringhelli<sup>1</sup> <br><br>\n \n <sup>1</sup> Fritz Haber Institute of the Max Planck Society, Faradayweg 4-6, D-14195 Berlin, Germany <br>\n <sup>2</sup> Engineering Laboratory, University of Cambridge, Trumpington Street, Cambridge CB2 1PZ, UK\n <span class=\"nomad--last-updated\" data-version=\"v1.0.1\">[Last updated: January 30, 2018]</span>\n </p>\n</div>" }, "selectedType": "BeakerDisplay", "elapsedTime": 0, @@ -329,6 +329,7 @@ "from nomad_sim.nomad_structures import NOMADStructure", "from nomad_sim.wrappers import get_json_list", "from nomad_sim.wrappers import plot, logger", + "from nomad_sim.wrappers import _get_structures", "from nomad_sim.utils_crystals import get_spacegroup", "from nomad_sim.utils_crystals import create_supercell", "from nomad_sim.utils_crystals import filter_json_list", @@ -340,15 +341,28 @@ }, "output": { "state": {}, - "selectedType": "BeakerDisplay", + "selectedType": "Results", "pluginName": "IPython", - "shellId": "24B535D4EA8C404AA5653E575AEA98F9", - "elapsedTime": 414, - "height": 51, - "hidden": true + "shellId": "32B7F85D85DA4B05AC8ABA4FA6E22968", + "elapsedTime": 3893, + "height": 50, + "hidden": true, + "result": { + "type": "Results", + "outputdata": [ + { + "type": "err", + "value": "/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n from ._conv import register_converters as _register_converters\n/usr/local/lib/python2.7/dist-packages/pymatgen/__init__.py:87: UserWarning: \nPymatgen will drop Py2k support from v2019.1.1. Pls consult the documentation\nat https://www.pymatgen.org for more details.\n at https://www.pymatgen.org for more details.\"\"\")\n" + }, + { + "type": "err", + "value": "Using TensorFlow backend.\n" + } + ] + } }, "evaluatorReader": true, - "lineCount": 37, + "lineCount": 38, "initialization": true, "tags": "query_list" }, @@ -2048,9 +2062,7 @@ " display(df)", "else:", " logger.error(\"No query result found.\")", - " logger.error(\"Please go to 'https://analytics-toolkit.nomad-coe.eu/??' and perform a query.\" )", - " ", - "beaker.last_query_name = 'Crystal-C'" + " logger.error(\"Please go to 'https://analytics-toolkit.nomad-coe.eu' and perform a query.\" )" ], "hidden": true }, @@ -2109,294 +2121,312 @@ "values": [ [ 0, + "CaCO3", + "/data/private/angeloziletti/nomad-query/data/2018-01-29 105041 CaCO3.json", + "2018-01-29 10:50:41" + ], + [ + 1, + "c100", + "/data/private/angeloziletti/nomad-query/data/2018-01-26 144119 c100.json", + "2018-01-26 14:41:19" + ], + [ + 2, + "Gold", + "/data/private/angeloziletti/nomad-query/data/2018-01-26 134358 Gold.json", + "2018-01-26 13:43:58" + ], + [ + 3, "NaCl", "/data/private/angeloziletti/nomad-query/data/2018-01-19 131946 NaCl.json", "2018-01-19 13:19:46" ], [ - 1, + 4, "H100", "/data/private/angeloziletti/nomad-query/data/2018-01-19 130210 H100.json", "2018-01-19 13:02:10" ], [ - 2, + 5, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-19 125348 VASP.json", "2018-01-19 12:53:48" ], [ - 3, + 6, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-19 125302 VASP.json", "2018-01-19 12:53:02" ], [ - 4, + 7, "Ge100", "/data/private/angeloziletti/nomad-query/data/2018-01-19 125245 Ge100.json", "2018-01-19 12:52:45" ], [ - 5, + 8, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-19 125154 VASP.json", "2018-01-19 12:51:54" ], [ - 6, + 9, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-19 115503 VASP.json", "2018-01-19 11:55:03" ], [ - 7, + 10, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-19 115417 VASP.json", "2018-01-19 11:54:17" ], [ - 8, + 11, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-19 115302 VASP.json", "2018-01-19 11:53:02" ], [ - 9, + 12, "bla", "/data/private/angeloziletti/nomad-query/data/2018-01-19 115243 bla.json", "2018-01-19 11:52:43" ], [ - 10, + 13, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-19 113914 VASP.json", "2018-01-19 11:39:14" ], [ - 11, + 14, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-19 113901 VASP.json", "2018-01-19 11:39:01" ], [ - 12, + 15, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-19 113323 VASP.json", "2018-01-19 11:33:23" ], [ - 13, + 16, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-18 074355 VASP.json", "2018-01-18 07:43:55" ], [ - 14, + 17, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-18 074123 VASP.json", "2018-01-18 07:41:23" ], [ - 15, + 18, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-18 074027 VASP.json", "2018-01-18 07:40:27" ], [ - 16, + 19, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-18 073508 VASP.json", "2018-01-18 07:35:08" ], [ - 17, + 20, "TiO2", "/data/private/angeloziletti/nomad-query/data/2018-01-18 073456 TiO2.json", "2018-01-18 07:34:56" ], [ - 18, + 21, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-18 073337 VASP.json", "2018-01-18 07:33:37" ], [ - 19, + 22, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 132652 VASP.json", "2018-01-17 13:26:52" ], [ - 20, + 23, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 132444 VASP.json", "2018-01-17 13:24:44" ], [ - 21, + 24, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 132303 VASP.json", "2018-01-17 13:23:03" ], [ - 22, + 25, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 132217 VASP.json", "2018-01-17 13:22:17" ], [ - 23, + 26, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 131846 VASP.json", "2018-01-17 13:18:46" ], [ - 24, + 27, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 131816 VASP.json", "2018-01-17 13:18:16" ], [ - 25, + 28, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 131747 VASP.json", "2018-01-17 13:17:47" ], [ - 26, + 29, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 131454 VASP.json", "2018-01-17 13:14:54" ], [ - 27, + 30, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 130713 VASP.json", "2018-01-17 13:07:13" ], [ - 28, + 31, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 130702 VASP.json", "2018-01-17 13:07:02" ], [ - 29, + 32, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 130230 VASP.json", "2018-01-17 13:02:30" ], [ - 30, + 33, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 125954 VASP.json", "2018-01-17 12:59:54" ], [ - 31, + 34, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 125936 VASP.json", "2018-01-17 12:59:36" ], [ - 32, + 35, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 125716 VASP.json", "2018-01-17 12:57:16" ], [ - 33, + 36, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 125702 VASP.json", "2018-01-17 12:57:02" ], [ - 34, + 37, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 124915 VASP.json", "2018-01-17 12:49:15" ], [ - 35, + 38, "Au", "/data/private/angeloziletti/nomad-query/data/2018-01-17 124908 Au.json", "2018-01-17 12:49:08" ], [ - 36, + 39, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 124534 VASP.json", "2018-01-17 12:45:34" ], [ - 37, + 40, "CO2", "/data/private/angeloziletti/nomad-query/data/2018-01-17 124513 CO2.json", "2018-01-17 12:45:13" ], [ - 38, + 41, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 124425 VASP.json", "2018-01-17 12:44:25" ], [ - 39, + 42, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 124039 VASP.json", "2018-01-17 12:40:39" ], [ - 40, + 43, "HF100_Curtarolo", "/data/private/angeloziletti/nomad-query/data/2018-01-17 124019 HF100_Curtarolo.json", "2018-01-17 12:40:19" ], [ - 41, + 44, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 123513 VASP.json", "2018-01-17 12:35:13" ], [ - 42, + 45, "TiO2_gaussian", "/data/private/angeloziletti/nomad-query/data/2018-01-17 123503 TiO2_gaussian.json", "2018-01-17 12:35:03" ], [ - 43, + 46, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 122937 VASP.json", "2018-01-17 12:29:37" ], [ - 44, + 47, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 122910 VASP.json", "2018-01-17 12:29:10" ], [ - 45, + 48, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 122721 VASP.json", "2018-01-17 12:27:21" ], [ - 46, + 49, "VASP", "/data/private/angeloziletti/nomad-query/data/2018-01-17 122647 VASP.json", "2018-01-17 12:26:47" ], [ - 47, + 50, "TiO2", "/data/private/angeloziletti/nomad-query/data/2018-01-17 122439 TiO2.json", "2018-01-17 12:24:39" ], [ - 48, + 51, "gaussian_all", "/data/private/angeloziletti/nomad-query/data/2018-01-08 125655 gaussian_all.json", "2018-01-08 12:56:55" @@ -2413,13 +2443,13 @@ }, "selectedType": "Table", "pluginName": "IPython", - "shellId": "24B535D4EA8C404AA5653E575AEA98F9", - "elapsedTime": 274, + "shellId": "32B7F85D85DA4B05AC8ABA4FA6E22968", + "elapsedTime": 1000, "dataresult": 1, "height": 785 }, "evaluatorReader": true, - "lineCount": 14, + "lineCount": 12, "initialization": true, "tags": "query_list" }, @@ -2784,7 +2814,7 @@ "result": { "type": "BeakerDisplay", "innertype": "Html", - "object": "<script>\nvar beaker = bkHelper.getBeakerObject().beakerObj;\n</script>\n<script>\nvar run_soap = function() {\n $(\"#plot_result_button\").removeClass(\"active\").addClass(\"disabled\");\n get_options();\n beaker.evaluate(\"cell_soap_run\");\n};\n \nvar show_hide = function(tag, bt_tag) {\n $(\"#\"+tag).toggle();\n $(\"#\"+bt_tag).toggleClass(\"active\");\n}\n\nvar allow = function(yesno) {\n if (yesno) {\n $(\"#option_el_spec_dens\").removeAttr('disabled');\n $(\"#atomic_density_type\").val('number_density').change();\n }\n else {\n if ($(\"#atomic_density_type\").val() == \"number_density\") {\n $(\"#atomic_density_type\").val('number_density_generic').change();\n }\n $(\"#option_el_spec_dens\").attr('disabled', 'disabled');\n }\n}\n \nvar reset_soap = function() {\n beaker.evaluate(\"cell_soap_gui\");\n};\n \nvar get_options = function() {\n var query_name = $(\"#query_name\").val(); \n var max_nb_res = $(\"#max_nb_res\").val(); \n \n // Determine kernel adaptor function\n // [i.e., choose from specific/generic/global-specific/global-generic] \n var density_type = $(\"#atomic_density_type\").val(); \n var adaptor_type = \"?\";\n if (density_type == \"number_density\") {\n adaptor_type = \"specific\";\n }\n else { // element-agnostic, core charge, valence charge, electronegativity\n adaptor_type = \"generic\";\n }\n var kernel_method = $(\"#kernel_method\").val();\n if (kernel_method == \"global\") {\n adaptor_type = \"global-\" + adaptor_type;\n }\n \n var n_procs = parseInt($(\"#exe_n_procs\").val());\n if ($(\"#threading_mode\").val() == \"single_threaded\") n_procs = 1;\n \n beaker.options = {\n \"query\": {\n \"query_name\": $(\"#query_name\").val(),\n \"max_nb_res\": $(\"#max_nb_res\").val()\n },\n \"run\": {\n \"config_folder\": $(\"#dataset_example\").val(),\n \"n_configs\": -1,\n \"n_procs\": n_procs,\n \"n_blocksize\": parseInt($(\"#exe_batch_size\").val()),\n \"queue\": \"?\",\n \"walltime\": 12,\n \"out_folder\": \"out.kernel\",\n \"verbose\": false\n },\n \"atomic_density\": {\n \"density_type\": $(\"#atomic_density_type\").val(),\n \"atomic_radius\": parseFloat($(\"#atomic_density_atomic_radius\").val()),\n \"use_covrad\": $(\"#atomic_density_use_covrad:checked\").val() == \"true\"\n },\n \"kernel\": {\n \"method\": kernel_method\n },\n \n \"basekernel\": {\n \"type\": \"dot\",\n \"dot\": {\n \"xi\": parseFloat($(\"#basekernel_kernel_xi\").val()),\n \"delta\": 1.0\n }\n },\n \n \"topkernel\": {\n \"type\": \"rematch\",\n \"rematch\": {\n \"gamma\": 0.01\n },\n \"rematch-atomic\": {\n \"gamma\": 0.01\n },\n \"average\": {\n \"xi\": 1.0,\n \"delta\": 1.0\n }\n },\n \n \"laplacian\": {\n \"inverse_dist\": true,\n \"coulomb\": true,\n \"scale\": 0.01,\n \"eta\": 1.0,\n \"gamma\": 0.01,\n \"optimize_eta_gamma\": false\n },\n \"dimred\": {\n \"method\": $(\"#dimred_method\").val()\n },\n \"graph\": {\n \"descriptor\": \"soap\",\n \"pca\": \"none\",\n \"hierarchical\": $(\"#kernel_hierarchical\").val() == \"true\",\n \"r0\": 1.0,\n \"alpha\": 2.0,\n \"n_levels\": 3,\n \"optimize_hierarchy\": false\n },\n \"lamatch\": {\n \"gamma\": 0.3,\n \"optimize_rematch\": false\n },\n\n \"descriptor\": {\n \"type\": \"soap-atomic-dmap\",\n \"soap-atomic\": {\n \"spectrum.global\": false,\n \"spectrum.gradients\": false,\n \"spectrum.2l1_norm\": false,\n \"_spectrum.2l1_norm\": true,\n \"radialbasis.type\" : \"gaussian\",\n \"radialbasis.mode\" : $(\"#soap_radialbasis_mode\").val(),\n \"radialbasis.N\" : parseInt($(\"#soap_radialbasis_N\").val()),\n \"radialbasis.sigma\": parseFloat($(\"#soap_radialbasis_sigma\").val()),\n \"radialbasis.integration_steps\": 15,\n \"radialcutoff.Rc\": parseFloat($(\"#soap_radialbasis_Rc\").val()),\n \"radialcutoff.Rc_width\": parseFloat($(\"#soap_radialbasis_sigma\").val()),\n \"radialcutoff.type\": \"heaviside\",\n \"radialcutoff.center_weight\": 1.0,\n \"angularbasis.type\": \"spherical-harmonic\",\n \"angularbasis.L\": parseInt($(\"#soap_angularbasis_L\").val()),\n \"kernel.adaptor\": \"specific-unique\",\n \"exclude_centers\": [],\n \"exclude_targets\": [],\n \"type_list\": []\n },\n \"soap-atomic-dmap\": {\n \"spectrum.global\": false,\n \"spectrum.gradients\": false,\n \"spectrum.2l1_norm\": false,\n \"radialbasis.type\" : \"gaussian\",\n \"radialbasis.mode\" : \"adaptive\",\n \"radialbasis.N\" : 9,\n \"radialbasis.sigma\": 0.5,\n \"radialbasis.integration_steps\": 15,\n \"radialcutoff.Rc\": 3.5,\n \"radialcutoff.Rc_width\": 0.5,\n \"radialcutoff.type\": \"heaviside\",\n \"radialcutoff.center_weight\": 1.0,\n \"angularbasis.type\": \"spherical-harmonic\",\n \"angularbasis.L\": 6,\n \"kernel.adaptor\": \"specific-unique-dmap\",\n \"exclude_centers\": [],\n \"exclude_targets\": [],\n \"type_list\": []\n }\n }\n\n \n };\n\n}; \n \nbeaker.view_result = function(result_link) {\n $(\"#plot_result_button\").attr(\"href\", result_link);\n $(\"#plot_result_button\").removeClass(\"disabled\"); //.addClass(\"active\");\n}\n</script>\n<style type=\"text/css\">\n .in11f {\n width: 3.5em;\n }\n .in3d {\n width: 5em;\n }\n .select_main {\n width: 20em;\n }\n .btn.active, .btn:active {\n background: #cecece;\n text-decoration: none;\n }\n</style>\n\n <p style=\"color:#20335d; font-weight:900; font-size:18pt;\"> Control options Query <br> </p><hr style=\"border-width:2px\"> <p></p>\n\n <table class=\"query_control\">\n \n <!-- SYSTEM REWEIHGTED COMPOSITION --> \n <tbody><tr style=\"line-height:40px\">\n <td><b>Name of query to analyze</b> (if empty: load latest query)</td>\n <td>\n <input type=\"text\" id=\"query_name\" value=\"\"> \n\n </td>\n </tr>\n \n \n <!-- BASE KERNEL --> \n <tr style=\"line-height:40px\">\n <td><b>Max number or results for each space group/point group</b> </td>\n <td>\n <input type=\"number\" name=\"quantity\" id=\"max_nb_res\" min=\"5\" max=\"100\" value=\"25\" step=\"1\"> \n </td>\n </tr> \n \n \n \n</tbody></table>\n \n<br> <br>\n\n <p style=\"color:#20335d; font-weight:900; font-size:18pt;\"> Control options Analysis <br> </p><hr style=\"border-width:2px\"> <p></p>\n \n \n <table class=\"glosim_control\">\n \n <!-- ATOMIC DENSITY --> \n <tbody><tr style=\"line-height:40px\">\n <td><b>Atomic density</b> </td>\n <td>\n <select class=\"select_main\" id=\"atomic_density_type\">\n <option id=\"option_el_agno_dens\" value=\"number_density_generic\" selected=\"\"> Density type: element-agnostic density </option>\n <option id=\"option_el_spec_dens\" value=\"number_density\" disabled=\"\"> Density type: element-specific density </option> \n <option value=\"valence_charge_density\"> Density type: valence charge </option>\n <option value=\"z_density\"> Density type: core charge </option>\n <option value=\"elneg_density\"> Density type: electronegativity </option>\n </select> <!-- DATASETS -->\n \n <button id=\"toggle_detail_2\" type=\"button\" class=\"btn btn-xs\" onclick=\"show_hide("in_detail_2", "toggle_detail_2")\">Configure</button>\n <g id=\"in_detail_2\" hidden=\"\"> Use covalent radii <input id=\"atomic_density_use_covrad\" type=\"checkbox\" value=\"true\" unchecked=\"\">\n Constant atomic radius (Angstrom) <input id=\"atomic_density_atomic_radius\" type=\"number\" value=\"0.5\" min=\"0.0\" max=\"2.0\" step=\"0.1\" class=\"in11f\"> </g>\n </td>\n </tr>\n \n <!-- BASIS SET --> \n <tr style=\"line-height:40px\">\n <td><b>Basis set</b> </td>\n <td>\n <select class=\"select_main\" id=\"soap_radialbasis_mode\">\n <option value=\"adaptive\"> Radial basis: adaptive </option>\n <option value=\"equispaced\"> Radial basis: equispaced </option>\n </select>\n <button id=\"toggle_detail_3\" type=\"button\" class=\"btn btn-xs\" onclick=\"show_hide("in_detail_3", "toggle_detail_3")\">Configure</button>\n <g id=\"in_detail_3\" hidden=\"\">\n Radial functions N = <input id=\"soap_radialbasis_N\" type=\"number\" value=\"9\" min=\"1\" max=\"14\" step=\"1\" class=\"in11f\">\n Radial cutoff (equispaced only) <input id=\"soap_radialbasis_Rc\" type=\"number\" value=\"3.5\" min=\"0.1\" max=\"10.0\" step=\"0.1\" class=\"in11f\">\n Radial Gaussian width <input id=\"soap_radialbasis_sigma\" type=\"number\" value=\"0.5\" min=\"0.1\" max=\"3.0\" step=\"0.1\" class=\"in11f\">\n Angular functions L = <input id=\"soap_angularbasis_L\" type=\"number\" value=\"6\" min=\"1\" max=\"14\" step=\"1\" class=\"in11f\"> \n </g>\n </td>\n </tr> \n \n <!-- BASE KERNEL --> \n <tr style=\"line-height:40px\">\n <td><b>Base kernel</b> </td>\n <td>\n <select class=\"select_main\" id=\"basekernel_method\">\n <option value=\"dot\"> Dot-product kernel </option>\n <option value=\"laplacian\" disabled=\"\"> Laplacian kernel </option>\n <option value=\"gaussian\" disabled=\"\"> Gaussian kernel </option>\n </select>\n <button id=\"toggle_detail_4\" type=\"button\" class=\"btn btn-xs\" onclick=\"show_hide("in_detail_4", "toggle_detail_4")\">Configure</button>\n <g id=\"in_detail_4\" hidden=\"\">\n Exponent <input id=\"basekernel_kernel_xi\" type=\"number\" value=\"3.0\" min=\"0.1\" max=\"5.0\" step=\"0.1\" class=\"in11f\">\n </g>\n </td>\n </tr> \n \n <!-- TOP KERNEL -->\n <tr style=\"line-height:40px\">\n <td><b>Top kernel</b> </td>\n <td>\n <select class=\"select_main\" id=\"kernel_method\">\n <option value=\"global\" selected=\"\"> Global average (coherent)</option>\n <option value=\"average\"> Global average (incoherent)</option>\n <option value=\"rematch\"> Regularized-entropy match</option> \n <option value=\"laplacian\"> Laplacian Markov random field</option>\n </select>\n <button id=\"toggle_detail_5\" type=\"button\" class=\"btn btn-xs\" onclick=\"show_hide("in_detail_5", "toggle_detail_5")\">Configure</button>\n <g id=\"in_detail_5\" hidden=\"\">\n Mode \n <select id=\"kernel_hierarchical\">\n <option value=\"false\"> single-level</option>\n <option value=\"true\"> hierarchical</option>\n </select>\n Graph Laplacian \n <select id=\"opt_top_kernel_hierarchy\">\n <option value=\"invdist\"> inverse distance</option>\n <option value=\"coulomb\"> Coulomb matrix</option>\n </select>\n Levels <input id=\"graph:n_levels\" type=\"number\" value=\"1\" min=\"1\" max=\"5\" step=\"1\" class=\"in11f\">\n Base radius <input id=\"graph:r0\" type=\"number\" value=\"1.0\" min=\"0.1\" max=\"5.0\" step=\"0.1\" class=\"in11f\">\n Scale <input id=\"graph:alpha\" type=\"number\" value=\"2.0\" min=\"0.1\" max=\"5.0\" step=\"0.1\" class=\"in11f\">\n </g>\n </td>\n </tr> \n \n</tbody></table>\n \n<hr style=\"border-width:2px\">\n \n <button class=\"btn btn-default\" onclick=\"run_soap()\">RUN Retrieval & Analysis</button> \n <button class=\"btn btn-default\" onclick=\"reset_soap()\">RESET </button> \n <label title=\"Activate once run is complete.\"> \n <a href=\"#\" target=\"_blank\" class=\"btn btn-primary disabled\" id=\"plot_result_button\">View 2D similarity map</a> \n </label>\n" + "object": "<script>\nvar beaker = bkHelper.getBeakerObject().beakerObj;\n</script>\n<script>\nvar run_soap = function() {\n $(\"#plot_result_button\").removeClass(\"active\").addClass(\"disabled\");\n get_options();\n beaker.evaluate(\"cell_soap_run\");\n};\n \nvar show_hide = function(tag, bt_tag) {\n $(\"#\"+tag).toggle();\n $(\"#\"+bt_tag).toggleClass(\"active\");\n}\n\nvar allow = function(yesno) {\n if (yesno) {\n $(\"#option_el_spec_dens\").removeAttr('disabled');\n $(\"#atomic_density_type\").val('number_density').change();\n }\n else {\n if ($(\"#atomic_density_type\").val() == \"number_density\") {\n $(\"#atomic_density_type\").val('number_density_generic').change();\n }\n $(\"#option_el_spec_dens\").attr('disabled', 'disabled');\n }\n}\n \nvar reset_soap = function() {\n beaker.evaluate(\"cell_soap_gui\");\n};\n \nvar get_options = function() {\n var query_name = $(\"#query_name\").val(); \n var max_nb_res = $(\"#max_nb_res\").val(); \n \n // Determine kernel adaptor function\n // [i.e., choose from specific/generic/global-specific/global-generic] \n var density_type = $(\"#atomic_density_type\").val(); \n var adaptor_type = \"?\";\n if (density_type == \"number_density\") {\n adaptor_type = \"specific\";\n }\n else { // element-agnostic, core charge, valence charge, electronegativity\n adaptor_type = \"generic\";\n }\n var kernel_method = $(\"#kernel_method\").val();\n if (kernel_method == \"global\") {\n adaptor_type = \"global-\" + adaptor_type;\n }\n \n var n_procs = parseInt($(\"#exe_n_procs\").val());\n if ($(\"#threading_mode\").val() == \"single_threaded\") n_procs = 1;\n \n beaker.options = {\n \"query\": {\n \"query_name\": $(\"#query_name\").val(),\n \"max_nb_res\": $(\"#max_nb_res\").val()\n },\n \"run\": {\n \"config_folder\": $(\"#dataset_example\").val(),\n \"n_configs\": -1,\n \"n_procs\": n_procs,\n \"n_blocksize\": parseInt($(\"#exe_batch_size\").val()),\n \"queue\": \"?\",\n \"walltime\": 12,\n \"out_folder\": \"out.kernel\",\n \"verbose\": false\n },\n \"atomic_density\": {\n \"density_type\": $(\"#atomic_density_type\").val(),\n \"atomic_radius\": parseFloat($(\"#atomic_density_atomic_radius\").val()),\n \"use_covrad\": $(\"#atomic_density_use_covrad:checked\").val() == \"true\"\n },\n \"kernel\": {\n \"method\": kernel_method\n },\n \n \"basekernel\": {\n \"type\": \"dot\",\n \"dot\": {\n \"xi\": parseFloat($(\"#basekernel_kernel_xi\").val()),\n \"delta\": 1.0\n }\n },\n \n \"topkernel\": {\n \"type\": \"rematch\",\n \"rematch\": {\n \"gamma\": 0.01\n },\n \"rematch-atomic\": {\n \"gamma\": 0.01\n },\n \"average\": {\n \"xi\": 1.0,\n \"delta\": 1.0\n }\n },\n \n \"laplacian\": {\n \"inverse_dist\": true,\n \"coulomb\": true,\n \"scale\": 0.01,\n \"eta\": 1.0,\n \"gamma\": 0.01,\n \"optimize_eta_gamma\": false\n },\n \"dimred\": {\n \"method\": $(\"#dimred_method\").val()\n },\n \"graph\": {\n \"descriptor\": \"soap\",\n \"pca\": \"none\",\n \"hierarchical\": $(\"#kernel_hierarchical\").val() == \"true\",\n \"r0\": 1.0,\n \"alpha\": 2.0,\n \"n_levels\": 3,\n \"optimize_hierarchy\": false\n },\n \"lamatch\": {\n \"gamma\": 0.3,\n \"optimize_rematch\": false\n },\n\n \"descriptor\": {\n \"type\": \"soap-atomic-dmap\",\n \"soap-atomic\": {\n \"spectrum.global\": false,\n \"spectrum.gradients\": false,\n \"spectrum.2l1_norm\": false,\n \"_spectrum.2l1_norm\": true,\n \"radialbasis.type\" : \"gaussian\",\n \"radialbasis.mode\" : $(\"#soap_radialbasis_mode\").val(),\n \"radialbasis.N\" : parseInt($(\"#soap_radialbasis_N\").val()),\n \"radialbasis.sigma\": parseFloat($(\"#soap_radialbasis_sigma\").val()),\n \"radialbasis.integration_steps\": 15,\n \"radialcutoff.Rc\": parseFloat($(\"#soap_radialbasis_Rc\").val()),\n \"radialcutoff.Rc_width\": parseFloat($(\"#soap_radialbasis_sigma\").val()),\n \"radialcutoff.type\": \"heaviside\",\n \"radialcutoff.center_weight\": 1.0,\n \"angularbasis.type\": \"spherical-harmonic\",\n \"angularbasis.L\": parseInt($(\"#soap_angularbasis_L\").val()),\n \"kernel.adaptor\": \"specific-unique\",\n \"exclude_centers\": [],\n \"exclude_targets\": [],\n \"type_list\": []\n },\n \"soap-atomic-dmap\": {\n \"spectrum.global\": false,\n \"spectrum.gradients\": false,\n \"spectrum.2l1_norm\": false,\n \"radialbasis.type\" : \"gaussian\",\n \"radialbasis.mode\" : \"adaptive\",\n \"radialbasis.N\" : 9,\n \"radialbasis.sigma\": 0.5,\n \"radialbasis.integration_steps\": 15,\n \"radialcutoff.Rc\": 3.5,\n \"radialcutoff.Rc_width\": 0.5,\n \"radialcutoff.type\": \"heaviside\",\n \"radialcutoff.center_weight\": 1.0,\n \"angularbasis.type\": \"spherical-harmonic\",\n \"angularbasis.L\": 6,\n \"kernel.adaptor\": \"specific-unique-dmap\",\n \"exclude_centers\": [],\n \"exclude_targets\": [],\n \"type_list\": []\n }\n }\n\n \n };\n\n}; \n \nbeaker.view_result = function(result_link) {\n $(\"#plot_result_button\").attr(\"href\", result_link);\n $(\"#plot_result_button\").removeClass(\"disabled\"); //.addClass(\"active\");\n}\n</script>\n<style type=\"text/css\">\n .in11f {\n width: 3.5em;\n }\n .in3d {\n width: 5em;\n }\n .select_main {\n width: 20em;\n }\n .btn.active, .btn:active {\n background: #cecece;\n text-decoration: none;\n }\n</style>\n\n <p style=\"color:#20335d; font-weight:900; font-size:18pt;\"> Control options Query <br> </p><hr style=\"border-width:2px\"> <p></p>\n\n <table class=\"query_control\">\n \n <!-- SYSTEM REWEIHGTED COMPOSITION --> \n <tbody><tr style=\"line-height:40px\">\n <td><b>Name of query to analyze</b> (if empty: load latest query)</td>\n <td>\n <input type=\"text\" id=\"query_name\" value=\"\"> \n\n </td>\n </tr>\n \n \n <!-- BASE KERNEL --> \n <tr style=\"line-height:40px\">\n <td><b>Max number or results for each space group/point group</b> </td>\n <td>\n <input type=\"number\" name=\"quantity\" id=\"max_nb_res\" min=\"5\" max=\"100\" value=\"25\" step=\"1\"> \n </td>\n </tr> \n \n \n \n</tbody></table>\n \n<br> <br>\n\n <p style=\"color:#20335d; font-weight:900; font-size:18pt;\"> Control options Analysis <br> </p><hr style=\"border-width:2px\"> <p></p>\n \n \n <table class=\"glosim_control\">\n \n <!-- ATOMIC DENSITY --> \n <tbody><tr style=\"line-height:40px\">\n <td><b>Atomic density</b> </td>\n <td>\n <select class=\"select_main\" id=\"atomic_density_type\">\n <option id=\"option_el_agno_dens\" value=\"number_density_generic\" selected=\"\"> Density type: element-agnostic density </option>\n <option id=\"option_el_spec_dens\" value=\"number_density\" disabled=\"\"> Density type: element-specific density </option> \n <option value=\"valence_charge_density\"> Density type: valence charge </option>\n <option value=\"z_density\"> Density type: core charge </option>\n <option value=\"elneg_density\"> Density type: electronegativity </option>\n </select> <!-- DATASETS -->\n \n <button id=\"toggle_detail_2\" type=\"button\" class=\"btn btn-xs\" onclick=\"show_hide("in_detail_2", "toggle_detail_2")\">Configure</button>\n <g id=\"in_detail_2\" hidden=\"\"> Use covalent radii <input id=\"atomic_density_use_covrad\" type=\"checkbox\" value=\"true\" unchecked=\"\">\n Constant atomic radius (Angstrom) <input id=\"atomic_density_atomic_radius\" type=\"number\" value=\"0.5\" min=\"0.0\" max=\"2.0\" step=\"0.1\" class=\"in11f\"> </g>\n </td>\n </tr>\n \n <!-- BASIS SET --> \n <tr style=\"line-height:40px\">\n <td><b>Basis set</b> </td>\n <td>\n <select class=\"select_main\" id=\"soap_radialbasis_mode\">\n <option value=\"adaptive\"> Radial basis: adaptive </option>\n <option value=\"equispaced\"> Radial basis: equispaced </option>\n </select>\n <button id=\"toggle_detail_3\" type=\"button\" class=\"btn btn-xs\" onclick=\"show_hide("in_detail_3", "toggle_detail_3")\">Configure</button>\n <g id=\"in_detail_3\" hidden=\"\">\n Radial functions N = <input id=\"soap_radialbasis_N\" type=\"number\" value=\"9\" min=\"1\" max=\"14\" step=\"1\" class=\"in11f\">\n Radial cutoff (equispaced only) <input id=\"soap_radialbasis_Rc\" type=\"number\" value=\"3.5\" min=\"0.1\" max=\"10.0\" step=\"0.1\" class=\"in11f\">\n Radial Gaussian width <input id=\"soap_radialbasis_sigma\" type=\"number\" value=\"0.5\" min=\"0.1\" max=\"3.0\" step=\"0.1\" class=\"in11f\">\n Angular functions L = <input id=\"soap_angularbasis_L\" type=\"number\" value=\"6\" min=\"1\" max=\"14\" step=\"1\" class=\"in11f\"> \n </g>\n </td>\n </tr> \n \n <!-- BASE KERNEL --> \n <tr style=\"line-height:40px\">\n <td><b>Base kernel</b> </td>\n <td>\n <select class=\"select_main\" id=\"basekernel_method\">\n <option value=\"dot\"> Dot-product kernel </option>\n <option value=\"laplacian\" disabled=\"\"> Laplacian kernel </option>\n <option value=\"gaussian\" disabled=\"\"> Gaussian kernel </option>\n </select>\n <button id=\"toggle_detail_4\" type=\"button\" class=\"btn btn-xs\" onclick=\"show_hide("in_detail_4", "toggle_detail_4")\">Configure</button>\n <g id=\"in_detail_4\" hidden=\"\">\n Exponent <input id=\"basekernel_kernel_xi\" type=\"number\" value=\"3.0\" min=\"0.1\" max=\"5.0\" step=\"0.1\" class=\"in11f\">\n </g>\n </td>\n </tr> \n \n <!-- TOP KERNEL -->\n <tr style=\"line-height:40px\">\n <td><b>Top kernel</b> </td>\n <td>\n <select class=\"select_main\" id=\"kernel_method\">\n <option value=\"global\" selected=\"\"> Global average (coherent)</option>\n <option value=\"average\"> Global average (incoherent)</option>\n <option value=\"rematch\"> Regularized-entropy match</option> \n <option value=\"laplacian\"> Laplacian Markov random field</option>\n </select>\n <button id=\"toggle_detail_5\" type=\"button\" class=\"btn btn-xs\" onclick=\"show_hide("in_detail_5", "toggle_detail_5")\">Configure</button>\n <g id=\"in_detail_5\" hidden=\"\">\n Mode \n <select id=\"kernel_hierarchical\">\n <option value=\"false\"> single-level</option>\n <option value=\"true\"> hierarchical</option>\n </select>\n Graph Laplacian \n <select id=\"opt_top_kernel_hierarchy\">\n <option value=\"invdist\"> inverse distance</option>\n <option value=\"coulomb\"> Coulomb matrix</option>\n </select>\n Levels <input id=\"graph:n_levels\" type=\"number\" value=\"1\" min=\"1\" max=\"5\" step=\"1\" class=\"in11f\">\n Base radius <input id=\"graph:r0\" type=\"number\" value=\"1.0\" min=\"0.1\" max=\"5.0\" step=\"0.1\" class=\"in11f\">\n Scale <input id=\"graph:alpha\" type=\"number\" value=\"2.0\" min=\"0.1\" max=\"5.0\" step=\"0.1\" class=\"in11f\">\n </g>\n </td>\n </tr> \n \n</tbody></table>\n \n<hr style=\"border-width:2px\">\n \n <button class=\"btn btn-default\" onclick=\"run_soap()\">RUN Retrieval & Analysis</button> \n <button class=\"btn btn-default\" onclick=\"reset_soap()\">RESET </button> \n <label title=\"Activate once run is complete.\"> \n <a href=\"/user/tmp/462b47d34c41e56d.html\" target=\"_blank\" class=\"btn btn-primary\" id=\"plot_result_button\">View 2D similarity map</a> \n </label>\n" }, "selectedType": "BeakerDisplay", "elapsedTime": 0, @@ -2803,6 +2833,7 @@ "body": [ "verbose = False", "logger.setLevel(logging.INFO)", + "#logger.setLevel(logging.DEBUG)", "soap.silence()", "np.set_printoptions(precision=2)", "", @@ -2826,16 +2857,14 @@ "control_file = '/home/beaker/.beaker/v1/web/tmp/control.json'", "", "if options['query']['query_name'] == ' ':", - " logger.info(\"Query name: %s\" % options['query']['query_name'])", - "else:", " logger.info(\"Query name: Latest\")", + "else:", + " logger.info(\"Query name: %s\" % options['query']['query_name'])", " ", "logger.info(\"Kernel method: %s\" % kernel_method)", "logger.info(\"Kernel adaptor: %s\" % adaptor_type)", "logger.info(\"Density type: %s\" % density_type)", "logger.info(\"Dim.-red. method: %s\" % dimred_method)", - "", - "", " ", "from nomad_sim.config import configs", "# clear output file", @@ -2864,8 +2893,8 @@ "state": {}, "selectedType": "Results", "pluginName": "IPython", - "shellId": "24B535D4EA8C404AA5653E575AEA98F9", - "elapsedTime": 862, + "shellId": "32B7F85D85DA4B05AC8ABA4FA6E22968", + "elapsedTime": 641, "dataresult": { "name": "Fe_query", "timestamp": 1516012342, @@ -12883,10 +12912,10 @@ "path": "data/2018-01-15 103222 Fe_query.json", "data": {} }, - "height": 177 + "height": 91 }, "evaluatorReader": true, - "lineCount": 56, + "lineCount": 55, "initialization": true, "tags": "cell_soap_run" }, @@ -12922,8 +12951,8 @@ "state": {}, "selectedType": "Hidden", "pluginName": "IPython", - "shellId": "24B535D4EA8C404AA5653E575AEA98F9", - "elapsedTime": 335, + "shellId": "32B7F85D85DA4B05AC8ABA4FA6E22968", + "elapsedTime": 296, "height": 88 }, "evaluatorReader": true, @@ -12995,8 +13024,8 @@ "state": {}, "selectedType": "Hidden", "pluginName": "IPython", - "shellId": "24B535D4EA8C404AA5653E575AEA98F9", - "elapsedTime": 333, + "shellId": "32B7F85D85DA4B05AC8ABA4FA6E22968", + "elapsedTime": 322, "height": 88 }, "evaluatorReader": true, @@ -13012,33 +13041,76 @@ "body": [ "logger.info(\"Retrieving query data from the NOMAD Archive...\")", "", + "# decide which path to use", + "", "sec_retrieval = {", " 'section-1': {'section_name': 'section_system',", - " 'path': '/section_run/0c/section_system/0c',", - " #'required_keys': ['atom_positions', 'simulation_cell', 'atom_species']}", - " 'required_keys': ['atom_positions', 'atom_species']}", - " #'required_keys': []}", + " 'paths': ['/section_run/0c/section_system/0c', '/section_run/0c/section_system/1c'],", + " 'required_keys_atom_species': ['atom_positions', 'atom_species', 'configuration_periodic_dimensions'],", + " 'required_keys_atom_labels': ['atom_positions', 'atom_labels', 'configuration_periodic_dimensions']}", "}", "", + "", "ase_atoms_list = []", "target_list = []", "", "for key, section in sec_retrieval.iteritems():", + " # define a default for retrieved keys ", + " # so it will not fail if nothing can be retrieved", + " required_keys = section['required_keys_atom_species']", + "", " for idx_nmd, nmd in enumerate(nmd_uri_sampled):", + " retrieval_success = False", " if idx_nmd % 100 == 0: ", " logger.debug('{0}/{1}'.format(idx_nmd+1, len(nmd_uri_sampled)))", - " ", - " nmd_dict = nomad_query.resolve(nmd=nmd, path=section['path'], recursive=True)", + " ", + " for path in section['paths']:", + " nmd_dict = nomad_query.resolve(nmd=nmd, path=path, recursive=True)", + " # first try with atom species (this is the correct procedure)", + " if all([required_key in nmd_dict for required_key in section['required_keys_atom_species']]):", + " logging.debug(\"Using path {} for query-data retrieval\".format(path))", + " retrieval_success = True", + " required_keys = section['required_keys_atom_species']", + " #logger.debug(\"Retrieval succedeed: {}\".format(retrieval_success))", + " #logger.debug(\"Retrieved keys: {}\".format(retrieved_keys))", + " break", + " ", + " if not retrieval_success:", + " # try with atom labels (this is not the correct procedure because atom_labels do not have ", + " # necessary to be atomic species (e.g. C1, C2)", + " # we need to do this because there was a bug in the Gaussian parser", + " for path in section['paths']:", + " nmd_dict = nomad_query.resolve(nmd=nmd, path=path, recursive=True)", + " # first try with atom species (this is the correct procedure)", + " if all([required_key in nmd_dict for required_key in section['required_keys_atom_labels']]):", + " logging.debug(\"Using path {} for query-data retrieval\".format(path))", + " retrieval_success = True", + " required_keys = section['required_keys_atom_labels']", + " #logger.debug(\"Retrieved keys: {}\".format(retrieved_keys))", + " break", "", - " if all([required_key in nmd_dict for required_key in section['required_keys']]):", + " ", + " if all([required_key in nmd_dict for required_key in required_keys]):", " if section['section_name'] == 'section_system':", " atom_positions = np.array(nmd_dict['atom_positions']['flatData']).reshape(nmd_dict['atom_positions']['shape'])*1.0E+10", - " atom_species = np.array(nmd_dict['atom_species'])", - " ", - " try:", - " simulation_cell = np.array(nmd_dict['simulation_cell']['flatData']).reshape(nmd_dict['simulation_cell']['shape'])*1.0E+10", - " except:", - " simulation_cell = None", + " periodicity = np.array(nmd_dict['configuration_periodic_dimensions'][0]['flatData'], dtype=bool)", + " ", + " if required_keys == section['required_keys_atom_species']:", + " atom_species = np.array(nmd_dict['atom_species'])", + " elif required_keys == section['required_keys_atom_labels']:", + " atom_species = np.array(nmd_dict['atom_labels']['flatData'])", + " else:", + " logger.error(\"No retrieved keys. Stopping.\")", + " ", + " # read cell only if periodicity is all True ", + " # the Gaussian parser for non-periodic systems still the cell (0., 0., 0.) even if there is no cell", + " if np.all(periodicity): ", + " try:", + " simulation_cell = np.array(nmd_dict['simulation_cell']['flatData']).reshape(nmd_dict['simulation_cell']['shape'])*1.0E+10", + " except:", + " simulation_cell = None", + " else:", + " logger.debug(\"Calculation {} is not periodic over 3-dimensions.\".format(nmd))", " ", " # create ASE object", " if simulation_cell is not None:", @@ -13089,7 +13161,7 @@ " pass", " ", " else:", - " logger.debug(\"Could not retrieve atom_positions and/or atom_species for entry: {}\".format(nmd))", + " logger.debug(\"Could not retrieve atom_positions and/or atom_species for entry: {} in paths {}\".format(nmd, section['paths']))", " ", " ", "# create json tmp folder", @@ -13107,12 +13179,12 @@ "state": {}, "selectedType": "Results", "pluginName": "IPython", - "shellId": "24B535D4EA8C404AA5653E575AEA98F9", - "elapsedTime": 38471, - "height": 62 + "shellId": "32B7F85D85DA4B05AC8ABA4FA6E22968", + "elapsedTime": 2035, + "height": 88 }, "evaluatorReader": true, - "lineCount": 91, + "lineCount": 134, "initialization": false, "tags": "cell_soap_run" }, @@ -13197,8 +13269,8 @@ "state": {}, "selectedType": "Hidden", "pluginName": "IPython", - "shellId": "24B535D4EA8C404AA5653E575AEA98F9", - "elapsedTime": 325, + "shellId": "32B7F85D85DA4B05AC8ABA4FA6E22968", + "elapsedTime": 301, "height": 88 }, "evaluatorReader": true, @@ -13240,9 +13312,9 @@ "state": {}, "selectedType": "Results", "pluginName": "IPython", - "shellId": "24B535D4EA8C404AA5653E575AEA98F9", - "elapsedTime": 244, - "height": 98 + "shellId": "32B7F85D85DA4B05AC8ABA4FA6E22968", + "elapsedTime": 224, + "height": 88 }, "evaluatorReader": true, "lineCount": 20, @@ -13294,8 +13366,8 @@ "state": {}, "selectedType": "Hidden", "pluginName": "IPython", - "shellId": "24B535D4EA8C404AA5653E575AEA98F9", - "elapsedTime": 332, + "shellId": "32B7F85D85DA4B05AC8ABA4FA6E22968", + "elapsedTime": 317, "height": 88 }, "evaluatorReader": true, @@ -13366,2020 +13438,2447 @@ "state": {}, "selectedType": "Results", "pluginName": "IPython", - "shellId": "24B535D4EA8C404AA5653E575AEA98F9", - "elapsedTime": 13807, + "shellId": "32B7F85D85DA4B05AC8ABA4FA6E22968", + "elapsedTime": 9549, "height": 50, - "hidden": true, "result": { "type": "Results", "outputdata": [ { "type": "out", - "value": "[Kernel] 85 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 85 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 85 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 85 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 120 120 \n" - }, - { - "type": "out", - "value": "[Kernel] 120 1 \n" - }, - { - "type": "out", - "value": "[Kernel] 120 4 \n" - }, - { - "type": "out", - "value": "[Kernel] 120 5 \n" - }, - { - "type": "out", - "value": "[Kernel] 120 6 \n" - }, - { - "type": "out", - "value": "[Kernel] 120 7 \n" - }, - { - "type": "out", - "value": "[Kernel] 120 8 \n" - }, - { - "type": "out", - "value": "[Kernel] 120 9 \n" - }, - { - "type": "out", - "value": "[Kernel] 120 12 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 120 18 \n" + "value": "[Graph] 2 \n" }, { "type": "out", - "value": "[Kernel] 120 19 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 120 20 \n" + "value": "[Graph] 4 \n" }, { "type": "out", - "value": "[Kernel] 120 21 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 120 24 \n" + "value": "[Graph] 5 \n" }, { "type": "out", - "value": "[Kernel] 120 26 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 120 29 \n" + "value": "[Graph] 6 \n" }, { "type": "out", - "value": "[Kernel] 120 31 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 120 32 \n" + "value": "[Graph] 7 \n" }, { "type": "out", - "value": "[Kernel] 120 33 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 120 36 \n" + "value": "[Graph] 8 \n" }, { "type": "out", - "value": "[Kernel] 120 37 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 120 39 \n" + "value": "[Graph] 9 \n" }, { "type": "out", - "value": "[Kernel] 120 44 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 120 47 \n" + "value": "[Graph] 10 \n" }, { "type": "out", - "value": "[Kernel] 120 48 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 120 49 \n" + "value": "[Graph] 11 \n" }, { "type": "out", - "value": "[Kernel] 120 10 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 120 61 \n" + "value": "[Graph] 12 \n" }, { "type": "out", - "value": "[Kernel] 120 106 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 120 13 \n" + "value": "[Graph] 13 \n" }, { "type": "out", - "value": "[Kernel] 120 98 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 1 1 \n" - }, - { - "type": "out", - "value": "[Kernel] 1 4 \n" + "value": "[Graph] 14 \n" }, { "type": "out", - "value": "[Kernel] 1 5 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 1 6 \n" + "value": "[Graph] 0 \n" }, { "type": "out", - "value": "[Kernel] 1 7 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 1 8 \n" + "value": "[Graph] 1 \n" }, { "type": "out", - "value": "[Kernel] 1 9 \n" + "value": "\r" }, { "type": "out", - "value": "[Kernel] 1 12 \n" + "value": "[Graph] 3 \n" }, { "type": "out", - "value": "[Kernel] 1 18 \n" + "value": "\u001b[92mComputing kernel ... \u001b[0;1m\n" }, { "type": "out", - "value": "[Kernel] 1 19 \n" + "value": "[Kernel] 2 2 \n" }, { "type": "out", - "value": "[Kernel] 1 20 \n" + "value": "[Kernel] 2 4 \n" }, { "type": "out", - "value": "[Kernel] 1 21 \n" + "value": "[Kernel] 2 5 \n" }, { "type": "out", - "value": "[Kernel] 1 24 \n" + "value": "[Kernel] 2 6 \n" }, { "type": "out", - "value": "[Kernel] 1 26 \n" + "value": "[Kernel] 2 7 \n" }, { "type": "out", - "value": "[Kernel] 1 29 \n" + "value": "[Kernel] 2 8 \n" }, { "type": "out", - "value": "[Kernel] 1 31 \n" + "value": "[Kernel] 2 9 \n" }, { "type": "out", - "value": "[Kernel] 1 32 \n" + "value": "[Kernel] 2 10 \n" }, { "type": "out", - "value": "[Kernel] 1 33 \n" + "value": "[Kernel] 2 11 \n" }, { "type": "out", - "value": "[Kernel] 1 36 \n" + "value": "[Kernel] 2 12 \n" }, { "type": "out", - "value": "[Kernel] 1 37 \n" + "value": "[Kernel] 2 13 \n" }, { "type": "out", - "value": "[Kernel] 1 39 \n" + "value": "[Kernel] 2 14 \n" }, { "type": "out", - "value": "[Kernel] 1 44 \n" + "value": "[Kernel] 2 0 \n" }, { "type": "out", - "value": "[Kernel] 1 47 \n" + "value": "[Kernel] 2 1 \n" }, { "type": "out", - "value": "[Kernel] 1 48 \n" + "value": "[Kernel] 2 3 \n" }, { "type": "out", - "value": "[Kernel] 1 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 1 10 \n" + "value": "[Kernel] 4 4 \n" }, { "type": "out", - "value": "[Kernel] 1 61 \n" + "value": "[Kernel] 4 5 \n" }, { "type": "out", - "value": "[Kernel] 1 106 \n" + "value": "[Kernel] 4 6 \n" }, { "type": "out", - "value": "[Kernel] 1 13 \n" + "value": "[Kernel] 4 7 \n" }, { "type": "out", - "value": "[Kernel] 1 98 \n" + "value": "[Kernel] 4 8 \n" }, { "type": "out", - "value": "[Kernel] 4 4 \n" + "value": "[Kernel] 4 9 \n" }, { "type": "out", - "value": "[Kernel] 4 5 \n" + "value": "[Kernel] 4 10 \n" }, { "type": "out", - "value": "[Kernel] 4 6 \n" + "value": "[Kernel] 4 11 \n" }, { "type": "out", - "value": "[Kernel] 4 7 \n" + "value": "[Kernel] 4 12 \n" }, { "type": "out", - "value": "[Kernel] 4 8 \n" + "value": "[Kernel] 4 13 \n" }, { "type": "out", - "value": "[Kernel] 4 9 \n" + "value": "[Kernel] 4 14 \n" }, { "type": "out", - "value": "[Kernel] 4 12 \n" + "value": "[Kernel] 4 0 \n" }, { "type": "out", - "value": "[Kernel] 4 18 \n" + "value": "[Kernel] 4 1 \n" }, { "type": "out", - "value": "[Kernel] 4 19 \n" + "value": "[Kernel] 4 3 \n" }, { "type": "out", - "value": "[Kernel] 4 20 \n" + "value": "[Kernel] 5 5 \n" }, { "type": "out", - "value": "[Kernel] 4 21 \n" + "value": "[Kernel] 5 6 \n" }, { "type": "out", - "value": "[Kernel] 4 24 \n" + "value": "[Kernel] 5 7 \n" }, { "type": "out", - "value": "[Kernel] 4 26 \n" + "value": "[Kernel] 5 8 \n" }, { "type": "out", - "value": "[Kernel] 4 29 \n" + "value": "[Kernel] 5 9 \n" }, { "type": "out", - "value": "[Kernel] 4 31 \n" + "value": "[Kernel] 5 10 \n" }, { "type": "out", - "value": "[Kernel] 4 32 \n" + "value": "[Kernel] 5 11 \n" }, { "type": "out", - "value": "[Kernel] 4 33 \n" + "value": "[Kernel] 5 12 \n" }, { "type": "out", - "value": "[Kernel] 4 36 \n" + "value": "[Kernel] 5 13 \n" }, { "type": "out", - "value": "[Kernel] 4 37 \n" + "value": "[Kernel] 5 14 \n" }, { "type": "out", - "value": "[Kernel] 4 39 \n" + "value": "[Kernel] 5 0 \n" }, { "type": "out", - "value": "[Kernel] 4 44 \n" + "value": "[Kernel] 5 1 \n" }, { "type": "out", - "value": "[Kernel] 4 47 \n" + "value": "[Kernel] 5 3 \n" }, { "type": "out", - "value": "[Kernel] 4 48 \n" + "value": "[Kernel] 6 6 \n" }, { "type": "out", - "value": "[Kernel] 4 49 \n" + "value": "[Kernel] 6 7 \n" }, { "type": "out", - "value": "[Kernel] 4 10 \n" + "value": "[Kernel] 6 8 \n" }, { "type": "out", - "value": "[Kernel] 4 61 \n" + "value": "[Kernel] 6 9 \n" }, { "type": "out", - "value": "[Kernel] 4 106 \n" + "value": "[Kernel] 6 10 \n" }, { "type": "out", - "value": "[Kernel] 4 13 \n" + "value": "[Kernel] 6 11 \n" }, { "type": "out", - "value": "[Kernel] 4 98 \n" + "value": "[Kernel] 6 12 \n" }, { "type": "out", - "value": "[Kernel] 5 5 \n" + "value": "[Kernel] 6 13 \n" }, { "type": "out", - "value": "[Kernel] 5 6 \n" + "value": "[Kernel] 6 14 \n" }, { "type": "out", - "value": "[Kernel] 5 7 \n" + "value": "[Kernel] 6 0 \n" }, { "type": "out", - "value": "[Kernel] 5 8 \n" + "value": "[Kernel] 6 1 \n" }, { "type": "out", - "value": "[Kernel] 5 9 \n" + "value": "[Kernel] 6 3 \n" }, { "type": "out", - "value": "[Kernel] 5 12 \n" + "value": "[Kernel] 7 7 \n" }, { "type": "out", - "value": "[Kernel] 5 18 \n" + "value": "[Kernel] 7 8 \n" }, { "type": "out", - "value": "[Kernel] 5 19 \n" + "value": "[Kernel] 7 9 \n" }, { "type": "out", - "value": "[Kernel] 5 20 \n" + "value": "[Kernel] 7 10 \n" }, { "type": "out", - "value": "[Kernel] 5 21 \n" + "value": "[Kernel] 7 11 \n" }, { "type": "out", - "value": "[Kernel] 5 24 \n" + "value": "[Kernel] 7 12 \n" }, { "type": "out", - "value": "[Kernel] 5 26 \n" + "value": "[Kernel] 7 13 \n" }, { "type": "out", - "value": "[Kernel] 5 29 \n" + "value": "[Kernel] 7 14 \n" }, { "type": "out", - "value": "[Kernel] 5 31 \n" + "value": "[Kernel] 7 0 \n" }, { "type": "out", - "value": "[Kernel] 5 32 \n" + "value": "[Kernel] 7 1 \n" }, { "type": "out", - "value": "[Kernel] 5 33 \n" + "value": "[Kernel] 7 3 \n" }, { "type": "out", - "value": "[Kernel] 5 36 \n" + "value": "[Kernel] 8 8 \n" }, { "type": "out", - "value": "[Kernel] 5 37 \n" + "value": "[Kernel] 8 9 \n" }, { "type": "out", - "value": "[Kernel] 5 39 \n" + "value": "[Kernel] 8 10 \n" }, { "type": "out", - "value": "[Kernel] 5 44 \n" + "value": "[Kernel] 8 11 \n" }, { "type": "out", - "value": "[Kernel] 5 47 \n" + "value": "[Kernel] 8 12 \n" }, { "type": "out", - "value": "[Kernel] 5 48 \n" + "value": "[Kernel] 8 13 \n" }, { "type": "out", - "value": "[Kernel] 5 49 \n" + "value": "[Kernel] 8 14 \n" }, { "type": "out", - "value": "[Kernel] 5 10 \n" + "value": "[Kernel] 8 0 \n" }, { "type": "out", - "value": "[Kernel] 5 61 \n" + "value": "[Kernel] 8 1 \n" }, { "type": "out", - "value": "[Kernel] 5 106 \n" + "value": "[Kernel] 8 3 \n" }, { "type": "out", - "value": "[Kernel] 5 13 \n" + "value": "[Kernel] 9 9 \n" }, { "type": "out", - "value": "[Kernel] 5 98 \n" + "value": "[Kernel] 9 10 \n" }, { "type": "out", - "value": "[Kernel] 6 6 \n" + "value": "[Kernel] 9 11 \n" }, { "type": "out", - "value": "[Kernel] 6 7 \n" + "value": "[Kernel] 9 12 \n" }, { "type": "out", - "value": "[Kernel] 6 8 \n" + "value": "[Kernel] 9 13 \n" }, { "type": "out", - "value": "[Kernel] 6 9 \n" + "value": "[Kernel] 9 14 \n" }, { "type": "out", - "value": "[Kernel] 6 12 \n" + "value": "[Kernel] 9 0 \n" }, { "type": "out", - "value": "[Kernel] 6 18 \n" + "value": "[Kernel] 9 1 \n" }, { "type": "out", - "value": "[Kernel] 6 19 \n" + "value": "[Kernel] 9 3 \n" }, { "type": "out", - "value": "[Kernel] 6 20 \n" + "value": "[Kernel] 10 10 \n" }, { "type": "out", - "value": "[Kernel] 6 21 \n" + "value": "[Kernel] 10 11 \n" }, { "type": "out", - "value": "[Kernel] 6 24 \n" + "value": "[Kernel] 10 12 \n" }, { "type": "out", - "value": "[Kernel] 6 26 \n" + "value": "[Kernel] 10 13 \n" }, { "type": "out", - "value": "[Kernel] 6 29 \n" + "value": "[Kernel] 10 14 \n" }, { "type": "out", - "value": "[Kernel] 6 31 \n" + "value": "[Kernel] 10 0 \n" }, { "type": "out", - "value": "[Kernel] 6 32 \n" + "value": "[Kernel] 10 1 \n" }, { "type": "out", - "value": "[Kernel] 6 33 \n" + "value": "[Kernel] 10 3 \n" }, { "type": "out", - "value": "[Kernel] 6 36 \n" + "value": "[Kernel] 11 11 \n" }, { "type": "out", - "value": "[Kernel] 6 37 \n" + "value": "[Kernel] 11 12 \n" }, { "type": "out", - "value": "[Kernel] 6 39 \n" + "value": "[Kernel] 11 13 \n" }, { "type": "out", - "value": "[Kernel] 6 44 \n" + "value": "[Kernel] 11 14 \n" }, { "type": "out", - "value": "[Kernel] 6 47 \n" + "value": "[Kernel] 11 0 \n" }, { "type": "out", - "value": "[Kernel] 6 48 \n" + "value": "[Kernel] 11 1 \n" }, { "type": "out", - "value": "[Kernel] 6 49 \n" + "value": "[Kernel] 11 3 \n" }, { "type": "out", - "value": "[Kernel] 6 10 \n" + "value": "[Kernel] 12 12 \n" }, { "type": "out", - "value": "[Kernel] 6 61 \n" + "value": "[Kernel] 12 13 \n" }, { "type": "out", - "value": "[Kernel] 6 106 \n" + "value": "[Kernel] 12 14 \n" }, { "type": "out", - "value": "[Kernel] 6 13 \n" + "value": "[Kernel] 12 0 \n" }, { "type": "out", - "value": "[Kernel] 6 98 \n" + "value": "[Kernel] 12 1 \n" }, { "type": "out", - "value": "[Kernel] 7 7 \n" + "value": "[Kernel] 12 3 \n" }, { "type": "out", - "value": "[Kernel] 7 8 \n" + "value": "[Kernel] 13 13 \n" }, { "type": "out", - "value": "[Kernel] 7 9 \n" + "value": "[Kernel] 13 14 \n" }, { "type": "out", - "value": "[Kernel] 7 12 \n" + "value": "[Kernel] 13 0 \n" }, { "type": "out", - "value": "[Kernel] 7 18 \n" + "value": "[Kernel] 13 1 \n" }, { "type": "out", - "value": "[Kernel] 7 19 \n" + "value": "[Kernel] 13 3 \n" }, { "type": "out", - "value": "[Kernel] 7 20 \n" + "value": "[Kernel] 14 14 \n" }, { "type": "out", - "value": "[Kernel] 7 21 \n" + "value": "[Kernel] 14 0 \n" }, { "type": "out", - "value": "[Kernel] 7 24 \n" + "value": "[Kernel] 14 1 \n" }, { "type": "out", - "value": "[Kernel] 7 26 \n" + "value": "[Kernel] 14 3 \n" }, { "type": "out", - "value": "[Kernel] 7 29 \n" + "value": "[Kernel] 0 0 \n" }, { "type": "out", - "value": "[Kernel] 7 31 \n" + "value": "[Kernel] 0 1 \n" }, { "type": "out", - "value": "[Kernel] 7 32 \n" + "value": "[Kernel] 0 3 \n" }, { "type": "out", - "value": "[Kernel] 7 33 \n" + "value": "[Kernel] 1 1 \n" }, { "type": "out", - "value": "[Kernel] 7 36 \n" + "value": "[Kernel] 1 3 \n" }, { "type": "out", - "value": "[Kernel] 7 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 7 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 7 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 7 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 7 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 7 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 7 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 7 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 7 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 7 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 7 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 8 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 9 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 12 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 18 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 19 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 20 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 21 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 24 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 26 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 29 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 31 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 32 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 33 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 8 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 9 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 12 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 18 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 19 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 20 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 21 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 24 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 26 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 29 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 31 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 32 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 33 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 9 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 12 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 18 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 19 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 20 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 21 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 24 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 26 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 29 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 31 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 32 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 33 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 12 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 18 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 19 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 20 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 21 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 24 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 26 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 29 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 31 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 32 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 33 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 18 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 19 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 20 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 21 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 24 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 26 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 29 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 31 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 32 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 33 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 19 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 20 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 21 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 24 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 26 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 29 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 31 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 32 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 33 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 20 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 21 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 24 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 26 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 29 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 31 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 32 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 33 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 21 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 24 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 26 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 29 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 31 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 32 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 33 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 24 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 26 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 29 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 31 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 32 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 33 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 26 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 29 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 31 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 32 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 33 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 29 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 31 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 32 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 33 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 31 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 32 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 33 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 32 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 33 33 \n" - }, - { - "type": "out", - "value": "[Kernel] 33 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 33 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 33 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 33 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 33 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 33 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 33 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 33 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 33 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 33 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 33 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 33 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 36 36 \n" - }, - { - "type": "out", - "value": "[Kernel] 36 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 36 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 36 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 36 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 36 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 36 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 36 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 36 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 36 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 36 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 36 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 37 37 \n" - }, - { - "type": "out", - "value": "[Kernel] 37 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 37 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 37 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 37 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 37 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 37 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 37 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 37 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 37 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 37 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 39 39 \n" - }, - { - "type": "out", - "value": "[Kernel] 39 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 39 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 39 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 39 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 39 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 39 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 39 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 39 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 39 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 44 44 \n" - }, - { - "type": "out", - "value": "[Kernel] 44 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 44 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 44 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 44 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 44 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 44 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 44 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 44 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 47 47 \n" - }, - { - "type": "out", - "value": "[Kernel] 47 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 47 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 47 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 47 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 47 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 47 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 47 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 48 48 \n" - }, - { - "type": "out", - "value": "[Kernel] 48 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 48 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 48 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 48 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 48 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 48 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 49 49 \n" - }, - { - "type": "out", - "value": "[Kernel] 49 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 49 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 49 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 49 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 49 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 10 10 \n" - }, - { - "type": "out", - "value": "[Kernel] 10 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 10 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 10 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 10 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 61 61 \n" - }, - { - "type": "out", - "value": "[Kernel] 61 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 61 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 61 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 106 106 \n" - }, - { - "type": "out", - "value": "[Kernel] 106 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 106 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 13 13 \n" - }, - { - "type": "out", - "value": "[Kernel] 13 98 \n" - }, - { - "type": "out", - "value": "[Kernel] 98 98 \n" + "value": "[Kernel] 3 3 \n" } ] - } + }, + "hidden": true + }, + "evaluatorReader": true, + "lineCount": 50, + "tags": "cell_soap_run", + "isError": true + }, + { + "id": "codelnUBqG", + "type": "code", + "evaluator": "IPython", + "input": { + "body": [ + "#!/usr/bin/python", + "# -*- coding: utf-8 -*-", + "from __future__ import absolute_import", + "", + "__author__ = \"Angelo Ziletti\"", + "__copyright__ = \"Copyright 2016, The NOMAD Project\"", + "__maintainer__ = \"Angelo Ziletti\"", + "__email__ = \"ziletti@fhi-berlin.mpg.de\"", + "__date__ = \"21/10/16\"", + "", + "import os, sys", + "import numpy as np", + "import itertools", + "import pandas as pd", + "", + "from jinja2 import Template", + "from bokeh.embed import components", + "from sklearn import preprocessing", + "from bokeh.plotting import figure", + "from bokeh.models import ColumnDataSource, HoverTool, CustomJS, TapTool, Rect", + "from six.moves import zip", + "from bokeh.models import Circle", + "from nomad_sim.patch_names_rs_zb import rename_material", + "from random import shuffle", + "from decimal import Decimal", + "from nomad_sim.utils_crystals import format_e", + "from nomad_sim.utils_crystals import convert_energy_substance", + "from scipy.spatial import ConvexHull", + "import ase", + "from PIL import Image", + "import copy", + "", + "import warnings ", + "from pint import UnitRegistry", + "# disable DeprecationWarning for scikit learn", + "warnings.filterwarnings('ignore', category=DeprecationWarning)", + "# disable warnings from pint", + "", + "import nomadcore.unit_conversion.unit_conversion as uc", + "import nomadcore.parser_backend as parser", + "", + "from nomad_sim.config import configs", + "", + "ureg = UnitRegistry(os.path.normpath(configs[\"ureg_file\"]))", + "", + "css_file_path = configs[\"css_file_viewer\"]", + "", + "__metainfopath__ = configs[\"meta_info_file\"]", + "", + "", + "class Viewer_local(object):", + " \"\"\" Generate the NOMAD viewer from a loookup file. ", + " ", + " By default, the lookup file needs to be called 'lookup.dat' and needs to be in the", + " `tmp_folder`. This file is a space separated file where each row correspond to a ", + " crystal structure with same parameters for the visualization. \\n", + " Such file needs to have the following columns: \\n", + " json | step_number | X | Y | target | label |chemical_formula | \\n", + " ", + " where", + "", + " json: string", + " Absolute path to the json file from the NOMAD Archive that we wish ", + " to read structures from. It can contain multiple frames.", + " ", + " step_number: int", + " For each json file, the frame number (relative to that ", + " json file) of the structure we want to read.", + " If only one frame is present, step_number=0", + " ", + " X: float", + " x position on the NOMAD viewer clustering plot of the structure of this row.", + "", + " Y: float", + " y position on the NOMAD viewer clustering plot of the structure of this row.", + " ", + " target: float, optional", + " Value of the target property that it is going to be used to create the ", + " color palette in the NOMAD viewer.", + "", + " label: float, optional", + " For classification, specifies the class associated with the sample (row).", + " At the moment, it is not used by the NOMAD Viewer.", + " ", + " chemical_formula: string, optional", + " Chemical formula of the material corresponding to the sample (row)", + " At the moment, it is not used by the NOMAD Viewer", + " ", + " ", + " ", + " Attributes", + " ----------", + " ", + " title : None or string", + " Title of the viewer.", + " ", + " width : float, default 600", + " Width in pixels (?) of the webpage containing the NOMAD viewer ", + " ", + " height : float, default 700", + " Height in pixels (?) of the webpage containing the NOMAD viewer ", + " ", + " Notes", + " -------", + " Examples of usage of the Viewer can be found at the NOMAD Analytics Toolkit.", + " ", + " Supervised learning", + " ", + " - https://analytics-toolkit.nomad-coe.eu/beaker/#/open?uri=%2Fhome%2Fbeaker%2Ftutorials%2Fsis_cscl.bkr", + " ", + " - http://analytics-toolkit.nomad-coe.eu/tutorial-LASSO_L0 (pretty much the same as the first, data-wise, while the algorithm is different)", + " ", + " Unsupervised learning", + " ", + " - https://analytics-toolkit.nomad-coe.eu/beaker/#/open?uri=%2Fhome%2Fbeaker%2Ftutorials%2FEmbedding.bkr", + " ", + " - https://analytics-toolkit.nomad-coe.eu/beaker/#/open?uri=%2Fhome%2Fbeaker%2Ftutorials%2FSOAP_similarity.bkr", + "", + "", + " \"\"\" ", + " ", + "", + " def __init__(self, title=None, name=None, width=600, height=700):", + "", + " if name is None:", + " name = 'viewer'", + "", + " self.title = title", + " self.width = width", + " self.height = height", + " self.name = name ", + "", + "", + " def plot(self, archive=None, colors=None, frames=None, frame_list=None, clustering_x_list=None, ", + " clustering_y_list=None, ", + " is_classification=None,", + " target_list=None, target_pred_list=None, target_unit=None, ", + " target_name=None, target_class_names=None,", + " energy_unit=None,", + " descriptor=None, xray_img_list=None,", + " legend_title=None, ", + " x_axis_label=None, y_axis_label=None, plot_title=None,", + " clustering_point_size=None, map_point_size=None, html_folder=None, tmp_folder=None,", + " plot_convex_hull=None, chemical_formula_list=None, crystal_structure_list=None):", + " ", + " \"\"\" Plot the NOMAD Viewer using a given list of structures", + " ", + " Parameters ", + " ----------", + " archive : string, list of `NOMADStructure` objects ", + " List of structures from the class `NOMADStructure`. Each instance of ", + " the class `NOMADStructure` can contain multiple frames ", + " ", + " colors : string, list ", + " Color palette used for the points in the plot. ", + " For regression: hardcoded to 5 values. ", + " Each color represents a quintile. ", + " We use percentile to have a scale which is robust to outliers.", + " For classification: hardcoded to 37 values. ", + " Each color is associated to a unique class value.", + "", + " frames : string, optional, {'all', 'first', 'last', 'list'}", + " Define which frames should be shown.\\n", + " 'all': show all the frames in the `NOMADstructure` \\n", + " 'first': show only 1st frame \\n", + " 'last': show only last frame \\n", + " 'list': show user-specified list of frames. ", + " .. todo:: Check compatibility with multiple frames.", + "", + "", + " frame_list : int, list (or list of lists)", + " Specifies for each `NOMADstructure` the frames to load.", + " It is a list if only one frame for each json file needs to be loaded,", + " while it is a list of lists otherwise. Negative indeces are supported.", + "", + " clustering_x_list : float, list or list of list", + " For each frame in a given `NOMADstructure`, it is the x_coord of the", + " clustering plot of the NOMAD Viewer.", + " If multiple frames need to be loaded by `NOMADstructure`, it is a list of lists.", + " ", + " clustering_y_list : float, list or list of list", + " For each frame in a given `NOMADstructure`, it is the y_coord of the", + " clustering plot of the NOMAD Viewer.", + " If multiple frames need to be loaded by `NOMADstructure`, it is a list of lists.", + " ", + " target_list : float, list (or list of lists), optional ", + " Used to define the colors of the points in the plot.", + " If not specified, the total energy (`energy_total`) is used as color code.", + " ", + " target_pred_list : float, list (or list of lists), optional ", + " Prediction of the underlying model on the target value. ", + " To be compared with target_list.", + " ", + " target_class_names : float or string, list, optional", + " List of classes for the case of classification.", + "", + " x_axis_label : float", + " Label of the x-axis.", + " ", + " y_axis_label : ", + " Label of the y-axis.", + " ", + " clustering_point_size : float, default 12", + " Size of the points (in pt?) in the clustering plot.", + "", + " map_point_size : float, default `clustering_point_size`*0.75", + " Size of the points (in pt?) in the map plot. ", + " ", + " html_folder : string, default `tmp_folder`", + " Path to the folder where the generated html page is saved.", + " ", + " tmp_folder : string, default './tmp/'", + " Path to the temporary folder where the images, the input files, ", + " the descriptor files, and the similarity matrix are written.", + " ", + " plot_convex_hull : bool, default False", + " calculate and plot convex hull for each color partition (class in case of classificication)", + " ", + " ", + " Returns", + " -------", + " ", + " file_html_link : string", + " html string that in the Beaker notebook generates the html link to the ", + " viewer (name.html). For example,", + " <a target=_blank href='/path/to/file/viewer.html'>Click here to open the Viewer</a>", + "", + " .. todo:: Add shaw support. ", + " ", + " file_html_name : string", + " Absolute path to where the NOMAD Viewer (html page) is generated. ", + " ", + "", + " \"\"\"", + "", + " energy_list = []", + " png_file_list =[]", + " geo_file_list =[]", + " name_list = [] ", + "", + " if chemical_formula_list is None:", + " chemical_formula_list = []", + " ", + " if tmp_folder is None:", + " tmp_folder = './tmp' ", + " ", + " if html_folder is None:", + " html_folder = tmp_folder", + "", + " if target_list is None:", + " target_list = energy_list", + "", + " if target_unit is not None:", + " target_unit_legend = target_unit", + " else:", + " target_unit = 'arb. units'", + " target_unit_legend = ''", + " ", + " if target_name is None:", + " target_name = 'Target'", + " ", + " if legend_title is None:", + " legend_title = ''", + " ", + " if frames is None:", + " frames = 'all'", + "", + " if clustering_point_size is None:", + " clustering_point_size = 12", + "", + " if map_point_size is None:", + " map_point_size = clustering_point_size*0.75", + " ", + " if plot_title is None:", + " plot_title = 'Structural-similarity plot'", + " ", + " if (x_axis_label is not None) and (x_axis_label is not None):", + " show_axis = True", + " else:", + " show_axis = False", + "", + " ", + " # read output log and substitute html end of line characters", + " out_log = os.path.join(tmp_folder, 'output.log') ", + " outf = open(out_log, 'r') ", + " outf_string = str(outf.read()).replace(\"\\n\", \"<br>\") ", + "", + " ", + " ", + " if archive is not None:", + " # extract the structure from the archive (list of structures)", + " for archive_id, archive_item in enumerate(archive):", + " structure = archive_item", + " # obtain number of frames", + " N_runs = structure.gIndexRunMax+1", + " N_frames = structure.gIndexDescMax+1", + " ", + " # make sure each element is a list, to have each element iterable for later use", + " if clustering_x_list is not None and clustering_y_list is not None:", + " if isinstance(clustering_x_list[archive_id], list)==False:", + " clustering_x_list[archive_id] = [clustering_x_list[archive_id]]", + "", + " if isinstance(clustering_y_list[archive_id], list)==False:", + " clustering_y_list[archive_id] = [clustering_y_list[archive_id]]", + "", + " if target_list is not None:", + " if isinstance(target_list[archive_id], list)==False:", + " target_list[archive_id] = [target_list[archive_id]] ", + " ", + " if target_pred_list is not None:", + " if isinstance(target_pred_list[archive_id], list)==False:", + " target_pred_list[archive_id] = [target_pred_list[archive_id]] ", + "", + " # read-in attributes from structure", + " # structure[i,j] returns energy, png_file, geo_file, name in position i,j in type Structure ", + " # see the method __getitem__ in Class NOMADStructure ", + " # in file \"nomad_structures.py\" from more details", + " if frames=='all':", + " structure_attributes = [structure[i,j] for i in range(N_runs) for j in range(N_frames)]", + " elif frames=='first':", + " structure_attributes = [structure[i,0] for i in range(N_runs)]", + " elif frames=='first-last':", + " # if only one structure first and last structures are the same - show only one", + " if (N_frames-1) == 0:", + " structure_attributes = [structure[i,0] for i in range(N_runs)] ", + " else:", + " structure_attributes = [structure[i,0] for i in range(N_runs)] + [structure[i,N_frames-1] for i in range(N_runs)]", + " elif frames=='last':", + " structure_attributes = [structure[i, N_frames-1] for i in range(N_runs)]", + " elif frames=='list':", + " # extract frame_list if present", + " if frame_list is not None:", + " # check if frame_list is a list or list of lists", + " if any(isinstance(el, list) for el in frame_list):", + " # frame is a list of lists -> extract the list referring to each archive", + " frame_slice = frame_list[archive_id]", + " else:", + " # frame is a list -> the frame_slice is the list itself", + " frame_slice = frame_list", + "", + " # check for negative values of the list", + " try:", + " frame_slice = [x+structure.gIndexDescMax if x < 0 else x for x in frame_slice]", + " except:", + " if frame_slice < 0:", + " frame_slice = frame_slice+structure.gIndexDescMax ", + " ", + " # check if index is not out-of-bound", + " if isinstance(frame_slice, list):", + " if all((i<= structure.gIndexDescMax and i>=0) for i in frame_slice):", + " structure_attributes = [structure[i, frame] for i in range(N_runs) for frame in frame_slice]", + " else:", + " logger.error(\"Frame_list contains at least one element out-of-bound. \" + ", + " \"For that sequence, the frame number needs to be between {0} and {1}. Maybe you have switched the order between the JSON files and the frame_list?\"", + " .format(-structure.gIndexDescMax, structure.gIndexDescMax))", + " elif isinstance(frame_slice, int):", + " if frame_slice<=structure.gIndexDescMax and frame_slice>=0:", + " structure_attributes = [structure[i, frame_slice] for i in range(N_runs)]", + " else:", + " logger.error(\"Frame_list is an integer out-of-bound. For that sequence, \\nthe frame number needs to be between {0} and {1}.\"", + " .format(-structure.gIndexDescMax, structure.gIndexDescMax))", + " ", + " else:", + " logger.error(\"Frame_slice is not valid. Please check the frame_list provided\")", + "", + " else:", + " logger.error(\"Please specify a valid list of frames to be shown.\")", + "", + " else:", + " logger.error(\"Please specify a valid option for frames. Options available: 'all', 'first', 'first-last', 'last', 'list'.\")", + "", + " # unpack the tuple structure_attributes", + " if descriptor is not None:", + " if descriptor.name == 'XrayDiffraction':", + " pass", + " ", + " # energy_total is always in J", + " energy, png_file, geo_file, chemical_formula, name = zip(*structure_attributes)", + " ", + " # create a list of list appending all the frames in the structures present in the archive", + " energy_list.append(energy)", + " png_file_list.append(png_file)", + " geo_file_list.append(geo_file)", + " chemical_formula_list.append(chemical_formula)", + " name_list.append(name)", + " # flatten the lists (since they could be list of lists)", + "", + "", + " energy = list(itertools.chain(*energy_list))", + " geo_file = list(itertools.chain(*geo_file_list))", + " png_file = list(itertools.chain(*png_file_list))", + " chemical_formula = list(itertools.chain(*chemical_formula_list))", + " name = list(itertools.chain(*name_list))", + "", + " # convert energy to energy_unit", + " energy = convert_energy_substance(unit='J', value=energy,", + " ureg=ureg, ", + " energy_unit=energy_unit, ", + " length_unit=None)", + "", + " ", + " # HARD-CODED for binary dataset", + " chemical_formula = rename_material(chemical_formula)", + "", + " else: ", + " #e.g. if archive is None; needed for metal-nonmetal classification tutorial with experimental data", + " # this part is somehow hard coded ", + " n_sample = len(clustering_x_list)", + " for archive_id in range(n_sample):", + " # make sure each element is a list, to have each element iterable for later use", + " if clustering_x_list is not None and clustering_y_list is not None:", + " if isinstance(clustering_x_list[archive_id], list)==False:", + " clustering_x_list[archive_id] = [clustering_x_list[archive_id]]", + "", + " if isinstance(clustering_y_list[archive_id], list)==False:", + " clustering_y_list[archive_id] = [clustering_y_list[archive_id]]", + "", + " if target_list is not None:", + " if isinstance(target_list[archive_id], list)==False:", + " target_list[archive_id] = [target_list[archive_id]] ", + " ", + " if target_pred_list is not None:", + " if isinstance(target_pred_list[archive_id], list)==False:", + " target_pred_list[archive_id] = [target_pred_list[archive_id]] ", + "", + " image = Image.new('RGB', (20,20), (255, 255, 255))", + " image_filename = os.path.join(tmp_folder, 'empty.png')", + " image.save(image_filename,\"PNG\")", + " ", + " energy = [\"\"]*n_sample", + " geo_file = [\"\"]*n_sample", + " png_file = [\"/user/tmp/empty.png\"]*n_sample", + " if not chemical_formula_list:", + " chemical_formula = [\"\"]*n_sample", + " else:", + " chemical_formula = chemical_formula_list", + "", + " try:", + " target_names_list = [target_class_names[t[0]] for t in target_list]", + " except:", + " target_names_list = target_list", + " name = [\"\"]*n_sample", + " ", + " ", + "", + "", + " if clustering_x_list is not None and clustering_y_list is not None:", + " x = list(itertools.chain(*clustering_x_list))", + " y = list(itertools.chain(*clustering_y_list))", + " else:", + " x = None", + " y = None", + " ", + " if target_list is not None:", + " if isinstance(target_list, list)==True:", + " target = list(itertools.chain(*target_list))", + " else:", + " target = target_list", + "", + " if target_pred_list is not None:", + " if isinstance(target_pred_list, list)==True:", + " target_pred = list(itertools.chain(*target_pred_list))", + " else:", + " target_pred = target_pred_list", + "", + " if target_pred_list is not None:", + " if target_list is not None:", + " if not is_classification:", + " abs_error = [abs(target_i - target_pred_i) for target_i, target_pred_i in zip(target, target_pred)]", + " abs_error_hover = [format_e(item) for item in abs_error] ", + "", + " #if xray_img_list is not None:", + " # xray_imgs = list(itertools.chain(*xray_img_list)) ", + " ", + " ", + " # set the total number of frames in the archive", + " if len(energy) == len(geo_file) == len(png_file) == len(chemical_formula) == len(name):", + " N_arch = len(energy)", + " else:", + " logger.error(\"Inconsistent list lengths in atomic structures.\")", + "", + " if (x is None or y is None):", + " logger.warning(\"Please provide x and y clustering coordinates for the plot.\\nGenerating random coordinates.\")", + " # create random x and y (later they will be read from an actual calculation)", + " x = np.random.rand(N_arch)", + " y = np.random.rand(N_arch)", + "", + " # define a predefinite JSmol window", + " whichJSmol = np.zeros(N_arch)", + " ", + " # define energy for hover tools for correct format visualization", + " # (truncation to a given number of significative digits)", + "# energy_hover = np.around(energy, decimals=4)", + " if archive is not None:", + " energy_hover = [format_e(item) for item in energy] ", + " else: ", + " energy_hover = copy.deepcopy(energy)", + "", + " target_hover = [format_e(item) for item in target] ", + "", + " ", + " if target_pred_list is not None:", + " # check if it is a tuple (as given for example by cnn model) ", + " try: ", + " target_pred_hover = [format_e(item) for item in target_pred]", + "# target_pred_hover = [np.around(item, decimals=3) for item in target_pred]", + " except:", + " target_pred_hover = target_pred", + "# target_pred_hover = np.around(target_pred_hover, decimals=3)", + "", + " # manipulate the target to use it in the color palette definition", + " # reshape for use in the MinMaxScaler (single feature convention)", + " target = np.asarray(target)", + " target = target.reshape(-1,1) ", + "", + " ", + " # Quantile-based discretization function", + " # Discretize variable into equal-sized buckets", + " # to have a color scale which is robust to outliers", + " df_target = pd.DataFrame(target, columns=['target'])", + " df_energy = pd.DataFrame(energy, columns=['energy'])", + "", + " if is_classification:", + " # works only if target is either 0 or 1 or 2 or 3 ", + " # (not sure if that is true)", + " ", + " palette = ['#000000', '#0072B2', '#009E73', '#E69F00', '#CC79A7',", + " '#f44336', '#e91e63', '#9c27b0', '#673ab7',", + " '#3f51b5', '#2196f3', '#03a9f4', '#00bcd4',", + " '#009688', '#4caf50', '#8bc34a', '#cddc39',", + " '#ffeb3b', '#ffc107', '#ff9800', '#ff5722',", + " '#795548', '#9e9e9e', '#607d8b',", + " # darker colors", + " '#b71c1c', '#880e4f', '#4a148c', '#311b92',", + " '#1a237e', '#0d47a1', '#01579b', '#006064',", + " '#004d40', '#1b5e20', '#33691e', '#827717',", + " '#f57f17', '#ff6f00', '#e65100', '#bf360c',", + " '#3e2723', '#212121', '#263238']", + " ", + " # get number of unique target values", + " n_classes = len(list(set(df_target.values.flatten().tolist())))", + " colors = [palette[int(target_value)] for target_value in df_target.values.flatten().tolist()]", + "", + " else: ", + " # one color for each bin ", + " # not color blind safe", + " #palette = ['#000099','#004d99','#009900','#994d00', '#990000']", + "", + " # color-blind safe (http://mkweb.bcgsc.ca/colorblind/)", + " palette = ['#000000', '#0072B2', '#009E73', '#E69F00', '#CC79A7']", + " # try to divide in 5 quantiles, if it does not work divide in less", + " for i in range(5, 0,-1):", + " try:", + " target_bin = (pd.qcut(df_target['target'], i, labels=False)).values", + " logger.info('The color in the plot is given by the target value.')", + " bins = list((pd.qcut(df_target['target'], i, labels=False, retbins=True))[1])", + "# bins = np.around(bins, decimals=3)", + " bins = [format_e(item) for item in bins] ", + " colors = [palette[idx] for idx in target_bin ]", + " n_quantiles = i", + " break", + " except:", + " pass", + " ", + " # initialize the zoom window to zero", + " x_zoom = np.zeros(N_arch)", + " y_zoom = np.zeros(N_arch)", + " width_zoom = np.zeros(N_arch)", + " height_zoom = np.zeros(N_arch)", + "", + " # put the necessary info in a ColumnDataSource to use in the plot", + " # ColumnDataSource is used by Bokeh", + " # (the library for the interactive plot)", + " if archive is None:", + " source = ColumnDataSource(", + " data=dict(", + " x = x,", + " y = y,", + " jmol_file = [],", + " name = name,", + " chemical_formula = chemical_formula,", + " crystal_structure_list = crystal_structure_list,", + " target_names_list=target_names_list,", + " energy = energy_hover, ", + " target = target_hover,", + " imgs = png_file, ", + " geo_file = geo_file, ", + " colors = colors,", + " whichJSmol = whichJSmol ", + " )", + " ) ", + " elif (target_pred_list is not None) and (xray_img_list is not None):", + " source = ColumnDataSource(", + " data=dict(", + " x = x,", + " y = y,", + " jmol_file = [],", + " name = name,", + " chemical_formula = chemical_formula,", + " energy = energy_hover, ", + " target = target_hover,", + " target_pred = target_pred_hover,", + " imgs = png_file, ", + " geo_file = geo_file,", + " xray_imgs = xray_img_list,", + " colors = colors,", + " whichJSmol = whichJSmol ", + " )", + " )", + " elif target_pred_list is not None:", + " source = ColumnDataSource(", + " data=dict(", + " x = x,", + " y = y,", + " jmol_file = [],", + " name = name,", + " chemical_formula = chemical_formula,", + " energy = energy_hover, ", + " target = target_hover,", + " target_pred = target_pred_hover,", + " abs_error = abs_error_hover,", + " imgs = png_file, ", + " geo_file = geo_file,", + " colors = colors,", + " whichJSmol = whichJSmol ", + " )", + " )", + " ", + " else:", + " source = ColumnDataSource(", + " data=dict(", + " x = x,", + " y = y,", + " jmol_file = [],", + " name = name,", + " chemical_formula = chemical_formula,", + " energy = energy_hover, ", + " target = target_hover,", + " imgs = png_file, ", + " geo_file = geo_file, ", + " colors = colors,", + " whichJSmol = whichJSmol ", + " )", + " ) ", + "", + " # ColumnDataSource to use in the 'Map' plot", + " # (we do not use the same because otherwise the glyph selection ", + " # properties are passed automatically", + " # and we loose the colors in the Map plot when a point is selected)", + " sourceMap = ColumnDataSource(", + " data=dict(", + " x=x,", + " y=y,", + " colors=colors,", + " x_zoom = x_zoom,", + " y_zoom = y_zoom,", + " width_zoom = width_zoom,", + " height_zoom = height_zoom", + " )", + " )", + "", + " # personalized Hover tool", + " # different according to the task (supervised learning, unsupervised,", + " # showing decriptor image, etc...)", + " if archive is None:", + " hover = HoverTool(", + " tooltips=\"\"\"", + " <table class=\"nomad-tooltip\">", + " <tr>", + " <th class=\"nomad-header-tooltip\">System description ", + " <span style=\"font-size: 10px; color: #cccccc;\">[$index]</span>", + " </th>", + " </tr>", + " <tr>", + " <td>", + " <span class=\"small-text-tooltip\"\">Chemical formula: </span>", + " <span class=\"small-text-tooltip\"\">@chemical_formula</span>", + " </td>", + " </tr>", + " <tr>", + " <td>", + " <span class=\"small-text-tooltip\"\">Crystal structure type: </span>", + " <span class=\"small-text-tooltip\"\">@crystal_structure_list</span>", + " </td>", + " </tr>", + "", + " <tr>", + " <td>", + " <span class=\"small-text-tooltip\"\">Target: </span>", + " <span class=\"small-text-tooltip\"\">@target_names_list</span>", + " </td>", + " </tr>", + " ", + " <tr>", + " <th class=\"nomad-header-tooltip\"> More info </th>", + " </tr>", + " <tr>", + " <td>", + " <span class=\"small-text-tooltip\">(x, y) = </span>", + " <span class=\"small-text-tooltip\">(@x, @y) </span>", + " </td>", + " </tr>", + "", + " </table>", + " ", + " \"\"\"", + " ) ", + "", + "", + " elif (target_pred_list is not None) and (xray_img_list is not None):", + " hover = HoverTool(", + " tooltips=\"\"\"", + " <div>", + " <div>", + " <img", + " src=\"@imgs\" height=\"150\" alt=\"@imgs\" width=\"150\"", + " style=\"float: center; margin: 15px 15px 15px 15px;\"", + " border=\"1\"", + " ></img>", + " <img", + " src=\"@xray_imgs\" height=\"150\" alt=\"@xray_imgs\" width=\"150\"", + " style=\"float: center; margin: 15px 15px 15px 15px;\"", + " border=\"1\"", + " ></img>", + " </div>", + " <div>", + " <span style=\"font-size: 15px; font-weight: bold;\">@chemical_formula</span>", + " <span style=\"font-size: 15px; color: #666;\">[$index]</span>", + " </div>", + " <div>", + " <span style=\"font-size: 15px; color: black;\">@name </span>", + " </div> ", + " ", + " <div>", + " <span style=\"font-size: 15px; color: black;\">(x, y) = </span>", + " <span style=\"font-size: 15px; color: black;\">(@x, @y) </span>", + " </div> ", + "", + " <div>", + " <span style=\"font-size: 15px; color: black;\"> Ref. \"\"\"+str(target_name)+\"\"\" = </span>", + " <span style=\"font-size: 15px; color: black;\">@target \"\"\"+ str(target_unit)+\"\"\" </span>", + " </div>", + " <div>", + " <span style=\"font-size: 15px; color: black;\"> Pred. \"\"\"+str(target_name)+\"\"\" = </span>", + " <span style=\"font-size: 15px; color: black;\">@target_pred \"\"\"+ str(target_unit)+\"\"\" </span>", + " </div> ", + " </div>", + " \"\"\"", + " )", + "", + "", + " elif target_pred_list is not None:", + " hover = HoverTool(", + " tooltips=\"\"\"", + " <table class=\"nomad-tooltip\">", + " <tr>", + " <th class=\"nomad-header-tooltip\">System description ", + " <span style=\"font-size: 10px; color: #cccccc;\">[$index]</span>", + " </th>", + " </tr>", + " <tr>", + " <td>", + " <span class=\"small-text-tooltip\"\">Chemical formula: </span>", + " <span class=\"small-text-tooltip\"\">@chemical_formula</span>", + " </td>", + " </tr>", + " <tr>", + " <td align=\"center\">", + " <p class=\"small-text-tooltip\">Atomic structure preview </p> ", + "", + " <img", + " src=\"@imgs\" height=\"150\" alt=\"@imgs\" width=\"150\"", + " style=\"float: center; margin: 15px 15px 15px 15px;\"", + " border=\"1\"", + " ></img>", + " </td>", + " </tr>", + " <tr>", + " <td align=\"center\">", + " <p class=\"small-text-tooltip\"> (click to load an interactive 3D view below)</p> ", + " </td>", + " </tr>", + "", + "", + "", + " ", + " <tr>", + " <th class=\"nomad-header-tooltip\">Predictions on this system </th>", + " </tr>", + " ", + " <tr>", + " <td>", + " <span class=\"small-text-tooltip\">Ref. \"\"\"+str(target_name)+\"\"\" = </span>", + " <span class=\"small-text-tooltip\">@target \"\"\"+ str(target_unit)+\"\"\" </span>", + " </td>", + " </tr> ", + " <tr>", + " <td>", + " <span class=\"small-text-tooltip\"> Pred. \"\"\"+str(target_name)+\"\"\" = </span>", + " <span class=\"small-text-tooltip\">@target_pred \"\"\"+ str(target_unit)+\"\"\" </span>", + " </td>", + " </tr>", + " <tr>", + " <td>", + " <span class=\"small-text-tooltip\"> Abs. error = </span>", + " <span class=\"small-text-tooltip-error\">@abs_error \"\"\"+ str(target_unit)+\"\"\" </span>", + " </td>", + " </tr>", + " <tr>", + " <th class=\"nomad-header-tooltip\"> More info </th>", + " </tr>", + " <tr>", + " <td>", + " <span class=\"small-text-tooltip\">(x, y) = </span>", + " <span class=\"small-text-tooltip\">(@x, @y) </span>", + " </td>", + " </tr>", + "", + " </table>", + " ", + " \"\"\"", + " )", + " ", + " else:", + " hover = HoverTool(", + " tooltips=\"\"\"", + " <table class=\"nomad-tooltip\">", + " <tr>", + " <th class=\"nomad-header-tooltip\">System description ", + " <span style=\"font-size: 10px; color: #cccccc;\">[$index]</span>", + " </th>", + " </tr>", + " <tr>", + " <td>", + " <span class=\"small-text-tooltip\"\">Chemical formula: </span>", + " <span class=\"small-text-tooltip\"\">@chemical_formula</span>", + " </td>", + " </tr>", + " <tr>", + " <td align=\"center\">", + " <p class=\"small-text-tooltip\">Atomic structure preview </p> ", + "", + " <img", + " src=\"@imgs\" height=\"150\" alt=\"@imgs\" width=\"150\"", + " style=\"float: center; margin: 15px 15px 15px 15px;\"", + " border=\"1\"", + " ></img>", + " </td>", + " </tr>", + " <tr>", + " <td align=\"center\">", + " <p class=\"small-text-tooltip\"> (click to load an interactive 3D view below)</p> ", + " </td>", + " </tr>", + "", + " ", + " <tr>", + " <th class=\"nomad-header-tooltip\"> More info </th>", + " </tr>", + " <tr>", + " <td>", + " <span class=\"small-text-tooltip\">(x, y) = </span>", + " <span class=\"small-text-tooltip\">(@x, @y) </span>", + " </td>", + " </tr>", + "", + " </table>", + " ", + " \"\"\"", + " ) ", + "", + " # Create a set of tools to use in the Bokeh plot", + " tools_1=hover,\"wheel_zoom,box_zoom,pan,reset,tap,previewsave,resize\"", + "", + " # create main clustering plot", + " p1 = figure(title=plot_title, plot_width=600, plot_height=600, tools=tools_1, background_fill_color = '#f2f2f2',", + " outline_line_width = 0.01, toolbar_location=\"left\")", + " ", + " p1.title_text_font =\"Trebuchet MS\"; p1.title_text_font_size = '30pt'; p1.title_text_color = '#20335d'", + " p1.title_text_font_style = 'bold'; p1.title_text_baseline = 'bottom'", + " # hide logo", + " #p1.logo = None ", + " if not show_axis:", + " p1.axis.visible = None; p1.xgrid.grid_line_color = None; p1.ygrid.grid_line_color = None ", + " else:", + " p1.axis.visible = True", + " p1.xaxis.axis_label = x_axis_label", + " p1.yaxis.axis_label = y_axis_label", + " p1.xaxis.axis_label_text_font_size = \"14pt\"", + " p1.yaxis.axis_label_text_font_size = \"14pt\"", + "", + "", + "", + " # JS code to reset the plot area according to the selection of the user", + " js_zoom=\"\"\"", + " var data = source.get('data');", + " ", + " //read from cb_obj the start and end of the selection", + " var start = cb_obj.get('start');", + " var end = cb_obj.get('end');", + " ", + " // save the values in the data source ", + " data['%s'] = [start + (end - start) / 2];", + " data['%s'] = [end - start];", + " source.trigger('change');", + " \"\"\"", + "", + " p1.x_range.callback = CustomJS(", + " args=dict(source=source), code=js_zoom % ('x_zoom', 'width_zoom'))", + " p1.y_range.callback = CustomJS(", + " args=dict(source=source), code=js_zoom % ('y_zoom', 'height_zoom'))", + "", + " # define the renderer and actually plot the point in figure p1 (Clustering plot)", + " r1 = p1.circle('x', 'y', size=clustering_point_size, fill_color=colors, fill_alpha=1.0, source=source, line_color=None,", + "", + " # set visual properties for selected glyphs", + "", + " # set visual properties for non-selected glyphs", + " nonselection_fill_alpha=0.1,", + " nonselection_fill_color=\"blue\",", + " nonselection_line_color=None,", + " nonselection_line_alpha=0.0)", + " ", + "", + "", + " tools_2=\"pan,box_zoom,wheel_zoom,resize,reset\"", + "", + " # create small figure with the Map of the clustering plot ", + " p2 = figure(title='Map', plot_width=350, plot_height=300, tools=tools_2, background_fill_color= \"#ffffff\",", + " outline_line_width=0.01, toolbar_location=\"right\")", + "", + " p2.title_text_font =\"Trebuchet MS\"; p2.title_text_font_size = '18pt'; p2.title_text_color = '#20335d'", + " p2.title_text_font_style = 'bold'; p2.title_text_baseline = 'bottom'", + " p2.axis.visible = None; p2.xgrid.grid_line_color = None; p2.ygrid.grid_line_color = None", + " p2.logo = None", + " ", + " #p2.toolbar_location = None", + "", + " # define the renderer and actually plot the point in figure p2 (Map plot)", + " r2 = p2.circle('x', 'y', size=map_point_size, fill_color=colors, fill_alpha=1.0, source=sourceMap, line_color=None)", + "", + " #r2.selection_glyph = Circle(fill_color='blue', line_color=None)", + " r2.nonselection_glyph = Circle(fill_color='blue', fill_alpha=1.0, line_color=None)", + " rect = Rect(x='x_zoom', y='y_zoom', width='width_zoom', height='height_zoom', fill_alpha=0.6,", + " line_color=None, fill_color='blue')", + " # pass source (not sourceMap) otherwise the Box will not be shown on the Map plot", + " p2.add_glyph(source, rect)", + " ", + " if plot_convex_hull:", + " for color_of_class in list(set(colors)):", + " matching_indices = [i for i, cc in enumerate(colors) if cc==color_of_class]", + " x_y_array = np.array([ (clustering_x_list[i][0],clustering_y_list[i][0]) for i in matching_indices ])", + " len_match_ind = len(matching_indices)", + " if len_match_ind>1:", + " if len_match_ind>2:", + " hull = ConvexHull(x_y_array)", + " x_for_hull, y_for_hull = x_y_array[hull.vertices].transpose()", + " else:", + " x_for_hull, y_for_hull = x_y_array.transpose()", + " p1.patch(x_for_hull, y_for_hull, color=color_of_class, alpha=0.5 )", + " p2.patch(x_for_hull, y_for_hull, color=color_of_class, alpha=0.5 )", + "", + "", + "", + " # JS code to be used in the callback to load the corresponding structure in JSmol", + " # when user clicks on a point of the Clustering plot ", + " js_loadJmol_1 =\"\"\"", + " // get data source from Callback args", + " var data = source.get('data');", + " ", + " // obtain the index of the point that was clicked", + " // cb_obj contains information on the tool used", + " var inds = cb_obj.get('selected')['1d'].indices;", + " \"\"\"", + " if target_pred_list:", + " js_loadJmol_2 = \"\"\"", + " //pick from the data source the corresponding file", + " var geo_file = data['geo_file'][inds];", + " var chemical_formula = data['chemical_formula'][inds];", + " var target = data['target'][inds];", + " var target_pred = data['target_pred'][inds];", + " \"\"\"", + " else:", + " js_loadJmol_2 = \"\"\"", + " //pick from the data source the corresponding file", + " var geo_file = data['geo_file'][inds];", + " var chemical_formula = data['chemical_formula'][inds];", + " var target = data['target'][inds];", + " \"\"\" ", + " js_loadJmol_3 =\"\"\" ", + " // load in which JSmol applet the structure should be loaded", + " // it is an array because it is included in the ColumnDataSource which needs to be iterable ", + " var whichJSmol = data['whichJSmol'];", + "", + " ", + " // decide in which JSmol applet the structure should be loaded", + " // swap the value between 0 and 1 to alternate the JSmol applet in which we should plot", + " // only one value of the array is read (for convenience). It does not matter because the elements are all the same (either 0 or 1)", + " // open the file in jsmol", + "", + " if (whichJSmol[inds] == 0) {", + " var file= \\\"javascript:Jmol.script(jmolApplet0,\" + \"'load \"+ geo_file + \" {1 1 1}; rotate x 0; rotate y 0; rotate z 0; set bondTolerance 0.45; ')\" ; ", + " //var file= \\\"javascript:Jmol.script(jmolApplet0,\" + \"'load \"+ geo_file + \" {3 3 3}; rotate x 0; rotate y 0; rotate z 0; set bondTolerance 0.45; ')\" ; ", + " //var file= \\\"javascript:Jmol.script(jmolApplet0,\" + \"'load \"+ geo_file + \" {3 3 3}; rotate x 10; rotate y 12; rotate z 6; set bondTolerance 0.45; ')\" ; ", + " location.href = file;", + " // change all the values of the array", + " for (var i = 0; i < whichJSmol.length; i++){ ", + " whichJSmol[i] = 1;", + " }", + " writeInfoApplet0(chemical_formula, geo_file);", + " } ", + " else if (whichJSmol[inds] == 1) {", + " //var file= \\\"javascript:Jmol.script(jmolApplet1,\" + \"'load \"+ geo_file + \" {3 3 3}; rotate x 10; rotate y 12; rotate z 6; set bondTolerance 0.45; ')\" ; ", + " //var file= \\\"javascript:Jmol.script(jmolApplet1,\" + \"'load \"+ geo_file + \" {3 3 3}; rotate x 0; rotate y 0; rotate z 0; set bondTolerance 0.45; ')\" ; ", + " var file= \\\"javascript:Jmol.script(jmolApplet1,\" + \"'load \"+ geo_file + \" {1 1 1}; rotate x 0; rotate y 0; rotate z 0; set bondTolerance 0.45; ')\" ; ", + " location.href = file;", + " for (var i = 0; i < whichJSmol.length; i++){", + " whichJSmol[i] = 0;", + " } ", + " writeInfoApplet1(chemical_formula, geo_file);", + " }", + " \"\"\"", + " ", + " if target_pred_list:", + " js_loadJmol_4 = \"\"\"writeSummary(chemical_formula, target, target_pred);\"\"\"", + " else:", + " js_loadJmol_4 = \"\"\"writeSummary(chemical_formula, target);\"\"\"", + "", + " js_loadJmol_5 = \"\"\"", + " // save the modification in the ColumnDataSource to keep the information for the next user click", + " data['whichJSmol'] = whichJSmol;", + " source.trigger('change');", + "", + " \"\"\"", + "", + " js_loadJmol = js_loadJmol_1 + js_loadJmol_2 + js_loadJmol_3 + js_loadJmol_4 + js_loadJmol_5", + "", + " # returns the TapTool objects of p1 (Clustering plot) ", + " taptool = p1.select(type=TapTool)", + "", + "", + " # load the corrsponding crystal structure when a point on the Clustering plot is clicked ", + " # load in either 1st or 2nd JSmol applet", + " taptool.callback = CustomJS(args=dict(source=source), code=js_loadJmol)", + "", + " # plots can be a single Bokeh model, a list/tuple, or even a dictionary", + " plots = {'Clustering': p1, 'Map': p2}", + "", + " script, div = components(plots)", + "", + " # template for the HTML page to be generated ", + " html_template_viewer_1_a = '''<!DOCTYPE html>", + " <html lang=\"en\">", + " <head>", + " <meta charset=\"utf-8\">", + " <script>", + " document.title = \"NOMAD viewer\";", + " </script> ", + "", + " <link rel=\"stylesheet\" href=\"./jsmol/bokeh-0.11.1.min.css\" type=\"text/css\" />", + " <link rel=\"stylesheet\" href=\"https://netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css\">'''", + "", + " ", + " html_template_viewer_1_b = '''<link rel=\"stylesheet\" type=\"text/css\" href=\"''' + str(css_file_path) + '''\">''' ", + " ", + " html_template_viewer_1_c = '''", + " <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js\"></script> ", + " <script type=\"text/javascript\" src=\"https://cdn.pydata.org/bokeh/release/bokeh-0.11.1.min.js\"></script>", + " <script>window.Bokeh || document.write('<script src=\"./jsmol/bokeh-0.11.1.min.js\"></script>", + " <script src=\"https://code.jquery.com/jquery-1.11.2.js\"></script>", + " {{ js_resources }}", + " {{ css_resources }}", + " {{ script }}", + "", + " <script>", + " ", + " function writeInfoApplet0(chemical_formula_, geo_file_) {", + " document.getElementById(\"chemical_formula0\").innerHTML = String(chemical_formula_);", + " document.getElementById(\"geo_link0\").innerHTML = \"View\";", + " document.getElementById(\"geo_link0\").href = String(geo_file_);", + " document.getElementById(\"geo_link0\").target = \"_blank\";", + " };", + " ", + " function writeInfoApplet1(chemical_formula_, geo_file_) {", + " document.getElementById(\"chemical_formula1\").innerHTML = String(chemical_formula_);", + " document.getElementById(\"geo_link1\").innerHTML = \"View\";", + " document.getElementById(\"geo_link1\").href = String(geo_file_);", + " document.getElementById(\"geo_link1\").target = \"_blank\";", + " };'''", + "", + " if target_pred_list:", + " write_summary_function ='''", + " function writeSummary(chemical_formula_, target_, target_pred_){", + " //check if the user actually clicked on one point on the plot", + " if (chemical_formula_ != null && target_pred_ != null){", + " $(\"#clustering_info tbody\").append(", + " \"<tr class='clickable-row' data-href='url://www.google.com'>\"+", + " \"<td>\" + String(chemical_formula_) + \"</td>\"+", + " \"<td>\" + String(target_) + \"</td>\"+", + " \"<td>\" + String(target_pred_) + \"</td>\"+", + " \"</tr>\");", + " }", + " }; ", + " '''", + " else:", + " write_summary_function =''' ", + " function writeSummary(chemical_formula_, target_){", + " //check if the user actually clicked on one point on the plot", + " if (chemical_formula_ != null){", + " $(\"#clustering_info tbody\").append(", + " \"<tr class='clickable-row' data-href='url://www.google.com'>\"+", + " \"<td>\" + String(chemical_formula_) + \"</td>\"+", + " \"<td>\" + String(target_) + \"</td>\"+", + " \"</tr>\");", + " }", + " }; ", + " '''", + " ", + " html_template_viewer_2 = '''function deleteRow(tableID) {", + " var table = document.getElementById(tableID);", + " var rowCount = table.rows.length;", + " ", + " for(var i=2; i<rowCount; i++) {", + " var row = table.rows[i];", + " table.deleteRow(i);", + " rowCount--;", + " i--;", + " }", + " };", + " ", + " </script> ", + "<style>", + "", + "", + "", + ".legend { list-style: none; }", + ".legend li { float: left; margin-right: 10px; }", + ".legend span { border: 1px solid #ccc; float: left; width: 12px; height: 12px; margin: 2px; ", + "}", + "/* your colors */", + "", + " ", + ".legend .label_0 { background-color: #000000; }", + ".legend .label_1 { background-color: #0072B2; }", + ".legend .label_2 { background-color: #009E73; }", + ".legend .label_3 { background-color: #E69F00; }", + ".legend .label_4 { background-color: #CC79A7; }", + "", + "", + ".legend .label_5 { background-color: #2196f3; }", + ".legend .label_6 { background-color: #03a9f4; }", + ".legend .label_7 { background-color: #00bcd4; }", + ".legend .label_8 { background-color: #009688; }", + ".legend .label_9 { background-color: #4caf50; }", + ".legend .label_10 { background-color: #8bc34a; }", + ".legend .label_11 { background-color: #cddc39; }", + ".legend .label_12 { background-color: #ffeb3b; }", + ".legend .label_13 { background-color: #ffc107; }", + ".legend .label_14 { background-color: #ff9800; }", + ".legend .label_15 { background-color: #ff5722; }", + ".legend .label_16 { background-color: #795548; }", + ".legend .label_17 { background-color: #9e9e9e; }", + ".legend .label_18 { background-color: #607d8b; }", + ".legend .label_19 { background-color: #b71c1c; }", + ".legend .label_20 { background-color: #880e4f; }", + ".legend .label_21 { background-color: #4a148c; }", + ".legend .label_22 { background-color: #311b92; }", + ".legend .label_23 { background-color: #1a237e; }", + ".legend .label_24 { background-color: #0d47a1; }", + ".legend .label_25 { background-color: #01579b; }", + ".legend .label_26 { background-color: #006064; }", + ".legend .label_27 { background-color: #004d40; }", + ".legend .label_28 { background-color: #1b5e20; }", + ".legend .label_29 { background-color: #33691e; }", + ".legend .label_30 { background-color: #827717; }", + ".legend .label_31 { background-color: #f57f17; }", + ".legend .label_32 { background-color: #ff6f00; }", + ".legend .label_33 { background-color: #e65100; }", + ".legend .label_34 { background-color: #bf360c; }", + ".legend .label_35 { background-color: #3e2723; }", + ".legend .label_36 { background-color: #212121; }", + ".legend .label_37 { background-color: #263238; }", + "", + " ", + "", + ".legend .quintile_1 { background-color: #000000; }", + ".legend .quintile_2 { background-color: #0072B2; }", + ".legend .quintile_3 { background-color: #009E73; }", + ".legend .quintile_4 { background-color: #E69F00; }", + ".legend .quintile_5 { background-color: #CC79A7; }", + "", + "", + " </style>", + " ", + " </head><body id='fullwidth' class='fullwidth page-1'>", + " <table style=\"width: 100%, border: 4\">", + "", + " <tr>", + " <table class=\"headerNOMAD\">", + " <tr>", + " <td class=\"label\">", + " <img id=\"nomad\" src=\"https://nomad-coe.eu/uploads/nomad/images/NOMAD_Logo2.png\" width=\"229\" height=\"100\" alt=\"NOMAD Logo\" />", + " </td>", + " <td class=\"input\">", + " <span class=\"header-large-text\">Viewer<br></span>", + " <span class=\"header-small-text\">The NOMAD Laboratory <br></span>", + " <span> </span>", + " </td>", + " </tr>", + " </table>", + " </tr>", + " <tr>", + "", + " <table align=\"center\" style=\"background-color: #F5F5F5\">", + " <tr align=\"center\">", + " <td style=\"vertical-align: top;\">", + " {{ div['Clustering'] }}'''", + " ", + " ", + " if is_classification: ", + " # works only with 2 or 3 classes (?? please check)", + "", + " legend_1 = '''", + " <span class=\"results-small-text\"> <p align=\"center\"> '''+ str(legend_title) + '''</p></span>", + " '''", + " ", + " legend_2_list = []", + " ", + " for i in xrange(len(target_class_names)): ", + " legend_2_list.append('''<li><span class=\"label_''' + str(i) + ", + " '''\"></span><div class=\"legend-small-text\">''' ", + " + str(target_class_names[i]) + ", + " ''' (Target=''' + str(i) + ''')</div> </li>''')", + " ", + " legend_2_ = ''.join(legend_2_list)", + " ", + " legend_2 = '''<p align=\"center\">", + " <ul class=\"legend\">''' + legend_2_ +'''</ul> </p>'''", + " ", + " ", + " legend = legend_1 + legend_2", + "", + " ", + " else:", + " legend_1 = '''", + " <span class=\"results-small-text\"> <p align=\"center\"> '''+ str(legend_title) + '''</p></span>", + " <p align=\"center\"> ", + " <ul class=\"legend\">", + " '''", + " # NOTE: this is ugly and it should be changed but it is not trivial ", + " # to automatize (also the colors should be changed accordingly)", + " if n_quantiles == 5:", + " legend_2 = '''", + " <li><span class=\"quintile_1\"></span><div class=\"legend-small-text\">''' +'['+str(bins[0])+str(target_unit_legend)+', '+str(bins[1])+str(target_unit_legend)+')' + '''</div> </li>", + " <li><span class=\"quintile_2\"></span><div class=\"legend-small-text\">''' +'['+str(bins[1])+str(target_unit_legend)+', '+str(bins[2])+str(target_unit_legend)+')' + '''</div> </li>", + " <li><span class=\"quintile_3\"></span><div class=\"legend-small-text\">''' +'['+str(bins[2])+str(target_unit_legend)+', '+str(bins[3])+str(target_unit_legend)+')' + '''</div> </li>", + " <li><span class=\"quintile_4\"></span><div class=\"legend-small-text\">''' +'['+str(bins[3])+str(target_unit_legend)+', '+str(bins[4])+str(target_unit_legend)+')' + '''</div> </li>", + " <li><span class=\"quintile_5\"></span><div class=\"legend-small-text\">''' +'['+str(bins[4])+str(target_unit_legend)+', '+str(bins[5])+str(target_unit_legend)+')' + '''</div> </li>", + " </ul>", + " </p>''' ", + " elif n_quantiles == 4:", + " legend_2 = '''", + " <li><span class=\"quintile_1\"></span><div class=\"legend-small-text\">''' +'['+str(bins[0])+str(target_unit_legend)+', '+str(bins[1])+str(target_unit_legend)+')' + '''</div> </li>", + " <li><span class=\"quintile_2\"></span><div class=\"legend-small-text\">''' +'['+str(bins[1])+str(target_unit_legend)+', '+str(bins[2])+str(target_unit_legend)+')' + '''</div> </li>", + " <li><span class=\"quintile_3\"></span><div class=\"legend-small-text\">''' +'['+str(bins[2])+str(target_unit_legend)+', '+str(bins[3])+str(target_unit_legend)+')' + '''</div> </li>", + " <li><span class=\"quintile_4\"></span><div class=\"legend-small-text\">''' +'['+str(bins[3])+str(target_unit_legend)+', '+str(bins[4])+str(target_unit_legend)+')' + '''</div> </li>", + " </ul>", + " </p>''' ", + " elif n_quantiles == 3:", + " legend_2 = '''", + " <li><span class=\"quintile_1\"></span><div class=\"legend-small-text\">''' +'['+str(bins[0])+str(target_unit_legend)+', '+str(bins[1])+str(target_unit_legend)+')' + '''</div> </li>", + " <li><span class=\"quintile_2\"></span><div class=\"legend-small-text\">''' +'['+str(bins[1])+str(target_unit_legend)+', '+str(bins[2])+str(target_unit_legend)+')' + '''</div> </li>", + " <li><span class=\"quintile_3\"></span><div class=\"legend-small-text\">''' +'['+str(bins[2])+str(target_unit_legend)+', '+str(bins[3])+str(target_unit_legend)+')' + '''</div> </li>", + " </ul>", + " </p>''' ", + " elif n_quantiles == 2:", + " legend_2 = '''", + " <li><span class=\"quintile_1\"></span><div class=\"legend-small-text\">''' +'['+str(bins[0])+str(target_unit_legend)+', '+str(bins[1])+str(target_unit_legend)+')' + '''</div> </li>", + " <li><span class=\"quintile_2\"></span><div class=\"legend-small-text\">''' +'['+str(bins[1])+str(target_unit_legend)+', '+str(bins[2])+str(target_unit_legend)+')' + '''</div> </li>", + " </ul>", + " </p>''' ", + " elif n_quantiles == 1:", + " legend_2 = '''", + " <li><span class=\"quintile_1\"></span><div class=\"legend-small-text\">''' +'['+str(bins[0])+str(target_unit_legend)+', '+str(bins[1])+str(target_unit_legend)+')' + '''</div> </li>", + " </ul>", + " </p>''' ", + " ", + " ", + " legend = legend_1 + legend_2", + " ", + " if archive is None:", + " html_template_viewer_2_1 = '''", + " </td> ", + " ", + " <td style=\"vertical-align: top;\">", + " ", + " <table class=\"instructions-table\">", + " <tr>", + " <td class=\"instructions-title-text\">Instructions </td>", + " </tr>", + " <tr>", + " <td colspan=2 class=\"instructions-text\">", + " ", + " On the left, we provide an <b><i>interactive</i></b> plot of the data-analytics results. <br>", + " A menu to turn on/off interactive functions is located on the left side of the plot (just below the pinwheel logo).", + " <br><br>", + " ", + " <span class=\"instructions-h1-text\"> Basic features </span>", + " ", + " <ul>", + " <li> By <i>hovering</i> over a point in the plot, information regarding that system is displayed. </li>", + " </ul>", + "", + " <span class=\"instructions-h1-text\"> Advanced features </span>", + " ", + " <ul>", + " <li> You can <i>zoom-in</i> on a selected area activating the <i>box zoom</i> function (2nd button from the top). ", + " The full plot is still shown in the map on the right-side of this webpage, and a shaded area indicates where the selected area is in the plot. </li>", + " <li> You can modify the <i>aspect-ratio</i> activating the <i>resize</i> function (3rd button from the top),", + " and dragging the bottom-right corner of the plot.</li>", + " </ul>", + " ", + " </td>", + " </tr>", + " </table>", + "", + " </td>", + " ", + " <td style=\"height:100%\">", + " <table style=\"height:100%\">", + " <tr> ", + " <td align=\"center\" style=\"width: 100%; height:320px; vertical-align: top\">", + " {{ div['Map'] }} ", + " </td>", + " </tr>", + " '''", + "", + " html_template_viewer_outputlog = ''' ", + " </table>", + " </td>", + " </tr>", + " ", + " <tr>", + " <td colspan=2>", + " <table>", + " <tr>", + " <td style=\"width:10%\"> </td> ", + " <td>", + " <span class=\"results-small-text\"><br>'''+ outf_string + '''</span>", + " </td> ", + " <td> </td> ", + " </tr>", + " </table> ", + " </td>", + " </tr>", + " </table>", + "", + " </tr>", + " <tr>", + " <td> </td>", + " </tr>", + "", + " </table>", + " </body>", + " </html>", + "", + " '''", + "", + " template = Template(html_template_viewer_1_a + html_template_viewer_1_b + html_template_viewer_1_c + write_summary_function +", + " html_template_viewer_2 + legend + html_template_viewer_2_1 + html_template_viewer_outputlog)", + "", + " # javascript script to be included in the HTML page to load JSmol", + " js_jsmol=None", + " ", + " else:", + " html_template_viewer_2_1 = '''", + " </td> ", + " ", + " <td style=\"vertical-align: top;\">", + " ", + " <table class=\"instructions-table\">", + " <tr>", + " <td class=\"instructions-title-text\">Instructions </td>", + " </tr>", + " <tr>", + " <td colspan=2 class=\"instructions-text\">", + " ", + " On the left, we provide an <b><i>interactive</i></b> plot of the data-analytics results. <br>", + " A menu to turn on/off interactive functions is located on the left side of the plot (just below the pinwheel logo).", + " <br><br>", + " ", + " <span class=\"instructions-h1-text\"> Basic features </span>", + " ", + " <ul>", + " <li> By <i>hovering</i> over a point in the plot, information regarding that system is displayed. </li>", + " <li> By <i>clicking</i> over a point, an interactive 3D visualization of the structure appears ", + " in one of the bottom panels (alternating left and right panel at each click, ", + " for comparing the last two selections). </li> ", + "", + " </ul>", + "", + " <span class=\"instructions-h1-text\"> Advanced features </span>", + " ", + " <ul>", + " <li> You can <i>zoom-in</i> on a selected area activating the <i>box zoom</i> function (2nd button from the top). ", + " The full plot is still shown in the map on the right-side of this webpage, and a shaded area indicates where the selected area is in the plot. </li>", + " <li> You can modify the <i>aspect-ratio</i> activating the <i>resize</i> function (3rd button from the top),", + " and dragging the bottom-right corner of the plot.</li>", + " </ul>", + " ", + " </td>", + " </tr>", + " </table>", + "", + " </td>", + " ", + " <td style=\"height:100%\">", + " <table style=\"height:100%\">", + " <tr> ", + " <td align=\"center\" style=\"width: 100%; height:320px; vertical-align: top\">", + " {{ div['Map'] }} ", + " </td>", + " </tr>", + " <tr>", + " <td align=\"center\" style=\" vertical-align: top\">", + " <table id=\"clustering_info\" align=\"center\">", + " <tr class='clickablea-row' data-href='url://www.google.com'>", + " <th colspan=3 class=\"selection\"> Selection </th>", + " </tr>", + " ", + " '''", + "", + " if target_pred_list:", + " html_template_viewer_3 = '''", + " <tr>", + " <th> Name </th>", + " <th> Reference '''+str(target_name)+''' ['''+str(target_unit)+'''] </th>", + " <th> Predicted '''+str(target_name)+''' ['''+str(target_unit)+'''] </th>", + " </tr>", + " '''", + " else:", + " html_template_viewer_3 = '''", + " <tr>", + " <th> Name </th>", + " <th> '''+str(target_name)+''' ['''+str(target_unit)+'''] </th> ", + " </tr>", + " ''' ", + " ", + " html_template_viewer_4 = ''' ", + " ", + " </table>", + " <INPUT type=\"button\" value=\"Clear Selection\" onclick=\"deleteRow('clustering_info')\" />", + " </td>", + " </tr>", + " </table>", + " </td>", + " </tr>", + " <tr>", + " <td align=\"center\">", + " <table id=\"jsmol_table\">", + " <tr>", + " <th>Name</th>", + " <th>Geometry File</th>", + " </tr>", + " <tr>", + " <td> <div id=\"chemical_formula0\"> </div> </td> ", + " <td> <a id=\"geo_link0\"></a> </td> ", + " </tr>", + " <tr>", + " <td colspan=2 class=\"none\"> ", + " <div id=\"appdiv0\"></div>", + " </td> ", + " </tr>", + " </table>", + " </td>", + "", + "", + " <td align=\"center\">", + " <table id=\"jsmol_table\">", + " <tr>", + " <th>Name</th>", + " <th>Geometry File</th>", + " </tr>", + " <tr>", + " <td> <div id=\"chemical_formula1\"> </div> </td> ", + " <td> <a id=\"geo_link1\"></a> </td> ", + " </tr>", + " <tr>", + " <td colspan=2 class=\"none\"> ", + " <div id=\"appdiv1\"></div>", + " </td> ", + " </tr>", + " </table>", + " </td>", + " </tr>", + " <tr>", + " <td colspan=2>", + " <table>", + " <tr>", + " <td style=\"width:10%\"> </td> ", + " <td>", + " <span class=\"results-small-text\"><br>'''+ outf_string + '''</span>", + " </td> ", + " <td> </td> ", + " </tr>", + " </table> ", + " </td>", + " </tr>", + " </table>", + "", + " </tr>", + " <tr>", + " <td> </td>", + " </tr>", + "", + " </table>", + " </body>", + " </html>", + " '''", + "", + "", + " template = Template(html_template_viewer_1_a + html_template_viewer_1_b + html_template_viewer_1_c + write_summary_function +", + " html_template_viewer_2 + legend + html_template_viewer_2_1 + html_template_viewer_3 + html_template_viewer_4)", + "", + " # javascript script to be included in the HTML page to load JSmol", + " js_jsmol=\"\"\" ", + " <script type=\"text/javascript\" src=\"./jsmol/JSmol.min.js\"></script>", + " <script type=\"text/javascript\">", + " Jmol._isAsync = false;", + " Jmol.getProfile() // records repeat calls to overridden or overloaded Java methods", + " var jmolApplet0; // set up in HTML table, below", + " var jmolApplet1; // set up in HTML table, below", + " var chemical_formula;", + " // use ?_USE=JAVA or _USE=SIGNED or _USE=HTML5", + " jmol_isReady = function(applet) {", + " Jmol._getElement(applet, \"appletdiv\").style.border=\"0px solid black\"", + " } ", + "", + " var Info = {", + " width: 400,", + " height: 300,", + " debug: false,", + " color: \"#FFFFFF\",", + " //color: \"#F0F0F0\",", + " zIndexBase: 20000,", + " z:{monitorZIndex:100},", + " serverURL: \"./php/jsmol.php\",", + " use: \"HTML5\",", + " jarPath: \"./jsmol/java\", // this needs to point to where the j2s directory is.", + " j2sPath: \"./jsmol/j2s\", // this needs to point to where the java directory is.", + " jarFile: \"./jsmol/JmolApplet.jar\",", + " isSigned: false,", + " disableJ2SLoadMonitor: true,", + " disableInitialConsole: true,", + " readyFunction: jmol_isReady,", + " allowjavascript: true,", + " //script: \"set antialiasDisplay;load async /home/ziletti/nomad-lab-base/analysis-tools/structural-similarity/tutorials/tmp/P2Uyj-OseIfJb-idQy8HkE-q5VYUp_0_0_aims.in; spin on\"", + " }", + "", + "", + " $(document).ready(function() {", + " ", + " $(\"#appdiv0\").html(Jmol.getAppletHtml(\"jmolApplet0\", Info));", + " $(\"#appdiv1\").html(Jmol.getAppletHtml(\"jmolApplet1\", Info));", + " }", + " ); ", + "", + "", + " var lastPrompt=0;", + "", + " </script>", + "", + " \"\"\"", + "", + "", + "", + " # output static HTML file", + " # isBeaker is to allow the viewer to work locally and on Beaker", + " # with Beaker only certain files are accessible by the browsers", + " # in particular, only webpage in \"'/home/beaker/.beaker/v1/web/\"", + " # and subfolders can be accessed", + " # Here, isBeaker is defined as global variable in the Tutorial notebooks", + " # this is not clean, and it should be changed", + " if configs[\"isBeaker\"] == \"True\":", + " #Beaker", + " file_html_name = '/home/beaker/.beaker/v1/web/tmp/'+self.name+'.html'", + " file_html_link = \"<a target=_blank href='/user/tmp/\"+self.name+\".html'>Click here to open the Viewer</a>\"", + " else:", + " # Local", + " file_html_name = os.path.abspath(os.path.normpath(os.path.join(html_folder, ", + " '%s.html' % (self.name)))) ", + " file_html_link = \"<a target=_blank href='\"+file_html_name+\"'>Click here to open the Viewer</a>\"", + "", + "", + " # build the page HTML", + " html = template.render( js_resources=js_jsmol,", + " script=script,", + " div=div)", + "", + " with open(file_html_name, 'w') as f:", + " f.write(html)", + " f.flush()", + " f.close()", + "", + " logger.info(\"Click on the button 'View interactive 2D scatter plot' to see the plot.\")", + " ", + " ", + " return file_html_link, file_html_name", + "", + "# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4", + "" + ], + "hidden": true + }, + "output": { + "state": {}, + "selectedType": "Hidden", + "pluginName": "IPython", + "shellId": "32B7F85D85DA4B05AC8ABA4FA6E22968", + "elapsedTime": 3606, + "height": 88 }, "evaluatorReader": true, - "lineCount": 50, - "tags": "cell_soap_run", - "isError": true + "lineCount": 1611, + "tags": "cell_soap_run" + }, + { + "id": "coderPBQEl", + "type": "code", + "evaluator": "IPython", + "input": { + "body": [ + "def plot_local(", + " json_list=None,", + " frames=None,", + " frame_list=None,", + " file_format=None,", + " png_path=None,", + " geo_path=None,", + " desc_folder=None,", + " tmp_folder=None,", + " control_file=None,", + " clustering_x_list=None,", + " clustering_y_list=None,", + " target_list=None,", + " target_pred_list=None,", + " target_class_names=None,", + " target_unit=None,", + " energy_unit=None,", + " xray_img_list=None,", + " is_classification=None,", + " write_png=True,", + " write_geometry=True,", + " legend_title=None,", + " plot_title=None,", + " target_name=None,", + " clustering_point_size=None,", + " name=None,", + " html_folder=None,", + " cell_type=None,", + " operations_on_structure=None,", + " op_list=None,", + " descriptor=None,", + " atoms_scaling=None):", + " \"\"\" Generate the Viewer.", + "", + " Parameters", + " ----------", + "", + " json_list : list", + " List with the absolute paths to the json files", + "", + " frames : string, optional, {'all', 'first', 'last', 'list'}", + " Define which frames should be shown from the NOMADstructure.\\n", + " 'all': show all the frames in the NOMADstucture \\n", + " 'first': show only 1st frame \\n", + " 'last': show only last frame \\n", + " 'list': show user-specified list of frames. The list of frames", + " needs to be specified in `frame_list`.", + "", + " frame_list : list or list of lists, optional", + " For each json file, specifies with frames to consider in the descriptor", + " calculation. If multiple json files are present, it is a list of lists.", + " Supports negative indeces.", + "", + " file_format : text, optional, {'NOMAD', 'rdf'}", + " Specify what is the format of the file to read.", + " ('rdf' is DEPRECATED).", + "", + " png_path : string, default `tmp_folder`", + " Path to the folder where the png file for each structure are written.", + "", + " geo_path: string, default `tmp_folder`", + " Path to the folder where the png file for each structure are written.", + "", + " desc_folder : string, default `tmp_folder`", + " Folder where the `desc_file` is written.", + "", + " tmp_folder: string", + " Temporary folder.", + "", + " clustering_x_list : list or list of lists of floats", + " x coordinate for the 2d-plot in the Viewer. Usually read from a 'lookup.dat'", + " file written by the `calc_embedding` function (see the `calc_embedding` function", + " for more details).", + " If multiple json files are present, it is a list of lists.", + "", + " clustering_y_list : list or list of lists of floats", + " y coordinate for the 2d-plot in the Viewer. Usually read from a 'lookup.dat'", + " file written by the `calc_embedding` function (see the `calc_embedding` function", + " for more details).", + " If multiple json files are present, it is a list of lists.", + "", + " target_list : list or list of list of floats", + " Used for the colors of the poins in the 2d-plot of the Viewer.", + " Usually read from a 'lookup.dat' file written by the calc_embedding function", + " (see the `calc_embedding` function for more details).", + " If multiple json files are present, it is a list of lists.", + "", + " .. todo:: check if it actually supports multiple files and multiple frames", + "", + " clustering_point_size : float, optional, default 12", + " Size of the points in the 2d-embedding plot.", + "", + " name : string, optional, default 'viewer'", + " Name of the html page (without extension) generated.", + " Such html page (name.html) is the NOMAD Viewer.", + "", + " html_folder : string, optional, default `tmp_folder`", + " Folder where the html page name.html is saved.", + "", + " Returns", + " ----------", + "", + " file_html_link : string", + " html string that in the Beaker notebook generates the html link to the", + " viewer (name.html). For example,", + " <a target=_blank href='/path/to/file/viewer.html'>Click here to open the Viewer</a>", + "", + " .. todo:: Add Sha support.", + "", + "", + " \"\"\"", + "", + "", + " # get structures, generate png, geometry files and optionally descriptor", + " # files", + " structure_list = _get_structures(", + " json_list=json_list,", + " frame_list=frame_list,", + " file_format=file_format,", + " png_path=png_path,", + " geo_path=geo_path,", + " tmp_folder=tmp_folder,", + " cell_type=cell_type,", + " operations_on_structure=operations_on_structure,", + " op_list=op_list,", + " descriptor=descriptor,", + " atoms_scaling=atoms_scaling)", + " ", + " # flatten the list", + " # it is a list of lists when operations_on_structure is not None", + " if operations_on_structure is not None:", + " structure_list = [item for sublist in structure_list for item in sublist]", + " #take only the 1st frame of frame list and make a list of single item", + " # NOTE: this works only for single frames but it is okay for us", + " #frame_list = [[item[0]] for item in frame_list]", + "", + " logger.debug(\"Plotting {0} crystal structures.\".format(len(structure_list)))", + " ", + " ", + " # create an instance of class Viewer", + " viewer = Viewer_local(name=name)", + "", + " # check if there is a control file", + " try:", + " with open(control_file) as data_file:", + " data = json.load(data_file)", + "", + " for c in data['model_info']:", + " x_axis_label = c[\"x_axis_label\"]", + " y_axis_label = c[\"y_axis_label\"]", + " except:", + " x_axis_label = None", + " y_axis_label = None", + "", + " # make the plot", + " file_html_link, file_html_name = viewer.plot(archive=structure_list, frames=frames,", + " frame_list=frame_list, clustering_x_list=clustering_x_list, clustering_y_list=clustering_y_list,", + " target_list=target_list, target_pred_list=target_pred_list,", + " target_class_names=target_class_names,", + " target_unit=target_unit, target_name=target_name,", + " energy_unit=energy_unit,", + " descriptor=descriptor, xray_img_list=xray_img_list,", + " legend_title=legend_title, is_classification=is_classification,", + " x_axis_label=x_axis_label, y_axis_label=y_axis_label, plot_title=plot_title,", + " clustering_point_size=clustering_point_size, html_folder=html_folder, tmp_folder=tmp_folder)", + "", + " # open the browser and show the plot", + " #view(file_html_name)", + "", + " return file_html_link" + ], + "hidden": true + }, + "output": { + "state": {}, + "selectedType": "Hidden", + "pluginName": "IPython", + "shellId": "32B7F85D85DA4B05AC8ABA4FA6E22968", + "elapsedTime": 368, + "height": 88 + }, + "evaluatorReader": true, + "lineCount": 170, + "tags": "cell_soap_run" }, { "id": "codeyp572I", @@ -15414,7 +15913,7 @@ "", "energy_unit='eV'", "", - "plot_result = plot(", + "plot_result = plot_local(", " name=name_html_page, ", " json_list=json_list, ", " frames='list', ", @@ -15424,10 +15923,10 @@ " clustering_y_list=y_list, ", " # changed to have labels with spacegroup numer", " target_list=new_target_list,", - " target_unit='', ", + " target_unit='No Units', ", " legend_title='Space group number or point group symbol (classes)', ", " #legend_title='Similarity measure', ", - " target_name='class number',", + " target_name='Class number',", " energy_unit=energy_unit,", " plot_title='SOAP structure map',", " op_list=op_list, ", @@ -15457,9 +15956,9 @@ "state": {}, "selectedType": "Results", "pluginName": "IPython", - "shellId": "24B535D4EA8C404AA5653E575AEA98F9", - "elapsedTime": 4756, - "height": 93 + "shellId": "32B7F85D85DA4B05AC8ABA4FA6E22968", + "elapsedTime": 1730, + "height": 88 }, "evaluatorReader": true, "lineCount": 64, @@ -15481,8 +15980,8 @@ "state": {}, "selectedType": "BeakerDisplay", "pluginName": "JavaScript", - "elapsedTime": 16, - "height": 56 + "elapsedTime": 20, + "height": 88 }, "evaluatorReader": true, "lineCount": 2, @@ -15632,7 +16131,7 @@ } } }, - "viewer_result": "5a575ace0e6e9e6a", + "viewer_result": "462b47d34c41e56d", "last_query_name": "Crystal-C" }, "locked": true