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

Add a builder class for CIF files #548

Merged
merged 9 commits into from
Sep 16, 2024
Merged

Add a builder class for CIF files #548

merged 9 commits into from
Sep 16, 2024

Conversation

jl-wynen
Copy link
Member

@jl-wynen jl-wynen commented Sep 5, 2024

This PR adds a new class to simplify writing CIF files. When implementing scipp/essdiffraction#89, I found that the existing low-level interface is tedious to use. And I needed to implement some functionality that should be in ScippNeutron and not ESS*, such as author and beamline handling. This will in particular be relevant once #473 is implemented. (Note that the current PR is meant as a stop-gap solution until the models from that issue are added.)

Fixes #547

@YooSunYoung YooSunYoung self-assigned this Sep 16, 2024
src/scippneutron/io/cif.py Outdated Show resolved Hide resolved
blocks = (blocks,)
if isinstance(content, CIF):
if comment:
raise ValueError('Cannot specify a comment when saving a CIF object')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just replace the comment if another one is given...?
Or will it be too flacky...?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I changed to it overwrite the comment. I don't think this is too flaky.

@jl-wynen jl-wynen merged commit 0c63a5e into main Sep 16, 2024
5 checks passed
@jl-wynen jl-wynen deleted the improve-cif branch September 16, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CIF writer should mark empty strings
2 participants