ubermag / help

Repository for raising issues and requesting help on Ubermag
BSD 2-Clause "Simplified" License
11 stars 3 forks source link

How to create video animations in Ubermag? #144

Open ninadjadkar opened 3 years ago

ninadjadkar commented 3 years ago

Hey! Can anyone tell me a way to create a video animation in Ubermag? In tutorial 1 of Ubermag (https://www.youtube.com/watch?v=YvONq0dSWsI&list=PL2e4GE4u3Jp9Pj15Xgb3u5-SIbFAF2OhA&index=1&t=1921s ) where the presenter explains the different kind of energies, he puts some animation in the slides as well. He mentions that these are created using ubermag itself, but nothing much is talked about it in subsequent tutorial lectures. The interactive plot provides a slider which we can drag to visualize the change with time, but how to convert that into animation? Regards.

code-whale commented 3 years ago

@ninadjadkar ,Hi! I currently use matplotlib for drawing, and matplotlib itself has a matplotlib.animation that can animate multiple pictures. I enclose a link to this module here.https://matplotlib.org/stable/api/animation_api.html I hope it will be helpful to you! I'm also curious about how the interactive animation in the ubermag tutorial demo you mentioned is implemented. Hope the ubermag team can answer our questions! In addition, if you think that using animation to make animation is more complicated, you can try to use the for loop sentence to save the results on some time nodes in your simulation (the time nodes you want to show) as pictures, and then use some online web pages to convert pictures into animation to achieve animation output!

marijanbeg commented 3 years ago

Hi @ninadjadkar, thank you for your question and for using Ubermag. I transferred your issue to our help repository (https://github.com/ubermag/help). This is the repository we monitor regularly and where you can get support from others in the community. Therefore, we would encourage you to raise future issues in this repository.

The way I created those animations was:

  1. I ran the simulations
  2. Using micromagneticdata, I converted all output files to VTK
  3. I used Paraview (https://www.paraview.org/) to create a movie.

Please let us know if you need any further details.

ninadjadkar commented 3 years ago

@code-whale can you share a simple code of how to make an animation. I attach a "Zeeman" Jupyter notebook with this comment. This one is from the worship repository of ubermag itself. I'm also learning to make an animation in Paraview, but facing some scaling issues.

zeeman.zip

Regards.

code-whale commented 3 years ago

@ninadjad, Hi, I attach the updated notebook here. I have attached two ways to output animation. One needs to install an additional Python package, and the other can output directly using Matplotlib. It should be emphasized that due to the limitation of MAC system, I can only output GIF animation at present. If you need avi or MP4 video, I suggest you use adobe or Final Cut Pro for format conversion. zeeman.ipynb.zip In addition, if you find a way to convert VTK to video by using paraview, please teach me how to do it. I have tried to convert VTK by using paraview before, but after importing multiple VTK files, I don't know how to batch operate them, and I don't know how to create a timeline for animation conversion. I hope you and @marijanbeg can teach me how to do this.