Utilities/maths/math_utils.py
def calc_angle_between_points_of_vector(v):
	"""calc_angle_between_points_of_vector [Given one 2d array of XY coordinates as a function of T
	calculates the angle theta between the coordintes at one time point and the next]
	
	Arguments:
		v1 {[np.array]} -- [2D array of XY coordinates as a function of time]
	"""

	assert isinstance(v, np.ndarray), 'Input data needs to be a numpy array'
	assert v.shape[1] == 2, 'Input array must be a 2d array with two columns'

	thetas = np.zeros(v.shape[0])
	for i in range(v.shape[0]):
		try: # Get current and previous time points coordinates
			p0, p1 = v[i-1,:], v[i, :]
			if np.any(np.isnan(p0)) or np.any(np.isnan(p1)): raise ValueError
		except:
			thetas[i] = 0
		else:

			d = calc_distance_between_points_2d(p0, p1)
			if d >= 1:
				try:
					thetas[i] = angle_between_points_2d_clockwise(p0, p1)
				except:
					print('Failed with d: ', d)
					thetas[i] = 0
			else:
				thetas[i] = 0
	return thetas
calc_angle_between_points_of_vector [Given one 2d array of XY coordinates as a function of T
	calculates the angle theta between the coordintes at one time point and the next]
	
	Arguments:
		v1 {[np.array]} -- [2D array of XY coordinates as a function of time]
	
calc_angle_between_points_of_vector [Given one 2d array of XY coordinates as a function of T
calculates the angle theta between the coordintes at one time point and the next]

v1 {[np.array]} -- [2D array of XY coordinates as a function of time]
calc_angle_between_points_of_vector [ Given one 2d array of XY coordinates as a function of T calculates the angle theta between the coordintes at one time point and the next ] v1 { [ np . array ] } -- [ 2D array of XY coordinates as a function of time ]
def calc_angle_between_points_of_vector(v):
	assert isinstance(v, np.ndarray), 'Input data needs to be a numpy array'
	assert v.shape[1] == 2, 'Input array must be a 2d array with two columns'
	thetas = np.zeros(v.shape[0])
	for i in range(v.shape[0]):
		try: 
			p0, p1 = v[i-1,:], v[i, :]
			if np.any(np.isnan(p0)) or np.any(np.isnan(p1)): raise ValueError
		except:
			thetas[i] = 0
		else:
			d = calc_distance_between_points_2d(p0, p1)
			if d >= 1:
				try:
					thetas[i] = angle_between_points_2d_clockwise(p0, p1)
				except:
					print('Failed with d: ', d)
					thetas[i] = 0
			else:
				thetas[i] = 0
	return thetas
def calc_angle_between_points_of_vector ( v ) : assert isinstance ( v , np . ndarray ) , 'Input data needs to be a numpy array' assert v . shape [ 1 ] == 2 , 'Input array must be a 2d array with two columns' thetas = np . zeros ( v . shape [ 0 ] ) for i in range ( v . shape [ 0 ] ) : try : p0 , p1 = v [ i - 1 , : ] , v [ i , : ] if np . any ( np . isnan ( p0 ) ) or np . any ( np . isnan ( p1 ) ) : raise ValueError except : thetas [ i ] = 0 else : d = calc_distance_between_points_2d ( p0 , p1 ) if d >= 1 : try : thetas [ i ] = angle_between_points_2d_clockwise ( p0 , p1 ) except : print ( 'Failed with d: ' , d ) thetas [ i ] = 0 else : thetas [ i ] = 0 return thetas
calc_angle_between_points_of_vector [Given one 2d array of XY coordinates as a function of T
calculates the angle theta between the coordintes at one time point and the next]
calc_angle_between_points_of_vector [ Given one 2d array of XY coordinates as a function of T calculates the angle theta between the coordintes at one time point and the next ]
"""calc_angle_between_points_of_vector [Given one 2d array of XY coordinates as a function of T
	calculates the angle theta between the coordintes at one time point and the next]
	
	Arguments:
		v1 {[np.array]} -- [2D array of XY coordinates as a function of time]
	""" # Get current and previous time points coordinates
v