<commit_before>from __future__ import absolute_import, print_function, division

import click

from bvs.eyeparse import *

@click.group()
def main():
    #click.echo("Tesing the main function!")
    pass


@main.command()
@click.argument('fpath')#, help='Path to the EyeLink ascii file.')
def parse(fpath):
    """
    Parse an ascii eyelink file into a file with gaze info
    """

    import os

    eye_data_parser = EyeDataParser(fpath)
    print("Parsing...")
    eye_data_parser.parse_data()
    print("Done!\n")

    print("Creating DataFrames...")
    eye_dfs = EyeDataFrameCreator(eye_data_parser)

    # calc_target_locations(eye_dfs.)

    # TODO Decide where to put the parsed data. Putting it in a test file for now.
    # Probably want to make a list of current subjects and tasks
    out_fpath = './testing/parser_output'
    if not os.path.exists(out_fpath):
	    os.makedirs(out_fpath)
    eye_dfs.task_df.to_csv(os.path.join(out_fpath, 'task_output.csv'))
    eye_dfs.radial_target_df.to_csv(os.path.join(out_fpath, 'rt_output.csv'))
    eye_dfs.frame_df.to_csv(os.path.join(out_fpath, 'frame_output.csv'), index=False)<commit_msg>Changed Parse command to save as .h5 file<commit_after>from __future__ import absolute_import, print_function, division

import click

from bvs.eyeparse import *

@click.group()
def main():
    #click.echo("Tesing the main function!")
    pass


@main.command()
@click.argument('fpath')#, help='Path to the EyeLink ascii file.')
def parse(fpath):
    """
    Parse an ascii eyelink file into a file with gaze info
    """

    import os

    eye_data_parser = EyeDataParser(fpath)
    print("Parsing...")
    eye_data_parser.parse_data()
    print("Done!\n")

    print("Creating DataFrames...")
    eye_dfs = EyeDataFrameCreator(eye_data_parser)

    # calc_target_locations(eye_dfs.)

    # TODO Decide where to put the parsed data. Putting it in a test file for now.
    # Probably want to make a list of current subjects and tasks
    out_fpath = './testing/parser_output'
    if not os.path.exists(out_fpath):
	    os.makedirs(out_fpath)
    eye_dfs.task_df.to_hdf(os.path.join(out_fpath, 'task_output.h5'), 'task')
    eye_dfs.radial_target_df.to_hdf(os.path.join(out_fpath, 'rt_output.h5'), 'rt')
    eye_dfs.frame_df.to_hdf(os.path.join(out_fpath, 'frame_output.h5'), 'frames', index=False)
{'fraction_non_alphanumeric': 0.12015338730293992, 'fraction_numerical': 0.0017043033659991478, 'mean_word_length': 3.912133891213389, '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': '1016015', 'n_tokens_mistral': 851, 'n_tokens_neox': 817, 'n_words': 193}