Skip to content

Commit

Permalink
Abstracting out entry data def as a attr of the parser
Browse files Browse the repository at this point in the history
  • Loading branch information
ka-sarthak committed Oct 9, 2024
1 parent 237dd2b commit 7432c3f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/nomad_measurements/xrd/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ class XRDParser(MatchingParser):
"""
Parser for matching XRD files and creating instances of ELNXRayDiffraction
"""
def set_entrydata_definition(self):
self.entrydata_definition = ELNXRayDiffraction

def parse(
self, mainfile: str, archive: 'EntryArchive', logger=None, child_archives=None
) -> None:
self.set_entrydata_definition()
data_file = mainfile.split('/')[-1]
entry = ELNXRayDiffraction.m_from_dict(ELNXRayDiffraction.m_def.a_template)
entry = self.entrydata_definition.m_from_dict(self.entrydata_definition.m_def.a_template)
entry.data_file = data_file
file_name = f'{"".join(data_file.split(".")[:-1])}.archive.json'
archive.data = RawFileXRDData(
Expand Down

0 comments on commit 7432c3f

Please sign in to comment.