<commit_before>import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np

# np.set_printoptions(threshold=np.nan)

try:
    image = mpimg.imread('test.jpg')  # Reading a image file.
except FileNotFoundError as e:
    print(e)
print('This image is: {}, with dimensions: {}'.format(type(image), image.shape))

# Making a copy of the image.
color_select = np.copy(image)

red_threshold = 200
green_threshold = 200
blue_threshold = 200
rgb_threshold = [red_threshold, green_threshold, blue_threshold]

# Select any pixels less than given threshold.
thresholds = (image[:, :, 0] < rgb_threshold[0]) | (image[:, :, 1] < rgb_threshold[1]) | (image[:, :, 2] < rgb_threshold[2])
color_select[thresholds] = [0, 0, 0]

# Show image.
plt.imshow(color_select)
plt.show()
<commit_msg>title and original image added<commit_after>import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np

# np.set_printoptions(threshold=np.nan)

try:
    image = mpimg.imread('test.jpg')  # Reading a image file.
except FileNotFoundError as e:
    print(e)
print('This image is: {}, with dimensions: {}'.format(type(image), image.shape))

# Making a copy of the image.
color_select = np.copy(image)

red_threshold = 200
green_threshold = 200
blue_threshold = 200
rgb_threshold = [red_threshold, green_threshold, blue_threshold]

# Select any pixels less than given threshold.
thresholds = (image[:, :, 0] < rgb_threshold[0]) | (image[:, :, 1] < rgb_threshold[1]) | (image[:, :, 2] < rgb_threshold[2])
color_select[thresholds] = [0, 0, 0]

# Show image.
f = plt.figure()

f.add_subplot(1, 2, 1)
plt.imshow(image)
plt.title("Original image")

f.add_subplot(1, 2, 2)
plt.imshow(color_select)
plt.title("Gradient image")

plt.show()

{'fraction_non_alphanumeric': 0.1400800457404231, 'fraction_numerical': 0.024013722126929673, 'mean_word_length': 5.205673758865248, 'pattern_counts': {'":': 0, '<': 9, '<?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': '4660164', 'n_tokens_mistral': 647, 'n_tokens_neox': 605, 'n_words': 167}