-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add a CIF writer #89
Add a CIF writer #89
Conversation
Needed for new CIF builder
Can be merged now after a review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just couple of minor comments.
@@ -57,8 +58,8 @@ | |||
WavelengthMask: None, | |||
CIFAuthors: CIFAuthors( | |||
[ | |||
CIFAuthor( | |||
name="Jane Doe", email="[email protected]", id_orcid="0000-0000-0000-0001" | |||
Author( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to add one more Author
for testing since it's CIFAuthors
...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is so important. The tests here are mainly about checking that the workflow routes the correct data to the writer. The writer itself is tested in ScippNeutron.
Using multiple authors here makes testing harder because then we have a loop over authors in the file. And I already find the string-based tests brittle. So I would like to avoid testing a multi line string for a loop.
@@ -188,3 +182,14 @@ def _assert_contains_source_info(cif_content: str) -> None: | |||
def _assert_contains_author_info(cif_content: str) -> None: | |||
assert "audit_contact_author.name 'Jane Doe'" in cif_content | |||
assert 'audit_contact_author.email [email protected]' in cif_content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Orcid ID could be tested as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to replicate all tests from ScippNeutron. But I can add this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ha, right it's essdiffraction specific test...
Fixes #38
This depends on scipp/scippneutron#548.
I was a bit unsure about the interface. I also tried
This is quite concise and gives the user access to the reduced data in the notebook, not just via the file. But I prefer the current solution which gives the user more control over how and when the file is saved. See commit 3248368 for the transition to the current solution.
Note that this is not a complete solution. We will have to save additional data such as a calibration table. Also, this PR saves the data in d-spacing. The analysis team have been asking for data in tof. However, it is still unclear how to convert reduced data back to tof.
For reference, the file written in the DREAm workflow begins with