[main] adding timeline command
This commit is contained in:
parent
f3f5f916fb
commit
5bc7b31b28
@ -3,6 +3,7 @@ from pathlib import Path
|
|||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
import nixio
|
import nixio
|
||||||
|
import rlxnix as rlx
|
||||||
import typer
|
import typer
|
||||||
from IPython import embed
|
from IPython import embed
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
@ -37,11 +38,11 @@ def main(
|
|||||||
setup_logging(logging.getLogger("oephys2nix"), verbosity=verbose)
|
setup_logging(logging.getLogger("oephys2nix"), verbosity=verbose)
|
||||||
log.info(f"Selected data_path is {data_path}")
|
log.info(f"Selected data_path is {data_path}")
|
||||||
open_ephys_data_paths = list(Path(data_path).rglob("*open-ephys"))
|
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:
|
if not open_ephys_data_paths:
|
||||||
log.error("Did not find any open-ephys data")
|
log.error("Did not find any open-ephys data")
|
||||||
raise typer.Exit()
|
raise typer.Exit()
|
||||||
|
|
||||||
|
relacs_data_paths = list(Path(data_path).rglob("*relacs/*.nix"))
|
||||||
if not relacs_data_paths:
|
if not relacs_data_paths:
|
||||||
log.error("Did not find any relacs data")
|
log.error("Did not find any relacs data")
|
||||||
raise typer.Exit()
|
raise typer.Exit()
|
||||||
@ -97,5 +98,27 @@ def main(
|
|||||||
# stim.plot_stimulus()
|
# 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__":
|
if __name__ == "__main__":
|
||||||
app()
|
app()
|
||||||
|
Loading…
Reference in New Issue
Block a user