<commit_before>"""
Profile extractor
"""

import numpy as np

def profiles(image_array):
	"""
	Returns [upper, lower, average] profiles of active (dark) pixels
	"""
	
	average = np.sum(image_array, axis = 0)
	upper = outline_profile(image_array)
	lower = outline_profile(image_array, flip = True)
	
	return [upper, lower, average]
	
def outline_profile(image_array, flip = False):
	"""
	Returns outline of the image from top (flip = False) or bottom (flip = True)
	"""
	
	if flip = True:
		image_array = np.flipud(image_array)
	
	rows, columns = image_array.shape
	
	profile = [0 for x in range(columns)]

	for col_number in range(columns):
		# For each column
		flag = 0
		for row_number in range(rows):
			# Check for presence of data
			if image_array[row_number][col_number] == 0:
				flag += 1
				# Searching for three continous active pixels
				if flag == 3:<commit_msg>Implemented bridge function in profiles<commit_after>"""
Profile extractor
"""

import numpy as np

def profiles(image_array):
	"""
	Returns [upper, lower, average] profiles of active (dark) pixels
	"""
	
	average = np.sum(image_array, axis = 0)
	upper = outline_profile(image_array)
	lower = outline_profile(image_array, flip = True)
	
	profiles = [upper, lower, average]
	
	profiles = map(bridge_profile, profiles)
	
	return profiles
	
def outline_profile(image_array, flip = False):
	"""
	Returns outline of the image from top (flip = False) or bottom (flip = True)
	"""
	
	if flip = True:
		image_array = np.flipud(image_array)
	
	rows, columns = image_array.shape
	
	profile = [0 for x in range(columns)]

	for col_number in range(columns):
		# For each column
		flag = 0
		for row_number in range(rows):
			# Check for presence of data
			if image_array[row_number][col_number] == 0:
				flag += 1
				# Searching for three continous active pixels
				if flag == 3:
{'fraction_non_alphanumeric': 0.10546241211465657, 'fraction_numerical': 0.006489994591671174, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7111385', 'n_tokens_mistral': 659, 'n_tokens_neox': 578, 'n_words': 198}