Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To allow entry_type would be written or not. #418

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/pynxtools/nomad/dataconverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def populate_nexus_subsection(
output_file_path: Optional[str] = None,
on_temp_file=False,
nxs_as_entry=True,
write_entry_type=True,
):
"""Populate nexus subsection in nomad from nexus template.

Expand All @@ -84,6 +85,7 @@ def populate_nexus_subsection(
logger: nomad logger.
on_temp_file: Whether data will be written in temporary disk, by default False.
nxs_as_entry: If the nxs file should be as ann nonmad entry or a general file, by default True.
write_entry_type: If the attr entry_type in archive.meatadata would be written or not.

Raises:
Exception: could not trigger processing from NexusParser
Expand All @@ -107,6 +109,7 @@ def populate_nexus_subsection(
mainfile=archive.data.output,
archive=archive,
logger=logger,
write_entry_type=write_entry_type,
)
# If a NeXus file written a an entry e.g XRD use case
if nxs_as_entry:
Expand Down
3 changes: 2 additions & 1 deletion src/pynxtools/nomad/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ def parse(
mainfile: str,
archive: EntryArchive,
logger=None,
write_entry_type=True,
child_archives: Dict[str, EntryArchive] = None,
) -> None:
self.archive = archive
Expand All @@ -487,7 +488,7 @@ def parse(
if getattr(archive.nexus, var, None) is not None:
app_def = var
break
if archive.metadata.entry_type is None:
if write_entry_type:
archive.metadata.entry_type = app_def
archive.metadata.domain = "nexus"

Expand Down
Loading