[main] adding timeline command

This commit is contained in:
wendtalexander 2025-10-20 10:19:46 +02:00
parent f3f5f916fb
commit 5bc7b31b28

View File

@ -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()