NanoComp / meep

free finite-difference time-domain (FDTD) software for electromagnetic simulations
GNU General Public License v2.0
1.25k stars 626 forks source link

Meep / IPython Animation Error #1004

Open mucahitdemir opened 5 years ago

mucahitdemir commented 5 years ago

Hello! I have been trying to run the first meep project uploaded on the website (https://nbviewer.jupyter.org/github/NanoComp/meep/blob/master/python/examples/straight-waveguide.ipynb)

I have received the results totally but when it comes to the animation part, the terminal always gives errors. Moreover, I installed IPython. Could somebody help me? I have been running the program on macOS. Best regards,

Screen Shot 2019-08-29 at 10 54 39

smartalecH commented 5 years ago

Do you also have Jupyter installed?

mucahitdemir commented 5 years ago

Do you also have Jupyter installed?

Yes! Do I need to open or write some code for the Jupiter notebook to open it for creating a video?

smartalecH commented 5 years ago

If you just want to save an animation, you don’t need Jupyter/iPython. If you want to display your animation next to your code in an interactive environment, then you need to use the web interface. You can’t visualize an mp4 inside a shell.

It’s hard to say why your ffmpeg pipe is breaking. It might just be because you are running the notebook in your shell. Try just running the interactive notebook in a web browser. Also, make sure you’re running the latest version of meep. There’s been a lot of bug fixes to the animation output.

Nico2344 commented 5 years ago

Hello,

I installed MEEP last week on my Mac (10.14.6) and came out with the same issue.

What seems to happen is that the code does not create the "media" folder and I suspect that the script crashes because the buffer is saturated (Not sure). Just changing the filename path to the current directory worked fine: filename = "straight_waveguide.mp4"

Another workaround when working with Jupyter notebooks (with google chrome) is using the method "to_jshtml" instead of "to_mp4":

from IPython.display import HTML HTML(Animate.to_jshtml(10).get_jshtml())

It worked for me and I hope it will be the same for others. Nico