Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
shiba24 committed Jun 30, 2023
1 parent 2536b5c commit 7c1cf9b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ $ pip install event-vision-library

## Usage

Please see our examples and [documentation][read the docs].
Please see our [examples] and [documentation][read the docs].

## Contributing

Expand Down Expand Up @@ -87,6 +87,7 @@ This project was generated from [Hypermodern Python Cookiecutter] template.

<!-- github-only -->

[examples]: https://github.com/shiba24/event-vision-library/blob/main/examples
[license]: https://github.com/shiba24/event-vision-library/blob/main/LICENSE
[contributor guide]: https://github.com/shiba24/event-vision-library/blob/main/CONTRIBUTING.md
[command-line reference]: https://event-vision-library.readthedocs.io/en/latest/usage.html
15 changes: 15 additions & 0 deletions examples/convert_text_to_hdf5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Convert existing text format event file into hdf5 file"""

from evlib.codec import fileformat

# Setup iterator reader
text_file_path = "./artifacts/sample_data/event.txt"
ev_iter = fileformat.IteratorTextEvent(text_file_path)

# Define key mapping for the hdf5 file
data_keys = {"x": "raw_events/x", "y": "raw_events/y", "t": "raw_events/t", "p": "raw_events/p"}

# Convert
output_file_name = "event.hdf5"
fileformat.convert_iterator_access_to_hdf5(ev_iter, output_file_name, data_keys)
print(f"Finished conversion: {output_file_name}")

0 comments on commit 7c1cf9b

Please sign in to comment.