Exemplo n.º 1
0
import img2vid as i2v

master_dir = '/run/user/1001/gvfs/smb-share:server=uosfstore.shef.ac.uk,share=shared/mhd_jet1/User/smp16fm/sims/v_jet/hd/2D'
fps = 7

jet_angle = [
    '0.1', '0.5', '1.0', '5.0', '10.0', '15.0', '20.0', '25.0', '30.0'
]
for ii in range(len(jet_angle)):
    sav_loc = master_dir + '/vids/jet_' + jet_angle[ii]
    file_sav_name = 'jet_a' + jet_angle[ii] + '.'
    i2v.image2video(filepath=sav_loc,
                    prefix=file_sav_name,
                    in_extension='png',
                    output_name=file_sav_name + 'video',
                    out_extension='avi',
                    fps=fps,
                    n_loops=1,
                    delete_images=True,
                    delete_old_videos=True,
                    res=1080,
                    overlay=False,
                    cover_page=False)
Exemplo n.º 2
0
                mpf.view_position(fig, view, nx, ny, nz)

                if save_images:
                    prefix = 'R1_' + str(
                        R1
                    ) + '_' + mode + '_' + vis_mod_string + view + '_'  # + '_norho_'
                    mlab.savefig(
                        os.path.join(save_directory,
                                     prefix + str(t_ind + 1) + '.png'))
                if t_ind == nt - 1:
                    if make_video:
                        i2v.image2video(filepath=save_directory,
                                        prefix=prefix,
                                        output_name=prefix + 'video',
                                        out_extension='mp4',
                                        fps=fps,
                                        n_loops=4,
                                        delete_images=True,
                                        delete_old_videos=True,
                                        res=res[1])

            # Log: to keep us updated with progress
            if t_ind % 5 == 4:
                print('Finished frame number ' + str(t_ind + 1) + ' out of ' +
                      str(number_of_frames))

            #Release some memory after each time step
            gc.collect()

            #step t forward
            t = t + (t_end - t_start) / nt
Exemplo n.º 3
0
            
            
    if show_vel_top == True:
        vxvals_mask_top_t, vyvals_mask_top_t, vzvals_mask_top_t = mpf.mask_points(vxvals_t, vyvals_t, vzvals_t, 
                                                                                                  'top', mod, mod_y)                                                
        vdirfield_top.mlab_source.set(u=vxvals_mask_top_t, v=vzvals_mask_top_t, w=vyvals_mask_top_t)
        
    if show_disp_top == True:
        xidirfield_top = mlab.pipeline.vector_field(xixvals_mask_top_t, np.zeros_like(xixvals_mask_top_t),
                                                    xiyvals_mask_top_t, name="Xi field top",
                                                    figure=fig)
        xidirfield_top.spacing = spacing
        mpf.vector_cut_plane(xidirfield_top, 'top', ny, nz, y_spacing, scale_factor=scalefactor)

    #Set viewing angle
    mpf.view_position(fig, view, nx, ny, nz)

    if save_images == True:
        prefix = 'bouncing_field_test_amd_' + mode + '_' + view + '_vel_top_bounce_test'
        mlab.savefig('D:\\my_work\\projects\\Asymmetric_slab\\Python\\visualisations\\3D_vis_animations\\'
                 + prefix + str(t_ind+1) + '.png')
        
    t = t + (t_end - t_start) / nt
    
if make_video == True:
    mlab.close(fig)
    i2v.image2video(prefix=prefix, output_name=prefix + '_video', 
                    out_extension='mp4', fps=fps, n_loops=1, delete_images=True,
                    delete_old_videos=True, cover_page=False, res=res[1])
print('Finished ' + mode)
    
Exemplo n.º 4
0
import numpy as np
import glob
import img2vid as i2v
import os

mini_path = '/run/user/1001/gvfs/smb-share:server=uosfstore.shef.ac.uk,share=shared/mhd_jet1/User/smp16fm/sims/jet'
sav_loc = mini_path + '/vids'

B = ['30', '40', '50', '60', '70', '80']
V = ['30', '40', '50', '60']
fps = 7

for ii in range(len(B)):
    for jj in range(len(V)):
        prefix = 'jet_B' + str(B[ii]) + '_V' + str(V[jj])
        file_sav_name = 'jet_B' + str(B[ii]) + '_V' + str(V[jj]) + '_.'
        i2v.image2video(filepath=sav_loc + '/jet_B' + str(B[ii]) + '_V' +
                        str(V[jj]),
                        prefix=file_sav_name,
                        in_extension='png',
                        output_name=prefix + 'video2',
                        out_extension='avi',
                        fps=fps,
                        n_loops=1,
                        delete_images=True,
                        delete_old_videos=True,
                        res=1080,
                        overlay=False,
                        cover_page=False)