<commit_before>#!/usr/bin/env python

from kernels import *
from scipy.misc import imread, imsave
import time
import sys
import enum

debug = False
filename = 'image.png'
output_filename = None
iters = 500
pattern = None
output_channels = 4

if __name__ == '__main__':
    import argparse, sys
    parser = argparse.ArgumentParser()
    parser.add_argument('filename', default=filename)
    parser.add_argument('output', default=output_filename)
    parser.add_argument('--debug', action='store_true', default=debug)
    parser.add_argument('-i','--iterations', type=int, default=iters)
    parser.add_argument('--pattern','-p', type=str, required=True)
    parser.add_argument('--channels','-c', type=int, default = output_channels)
    args = parser.parse_args()
    filename = args.filename
    output_filename = args.output
    debug = args.debug
    iters = args.iterations
    pattern = getattr(Demosaic.Pattern, args.pattern)
    output_channels = args.channels

img = imread(filename)
if len(img.shape) > 2:
    img = np.sum(img, axis=2)
<commit_msg>preserve correct type on multichannel input images<commit_after>#!/usr/bin/env python

from kernels import *
from scipy.misc import imread, imsave
import time
import sys
import enum

debug = False
filename = 'image.png'
output_filename = None
iters = 500
pattern = None
output_channels = 4

if __name__ == '__main__':
    import argparse, sys
    parser = argparse.ArgumentParser()
    parser.add_argument('filename', default=filename)
    parser.add_argument('output', default=output_filename)
    parser.add_argument('--debug', action='store_true', default=debug)
    parser.add_argument('-i','--iterations', type=int, default=iters)
    parser.add_argument('--pattern','-p', type=str, required=True)
    parser.add_argument('--channels','-c', type=int, default = output_channels)
    args = parser.parse_args()
    filename = args.filename
    output_filename = args.output
    debug = args.debug
    iters = args.iterations
    pattern = getattr(Demosaic.Pattern, args.pattern)
    output_channels = args.channels

img = imread(filename)
if len(img.shape) > 2:
    img = np.sum(img, axis=2, dtype=img.dtype)

{'fraction_non_alphanumeric': 0.12672811059907835, 'fraction_numerical': 0.005529953917050691, 'mean_word_length': 4.387096774193548, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4896221', 'n_tokens_mistral': 696, 'n_tokens_neox': 675, 'n_words': 159}