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 visualization tools with a video generation #79

Merged
merged 9 commits into from
Feb 26, 2025

Conversation

albangossard
Copy link
Member

@albangossard albangossard commented Feb 24, 2025

  • Add a function that generates a mp4 video of the ice thickness over time
  • This requires to add a complete_report flag in the simulation parameters which breaks retro-compatibility

There is a PR in Huginn associated to this one: ODINN-SciML/Huginn.jl#64
Since this new feature is not that important for future developments, I suggest that even if we merge the current PR, we don't waste time making a new release. We'll be able to merge ODINN-SciML/Huginn.jl#64 later on once a new release of Sleipnir is fully justified.

@codecov-commenter
Copy link

codecov-commenter commented Feb 24, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 12 lines in your changes missing coverage. Please review.

Project coverage is 69.95%. Comparing base (0b3536a) to head (3cac015).

Files with missing lines Patch % Lines
src/simulations/results/results_utils.jl 0.00% 11 Missing ⚠️
...imulations/results/results_plotting_video_utils.jl 95.83% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main      #79       +/-   ##
===========================================
+ Coverage   35.11%   69.95%   +34.83%     
===========================================
  Files          17       18        +1     
  Lines         672      669        -3     
===========================================
+ Hits          236      468      +232     
+ Misses        436      201      -235     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@albangossard albangossard marked this pull request as ready for review February 24, 2025 13:45
@albangossard albangossard added the enhancement New feature or request label Feb 24, 2025
Copy link
Member

@JordiBolibar JordiBolibar left a comment

Choose a reason for hiding this comment

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

Very cool @albangossard! This type of stuff will be very useful in the future to present the results of the simulations. We should iterate on all the existing plotting functions to improve them. I know Makie.jl also have 3D animations, so we could also try something in 3D in the future.

@@ -17,6 +17,7 @@ struct SimulationParameters{I <: Integer, F <: AbstractFloat} <: AbstractParamet
test_mode::Bool
rgi_paths::Dict{String, String}
ice_thickness_source::String
complete_report::Bool
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this flag is really self explainable. This means that the full solution is stored? Or which time step have you chosen? The solve function of OrdinaryDiffEq.jl already enables to control this. Is this also linked to the creation of the results with the video?

Copy link
Member

Choose a reason for hiding this comment

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

Is it complete_result currently being used for something?

Copy link
Member Author

Choose a reason for hiding this comment

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

@facusapienza21 my initial goal was to use complete_report in ODINN-SciML/Huginn.jl#64 to dump all the results of the solver and store them in the Results instance. As pointed out by @JordiBolibar we already have params.solver.save_everystep which controls whether the solve function returns all the intermediate steps or not. This was to be able to generate the mp4 video of the ice thickness over time.
In 5707b8a I removed complete_report and save_everystep will be used instead in ODINN-SciML/Huginn.jl#64

@facusapienza21
Copy link
Member

This looks pretty cool! One question: would it make more sense to have this tools in another of the packages and leaving Sleipnir just for very basic computations? It would be good if Sleipnir is very light and maybe add this to Huginn or any other library. What do you think?

@albangossard
Copy link
Member Author

Very cool @albangossard! This type of stuff will be very useful in the future to present the results of the simulations. We should iterate on all the existing plotting functions to improve them. I know Makie.jl also have 3D animations, so we could also try something in 3D in the future.

@JordiBolibar I didn't have the courage to update them all at once but yes the goal in the long term is to improve all the plotting functions so that we can generate videos.

This looks pretty cool! One question: would it make more sense to have this tools in another of the packages and leaving Sleipnir just for very basic computations? It would be good if Sleipnir is very light and maybe add this to Huginn or any other library. What do you think?

@facusapienza21 I agree that keeping Sleipnir as minimalist as possible is important. I added the new plotting functions in Sleipnir because there were already a few of them. I have no opinion on which library would be the good place to put all these functions. On one hand we don't need access to the solver in order to implement the plotting functions, but on the other hand we cannot test them without running simulations. So maybe we should move these functions to Huginn?

@JordiBolibar
Copy link
Member

Very cool @albangossard! This type of stuff will be very useful in the future to present the results of the simulations. We should iterate on all the existing plotting functions to improve them. I know Makie.jl also have 3D animations, so we could also try something in 3D in the future.

@JordiBolibar I didn't have the courage to update them all at once but yes the goal in the long term is to improve all the plotting functions so that we can generate videos.

This looks pretty cool! One question: would it make more sense to have this tools in another of the packages and leaving Sleipnir just for very basic computations? It would be good if Sleipnir is very light and maybe add this to Huginn or any other library. What do you think?

@facusapienza21 I agree that keeping Sleipnir as minimalist as possible is important. I added the new plotting functions in Sleipnir because there were already a few of them. I have no opinion on which library would be the good place to put all these functions. On one hand we don't need access to the solver in order to implement the plotting functions, but on the other hand we cannot test them without running simulations. So maybe we should move these functions to Huginn?

We discussed this with Alban this morning, but I really think we should keep all the plotting utils together in Sleipnir.jl. Even if it is slightly less straightforward to test, it is more solid in terms of structure and code development. Otherwise, this opens the door to spreading utils and functionalities across all the packages, making it extremely difficult to navigate and to know where to add or edit code. Sleipnir has the Results object and all its plotting utils, so I strongly suggest this to be there.

@albangossard
Copy link
Member Author

Hey @facusapienza21 @JordiBolibar finally I moved the video generation test in Sleipnir. This requires to save jld2 files in the repo but that's something we were already doing for other tests. These files are generated from a forward run in Huginn.
I have also put back the tests of plot_glacier

@albangossard albangossard force-pushed the improveVisualizationTools branch from 5e43604 to b56816d Compare February 25, 2025 15:31
@facusapienza21
Copy link
Member

Ok!!! Makes sense to me! I just wanted to bring the topic to the table in case it made sense to have plotting in other place. However, as @albangossard mentioned we don't have solvers here, so we will probably have to add some special plots that required the solver in other libraries (maybe for stuff that is not included in Results). We will definitely have more plotting in ODINN for tracking training, so I think it is then natural that plotting is distributed between libraries.

Feel free to merge!

@JordiBolibar
Copy link
Member

Ok!!! Makes sense to me! I just wanted to bring the topic to the table in case it made sense to have plotting in other place. However, as @albangossard mentioned we don't have solvers here, so we will probably have to add some special plots that required the solver in other libraries (maybe for stuff that is not included in Results). We will definitely have more plotting in ODINN for tracking training, so I think it is then natural that plotting is distributed between libraries.

Feel free to merge!

Just to make sure we're on the same page, the outcome of this discussion is that ALL plotting functions will stay in Sleipnir, right? Because that's not what I understood from your last message haha.

@facusapienza21
Copy link
Member

@JordiBolibar I think there are plotting functions that are in ODINN and don't make sense outside the training, which is not currently include in Sleipnir.

@albangossard albangossard merged commit b76862b into main Feb 26, 2025
4 checks passed
@albangossard albangossard deleted the improveVisualizationTools branch February 26, 2025 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants