Skip to content

Commit

Permalink
adapted plugin for exemplary greenlight data
Browse files Browse the repository at this point in the history
  • Loading branch information
lufire committed Nov 29, 2024
1 parent 509d401 commit 4734e69
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/nomad_greenlight_plugin/parsers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ def load(self):
parser_entry_point = GreenlightParserEntryPoint(
name='GreenlightParser',
description='Greenlight parser entry point configuration.',
mainfile_content_re='\s*\n\s*Emerald Version',
# mainfile_name_re='.greenlight.',
mainfile_contents_re='\s*\n\s*Emerald Version',
)
7 changes: 3 additions & 4 deletions src/nomad_greenlight_plugin/parsers/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
)

# Import additional libraries
import os

from echem_data import electrochem_data as ed
from nomad.config import config
Expand Down Expand Up @@ -40,13 +39,13 @@ def parse(
archive.workflow2 = Workflow(name='test')
data_file_object = ed.EChemDataFile(mainfile, 'Greenlight')

archive.metadata.entry_name = os.path.basename(mainfile)
# archive.metadata.entry_name = os.path.basename(mainfile)
# archive.metadata.external_id = data[0][1:]
archive.data = GreenlightSchemaPackage()
print(data_file_object.data.columns)
archive.data.test_name = data_file_object.header['Test Name']
archive.data.name = data_file_object.header['Test Name']
archive.data.cell_voltage = data_file_object.data['cell_voltage_total']
# archive.data.cell_voltage.unit = data_file_object.units['cell_voltage_total']
archive.data.current_density = data_file_object.data['current_density']
# archive.data.current_density.unit = data_file_object.units['current_density']
archive.data.current = data_file_object.data['current']
#archive.data.current = data_file_object.data['current']
5 changes: 5 additions & 0 deletions tests/schema_packages/test_schema_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

def test_schema_package():
test_file = os.path.join('tests', 'data', 'test.archive.yaml')
# test_file = os.path.join('..', 'data', 'test.archive.yaml')

entry_archive = parse(test_file)[0]
normalize_all(entry_archive)

assert entry_archive.data.message == 'Hello Markus!'


test_schema_package()

0 comments on commit 4734e69

Please sign in to comment.