@@ -68,7 +68,7 @@ def integration(D,alpha):
68
68
return [0 ],[0 ] #r and phi=0
69
69
if alpha == 180 :
70
70
return [D ],[0 ] # if angle= pi then, tan(pi)=0 so 1/tan=1/0
71
- y0 = [1 / D , 1 / (D * math .tan (alpha * math .pi / 180 ))] #initial value for position and angular speed
71
+ y0 = [1 / D , 1 / (D * math .tan (math .radians ( alpha ) ))] #initial value for position and angular speed
72
72
sol = solve_ivp (fun = fun , t_span = [0 ,t_max ], y0 = y0 , method = 'Radau' ,dense_output = False , events = [eventRs ])#,eventR])#,t_eval=np.linspace(0,t_max,10000))
73
73
if sol .t [- 1 ]== t_max :
74
74
raise StopIteration ("integration error, alpha reached computing limit (loop number)" )
@@ -127,7 +127,7 @@ def search_alpha_min(D,img_res,Rs):
127
127
r ,phi = integration (D ,alpha )
128
128
if r [- 1 ]> Rs * 1.1 : #if not capture by black hole
129
129
seen_angle .append (180 - alpha ) #put 180 in the center
130
- deviated_angle .append (180 / math .pi * ( phi [- 1 ]+ math .asin (D / r [- 1 ]* math .sin (phi [- 1 ]))))
130
+ deviated_angle .append (math .degrees (( phi [- 1 ]+ math .asin (D / r [- 1 ]* math .sin (phi [- 1 ])))))
131
131
Ci = 'C' + str (i )
132
132
ax .plot (phi ,r ,Ci ) #plot one trajectory
133
133
if kind == 'linear' :
@@ -200,8 +200,6 @@ def listdirectory2(path,matrix_file):
200
200
return False
201
201
# =============================================================================
202
202
def spheric2cart (theta ,phi ):
203
- # theta=theta/180*math.pi
204
- # phi=phi/180*math.pi
205
203
x = math .sin (theta ) * math .cos (phi )
206
204
y = math .sin (theta ) * math .sin (phi )
207
205
z = math .cos (theta )
@@ -212,15 +210,14 @@ def cart2spheric(x,y,z):
212
210
theta = math .acos (z )
213
211
phi = math .atan2 (y ,x )
214
212
while phi < 0 : #define phi [0,360]
215
- phi += 2 * math .pi
213
+ phi += math .radians ( 360 )
216
214
while theta < 0 : # define theta [0,180]
217
215
theta += math .pi
218
- if phi == 2 * math .pi :
216
+ if phi == math .radians ( 360 ) :
219
217
phi = 0
220
218
return theta ,phi
221
219
# =============================================================================
222
220
def rotation_matrix (beta ):
223
- # beta*=math.pi/180
224
221
"""from https://stackoverflow.com/questions/6802577/rotation-of-3d-vector
225
222
Return the rotation matrix associated with counterclockwise rotation about
226
223
the x axis by beta degree."""
0 commit comments