Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the parser for DReyeVR actor data #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions simple_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from typing import Dict, Optional, List
from src.parser import parse_file
from src.utils import get_good_idxs, fill_gaps, smooth_arr, compute_YP, convert_to_df, flatten_dict
import numpy as np
import argparse
from src.visualizer import (
set_results_dir,
)


def main(filename: str, results_dir: str, vlines: Optional[List[float]] = None):
set_results_dir(results_dir)

"""parse the file"""
data: Dict[str, np.ndarray or dict] = parse_file(filename)
print(data.keys())
# Convert to pandas dataframe
import pandas as pd
actors_data = {}
actors_data["TimeElapsed"] = data["TimeElapsed"]
actors_data["Actors"] = {}
actors_data["Actors"]["Location"] = data["Actors"]["Location"]



data_frame = convert_to_df(data)
actors_df = convert_to_df(actors_data)

# Display the frame
from IPython.display import display
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This display variable is unused in the rest of the program.

Also I'd recommend to move all your imports to the top of the file for better readability

from tabulate import tabulate
print(data_frame.keys())
print(tabulate(actors_df, headers = 'keys', tablefmt = 'fancy_grid'))



if __name__ == "__main__":
argparser = argparse.ArgumentParser(description="DReyeVR recording parser")
argparser.add_argument(
"-f",
"--file",
metavar="P",
type=str,
help="path of the (human readable) recording file",
)
argparser.add_argument(
"-o",
"--out",
default="results",
type=str,
help="path of the results folder",
)
args = argparser.parse_args()

main(args.file, args.out)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be nice to include an example log (txt) file that someone can run using this simple test just to see what the outputs look like