forked from jdOchoa2/Barnes-Hut
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtangent_velocity.py
45 lines (31 loc) · 961 Bytes
/
tangent_velocity.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'''Plot of tangent velocity of bodies vs radius'''
from common import *
import time
from numpy import loadtxt, float_
Data = loadtxt('Parameters', dtype=str)
# Number of bodies.
N = int(Data[2])
# Number of time-iterations executed by the program.
n = int(Data[7])
# Initial radius of the distribution
ini_radius = float(Data[3]) #kpc
# Frequency at which data is written.
save_step = int(Data[8])
# Inclination
i = float(Data[4])
# Longitud of ascending node
Omega = float(Data[5])
# Folder to save the data
data_folder = Data[10]
# Video Name
video_name = f'{N}-bodies_tv.mp4'
# Format of files
format = Data[11]
# Folder to save the images
image_folder = str(Data[12])
start = time.time()
tangent_velocity_distribution(N, n, ini_radius, save_step, Omega, i, data_folder, format, image_folder)
create_video(image_folder, video_name)
end = time.time()
total_time = end - start
print(f'\nComputation of tangent velocity spent {total_time:.2f} s')