(arr, new_range=(0, 255))
return scaled
Perform min-max scaling to a NumPy array

	Parameters:
	-------
	arr: NumPy array to be scaled to [new_min, new_max] range
	new_range: tuple of form (min, max) specifying range of
		transformed array

	Returns:
	-------
	NumPy array that has been scaled to be in
	[new_range[0], new_range[1]] range
Perform min-max scaling to a NumPy array
Perform min - max scaling to a NumPy array
def _min_max_scale(arr, new_range=(0, 255)):
	"""
	Perform min-max scaling to a NumPy array

	Parameters:
	-------
	arr: NumPy array to be scaled to [new_min, new_max] range
	new_range: tuple of form (min, max) specifying range of
		transformed array

	Returns:
	-------
	NumPy array that has been scaled to be in
	[new_range[0], new_range[1]] range
	"""
	# get array's current min and max
	mn = arr.min()
	mx = arr.max()

	# check if scaling needs to be done to be in new_range
	if mn < new_range[0] or mx > new_range[1]:
		# perform min-max scaling
		scaled = (new_range[1] - new_range[0]) * (arr - mn) / (mx - mn) + new_range[0]
	else:
		# return array if already in range
		scaled = arr

	return scaled
def _min_max_scale ( arr , new_range = ( 0 , 255 ) ) : # get array's current min and max mn = arr . min ( ) mx = arr . max ( ) # check if scaling needs to be done to be in new_range if mn < new_range [ 0 ] or mx > new_range [ 1 ] : # perform min-max scaling scaled = ( new_range [ 1 ] - new_range [ 0 ] ) * ( arr - mn ) / ( mx - mn ) + new_range [ 0 ] else : # return array if already in range scaled = arr return scaled