generated from lukasturcani/python-template
-
Notifications
You must be signed in to change notification settings - Fork 10
replacing the example / recipes with a tutorial page and improvements #148
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
Merged
SimoneMartino98
merged 37 commits into
GMPavanLab:main
from
SimoneMartino98:recipe_revisions
Jan 27, 2026
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
aadcb7e
Adding sphinx_design for tutorial page.
SimoneMartino98 8994f73
Revising the index.
SimoneMartino98 99b26a7
Added the first tutorial.
SimoneMartino98 5a328d5
styling for tutorial cards.
SimoneMartino98 8c29940
Added dynsight workflow page (WIP).
SimoneMartino98 01117c8
Added workflow page.
SimoneMartino98 747ab5e
added doc string.
SimoneMartino98 1b23a2c
Update docs/source/tutorials/getting_started.rst
SimoneMartino98 6b4cace
Update docs/source/tutorials/getting_started.rst
SimoneMartino98 38bad39
Update docs/source/tutorials/getting_started.rst
SimoneMartino98 5ec3847
Update docs/source/tutorials/getting_started.rst
SimoneMartino98 e78d347
Update docs/source/tutorials/getting_started.rst
SimoneMartino98 82cc4b2
Update docs/source/tutorials/getting_started.rst
SimoneMartino98 aafac9c
Update docs/source/tutorials/getting_started.rst
SimoneMartino98 c803ccc
Removing unused files and minor fixes.
SimoneMartino98 fa84054
suppressing link duplicate warning in doc.
SimoneMartino98 fac432f
minor fixes.
SimoneMartino98 dcbfd6b
using anonymous links.
SimoneMartino98 89ccfbe
added new tutorial cards.
SimoneMartino98 f29d540
fixed typo.
SimoneMartino98 d7cc023
missing part added.
SimoneMartino98 851d363
minor.
SimoneMartino98 48a5b4c
Added spatial denoising tutorial.
SimoneMartino98 14c975f
updated simulation files and minor changes.
SimoneMartino98 8874215
link to the github example folder.
SimoneMartino98 3e80284
added note on the units used.
SimoneMartino98 1a62e45
minor fixes.
SimoneMartino98 4752261
minor fixes.
SimoneMartino98 dfba7b2
excluding .DS_Store file (mac users)
SimoneMartino98 bf27483
Updating docs.
SimoneMartino98 b2bff4c
warning on SOAP computation.
SimoneMartino98 81b7ebf
update readme with the tutorials page.
SimoneMartino98 3b892c6
doctests added.
SimoneMartino98 cc8d379
minor fixes.
SimoneMartino98 a90a727
ignoring simulations offsets.
SimoneMartino98 8d85707
formatting code-blocks.
SimoneMartino98 860ea29
added .meta content example.
SimoneMartino98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| """Code from the Getting Started tutorial.""" | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| from dynsight.trajectory import Trj | ||
|
|
||
|
|
||
| def main() -> None: | ||
| """Code from the Getting Started tutorial.""" | ||
| # Loading an example trajectory | ||
| files_path = Path("Path/to/the/folder/where/files/are/stored") | ||
| trj = Trj.init_from_xtc( | ||
| traj_file=files_path / "ice_water_ox.xtc", | ||
| topo_file=files_path / "ice_water_ox.gro", | ||
| ) | ||
| # Computing a descriptor | ||
| # Adjust n_jobs according to your computer capabilities | ||
| lens = trj.get_lens(r_cut=10, n_jobs=4) | ||
|
|
||
| # Performing Onion Clustering on the descriptor computed | ||
| lens_onion = lens.get_onion_smooth(delta_t=10) | ||
|
|
||
| # Plotting the results | ||
| lens_onion.plot_output( | ||
| file_path=files_path / "output_plot.png", | ||
| data_insight=lens, | ||
| ) | ||
| lens_onion.plot_one_trj( | ||
| file_path=files_path / "single_trj.png", | ||
| data_insight=lens, | ||
| particle_id=1234, | ||
| ) | ||
|
|
||
| # Exporting a colored trajectory based on the clustering results | ||
| trajslice = slice(0, -1, 1) | ||
| sliced_trj = trj.with_slice(trajslice=trajslice) | ||
|
|
||
| lens_onion.dump_colored_trj( | ||
| trj=sliced_trj, | ||
| file_path=files_path / "colored_trj.xyz", | ||
| ) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| """Code from the Spatial Denoising tutorial.""" | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| from dynsight.trajectory import Trj | ||
|
|
||
|
|
||
| def main() -> None: | ||
| """Code from the Spatial Denoising tutorial.""" | ||
| # Loading an example trajectory | ||
| files_path = Path("INPUT") | ||
| trj = Trj.init_from_xtc( | ||
| traj_file=files_path / "ice_water_ox.xtc", | ||
| topo_file=files_path / "ice_water_ox.gro", | ||
| ) | ||
|
|
||
| # Computing SOAP descriptor | ||
| soap = trj.get_soap( | ||
| r_cut=10, | ||
| n_max=8, | ||
| l_max=8, | ||
| n_jobs=4, # Adjust n_jobs according to your computer capabilities | ||
| ) | ||
|
|
||
| # Computing TimeSOAP descriptor | ||
| _, tsoap = trj.get_timesoap( | ||
| soap_insight=soap, | ||
| ) | ||
|
|
||
| # Performing Onion Clustering on the descriptor computed | ||
| tsoap.get_onion_analysis( | ||
| delta_t_min=2, | ||
| delta_t_num=20, | ||
| fig1_path=files_path / "onion_analysis.png", | ||
| ) | ||
|
|
||
| # Applying Spatial Denoising | ||
| sliced_trj = trj.with_slice(slice(0, -1, 1)) | ||
| sp_denoised_tsoap = tsoap.spatial_average( | ||
| trj=sliced_trj, | ||
| r_cut=10, | ||
| n_jobs=4, # Adjust n_jobs according to your computer capabilities | ||
| ) | ||
|
|
||
| # Performing Onion Clustering on the descriptor computed | ||
| sp_denoised_tsoap.get_onion_analysis( | ||
| delta_t_min=2, | ||
| delta_t_num=20, | ||
| fig1_path=files_path / "denoised_onion_analysis.png", | ||
| ) | ||
|
|
||
| single_point_onion = tsoap.get_onion_smooth( | ||
| delta_t=37, | ||
| ) | ||
| single_point_onion.dump_colored_trj( | ||
| sliced_trj, files_path / "onion_trj.xyz" | ||
| ) | ||
|
|
||
| denoised_single_point_onion = sp_denoised_tsoap.get_onion_smooth( | ||
| delta_t=37, | ||
| ) | ||
| denoised_single_point_onion.dump_colored_trj( | ||
| sliced_trj, files_path / "onion_trj_denoised.xyz" | ||
| ) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+474 KB
docs/source/_static/tutorials/getting_started/colored_wat_ice_lens_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+237 KB
docs/source/_static/tutorials/spatial_denoising/denoised_onion_analysis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.1 KB
docs/source/_static/tutorials/spatial_denoising/doctests/test_denoised_tsoap.npy
Binary file not shown.
Binary file added
BIN
+10.1 MB
docs/source/_static/tutorials/spatial_denoising/doctests/test_soap.npy
Binary file not shown.
Binary file added
BIN
+16.1 KB
docs/source/_static/tutorials/spatial_denoising/doctests/test_tsoap.npy
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 delete these off your computer?
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.
It's macOS; every mac user will have this annoying and useless DS_Store. I would ignore it.
If it's a problem, i'll remove that line
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.
seems like things you can just delete, but all good.