def check(value, value_list, difference):
n = True
if len(value_list) == 0:
value_list.append(value)
else:
for x in value_list:
if np.abs(np.real(x) - np.real(value)) < difference and \
np.abs(np.imag(x) - np.imag(value)) < difference:
n = False
else:
pass
if n == True:
value_list.append(value)
return value_list
# This function converts a list of lists into a numpy array. It only takes the
# list of lists as input, and returns the array as output. If the lists inside
# the list are of unequal lengths, it fills up the lines with None so that all
# lines in the output array are of equal length.
# Example input:
# a = [[1,3,4], [2,1], [2,3,4,7]]
# Output:
# array([[1, 3, 4, None],
# [2, 1, None, None],
# [2, 3, 4, 7]], dtype=object)
评论列表
文章目录