From 87b4c90a765e0fee66badfe54a9d6431a2a44dd4 Mon Sep 17 00:00:00 2001 From: Lauri Himanen <lauri.himanen@gmail.com> Date: Wed, 23 Oct 2024 10:24:58 +0000 Subject: [PATCH] Resolve "Issue with missing color markers in scatter plots" --- examples/data/rdm_tutorial/tutorial.ipynb | 1240 ++--------------- .../editQuantity/QueryEditQuantity.js | 2 +- .../entry/properties/SampleHistoryCard.js | 16 +- gui/src/components/search/SearchContext.js | 10 +- .../components/search/SearchContext.spec.js | 10 +- gui/src/components/search/SearchResults.js | 2 +- .../components/search/SearchResults.spec.js | 16 +- gui/src/components/search/conftest.spec.js | 6 +- .../search/widgets/WidgetScatterPlot.js | 2 +- .../search/widgets/WidgetScatterPlot.spec.js | 15 +- .../components/uploads/SectionSelectDialog.js | 2 +- gui/tests/env.js | 248 ++-- nomad/config/models/ui.py | 12 +- 13 files changed, 282 insertions(+), 1299 deletions(-) diff --git a/examples/data/rdm_tutorial/tutorial.ipynb b/examples/data/rdm_tutorial/tutorial.ipynb index 7a3783f615..845cc22f24 100644 --- a/examples/data/rdm_tutorial/tutorial.ipynb +++ b/examples/data/rdm_tutorial/tutorial.ipynb @@ -6814,19 +6814,11 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Schema is deprecated, use plugins. ()\n" - ] - } - ], + "outputs": [], "source": [ "from nomad.metainfo import Quantity\n", "from nomad.datamodel.data import Schema\n", @@ -6881,40 +6873,11 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.10000021008919545 electron_volt\n" - ] - }, - { - "data": { - "application/json": { - "delayed_lifetime": 1, - "peak_emission_wavelength": 470, - "photoluminescence_quantum_yield": 0.9, - "singlet_triplet_energy_splitting": 0.10000021008919545 - }, - "text/plain": [ - "<IPython.core.display.JSON object>" - ] - }, - "execution_count": 2, - "metadata": { - "application/json": { - "expanded": false, - "root": "root" - } - }, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# Quantities can be instantiated in the constructor\n", "molecule = TADFMolecule(\n", @@ -6945,7 +6908,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": { "tags": [] }, @@ -6998,7 +6961,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": { "tags": [] }, @@ -7026,7 +6989,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": { "tags": [] }, @@ -7093,25 +7056,11 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Collecting rdkit\n", - " Downloading rdkit-2023.9.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.9 MB)\n", - "\u001b[2K \u001b[90mâ”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”\u001b[0m \u001b[32m34.9/34.9 MB\u001b[0m \u001b[31m29.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: numpy in /opt/conda/lib/python3.10/site-packages (from rdkit) (1.22.4)\n", - "Requirement already satisfied: Pillow in /opt/conda/lib/python3.10/site-packages (from rdkit) (9.4.0)\n", - "Installing collected packages: rdkit\n", - "Successfully installed rdkit-2023.9.6\n" - ] - } - ], + "outputs": [], "source": [ "! pip install rdkit" ] @@ -7125,7 +7074,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": { "tags": [] }, @@ -7156,47 +7105,11 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "application/json": { - "DOI_number": "https://doi.org/10.1021/jp5126624", - "journal": "The Journal of Physical Chemistry C", - "m_def": "__main__.TADFMolecule", - "molecular_formula": "C8H10N4O2", - "molecular_mass": 194.08037556, - "publication_authors": [ - "Dharani Sabba", - "Hemant Kumar Mulmudi", - "Rajiv Ramanujam Prabhakar", - "Thirumal Krishnamoorthy", - "Tom Baikie", - "Pablo P. Boix", - "Subodh Mhaisalkar", - "Nripan Mathews" - ], - "publication_date": "2015-01-06T15:24:53+00:00", - "publication_title": "Impact of Anionic Br<sup>–</sup> Substitution on Open Circuit Voltage in Lead Free Perovskite (CsSnI<sub>3-x</sub>Br<sub><i>x</i></sub>) Solar Cells", - "smile": "CN1C=NC2=C1C(=O)N(C(=O)N2C)C" - }, - "text/plain": [ - "<IPython.core.display.JSON object>" - ] - }, - "execution_count": 8, - "metadata": { - "application/json": { - "expanded": false, - "root": "root" - } - }, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from nomad.datamodel.datamodel import EntryArchive\n", "import logging\n", @@ -7236,7 +7149,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": { "tags": [] }, @@ -7308,354 +7221,11 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/opt/conda/lib/python3.10/site-packages/nomad/atomutils.py:548: RuntimeWarning: invalid value encountered in double_scalars\n", - " angles[i] = np.dot(cell[j], cell[k]) / (lengths[j] * lengths[k])\n" - ] - }, - { - "data": { - "application/json": { - "material": { - "chemical_formula_anonymous": "A5B4C2D", - "chemical_formula_descriptive": "C8H10N4O2", - "chemical_formula_hill": "C8H10N4O2", - "chemical_formula_iupac": "C4N2H5O", - "chemical_formula_reduced": "C4H5N2O", - "elemental_composition": [ - { - "atomic_fraction": 0.3333333333333333, - "element": "C", - "mass": 1.994423656721262e-26, - "mass_fraction": 0.4948004692297156 - }, - { - "atomic_fraction": 0.4166666666666667, - "element": "H", - "mass": 1.673723746788804e-27, - "mass_fraction": 0.05190467509755879 - }, - { - "atomic_fraction": 0.16666666666666666, - "element": "N", - "mass": 2.325867254414622e-26, - "mass_fraction": 0.28851448010356834 - }, - { - "atomic_fraction": 0.08333333333333333, - "element": "O", - "mass": 2.656762874216004e-26, - "mass_fraction": 0.1647803755691573 - } - ], - "elements": [ - "C", - "H", - "N", - "O" - ], - "topology": [ - { - "atoms": { - "atomic_numbers": [ - 6, - 7, - 6, - 7, - 6, - 6, - 6, - 8, - 7, - 6, - 8, - 7, - 6, - 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ], - "labels": [ - "C", - "N", - "C", - "N", - "C", - "C", - "C", - "O", - "N", - "C", - "O", - "N", - "C", - "C", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H" - ], - "lattice_vectors": [ - [ - 0, - 0, - 0 - ], - [ - 0, - 0, - 0 - ], - [ - 0, - 0, - 0 - ] - ], - "m_def": "nomad.datamodel.metainfo.system.Atoms", - "periodic": [ - false, - false, - false - ], - "positions": [ - [ - 3.267350695943137e-10, - 6.127845346726945e-11, - -2.3641309333764952e-11 - ], - [ - 2.1264267420429976e-10, - -2.6661896678456337e-11, - -2.6747692166892374e-11 - ], - [ - 2.1513187968374684e-10, - -1.616340824737994e-10, - -5.0052799914054796e-11 - ], - [ - 9.413073395216916e-11, - -2.1385221520549949e-10, - -4.633868585952565e-11 - ], - [ - 1.2412444722048541e-11, - -1.0815858144375515e-10, - -1.9762823275917153e-11 - ], - [ - 8.208554511561448e-11, - 8.168406026665595e-12, - -7.173409161610923e-12 - ], - [ - 2.0538964901107783e-11, - 1.3321404984568095e-10, - 2.0601162514001555e-11 - ], - [ - 8.427235036457681e-11, - 2.3751569720617706e-10, - 3.17573943242735e-11 - ], - [ - -1.1832905692919276e-10, - 1.234987229403806e-10, - 3.3437171617139666e-11 - ], - [ - -1.9400499923973025e-10, - 5.06355939492267e-12, - 2.1114538376452735e-11 - ], - [ - -3.1677476653349573e-10, - 6.6136009589038535e-12, - 3.4193980895858896e-11 - ], - [ - -1.2422803362342743e-10, - -1.1262093475493376e-10, - -6.262349498520414e-12 - ], - [ - -1.9462084302123357e-10, - -2.387576145532664e-10, - -2.045149165165402e-11 - ], - [ - -1.9295407989600943e-10, - 2.4449615497563014e-10, - 6.188581606168382e-11 - ], - [ - 4.1764578860214176e-10, - 3.747347866373224e-12, - -4.29540084941502e-11 - ], - [ - 3.1416662470409146e-10, - 1.3735569757924307e-10, - -1.0108029050780618e-10 - ], - [ - 3.325812153015653e-10, - 1.072331505818336e-10, - 7.533594452231133e-11 - ], - [ - 3.0660963872821564e-10, - -2.1641674099606524e-10, - -6.895472353926869e-11 - ], - [ - -1.5762139477384895e-10, - -3.090024447474035e-10, - 5.490672142132536e-11 - ], - [ - -3.024849121555135e-10, - -2.2699923693474893e-10, - -7.1851780333203335e-12 - ], - [ - -1.7592984180859824e-10, - -2.7905390041965513e-10, - -1.2049657151537808e-10 - ], - [ - -2.4752564088222776e-10, - 2.313472349891166e-10, - 1.5590235176205895e-10 - ], - [ - -2.657054148524369e-10, - 2.610820200752254e-10, - -1.8252875322965927e-11 - ], - [ - -1.287739461582144e-10, - 3.325435523001943e-10, - 7.021912677971663e-11 - ] - ], - "species": [ - 6, - 7, - 6, - 7, - 6, - 6, - 6, - 8, - 7, - 6, - 8, - 7, - 6, - 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ] - }, - "cell": { - "a": 0, - "b": 0, - "c": 0, - "volume": 0 - }, - "chemical_formula_anonymous": "A5B4C2D", - "chemical_formula_descriptive": "C8H10N4O2", - "chemical_formula_hill": "C8H10N4O2", - "chemical_formula_iupac": "C4N2H5O", - "chemical_formula_reduced": "C4H5N2O", - "description": "3D reconstruction of the molecule generated from the SMILES.", - "dimensionality": "0D", - "elemental_composition": [ - { - "atomic_fraction": 0.3333333333333333, - "element": "C", - "mass": 1.994423656721262e-26, - "mass_fraction": 0.4948004692297156 - }, - { - "atomic_fraction": 0.16666666666666666, - "element": "N", - "mass": 2.325867254414622e-26, - "mass_fraction": 0.28851448010356834 - }, - { - "atomic_fraction": 0.08333333333333333, - "element": "O", - "mass": 2.656762874216004e-26, - "mass_fraction": 0.1647803755691573 - }, - { - "atomic_fraction": 0.4166666666666667, - "element": "H", - "mass": 1.673723746788804e-27, - "mass_fraction": 0.05190467509755879 - } - ], - "elements": [ - "C", - "H", - "N", - "O" - ], - "label": "Molecule reconstruction", - "n_atoms": 24, - "structural_type": "molecule", - "system_id": "results/material/topology/0" - } - ] - } - }, - "text/plain": [ - "<IPython.core.display.JSON object>" - ] - }, - "execution_count": 10, - "metadata": { - "application/json": { - "expanded": false, - "root": "root" - } - }, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "archive = EntryArchive(\n", " data=TADFMolecule(\n", @@ -7680,7 +7250,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": { "tags": [] }, @@ -7758,7 +7328,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": { "tags": [] }, @@ -7829,7 +7399,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": { "tags": [] }, @@ -7871,7 +7441,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": { "tags": [] }, @@ -7933,35 +7503,11 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "application/json": { - "DOI_number": "https://doi.org/10.1039/D0TC02884C", - "iupac_name": "5-(5-(dibenzo[b, d]furan-2-yl)-pyridin-2-yl)-5H-benzo[d]benzo-[4,5]imidazo[1,2-a]imidazole", - "m_def": "TADFMolecules.TADFMolecule", - "name": "5-(5-(dibenzo[b,d]furan-2-yl)-pyridin-2-yl)-5H-benzo[d]benzo-[4,5]imidazo[1,2-a]imidazole", - "peak_emission_wavelength": 483, - "smile": "c1ccc2c(c1)nc1n(-c3ccc(-c4ccc5oc6ccccc6c5c4)cn3)c3ccccc3n21" - }, - "text/plain": [ - "<IPython.core.display.JSON object>" - ] - }, - "execution_count": 15, - "metadata": { - "application/json": { - "expanded": false, - "root": "root" - } - }, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "archive = EntryArchive()\n", "parser = TADFMoleculesParser()\n", @@ -7980,610 +7526,11 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "application/json": { - "data": { - "DOI_number": "https://doi.org/10.1039/D0TC02884C", - "iupac_name": "5-(5-(dibenzo[b, d]furan-2-yl)-pyridin-2-yl)-5H-benzo[d]benzo-[4,5]imidazo[1,2-a]imidazole", - "journal": "Journal of Materials Chemistry C", - "m_def": "TADFMolecules.TADFMolecule", - "molecular_formula": "C30H18N4O", - "molecular_mass": 450.1480611960005, - "name": "5-(5-(dibenzo[b,d]furan-2-yl)-pyridin-2-yl)-5H-benzo[d]benzo-[4,5]imidazo[1,2-a]imidazole", - "peak_emission_wavelength": 483, - "publication_authors": [ - "Kyu Man Youn", - "Hyuna Lee", - "Han Jong Yoo", - "Young Hun Jung", - "Jae Do Park", - "Hyein Jeong", - "Jungsub Lee", - "Ju Young Lee", - "Jang Hyuk Kwon" - ], - "publication_date": "2020-09-11T02:25:56+00:00", - "publication_title": "High triplet energy bipolar host materials with the combination of dibenzofuran and benziimidazobenzoimidazole moieties for blue thermally activated delayed fluorescence emitter", - "smile": "c1ccc2c(c1)nc1n(-c3ccc(-c4ccc5oc6ccccc6c5c4)cn3)c3ccccc3n21" - }, - "metadata": { - "entry_type": "TADFMolecule", - "references": [ - "https://doi.org/10.1039/D0TC02884C" - ] - }, - "results": { - "material": { - "chemical_formula_anonymous": "A30B18C4D", - "chemical_formula_descriptive": "C30H18N4O", - "chemical_formula_hill": "C30H18N4O", - "chemical_formula_iupac": "C30N4H18O", - "chemical_formula_reduced": "C30H18N4O", - "elemental_composition": [ - { - "atomic_fraction": 0.5660377358490566, - "element": "C", - "mass": 1.994423656721262e-26, - "mass_fraction": 0.7998421807785707 - }, - { - "atomic_fraction": 0.33962264150943394, - "element": "H", - "mass": 1.673723746788804e-27, - "mass_fraction": 0.040273735637087894 - }, - { - "atomic_fraction": 0.07547169811320754, - "element": "N", - "mass": 2.325867254414622e-26, - "mass_fraction": 0.12436854331011744 - }, - { - "atomic_fraction": 0.018867924528301886, - "element": "O", - "mass": 2.656762874216004e-26, - "mass_fraction": 0.035515540274223996 - } - ], - "elements": [ - "C", - "H", - "N", - "O" - ], - "topology": [ - { - "atoms": { - "atomic_numbers": [ - 6, - 6, - 6, - 6, - 6, - 6, - 7, - 6, - 7, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 8, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 7, - 6, - 6, - 6, - 6, - 6, - 6, - 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ], - "labels": [ - "C", - "C", - "C", - "C", - "C", - "C", - "N", - "C", - "N", - "C", - "C", - "C", - "C", - "C", - "C", - "C", - "C", - "O", - "C", - "C", - "C", - "C", - "C", - "C", - "C", - "C", - "C", - "N", - "C", - "C", - "C", - "C", - "C", - "C", - "N", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H", - "H" - ], - "lattice_vectors": [ - [ - 0, - 0, - 0 - ], - [ - 0, - 0, - 0 - ], - [ - 0, - 0, - 0 - ] - ], - "m_def": "nomad.datamodel.metainfo.system.Atoms", - "periodic": [ - false, - false, - false - ], - "positions": [ - [ - -6.814696206160203e-10, - 1.5339613482155443e-10, - 3.0945049200911305e-10 - ], - [ - -7.604062062952854e-10, - 1.2930774891066646e-10, - 1.9679450047823717e-10 - ], - [ - -7.048048596347e-10, - 8.115241485901814e-11, - 7.767036294898098e-11 - ], - [ - -5.667785173451515e-10, - 5.852018673543404e-11, - 7.694743169822082e-11 - ], - [ - -4.850342691594443e-10, - 8.178998452723457e-11, - 1.8855025608136338e-10 - ], - [ - -5.434502695807768e-10, - 1.299793224706655e-10, - 3.0672355934618925e-10 - ], - [ - -3.5224960349401285e-10, - 5.150974722629348e-11, - 1.6351061639609565e-10 - ], - [ - -3.5112713495716793e-10, - 1.2223862812798571e-11, - 3.8495503895972046e-11 - ], - [ - -2.627452887254602e-10, - -3.4966900848627846e-11, - -5.512649715199801e-11 - ], - [ - -1.2467507511225188e-10, - -5.141663397864354e-11, - -3.0479241829250434e-11 - ], - [ - -5.43755819063466e-11, - -1.5760476767276282e-10, - -8.776773444775391e-11 - ], - [ - 8.244761816827424e-11, - -1.733611577116786e-10, - -6.324678729633925e-11 - ], - [ - 1.4999092286170733e-10, - -8.3440365510834e-11, - 1.926018749151556e-11 - ], - [ - 2.93703900441862e-10, - -9.591753936053172e-11, - 4.75446521237426e-11 - ], - [ - 3.4753192310284765e-10, - -2.1744650084680956e-10, - 9.407396189942876e-11 - ], - [ - 4.840143651294465e-10, - -2.3306652523875315e-10, - 1.2182736029447062e-10 - ], - [ - 5.647733512769404e-10, - -1.2177414102058032e-10, - 1.0102200356960969e-10 - ], - [ - 6.991566120468404e-10, - -1.170361772703141e-10, - 1.2201455077211776e-10 - ], - [ - 7.399140213459271e-10, - 8.857340197749392e-12, - 8.995291409559919e-11 - ], - [ - 8.710108566203223e-10, - 5.541080678881482e-11, - 9.748009932207535e-11 - ], - [ - 8.923974230093576e-10, - 1.8844467464662417e-10, - 5.996718974915281e-11 - ], - [ - 7.867570097424908e-10, - 2.693445555065859e-10, - 1.7323370862120943e-11 - ], - [ - 6.557680520763339e-10, - 2.1966310153958118e-10, - 1.0773282429655897e-11 - ], - [ - 6.320041166920742e-10, - 8.601379304025466e-11, - 4.8084068086379175e-11 - ], - [ - 5.179500122054107e-10, - 8.093429990468459e-13, - 5.542585257206444e-11 - ], - [ - 3.8026117791329646e-10, - 1.4001906242945373e-11, - 2.8286687956076562e-11 - ], - [ - 7.239122371820574e-11, - 1.8378618276004298e-11, - 7.351872206526169e-11 - ], - [ - -6.009231345281886e-11, - 3.5633858218644775e-11, - 5.0586980685559806e-11 - ], - [ - -3.403099097096614e-10, - -6.074901912450157e-11, - -1.7245100183639911e-10 - ], - [ - -3.0408719787154167e-10, - -1.0165117510325326e-10, - -2.990818809812584e-10 - ], - [ - -4.0537226351177007e-10, - -1.162262192727109e-10, - -3.9520071304881506e-10 - ], - [ - -5.404278943804877e-10, - -8.851789389468708e-11, - -3.648621774388778e-10 - ], - [ - -5.779815718460854e-10, - -4.4197705457654896e-11, - -2.38047758483311e-10 - ], - [ - -4.761449221258896e-10, - -3.1155059418135576e-11, - -1.4645373173719e-10 - ], - [ - -4.776087550979876e-10, - 1.351617917700087e-11, - -1.5319269705563714e-11 - ], - [ - -7.274243289262127e-10, - 1.9083860309970143e-10, - 4.006376451018059e-10 - ], - [ - -8.674541835873787e-10, - 1.4841700780088273e-10, - 2.0172204291739224e-10 - ], - [ - -7.669120197526692e-10, - 6.281281085800999e-11, - -9.203240912419018e-12 - ], - [ - -4.816191678845424e-10, - 1.4849087463079216e-10, - 3.9390223050895773e-10 - ], - [ - -1.0521576703730502e-10, - -2.31550921669807e-10, - -1.485860478570573e-10 - ], - [ - 1.3520791980735835e-10, - -2.56521084398323e-10, - -1.0935295658102853e-10 - ], - [ - 2.8187310250722185e-10, - -3.027872207465806e-10, - 1.1089697879488628e-10 - ], - [ - 5.250064289500067e-10, - -3.2656559612793254e-10, - 1.5804431346851456e-10 - ], - [ - 9.517082636935286e-10, - -8.68480508471003e-12, - 1.3081419916141e-10 - ], - [ - 9.930874675672618e-10, - 2.2948061346575633e-10, - 6.41797213426903e-11 - ], - [ - 8.062568381145381e-10, - 3.725263006137671e-10, - -1.1216126730240736e-11 - ], - [ - 5.744573231016062e-10, - 2.834980926639528e-10, - -2.2451225508111783e-11 - ], - [ - 3.420802181449816e-10, - 1.0886772734583234e-10, - -8.603153377599315e-12 - ], - [ - 1.1532875058250963e-10, - 9.217143137930445e-11, - 1.4088389989047605e-10 - ], - [ - -2.0100344860447588e-10, - -1.2021609100621008e-10, - -3.267025530339569e-10 - ], - [ - -3.79195075451379e-10, - -1.4856011757095024e-10, - -4.958266255587795e-10 - ], - [ - -6.159405453629103e-10, - -1.0064321296382544e-10, - -4.423215014756119e-10 - ], - [ - -6.811731073907394e-10, - -2.1000209556077262e-11, - -2.152298862639582e-10 - ] - ], - "species": [ - 6, - 6, - 6, - 6, - 6, - 6, - 7, - 6, - 7, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 8, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 6, - 7, - 6, - 6, - 6, - 6, - 6, - 6, - 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ] - }, - "cell": { - "a": 0, - "b": 0, - "c": 0, - "volume": 0 - }, - "chemical_formula_anonymous": "A30B18C4D", - "chemical_formula_descriptive": "C30H18N4O", - "chemical_formula_hill": "C30H18N4O", - "chemical_formula_iupac": "C30N4H18O", - "chemical_formula_reduced": "C30H18N4O", - "description": "3D reconstruction of the molecule generated from the SMILES.", - "dimensionality": "0D", - "elemental_composition": [ - { - "atomic_fraction": 0.5660377358490566, - "element": "C", - "mass": 1.994423656721262e-26, - "mass_fraction": 0.7998421807785707 - }, - { - "atomic_fraction": 0.07547169811320754, - "element": "N", - "mass": 2.325867254414622e-26, - "mass_fraction": 0.12436854331011744 - }, - { - "atomic_fraction": 0.018867924528301886, - "element": "O", - "mass": 2.656762874216004e-26, - "mass_fraction": 0.035515540274223996 - }, - { - "atomic_fraction": 0.33962264150943394, - "element": "H", - "mass": 1.673723746788804e-27, - "mass_fraction": 0.040273735637087894 - } - ], - "elements": [ - "C", - "H", - "N", - "O" - ], - "label": "Molecule reconstruction", - "n_atoms": 53, - "structural_type": "molecule", - "system_id": "results/material/topology/0" - } - ] - } - } - }, - "text/plain": [ - "<IPython.core.display.JSON object>" - ] - }, - "execution_count": 16, - "metadata": { - "application/json": { - "expanded": false, - "root": "root" - } - }, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "archive.data.normalize(archive, logger)\n", "JSON(archive.m_to_dict())" @@ -8605,19 +7552,11 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "could not generate representative structure\n" - ] - } - ], + "outputs": [], "source": [ "import os\n", "import json\n", @@ -8678,12 +7617,14 @@ " Column,\n", " Columns,\n", " Dashboard,\n", - " FilterMenu,\n", - " FilterMenus,\n", - " Filters,\n", " Format,\n", " Layout,\n", + " Menu,\n", + " MenuItemHistogram,\n", + " MenuItemPeriodicTable,\n", + " MenuItemTerms,\n", " Pagination,\n", + " SearchQuantities,\n", " WidgetHistogram,\n", " WidgetPeriodicTable,\n", " WidgetScatterPlot,\n", @@ -8696,7 +7637,7 @@ " path='tadf-molecules',\n", " description='Search for thermally activated delayed fluorescent molecules.',\n", " category='Experiment',\n", - " filters=Filters(\n", + " search_quantities=SearchQuantities(\n", " include=[f'*#{schema}'],\n", " ),\n", " filters_locked={'section_defs.definition_qualified_name': schema},\n", @@ -8704,57 +7645,84 @@ " order_by=f'data.photoluminescence_quantum_yield#{schema}',\n", " order='desc',\n", " ),\n", - " columns=Columns(\n", - " selected=[\n", - " 'results.material.chemical_formula_hill',\n", - " f'data.photoluminescence_quantum_yield#{schema}',\n", - " f'data.peak_emission_wavelength#{schema}',\n", - " f'data.delayed_lifetime#{schema}',\n", - " f'data.singlet_triplet_energy_splitting#{schema}',\n", - " 'references',\n", - " ],\n", - " options={\n", - " 'results.material.chemical_formula_hill': Column(),\n", - " f'data.photoluminescence_quantum_yield#{schema}': Column(\n", - " format=Format(decimals=2, mode='standard')\n", - " ),\n", - " f'data.peak_emission_wavelength#{schema}': Column(\n", - " format=Format(decimals=2, mode='standard'), unit='nm'\n", - " ),\n", - " f'data.delayed_lifetime#{schema}': Column(\n", - " format=Format(decimals=2, mode='standard'), unit='µs'\n", + " columns=[\n", + " Column(search_quantity='results.material.chemical_formula_hill', selected=True),\n", + " Column(\n", + " search_quantity=f'data.photoluminescence_quantum_yield#{schema}',\n", + " format=Format(decimals=2),\n", + " selected=True,\n", + " ),\n", + " Column(\n", + " search_quantity=f'data.peak_emission_wavelength#{schema}',\n", + " format=Format(decimals=2),\n", + " selected=True,\n", + " ),\n", + " Column(\n", + " search_quantity=f'data.delayed_lifetime#{schema}',\n", + " format=Format(decimals=2),\n", + " selected=True,\n", + " ),\n", + " Column(\n", + " search_quantity=f'data.singlet_triplet_energy_splitting#{schema}',\n", + " format=Format(decimals=2),\n", + " selected=True,\n", + " ),\n", + " Column(search_quantity='references', selected=True),\n", + " ],\n", + " menu=Menu(\n", + " items=[\n", + " Menu(\n", + " title='Elements / Formula',\n", + " size='xxl',\n", + " items=[\n", + " MenuItemPeriodicTable(\n", + " search_quantity='results.material.elements',\n", + " ),\n", + " MenuItemTerms(\n", + " search_quantity='results.material.chemical_formula_hill',\n", + " options=0,\n", + " ),\n", + " MenuItemHistogram(\n", + " x='results.material.n_elements',\n", + " ),\n", + " ],\n", " ),\n", - " f'data.singlet_triplet_energy_splitting#{schema}': Column(\n", - " format=Format(decimals=2, mode='standard'),\n", - " unit='eV',\n", + " Menu(\n", + " title='TADF Properties',\n", + " items=[\n", + " MenuItemHistogram(\n", + " x=f'data.photoluminescence_quantum_yield#{schema}',\n", + " ),\n", + " MenuItemHistogram(\n", + " x=f'data.peak_emission_wavelength#{schema}',\n", + " ),\n", + " MenuItemHistogram(\n", + " x=f'data.delayed_lifetime#{schema}',\n", + " ),\n", + " MenuItemHistogram(\n", + " x=f'data.singlet_triplet_energy_splitting#{schema}',\n", + " ),\n", + " ],\n", " ),\n", - " 'references': Column(),\n", - " },\n", - " ),\n", - " filter_menus=FilterMenus(\n", - " options={\n", - " 'material': FilterMenu(label='Material'),\n", - " 'elements': FilterMenu(label='Elements / Formula', level=1, size='xl'),\n", - " 'custom_quantities': FilterMenu(label='Custom Quantities', size='l'),\n", - " 'metadata': FilterMenu(label='Visibility / IDs / Schema'),\n", - " }\n", + " ]\n", " ),\n", " dashboard=Dashboard(\n", " widgets=[\n", " WidgetPeriodicTable(\n", " scale='linear',\n", - " quantity='results.material.elements',\n", + " search_quantity='results.material.elements',\n", " layout={'lg': Layout(w=11, h=7, x=0, y=0)},\n", " ),\n", " WidgetScatterPlot(\n", " layout={'lg': Layout(w=7, h=7, x=11, y=0)},\n", - " x=Axis(quantity=f'data.peak_emission_wavelength#{schema}', unit='nm'),\n", - " y=Axis(quantity=f'data.photoluminescence_quantum_yield#{schema}'),\n", + " x=Axis(\n", + " search_quantity=f'data.peak_emission_wavelength#{schema}', unit='nm'\n", + " ),\n", + " y=Axis(search_quantity=f'data.delayed_lifetime#{schema}'),\n", " ),\n", " WidgetTerms(\n", - " type='terms',\n", " layout={'lg': Layout(w=6, h=7, x=18, y=0)},\n", - " quantity='results.material.chemical_formula_hill',\n", + " search_quantity='results.material.chemical_formula_hill',\n", " scale='linear',\n", " ),\n", " WidgetHistogram(\n", @@ -8762,18 +7730,22 @@ " autorange=False,\n", " nbins=30,\n", " scale='1/4',\n", - " quantity=f'data.delayed_lifetime#{schema}',\n", + " x=Axis(search_quantity=f'data.delayed_lifetime#{schema}'),\n", " ),\n", " WidgetHistogram(\n", " layout={'lg': Layout(w=12, h=4, x=12, y=7)},\n", " autorange=False,\n", " nbins=30,\n", " scale='linear',\n", - " quantity=f'data.singlet_triplet_energy_splitting#{schema}',\n", + " x=Axis(\n", + " search_quantity=f'data.singlet_triplet_energy_splitting#{schema}',\n", + " unit='joule',\n", + " ),\n", " ),\n", " ]\n", " ),\n", - ")" + ")\n", + "\n" ] }, { @@ -8784,8 +7756,8 @@ "source": [ "We will not go very deep into app development, but here are the most important things to notice:\n", "\n", - " - `filters`: By default, apps will not load any additional schemas to avoid overcrowding the search bar. Only the \"standardized\" set of information found in `archive.metadata` and `archive.results` is available by default. To load our schema into the app, we define in `filters.include` a pattern that matches all information in our schema.\n", - " - `filter_menus`: This controls which menus will be visible on the left. Currently, there is only a fixed set of available menus, but we are working on a more flexible customization for them as well.\n", + " - `search_quantities`: By default, apps will not load any additional schemas to avoid overcrowding the search bar. Only the \"standardized\" set of information found in `archive.metadata` and `archive.results` is available by default. To load our schema into the app, we define in `search_quantities.include` a pattern that matches all information in our schema.\n", + " - `menus`: This controls the menu layout on the left.\n", " - `filters_locked`: Used to pre-filter the results that this app will show. In our case we say we only want entries that originate from the `TADFMolecule` schema.\n", " - `columns`: This controls which columns will be shown in the results table.\n", " - `dashboard`: Controls which widgets to show by default above the search results.\n", @@ -8814,7 +7786,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "nomad", "language": "python", "name": "python3" }, @@ -8828,7 +7800,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.10" + "version": "3.11.0" } }, "nbformat": 4, diff --git a/gui/src/components/editQuantity/QueryEditQuantity.js b/gui/src/components/editQuantity/QueryEditQuantity.js index 8417258974..31f6b82e3a 100644 --- a/gui/src/components/editQuantity/QueryEditQuantity.js +++ b/gui/src/components/editQuantity/QueryEditQuantity.js @@ -44,7 +44,7 @@ const shownColumns = [ ] const rows = context?.rows const columns = (context?.columns || []) - .map((column) => ({...column, selected: shownColumns.includes(column.quantity)})) + .map((column) => ({...column, selected: shownColumns.includes(column.search_quantity)})) rows.details = {enabled: false} rows.actions = {enabled: false} diff --git a/gui/src/components/entry/properties/SampleHistoryCard.js b/gui/src/components/entry/properties/SampleHistoryCard.js index 0dc26bbb66..0d454f7b0e 100644 --- a/gui/src/components/entry/properties/SampleHistoryCard.js +++ b/gui/src/components/entry/properties/SampleHistoryCard.js @@ -27,14 +27,14 @@ import { ui } from "../../../config" const context = cloneDeep(ui?.apps?.options?.entries) const columns = [ - {quantity: 'entry_name', title: 'Name', align: 'left', selected: true}, - {quantity: 'entry_type', title: 'Entry type', align: 'left', selected: true}, - {quantity: 'entry_create_time', title: 'Entry creation time', align: 'left', selected: true}, - {quantity: 'upload_name', title: 'Upload name', align: 'left'}, - {quantity: 'upload_id', title: 'Upload id', align: 'left'}, - {quantity: 'upload_create_time', title: 'Upload time', align: 'left'}, - {quantity: 'authors', title: 'Authors', align: 'left', sortable: false}, - {quantity: 'results.eln.lab_ids', title: 'IDs'} + {search_quantity: 'entry_name', title: 'Name', align: 'left', selected: true}, + {search_quantity: 'entry_type', title: 'Entry type', align: 'left', selected: true}, + {search_quantity: 'entry_create_time', title: 'Entry creation time', align: 'left', selected: true}, + {search_quantity: 'upload_name', title: 'Upload name', align: 'left'}, + {search_quantity: 'upload_id', title: 'Upload id', align: 'left'}, + {search_quantity: 'upload_create_time', title: 'Upload time', align: 'left'}, + {search_quantity: 'authors', title: 'Authors', align: 'left', sortable: false}, + {search_quantity: 'results.eln.lab_ids', title: 'IDs'} ] context.colums = columns diff --git a/gui/src/components/search/SearchContext.js b/gui/src/components/search/SearchContext.js index bbedb85215..c54c7457ac 100644 --- a/gui/src/components/search/SearchContext.js +++ b/gui/src/components/search/SearchContext.js @@ -249,11 +249,11 @@ export const SearchContextRaw = React.memo(({ let options = cloneDeep(initialColumns) options.forEach(option => { - const parseResults = parseJMESPath(option.quantity) + const parseResults = parseJMESPath(option.search_quantity) if (parseResults.error) { - throw Error(`Invalid JMESPath query in the app columns: ${option.quantity}`) + throw Error(`Invalid JMESPath query in the app columns: ${option.search_quantity}`) } - option.sortable = parseResults.quantity === option.quantity + option.sortable = parseResults.quantity === option.search_quantity const filter = initialSearchQuantities[parseResults.quantity] const storageUnit = filter?.unit const displayUnit = option.unit @@ -362,9 +362,9 @@ export const SearchContextRaw = React.memo(({ } // Add key, defaults, and custom overrides - options = options.map((column) => ({...column, key: column.quantity})) + options = options.map((column) => ({...column, key: column.search_quantity})) addColumnDefaults(options, undefined, initialSearchQuantities) - options = options.map((column) => ({...column, ...(overrides[column.quantity] || {})})) + options = options.map((column) => ({...column, ...(overrides[column.search_quantity] || {})})) return options }, [initialSearchQuantities, initialColumns, user, units]) diff --git a/gui/src/components/search/SearchContext.spec.js b/gui/src/components/search/SearchContext.spec.js index 282c4fe9df..df4a3e1607 100644 --- a/gui/src/components/search/SearchContext.spec.js +++ b/gui/src/components/search/SearchContext.spec.js @@ -125,22 +125,22 @@ describe('reading query from URL', function() { }) }) -describe.only('test that final column information is generated correctly', function() { +describe('test that final column information is generated correctly', function() { test.each([ ['default unit, default label', {}, new Filter({name: 'test_filter'}, {group: 'test', unit: 'joule'}), 'Test filter (eV)'], ['custom label, default unit', {title: 'Testing'}, new Filter(undefined, {group: 'test', unit: 'joule'}), 'Testing (eV)'], ['default label, custom unit', {}, new Filter({name: 'test_filter'}, {group: 'test', unit: 'joule'}), 'Test filter (eV)'], ['custom label, custom unit', {title: 'Testing', unit: 'Ha'}, new Filter(undefined, {group: 'test', unit: 'joule'}), 'Testing (Ha)'] ])('%s', async (name, column, filter, label) => { - const quantity = 'test_filter' + const search_quantity = 'test_filter' const { result: resultUseSearchContext } = renderHook(() => useSearchContext(), { wrapper: (props) => <Wrapper - initialSearchQuantities={{[quantity]: filter}} - initialColumns={[{quantity, ...column}]} + initialSearchQuantities={{[search_quantity]: filter}} + initialColumns={[{search_quantity, ...column}]} {...props} />}) const columns = resultUseSearchContext.current.columns for (const column of columns) { - if (column.quantity === quantity) { + if (column.search_quantity === search_quantity) { expect(column.label).toBe(label) } } diff --git a/gui/src/components/search/SearchResults.js b/gui/src/components/search/SearchResults.js index e0016f3b81..07969485b1 100644 --- a/gui/src/components/search/SearchResults.js +++ b/gui/src/components/search/SearchResults.js @@ -71,7 +71,7 @@ export const SearchResults = React.memo(({ const shownColumns = columns ? columns .filter((column) => column.selected) - .map((column) => column.quantity) + .map((column) => column.search_quantity) : [] useEffect(() => { diff --git a/gui/src/components/search/SearchResults.spec.js b/gui/src/components/search/SearchResults.spec.js index cdfc0de37d..a51d3842e1 100644 --- a/gui/src/components/search/SearchResults.spec.js +++ b/gui/src/components/search/SearchResults.spec.js @@ -68,13 +68,13 @@ jest.mock('./SearchContext', () => ({ describe('test search columns', () => { test.each([ - ['boolean scalar', {quantity: 'my_boolean', selected: true}, 'My boolean', 'True', true], - ['float scalar', {quantity: 'my_float', selected: true, format: {decimals: 2}}, 'My float', '1.23', true], - ['float from repeating section', {quantity: 'repeated_section[*].my_float', selected: true, format: {decimals: 2}}, 'My float', '1.23, 2.35', false], - ['float from nested repeating section', {quantity: 'repeated_section_outer[*].repeated_section_inner[*].my_float', selected: true, format: {decimals: 2}}, 'My float', '1.23, 2.35, 3.46', false], - ['float from array', {quantity: 'my_float_array', selected: true, format: {decimals: 2}}, 'My float array', '1.23, 2.35', false], - ['custom title', {quantity: 'my_float', title: 'Custom', selected: true, format: {decimals: 2}}, 'Custom', '1.23', true], - ['custom quantity', {quantity: 'data.my_float#my_plugin.schema_packages.my_schema.MySchema.my_float', selected: true, format: {decimals: 2}}, 'My float', '1.23', true] + ['boolean scalar', {search_quantity: 'my_boolean', selected: true}, 'My boolean', 'True', true], + ['float scalar', {search_quantity: 'my_float', selected: true, format: {decimals: 2}}, 'My float', '1.23', true], + ['float from repeating section', {search_quantity: 'repeated_section[*].my_float', selected: true, format: {decimals: 2}}, 'My float', '1.23, 2.35', false], + ['float from nested repeating section', {search_quantity: 'repeated_section_outer[*].repeated_section_inner[*].my_float', selected: true, format: {decimals: 2}}, 'My float', '1.23, 2.35, 3.46', false], + ['float from array', {search_quantity: 'my_float_array', selected: true, format: {decimals: 2}}, 'My float array', '1.23, 2.35', false], + ['custom title', {search_quantity: 'my_float', title: 'Custom', selected: true, format: {decimals: 2}}, 'Custom', '1.23', true], + ['custom quantity', {search_quantity: 'data.my_float#my_plugin.schema_packages.my_schema.MySchema.my_float', selected: true, format: {decimals: 2}}, 'My float', '1.23', true] ])('%s', async (name, column, expected_title, expected_value, sortable) => { render( <SearchContextRaw @@ -95,7 +95,7 @@ describe('test search columns', () => { ) screen.getByText(expected_title) screen.getByText(expected_value) - const sortButton = screen.queryByTestId(`sortable_${column.quantity}`) + const sortButton = screen.queryByTestId(`sortable_${column.search_quantity}`) if (sortable) { expect(sortButton).not.toBeNull() } else { diff --git a/gui/src/components/search/conftest.spec.js b/gui/src/components/search/conftest.spec.js index 0e49362b7a..6a700ad967 100644 --- a/gui/src/components/search/conftest.spec.js +++ b/gui/src/components/search/conftest.spec.js @@ -343,9 +343,9 @@ export async function expectSearchResults(columns, root = screen) { const columnLabels = columns .filter((column) => column.selected) .map((column) => { - const quantity = column.quantity - const unit = column.unit || defaultFilterData[quantity]?.unit - const label = column.label || defaultFilterData[quantity]?.label || getDisplayLabel({name: quantity.split('.').slice(-1)[0]}) + const searchQuantity = column.search_quantity + const unit = column.unit || defaultFilterData[searchQuantity]?.unit + const label = column.label || defaultFilterData[searchQuantity]?.label || getDisplayLabel({name: searchQuantity.split('.').slice(-1)[0]}) return unit ? `${label} (${new Unit(unit).label()})` : label diff --git a/gui/src/components/search/widgets/WidgetScatterPlot.js b/gui/src/components/search/widgets/WidgetScatterPlot.js index 7f56fefdeb..04fd99367b 100644 --- a/gui/src/components/search/widgets/WidgetScatterPlot.js +++ b/gui/src/components/search/widgets/WidgetScatterPlot.js @@ -122,7 +122,7 @@ export const WidgetScatterPlot = React.memo(( yAxis: getAxisConfig(y, filterData, units), colorAxis: markers?.color ? getAxisConfig(markers.color, filterData, units) : {} } - }, [error, filterData, markers.color, x, units, y]) + }, [error, filterData, markers?.color, x, units, y]) const setXFilter = useSetFilter(xAxis.search_quantity) const setYFilter = useSetFilter(yAxis.search_quantity) diff --git a/gui/src/components/search/widgets/WidgetScatterPlot.spec.js b/gui/src/components/search/widgets/WidgetScatterPlot.spec.js index 161994bbd9..b2fb9cd182 100644 --- a/gui/src/components/search/widgets/WidgetScatterPlot.spec.js +++ b/gui/src/components/search/widgets/WidgetScatterPlot.spec.js @@ -148,18 +148,19 @@ describe('test custom axis units', () => { describe('test different colors', () => { test.each([ - ['empty', undefined, undefined, []], - ['scalar integer', 'results.material.n_elements', {search_quantity: 'results.material.n_elements'}, []], - ['scalar float', 'results.properties.geometry_optimization.final_energy_difference', {search_quantity: 'results.properties.geometry_optimization.final_energy_difference'}, []], - ['scalar string', 'results.material.chemical_formula_hill', undefined, ['Si2', 'CO2']], - ['array string', 'results.material.elements', undefined, ['Si', 'C, O']] - ])('%s', async (name, axis, colorTitle, legend) => { + ['empty markers', undefined, undefined, []], + ['empty color', {}, undefined, []], + ['scalar integer', {color: {search_quantity: 'results.material.n_elements'}}, {search_quantity: 'results.material.n_elements'}, []], + ['scalar float', {color: {search_quantity: 'results.properties.geometry_optimization.final_energy_difference'}}, {search_quantity: 'results.properties.geometry_optimization.final_energy_difference'}, []], + ['scalar string', {color: {search_quantity: 'results.material.chemical_formula_hill'}}, undefined, ['Si2', 'CO2']], + ['array string', {color: {search_quantity: 'results.material.elements'}}, undefined, ['Si', 'C, O']] + ])('%s', async (name, markers, colorTitle, legend) => { const config = { id: '0', scale: 'linear', x: {search_quantity: 'results.material.n_elements'}, y: {search_quantity: 'results.material.n_elements'}, - markers: {color: {search_quantity: axis}} + markers: markers } renderSearchEntry(<WidgetScatterPlot {...config} />) await expectWidgetScatterPlot(config, false, colorTitle, legend) diff --git a/gui/src/components/uploads/SectionSelectDialog.js b/gui/src/components/uploads/SectionSelectDialog.js index 9187165cd6..acefa519c6 100644 --- a/gui/src/components/uploads/SectionSelectDialog.js +++ b/gui/src/components/uploads/SectionSelectDialog.js @@ -198,7 +198,7 @@ Details.propTypes = { } const columns = (context?.columns || []) - .map((column) => ({...column, selected: shownColumns.includes(column.quantity)})) + .map((column) => ({...column, selected: shownColumns.includes(column.search_quantity)})) const rows = context?.rows rows.details = {enabled: true, render: Details} rows.actions = {enabled: false} diff --git a/gui/tests/env.js b/gui/tests/env.js index 33faca4662..d0a3b27971 100644 --- a/gui/tests/env.js +++ b/gui/tests/env.js @@ -441,158 +441,158 @@ window.nomadEnv = { }, "columns": [ { - "quantity": "entry_name", + "search_quantity": "entry_name", "selected": true, "title": "Name", "label": "Name", "align": "left" }, { - "quantity": "results.material.chemical_formula_hill", + "search_quantity": "results.material.chemical_formula_hill", "selected": true, "title": "Formula", "label": "Formula", "align": "left" }, { - "quantity": "entry_type", + "search_quantity": "entry_type", "selected": true, "align": "left" }, { - "quantity": "entry_create_time", + "search_quantity": "entry_create_time", "selected": false, "align": "left" }, { - "quantity": "upload_name", + "search_quantity": "upload_name", "selected": false, "align": "left" }, { - "quantity": "upload_id", + "search_quantity": "upload_id", "selected": false, "align": "left" }, { - "quantity": "upload_create_time", + "search_quantity": "upload_create_time", "selected": true, "title": "Upload time", "label": "Upload time", "align": "left" }, { - "quantity": "authors", + "search_quantity": "authors", "selected": true, "align": "left" }, { - "quantity": "results.method.method_name", + "search_quantity": "results.method.method_name", "selected": false, "align": "left" }, { - "quantity": "results.method.simulation.program_name", + "search_quantity": "results.method.simulation.program_name", "selected": false, "align": "left" }, { - "quantity": "results.method.simulation.dft.xc_functional_type", + "search_quantity": "results.method.simulation.dft.xc_functional_type", "selected": false, "align": "left" }, { - "quantity": "results.method.simulation.precision.apw_cutoff", + "search_quantity": "results.method.simulation.precision.apw_cutoff", "selected": false, "align": "left" }, { - "quantity": "results.method.simulation.precision.basis_set", + "search_quantity": "results.method.simulation.precision.basis_set", "selected": false, "align": "left" }, { - "quantity": "results.method.simulation.precision.k_line_density", + "search_quantity": "results.method.simulation.precision.k_line_density", "selected": false, "align": "left" }, { - "quantity": "results.method.simulation.precision.native_tier", + "search_quantity": "results.method.simulation.precision.native_tier", "selected": false, "align": "left" }, { - "quantity": "results.method.simulation.precision.planewave_cutoff", + "search_quantity": "results.method.simulation.precision.planewave_cutoff", "selected": false, "align": "left" }, { - "quantity": "results.material.structural_type", + "search_quantity": "results.material.structural_type", "selected": false, "align": "left" }, { - "quantity": "results.material.symmetry.crystal_system", + "search_quantity": "results.material.symmetry.crystal_system", "selected": false, "align": "left" }, { - "quantity": "results.material.symmetry.space_group_symbol", + "search_quantity": "results.material.symmetry.space_group_symbol", "selected": false, "align": "left" }, { - "quantity": "results.material.symmetry.space_group_number", + "search_quantity": "results.material.symmetry.space_group_number", "selected": false, "align": "left" }, { - "quantity": "results.eln.lab_ids", + "search_quantity": "results.eln.lab_ids", "selected": false, "align": "left" }, { - "quantity": "results.eln.sections", + "search_quantity": "results.eln.sections", "selected": false, "align": "left" }, { - "quantity": "results.eln.methods", + "search_quantity": "results.eln.methods", "selected": false, "align": "left" }, { - "quantity": "results.eln.tags", + "search_quantity": "results.eln.tags", "selected": false, "align": "left" }, { - "quantity": "results.eln.instruments", + "search_quantity": "results.eln.instruments", "selected": false, "align": "left" }, { - "quantity": "mainfile", + "search_quantity": "mainfile", "selected": false, "align": "left" }, { - "quantity": "comment", + "search_quantity": "comment", "selected": false, "align": "left" }, { - "quantity": "references", + "search_quantity": "references", "selected": false, "align": "left" }, { - "quantity": "datasets", + "search_quantity": "datasets", "selected": false, "align": "left" }, { - "quantity": "published", + "search_quantity": "published", "selected": false, "title": "Access", "label": "Access", @@ -2409,113 +2409,113 @@ window.nomadEnv = { }, "columns": [ { - "quantity": "results.material.chemical_formula_hill", + "search_quantity": "results.material.chemical_formula_hill", "selected": true, "title": "Formula", "label": "Formula", "align": "left" }, { - "quantity": "results.method.simulation.program_name", + "search_quantity": "results.method.simulation.program_name", "selected": true, "align": "left" }, { - "quantity": "results.method.method_name", + "search_quantity": "results.method.method_name", "selected": true, "align": "left" }, { - "quantity": "results.method.simulation.dft.xc_functional_type", + "search_quantity": "results.method.simulation.dft.xc_functional_type", "selected": true, "align": "left" }, { - "quantity": "upload_create_time", + "search_quantity": "upload_create_time", "selected": true, "title": "Upload time", "label": "Upload time", "align": "left" }, { - "quantity": "authors", + "search_quantity": "authors", "selected": true, "align": "left" }, { - "quantity": "results.method.simulation.precision.apw_cutoff", + "search_quantity": "results.method.simulation.precision.apw_cutoff", "selected": false, "align": "left" }, { - "quantity": "results.method.simulation.precision.basis_set", + "search_quantity": "results.method.simulation.precision.basis_set", "selected": false, "align": "left" }, { - "quantity": "results.method.simulation.precision.k_line_density", + "search_quantity": "results.method.simulation.precision.k_line_density", "selected": false, "align": "left" }, { - "quantity": "results.method.simulation.precision.native_tier", + "search_quantity": "results.method.simulation.precision.native_tier", "selected": false, "align": "left" }, { - "quantity": "results.method.simulation.precision.planewave_cutoff", + "search_quantity": "results.method.simulation.precision.planewave_cutoff", "selected": false, "align": "left" }, { - "quantity": "results.material.structural_type", + "search_quantity": "results.material.structural_type", "selected": false, "align": "left" }, { - "quantity": "results.material.symmetry.crystal_system", + "search_quantity": "results.material.symmetry.crystal_system", "selected": false, "align": "left" }, { - "quantity": "results.material.symmetry.space_group_symbol", + "search_quantity": "results.material.symmetry.space_group_symbol", "selected": false, "align": "left" }, { - "quantity": "results.material.symmetry.space_group_number", + "search_quantity": "results.material.symmetry.space_group_number", "selected": false, "align": "left" }, { - "quantity": "entry_name", + "search_quantity": "entry_name", "selected": false, "title": "Name", "label": "Name", "align": "left" }, { - "quantity": "mainfile", + "search_quantity": "mainfile", "selected": false, "align": "left" }, { - "quantity": "comment", + "search_quantity": "comment", "selected": false, "align": "left" }, { - "quantity": "references", + "search_quantity": "references", "selected": false, "align": "left" }, { - "quantity": "datasets", + "search_quantity": "datasets", "selected": false, "align": "left" }, { - "quantity": "published", + "search_quantity": "published", "selected": false, "title": "Access", "label": "Access", @@ -4077,39 +4077,39 @@ window.nomadEnv = { }, "columns": [ { - "quantity": "chemical_formula_hill", + "search_quantity": "chemical_formula_hill", "selected": true, "title": "Formula", "label": "Formula", "align": "left" }, { - "quantity": "structural_type", + "search_quantity": "structural_type", "selected": true, "align": "left" }, { - "quantity": "symmetry.structure_name", + "search_quantity": "symmetry.structure_name", "selected": true, "align": "left" }, { - "quantity": "symmetry.space_group_number", + "search_quantity": "symmetry.space_group_number", "selected": true, "align": "left" }, { - "quantity": "symmetry.crystal_system", + "search_quantity": "symmetry.crystal_system", "selected": true, "align": "left" }, { - "quantity": "symmetry.space_group_symbol", + "search_quantity": "symmetry.space_group_symbol", "selected": false, "align": "left" }, { - "quantity": "material_id", + "search_quantity": "material_id", "selected": false, "align": "left" } @@ -5359,88 +5359,88 @@ window.nomadEnv = { }, "columns": [ { - "quantity": "entry_name", + "search_quantity": "entry_name", "selected": true, "title": "Name", "label": "Name", "align": "left" }, { - "quantity": "entry_type", + "search_quantity": "entry_type", "selected": true, "align": "left" }, { - "quantity": "upload_create_time", + "search_quantity": "upload_create_time", "selected": true, "title": "Upload time", "label": "Upload time", "align": "left" }, { - "quantity": "authors", + "search_quantity": "authors", "selected": true, "align": "left" }, { - "quantity": "results.material.chemical_formula_hill", + "search_quantity": "results.material.chemical_formula_hill", "selected": false, "title": "Formula", "label": "Formula", "align": "left" }, { - "quantity": "results.method.method_name", + "search_quantity": "results.method.method_name", "selected": false, "align": "left" }, { - "quantity": "results.eln.lab_ids", + "search_quantity": "results.eln.lab_ids", "selected": false, "align": "left" }, { - "quantity": "results.eln.sections", + "search_quantity": "results.eln.sections", "selected": false, "align": "left" }, { - "quantity": "results.eln.methods", + "search_quantity": "results.eln.methods", "selected": false, "align": "left" }, { - "quantity": "results.eln.tags", + "search_quantity": "results.eln.tags", "selected": false, "align": "left" }, { - "quantity": "results.eln.instruments", + "search_quantity": "results.eln.instruments", "selected": false, "align": "left" }, { - "quantity": "mainfile", + "search_quantity": "mainfile", "selected": false, "align": "left" }, { - "quantity": "comment", + "search_quantity": "comment", "selected": false, "align": "left" }, { - "quantity": "references", + "search_quantity": "references", "selected": false, "align": "left" }, { - "quantity": "datasets", + "search_quantity": "datasets", "selected": false, "align": "left" }, { - "quantity": "published", + "search_quantity": "published", "selected": false, "title": "Access", "label": "Access", @@ -5855,78 +5855,78 @@ window.nomadEnv = { }, "columns": [ { - "quantity": "results.material.chemical_formula_hill", + "search_quantity": "results.material.chemical_formula_hill", "selected": true, "title": "Formula", "label": "Formula", "align": "left" }, { - "quantity": "results.properties.spectroscopic.spectra.provenance.eels.detector_type", + "search_quantity": "results.properties.spectroscopic.spectra.provenance.eels.detector_type", "selected": true, "align": "left" }, { - "quantity": "results.properties.spectroscopic.spectra.provenance.eels.resolution", + "search_quantity": "results.properties.spectroscopic.spectra.provenance.eels.resolution", "selected": true, "align": "left" }, { - "quantity": "upload_create_time", + "search_quantity": "upload_create_time", "selected": true, "title": "Upload time", "label": "Upload time", "align": "left" }, { - "quantity": "authors", + "search_quantity": "authors", "selected": true, "align": "left" }, { - "quantity": "results.properties.spectroscopic.spectra.provenance.eels.min_energy", + "search_quantity": "results.properties.spectroscopic.spectra.provenance.eels.min_energy", "selected": false, "align": "left" }, { - "quantity": "results.properties.spectroscopic.spectra.provenance.eels.max_energy", + "search_quantity": "results.properties.spectroscopic.spectra.provenance.eels.max_energy", "selected": false, "align": "left" }, { - "quantity": "entry_name", + "search_quantity": "entry_name", "selected": false, "title": "Name", "label": "Name", "align": "left" }, { - "quantity": "entry_type", + "search_quantity": "entry_type", "selected": false, "align": "left" }, { - "quantity": "mainfile", + "search_quantity": "mainfile", "selected": false, "align": "left" }, { - "quantity": "comment", + "search_quantity": "comment", "selected": false, "align": "left" }, { - "quantity": "references", + "search_quantity": "references", "selected": false, "align": "left" }, { - "quantity": "datasets", + "search_quantity": "datasets", "selected": false, "align": "left" }, { - "quantity": "published", + "search_quantity": "published", "selected": false, "title": "Access", "label": "Access", @@ -7465,47 +7465,47 @@ window.nomadEnv = { }, "columns": [ { - "quantity": "entry_id", + "search_quantity": "entry_id", "selected": false, "align": "left" }, { - "quantity": "entry_type", + "search_quantity": "entry_type", "selected": false, "title": "Entry type", "label": "Entry type", "align": "left" }, { - "quantity": "authors", + "search_quantity": "authors", "selected": true, "title": "Authors", "label": "Authors", "align": "left" }, { - "quantity": "data.name#nomad_aitoolkit.schema.AIToolkitNotebook", + "search_quantity": "data.name#nomad_aitoolkit.schema.AIToolkitNotebook", "selected": true, "title": "Name", "label": "Name", "align": "left" }, { - "quantity": "data.category#nomad_aitoolkit.schema.AIToolkitNotebook", + "search_quantity": "data.category#nomad_aitoolkit.schema.AIToolkitNotebook", "selected": true, "title": "Category", "label": "Category", "align": "left" }, { - "quantity": "data.platform#nomad_aitoolkit.schema.AIToolkitNotebook", + "search_quantity": "data.platform#nomad_aitoolkit.schema.AIToolkitNotebook", "selected": false, "title": "Platform", "label": "Platform", "align": "left" }, { - "quantity": "data.date#nomad_aitoolkit.schema.AIToolkitNotebook", + "search_quantity": "data.date#nomad_aitoolkit.schema.AIToolkitNotebook", "selected": true, "title": "Last update", "label": "Last update", @@ -7905,41 +7905,41 @@ window.nomadEnv = { }, "columns": [ { - "quantity": "results.material.chemical_formula_iupac", + "search_quantity": "results.material.chemical_formula_iupac", "selected": true, "title": "Formula", "label": "Formula", "align": "left" }, { - "quantity": "mainfile", + "search_quantity": "mainfile", "selected": true, "align": "left" }, { - "quantity": "upload_create_time", + "search_quantity": "upload_create_time", "selected": false, "title": "Upload time", "label": "Upload time", "align": "left" }, { - "quantity": "authors", + "search_quantity": "authors", "selected": true, "align": "left" }, { - "quantity": "comment", + "search_quantity": "comment", "selected": false, "align": "left" }, { - "quantity": "datasets", + "search_quantity": "datasets", "selected": false, "align": "left" }, { - "quantity": "published", + "search_quantity": "published", "selected": false, "title": "Access", "label": "Access", @@ -8829,14 +8829,14 @@ window.nomadEnv = { }, "columns": [ { - "quantity": "results.material.chemical_formula_descriptive", + "search_quantity": "results.material.chemical_formula_descriptive", "selected": true, "title": "Descriptive formula", "label": "Descriptive formula", "align": "left" }, { - "quantity": "results.properties.optoelectronic.solar_cell.efficiency", + "search_quantity": "results.properties.optoelectronic.solar_cell.efficiency", "selected": true, "title": "Efficiency (%)", "label": "Efficiency (%)", @@ -8847,7 +8847,7 @@ window.nomadEnv = { } }, { - "quantity": "results.properties.optoelectronic.solar_cell.open_circuit_voltage", + "search_quantity": "results.properties.optoelectronic.solar_cell.open_circuit_voltage", "selected": true, "align": "left", "unit": "V", @@ -8857,7 +8857,7 @@ window.nomadEnv = { } }, { - "quantity": "results.properties.optoelectronic.solar_cell.short_circuit_current_density", + "search_quantity": "results.properties.optoelectronic.solar_cell.short_circuit_current_density", "selected": true, "align": "left", "unit": "A/m**2", @@ -8867,7 +8867,7 @@ window.nomadEnv = { } }, { - "quantity": "results.properties.optoelectronic.solar_cell.fill_factor", + "search_quantity": "results.properties.optoelectronic.solar_cell.fill_factor", "selected": true, "align": "left", "format": { @@ -8876,24 +8876,24 @@ window.nomadEnv = { } }, { - "quantity": "references", + "search_quantity": "references", "selected": true, "align": "left" }, { - "quantity": "results.material.chemical_formula_hill", + "search_quantity": "results.material.chemical_formula_hill", "selected": false, "title": "Formula", "label": "Formula", "align": "left" }, { - "quantity": "results.material.structural_type", + "search_quantity": "results.material.structural_type", "selected": false, "align": "left" }, { - "quantity": "results.properties.optoelectronic.solar_cell.illumination_intensity", + "search_quantity": "results.properties.optoelectronic.solar_cell.illumination_intensity", "selected": false, "title": "Illum. intensity", "label": "Illum. intensity", @@ -8905,71 +8905,71 @@ window.nomadEnv = { } }, { - "quantity": "results.eln.lab_ids", + "search_quantity": "results.eln.lab_ids", "selected": false, "align": "left" }, { - "quantity": "results.eln.sections", + "search_quantity": "results.eln.sections", "selected": false, "align": "left" }, { - "quantity": "results.eln.methods", + "search_quantity": "results.eln.methods", "selected": false, "align": "left" }, { - "quantity": "results.eln.tags", + "search_quantity": "results.eln.tags", "selected": false, "align": "left" }, { - "quantity": "results.eln.instruments", + "search_quantity": "results.eln.instruments", "selected": false, "align": "left" }, { - "quantity": "entry_name", + "search_quantity": "entry_name", "selected": false, "title": "Name", "label": "Name", "align": "left" }, { - "quantity": "entry_type", + "search_quantity": "entry_type", "selected": false, "align": "left" }, { - "quantity": "mainfile", + "search_quantity": "mainfile", "selected": false, "align": "left" }, { - "quantity": "upload_create_time", + "search_quantity": "upload_create_time", "selected": false, "title": "Upload time", "label": "Upload time", "align": "left" }, { - "quantity": "authors", + "search_quantity": "authors", "selected": false, "align": "left" }, { - "quantity": "comment", + "search_quantity": "comment", "selected": false, "align": "left" }, { - "quantity": "datasets", + "search_quantity": "datasets", "selected": false, "align": "left" }, { - "quantity": "published", + "search_quantity": "published", "selected": false, "title": "Access", "label": "Access", diff --git a/nomad/config/models/ui.py b/nomad/config/models/ui.py index d92e549ee9..3a1e20a7e2 100644 --- a/nomad/config/models/ui.py +++ b/nomad/config/models/ui.py @@ -259,7 +259,7 @@ class Column(ConfigBaseModel): - Show instance that matches a criterion: `repeating_section[?label=='target'].quantity` """ - quantity: Optional[str] = Field( + search_quantity: Optional[str] = Field( description=""" Path of the targeted quantity. Note that you can most of the features JMESPath syntax here to further specify a selection of values. This @@ -267,6 +267,9 @@ class Column(ConfigBaseModel): statistical values. """ ) + quantity: Optional[str] = Field( + deprecated='The "quantity" field is deprecated, use "search_quantity" instead.' + ) selected: bool = Field( False, description="""Is this column initially selected to be shown.""" ) @@ -287,6 +290,13 @@ class Column(ConfigBaseModel): @root_validator(pre=True) def _validate(cls, values): + # Backwards compatibility for quantity. + quantity = values.get('quantity') + search_quantity = values.get('search_quantity') + if quantity is not None and search_quantity is None: + values['search_quantity'] = quantity + del values['quantity'] + # Backwards compatibility for label label = values.get('label') title = values.get('title') -- GitLab