<commit_before>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Documentation: http://docs.astropy.org/en/stable/io/fits/index.html

import argparse
from astropy.io import fits

import PIL.Image as pil_img # PIL.Image is a module not a class...
import numpy as np
import os

# SAVE THE IMAGE ##############################################################

def save_to_fits(img, output_file_path):
    """
    img is the image and it should be a 2D numpy array with values in the range [0,255].
    """

    # FLIP THE IMAGE IN THE UP/DOWN DIRECTION #############
    # WARNING: with fits, the (0,0) point is at the BOTTOM left corner
    #          whereas with pillow, the (0,0) point is at the TOP left corner
    #          thus the image should be converted

    img = np.flipud(img)

    # CREATE THE FITS STRUCTURE ###########################

    hdu = fits.PrimaryHDU(img)

    # SAVE THE FITS FILE ##################################

    if os.path.isfile(output_file_path):
        os.remove(output_file_path)

    hdu.writeto(output_file_path)

def main():

    # PARSE OPTIONS ###########################################################

    parser = argparse.ArgumentParser(description="Convert FITS files to PNG images")
    parser.add_argument("filearg", nargs=1, metavar="FILE", help="the FITS file to convert")
    args = parser.parse_args()
    input_file_path = args.filearg[0]<commit_msg>Add some comments.<commit_after>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Documentation: http://docs.astropy.org/en/stable/io/fits/index.html

import argparse
from astropy.io import fits

import PIL.Image as pil_img # PIL.Image is a module not a class...
import numpy as np
import os

# SAVE THE IMAGE ##############################################################

def save_to_fits(img, output_file_path):
    """
    img is the image and it should be a 2D numpy array with values in the range [0,255].
    """

    # FLIP THE IMAGE IN THE UP/DOWN DIRECTION #############
    # WARNING: with fits, the (0,0) point is at the BOTTOM left corner
    #          whereas with pillow, the (0,0) point is at the TOP left corner
    #          thus the image should be converted

    img = np.flipud(img)

    # CREATE THE FITS STRUCTURE ###########################

    hdu = fits.PrimaryHDU(img)

    # SAVE THE FITS FILE ##################################

    # Remove the FITS file if it already exists
    if os.path.isfile(output_file_path):
        os.remove(output_file_path)

    # Save the FITS file
    hdu.writeto(output_file_path)

def main():

    # PARSE OPTIONS ###########################################################

    parser = argparse.ArgumentParser(description="Convert FITS files to PNG images")
    parser.add_argument("filearg", nargs=1, metavar="FILE", help="the FITS file to convert")
    args = parser.parse_args()
    input_file_path = args.filearg[0]
{'fraction_non_alphanumeric': 0.21926795580110497, 'fraction_numerical': 0.008977900552486187, 'mean_word_length': 3.5984126984126985, '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': '6410396', 'n_tokens_mistral': 902, 'n_tokens_neox': 863, 'n_words': 271}