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

Animation improvements #359

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
added mp4 conversion
shimwell committed Dec 12, 2024
commit 33f08cc3d8cf8ab2e01430024f9d88e9d5b418d9
6 changes: 5 additions & 1 deletion examples/spherical_tokamak_from_plasma_animation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import paramak
import cadquery_png_plugin.plugin
import numpy as np
@@ -166,4 +167,7 @@ def export_reactor_to_png(reactor, file_path):
for modified_triangularity in [0.55, 0.3667, 0.1833, 0.0, -0.1833, -0.3667, -0.55, -0.3667, -0.1833, 0.0, 0.1833, 0.3667, 0.55]:
reactor = create_reactor(triangularity=modified_triangularity)
export_reactor_to_png(reactor, f'spherical_tokamak_frame_{frame:03d}.png')
frame += 1
frame += 1


os.system('ffmpeg -r 10 -i spherical_tokamak_frame_%3d.png -c:v libx264 -r 30 -pix_fmt yuv420p spherical_tokamak_animation.mp4')
4 changes: 3 additions & 1 deletion examples/tokamak_from_plasma_animation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import paramak
import imageio
import io
import cadquery_png_plugin.plugin
import numpy as np
import cadquery as cq
@@ -174,3 +174,5 @@ def export_reactor_to_png(reactor, file_path):
reactor = create_reactor(triangularity=modified_triangularity)
export_reactor_to_png(reactor, f'tokamak_frame_{frame:03d}.png')
frame += 1

os.system('ffmpeg -r 10 -i tokamak_frame_%3d.png -c:v libx264 -r 30 -pix_fmt yuv420p tokamak_animation.mp4')