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

Improve snapshot api and document State #1079

Merged
merged 16 commits into from
Aug 2, 2021
Merged

Conversation

joaander
Copy link
Member

Description

Implement the snapshot API improvements discussed in #819 . Also apply the same changes to the State.box property and add detailed documentation to State to explain all of the data it stores.

Motivation and context

See the extensive discussion in #819.

Resolves #819

How has this been tested?

The deprecated APIS are still present and use the new APIs.

Change log

TODO: write this

Checklist:

joaander added 8 commits July 28, 2021 05:27
Some developers discussed in #819 that they expect methods that make
in-place modifications to return the object. This enables chaining
of modifications.
Per the discussion in #819, users find it confusing that the
snapshot property access returns copies and does not allow direct
modification. Make these explicit methods so that the intent
of the design is clear as is the performance implications.

Also, prevent the type names from changing when restoring
snapshots. Allowing the names to change would lead to parameters
for one type applying to another.
- Both files now pass cspell checks
- Make a few clarifying statements
Give users a convenient shortcut to replicate a simulation state.
Make it clear to the user that the box property gives a copy and
that setting the box is a separate operation.
sphinx formats properties with short docstrings side by side in a
flowing layout. The layout is difficult to read as it makes an
unevenly spaced grid of blocks. With this change, the `State`
properties all render in a single column format.
Snapshot only offers brief descriptions of the particle properties.
State gives a complete description.
@joaander joaander requested review from a team, b-butler and yuanzhou0827 and removed request for a team July 28, 2021 21:04
Copy link
Member

@bdice bdice left a comment

Choose a reason for hiding this comment

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

I think these access patterns make a lot of sense, and it seems like a well-reasoned improvement over the current design. I have only minor comments. (I did not verify that the Sphinx docs are rendering correctly.)

hoomd/state.py Outdated Show resolved Hide resolved
hoomd/state.py Show resolved Hide resolved
hoomd/state.py Outdated Show resolved Hide resolved
@joaander joaander added the validate Execute long running validation tests on pull requests label Jul 29, 2021
Copy link
Member

@b-butler b-butler left a comment

Choose a reason for hiding this comment

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

The documentation is awesome, this will be a big improvement from the current stub documentation and help answer a lot of user questions (assuming they read the documentation). I have a few minor comments, but nothing big.

hoomd/snapshot.py Outdated Show resolved Hide resolved
hoomd/state.py Outdated Show resolved Hide resolved
hoomd/state.py Outdated Show resolved Hide resolved
hoomd/state.py Outdated Show resolved Hide resolved
Copy link
Member

@b-butler b-butler left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@joaander joaander merged commit cdbb01a into master Aug 2, 2021
@joaander joaander deleted the improve-snapshot-api branch August 2, 2021 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validate Execute long running validation tests on pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document and improve Snapshot API
3 participants