diff --git a/oephys2nix/main.py b/oephys2nix/main.py index 1e78a3c..5ae71ab 100644 --- a/oephys2nix/main.py +++ b/oephys2nix/main.py @@ -3,6 +3,7 @@ from pathlib import Path from typing import Annotated import nixio +import rlxnix as rlx import typer from IPython import embed from rich.console import Console @@ -37,11 +38,11 @@ def main( setup_logging(logging.getLogger("oephys2nix"), verbosity=verbose) log.info(f"Selected data_path is {data_path}") open_ephys_data_paths = list(Path(data_path).rglob("*open-ephys")) - relacs_data_paths = list(Path(data_path).rglob("*relacs/*.nix")) if not open_ephys_data_paths: log.error("Did not find any open-ephys data") raise typer.Exit() + relacs_data_paths = list(Path(data_path).rglob("*relacs/*.nix")) if not relacs_data_paths: log.error("Did not find any relacs data") raise typer.Exit() @@ -97,5 +98,27 @@ def main( # stim.plot_stimulus() +@app.command() +def timeline( + data_path: Path = typer.Argument( + ..., + help="The source directory containing the Open Ephys data.", + exists=True, + file_okay=False, + dir_okay=True, + readable=True, + resolve_path=True, + ), +): + relacs_data_paths = list(Path(data_path).rglob("*relacs/*.nix")) + if not relacs_data_paths: + log.error("Did not find any relacs data") + raise typer.Exit() + + dataset = rlx.Dataset(str(relacs_data_paths[0])) + dataset.plot_timeline() + dataset.close() + + if __name__ == "__main__": app()