diff --git a/nomad/processing/data.py b/nomad/processing/data.py index f102e3bb6e47a95f340ff3b840ce5295363b586d..3ee70bcfdedea8e63f4d75b5a6ea1df09ca13e96 100644 --- a/nomad/processing/data.py +++ b/nomad/processing/data.py @@ -399,6 +399,11 @@ class Calc(Proc): @task def normalizing(self): ''' The *task* that encapsulates all normalizing related actions. ''' + + # allow normalizer to access and add data to the entry metadata + self._parser_backend.entry_archive.m_add_sub_section( + datamodel.EntryArchive.section_metadata, self._entry_metadata) + for normalizer in normalizers: if normalizer.domain != parser_dict[self.parser].domain: continue @@ -459,7 +464,9 @@ class Calc(Proc): else: entry_archive = datamodel.EntryArchive() - entry_archive.m_add_sub_section(datamodel.EntryArchive.section_metadata, self._entry_metadata) + if entry_archive.section_metadata is None: + entry_archive.m_add_sub_section(datamodel.EntryArchive.section_metadata, self._entry_metadata) + entry_archive.processing_logs = self._calc_proc_logs try: diff --git a/tests/metainfo/test_metainfo.py b/tests/metainfo/test_metainfo.py index f9466bb5ae3bd79b39f145fe4415b4352603767f..611c46320f33a17e98fa8ccca6b109dac0c87afd 100644 --- a/tests/metainfo/test_metainfo.py +++ b/tests/metainfo/test_metainfo.py @@ -124,6 +124,11 @@ class TestM2: assert len(Run.m_def.all_sub_sections_by_section[System.m_def]) == 1 assert Run.m_def.all_sub_sections_by_section[System.m_def][0].sub_section == System.m_def + def test_unset_sub_section(self): + run = Run() + assert run.systems == [] + assert run.parsing is None + def test_properties(self): assert len(Run.m_def.all_properties) == 6