Я написал функцию для создания домена для сбора света, который попадает в зонд. Когда я использую одно значение для начальной точки, это хорошо, но когда я устанавливаю массив точек (потому что мне нужно описать поверхность и интегрировать интенсивность на эту поверхность), возникает ValueError: установка элемента массива с последовательностью.
Я попытался проверить форму различных массивов, а также (3,) и (3,), поэтому в теории нет противоречивости ... Здесь функция
def probe_intensity(cone_FOV, n_circles):
probeI = 0
# probe location information
#probe_angle = 5.0/4.0*np.pi
#tvar=np.linspace(4.09,4.186,30)
ray_cone_angle = cone_FOV/(2.0*n_circles)
# T0 = np.array([0, 0, 1])
r = 6.2
x = 5.5
probe_angle = np.linspace(1.2334*np.pi-1,1.2334*np.pi+1,30)
probe_direction_angle = probe_angle - np.pi
#R1=np.ones(len(probe_angle))
# probe direction
for k in probe_angle:
# getting the estimated cone for a single ray
#ray_cone_angle = cone_FOV/(2.0*n_circles)
# probe position information
#r = 6.2
#x = 5.5
R0 = np.array([5.5,
r*np.sin(probe_angle)+0.0001,
r*np.cos(probe_angle)+0.0001])*0.001
gamma = probe_direction_angle
ROT1 = np.matrix([[1, 0, 0],
[0, np.cos(gamma), np.sin(gamma)],
[0, -np.sin(gamma), np.cos(gamma)]])
# vector T0 before any rotation
T0 = np.array([0, 0, 1])
# vector T1 - probe axis vector
T1 = np.array(ROT1*np.matrix(T0).T).flatten()
# rotation for the cone_half_angle
for ray_carrier_angle in [(i + 0.5)*ray_cone_angle for i in range(n_circles)]:
alpha = ray_carrier_angle
ROT2 = np.matrix([[np.cos(alpha), 0, np.sin(alpha)],
[0, 1, 0],
[-np.sin(alpha), 0, np.cos(alpha)]])
# rotating to make a full circle of the cone
for beta in np.linspace(0, 2*np.pi, int(np.round(n_circles*np.pi))):
ROT3 = np.matrix([[np.cos(beta), np.sin(beta), 0],
[-np.sin(beta), np.cos(beta), 0],
[0, 0, 1]])
# second rotaiton for the cone after the probe direction rotation
T3 = np.array(ROT1*ROT3*ROT2*np.matrix(T0).T).flatten()
print R0
print R0.shape
print T3
print T3.shape
T3=list(T3)
R0=list(R0)
ray_solution = ray_trace_solve_ivp(R0, T3, 0.0005)
t, I = field.integrate_trace(ray_solution, 0.0005)
#s,e,alpha,I = field.getspectra
# Add the intensity of the ray to the intensity gathered at the probe. Dot product takes care of the projection
probeI += I[-1]*np.dot(T0, T3)
print probeI
return probeI
другая вызываемая функция
def ray_trace_solve_ivp(R0, T0, optical=False, dt=np.inf, atol=1e-6, rtol=1e-2):
y0 = np.r_[R0, T0]
if optical:
differential_equation = eikonalODE1system_optical
else:
differential_equation = eikonalODE1system_physical
sol = solve_ivp(differential_equation, [0, 0.5], y0,
events=limit_functions,
dense_output=True,
max_step=dt,
atol=atol,
rtol=rtol)
return sol
Я получаю следующее сообщение об ошибке:
File "/home/tont_fe/anaconda2/lib/python2.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "/home/tont_fe/anaconda2/lib/python2.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 102, in execfile
builtins.execfile(filename, *where)
File "/home/tont_fe/data/cfd/OH_analysis/OHstar_ray_tracing/oh_ray_trace_candidate_cone_federica.py", line 1109, in
print("probe intensity=", probe_intensity(np.pi/20.0, 10))
File "/home/tont_fe/data/cfd/OH_analysis/OHstar_ray_tracing/oh_ray_trace_candidate_cone_federica.py", line 878, in probe_intensity
ray_solution = ray_trace_solve_ivp(R0, T3, 0.0005)
File "/home/tont_fe/data/cfd/OH_analysis/OHstar_ray_tracing/oh_ray_trace_candidate_cone_federica.py", line 690, in ray_trace_solve_ivp
rtol=rtol)
File "/home/tont_fe/anaconda2/lib/python2.7/site-packages/scipy/integrate/_ivp/ivp.py", line 456, in solve_ivp
solver = method(fun, t0, y0, tf, vectorized=vectorized, **options)
File "/home/tont_fe/anaconda2/lib/python2.7/site-packages/scipy/integrate/_ivp/rk.py", line 96, in __init__
support_complex=True)
File "/home/tont_fe/anaconda2/lib/python2.7/site-packages/scipy/integrate/_ivp/base.py", line 120, in __init__
self._fun, self.y = check_arguments(fun, y0, support_complex)
File "/home/tont_fe/anaconda2/lib/python2.7/site-packages/scipy/integrate/_ivp/base.py", line 15, in check_arguments
y0 = y0.astype(dtype, copy=False)