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

NXWriter should use title from metadata first #876

Closed
prjemian opened this issue Aug 22, 2023 · 1 comment · Fixed by #908
Closed

NXWriter should use title from metadata first #876

prjemian opened this issue Aug 22, 2023 · 1 comment · Fixed by #908
Assignees
Labels
task Something to be done.
Milestone

Comments

@prjemian
Copy link
Contributor

nxentry["title"] = self.get_sample_title()

This code should first check if a title was given as metadata, otherwise use the default. Also, swap the scan_id and plan_name in the title, scan_id first.

@prjemian prjemian added the task Something to be done. label Aug 22, 2023
@prjemian prjemian added this to the 1.6.18 milestone Aug 22, 2023
@prjemian
Copy link
Contributor Author

See the revised get_sample_title() method.

    def get_sample_title(self):
        """
        Get the title from the metadata or modify the default.

        default title: S{scan_id}-{plan_name}-{short_uid}
        """
        try:
            title = self.metadata["title"]
        except KeyError:
            # title = super().get_sample_title()  # the default title
            title = f"S{self.scan_id:05d}-{self.plan_name}-{self.uid[:7]}"
        return title

@prjemian prjemian self-assigned this Jan 3, 2024
prjemian added a commit that referenced this issue Jan 9, 2024
prjemian added a commit that referenced this issue Jan 9, 2024
prjemian added a commit that referenced this issue Jan 9, 2024
prjemian added a commit that referenced this issue Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task Something to be done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant