1 year ago
#386965
EE_G_RLP
Floating Point Error in script, which computes a side plane
I have already searched stackoverflow and used different approaches like scipy special library to fix this error, but without success. I always get the Message: "invalid value encountered in double_scalars".Maybe someone can figure out the code snippet and tell me how to do the calculation with floating point numbers.
for i in xrange(0, int(grid_size/2)): # i -> row (y-axis velo plane / x-axis image plane)
for j in xrange(0, i+1): # j -> col (x-axis velo plane / y-axis image plane)
# Compute plane coords
x_min = cell_size * j
x_max = cell_size * (j + 1)
y_min = cell_size * i
y_max = cell_size * (i + 1)
max_angle = np.arctan(y_max / x_min) if x_min !=0 else np.pi/2
change_angle = np.arctan(y_min / x_min) if x_min !=0 else np.pi/2
min_angle = np.arctan(y_min / x_max) if y_min !=0 else 0
num_hor_rays = (max_angle-min_angle)/hrad_res
for p in xrange(0, nplanes):
current_hangle = min_angle
current_vngle = lowrad_angle + p * vrad_res
# Trace ray
# Side plane
while current_hangle < change_angle:
y = y_min
**x = np.cos(current_hangle)*y/np.sin(current_hangle)**
The problem is that in x are stored values, that produce a large number. Would be nice if someone could help me, Thanks a lot
python
scipy
floating
0 Answers
Your Answer