generated from FAIRmat-NFDI/nomad-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d80ae9e
commit 4e0cd53
Showing
9 changed files
with
261 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,9 @@ | ||
from nomad.config.models.plugins import AppEntryPoint | ||
from nomad.config.models.ui import App, Column, Columns, FilterMenu, FilterMenus | ||
|
||
from nomad_tadf_molecules.apps.tadf_molecules import tadf_molecules_app | ||
|
||
myapp = AppEntryPoint( | ||
name='MyApp', | ||
description='App defined using the new plugin mechanism.', | ||
app=App( | ||
label='MyApp', | ||
path='myapp', | ||
category='simulation', | ||
columns=Columns( | ||
selected=['entry_id'], | ||
options={ | ||
'entry_id': Column(), | ||
}, | ||
), | ||
filter_menus=FilterMenus( | ||
options={ | ||
'material': FilterMenu(label='Material'), | ||
} | ||
), | ||
), | ||
tadf_molecules = AppEntryPoint( | ||
name='TADF Molecules', | ||
description='Search information about thermally activated delayed fluorescent (TADF) molecules.', | ||
app=tadf_molecules_app, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
from nomad.config.models.ui import ( | ||
App, | ||
Axis, | ||
Column, | ||
Columns, | ||
Dashboard, | ||
FilterMenu, | ||
FilterMenus, | ||
Filters, | ||
Layout, | ||
WidgetPeriodicTable, | ||
WidgetHistogram, | ||
WidgetScatterPlot, | ||
WidgetTerms, | ||
) | ||
|
||
schema = 'nomad_tadf_molecules.schema_packages.tadf.TADFMolecule' | ||
tadf_molecules_app = App( | ||
label='Fluorescent Molecules', | ||
path='fluorescent-molecules', | ||
description='Search for fluorescent molecule data', | ||
category='Experiment', | ||
filters=Filters(include=[f'*#{schema}'],), | ||
filters_locked={'section_defs.definition_qualified_name': schema}, | ||
columns=Columns( | ||
selected=[ | ||
'results.material.chemical_formula_hill', | ||
f'data.photoluminescence_quantum_yield#{schema}', | ||
f'data.peak_emission_wavelength#{schema}', | ||
f'data.delayed_lifetime#{schema}', | ||
f'data.singlet_triplet_energy_splitting#{schema}', | ||
f'data.DOI_number#{schema}', | ||
], | ||
options={ | ||
'results.material.chemical_formula_hill': Column(), | ||
f'data.photoluminescence_quantum_yield#{schema}': Column(), | ||
f'data.peak_emission_wavelength#{schema}': Column(), | ||
f'data.delayed_lifetime#{schema}': Column(), | ||
f'data.singlet_triplet_energy_splitting#{schema}': Column(), | ||
f'data.DOI_number#{schema}': Column(), | ||
} | ||
), | ||
filter_menus=FilterMenus( | ||
options={ | ||
'material': FilterMenu(label='Material'), | ||
'elements': FilterMenu(label='Elements / Formula', level=1, size='xl'), | ||
'custom_quantities': FilterMenu(label='Custom Quantities', size='l'), | ||
} | ||
), | ||
dashboard=Dashboard( | ||
widgets=[ | ||
WidgetPeriodicTable( | ||
type='periodictable', | ||
scale='linear', | ||
quantity='results.material.elements', | ||
layout={'lg': Layout(w=11, h=7, x=0, y=0)}, | ||
), | ||
WidgetScatterPlot( | ||
type='scatterplot', | ||
layout={'lg':Layout(w=7, h=7, x=11, y=0)}, | ||
x=Axis(quantity=f'data.peak_emission_wavelength#{schema}', unit='nm'), | ||
y=Axis(quantity=f'data.photoluminescence_quantum_yield#{schema}'), | ||
), | ||
WidgetTerms( | ||
type='terms', | ||
layout={'lg': Layout(w=6, h=7, x=18, y=0)}, | ||
quantity='results.material.chemical_fomula_fill', | ||
scale='linear', | ||
), | ||
WidgetHistogram( | ||
type='histogram', | ||
layout={'lg': Layout(w=12, h=4, x=12, y=7)}, | ||
autorange=True, | ||
nbins=30, | ||
scale='linear', | ||
quantity=f'data.delayed_lifetime#{schema}', | ||
), | ||
WidgetHistogram( | ||
type='histogram', | ||
layout={'lg': Layout(w=12, h=4, x=12, y=7)}, | ||
autorange=True, | ||
nbins=30, | ||
scale='linear', | ||
quantity=f'data.singlet_triplet_energy_splitting#{schema}', | ||
) | ||
] | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
from nomad.config.models.plugins import ParserEntryPoint | ||
from pydantic import Field | ||
|
||
|
||
class MyParserEntryPoint(ParserEntryPoint): | ||
parameter: int = Field(0, description='Custom configuration parameter') | ||
|
||
class TADFMoleculesParserEntryPoint(ParserEntryPoint): | ||
def load(self): | ||
from nomad_tadf_molecules.parsers.myparser import MyParser | ||
from nomad_tadf_molecules.parsers.tadf_molecules import TADFMoleculesParser | ||
|
||
return MyParser(**self.dict()) | ||
return TADFMoleculesParser(**self.dict()) | ||
|
||
|
||
myparser = MyParserEntryPoint( | ||
name='MyParser', | ||
description='Parser defined using the new plugin mechanism.', | ||
mainfile_name_re='.*\.myparser', | ||
tadf_molecules = TADFMoleculesParserEntryPoint( | ||
name='TADFMoleculesParser', | ||
description='Used to parse information about thermally activated fluorescent molecules from JSON files.', | ||
mainfile_name_re='.*molecule\d+.json', | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import json | ||
|
||
from nomad.datamodel.datamodel import EntryArchive | ||
from nomad.parsing.parser import MatchingParser | ||
from nomad.units import ureg | ||
from structlog.stdlib import BoundLogger | ||
|
||
from nomad_tadf_molecules.schema_packages.tadf_molecules import TADFMolecule | ||
|
||
|
||
class TADFMoleculesParser(MatchingParser): | ||
def parse( | ||
self, | ||
mainfile: str, | ||
archive: EntryArchive, | ||
logger: BoundLogger, | ||
) -> None: | ||
# Extract file contents | ||
with open(mainfile) as file: | ||
raw = json.load(file) | ||
|
||
# Fill information about the chemical composition | ||
schema_instance = TADFMolecule() | ||
schema_instance.DOI_number = raw['doi'] | ||
schema_instance.name = raw['abbreviated_name'] | ||
schema_instance.iupac_name = raw['iupac_name'] | ||
schema_instance.smile = raw['smiles'] | ||
|
||
# Extract the four measured properties | ||
for name in [ | ||
'photoluminescence_quantum_yield', | ||
'peak_emission_wavelength', | ||
'delayed_lifetime', | ||
'singlet_triplet_energy_splitting', | ||
]: | ||
value = raw.get(f'{name}_value') | ||
if value is not None: | ||
setattr(schema_instance, name, value * ureg(raw[f'{name}_unit'])) | ||
|
||
# Save schema instance into archive.data | ||
archive.data = schema_instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
from nomad.config.models.plugins import SchemaPackageEntryPoint | ||
from pydantic import Field | ||
|
||
|
||
class MySchemaPackageEntryPoint(SchemaPackageEntryPoint): | ||
parameter: int = Field(0, description='Custom configuration parameter') | ||
|
||
class TADFMoleculesSchemaPackageEntryPoint(SchemaPackageEntryPoint): | ||
def load(self): | ||
from nomad_tadf_molecules.schema_packages.mypackage import m_package | ||
from nomad_tadf_molecules.schema_packages.tadf_molecules import m_package | ||
|
||
return m_package | ||
|
||
|
||
mypackage = MySchemaPackageEntryPoint( | ||
name='MyPackage', | ||
description='Schema package defined using the new plugin mechanism.', | ||
tadf_molecules = TADFMoleculesSchemaPackageEntryPoint( | ||
name='TADF molecules', | ||
description='Schema package for thermally activated delayed fluorescent (TADF) molecules.', | ||
) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.