[main] adding logging

This commit is contained in:
wendtalexander 2025-10-19 10:09:00 +02:00
parent 2e86edd639
commit 2c5deb17f1

View File

@ -1,5 +1,6 @@
import logging import logging
from pathlib import Path from pathlib import Path
from typing import Annotated
import nixio import nixio
import typer import typer
@ -12,7 +13,6 @@ from oephys2nix.tonix import RawToNix
app = typer.Typer() app = typer.Typer()
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
setup_logging(log, level="DEBUG")
console = Console() console = Console()
@ -30,8 +30,11 @@ def main(
ttl: bool = typer.Option(default=True, help="For recordings that did not have a ttl pulse"), ttl: bool = typer.Option(default=True, help="For recordings that did not have a ttl pulse"),
overwrite: bool = typer.Option(default=True, help="Overwrites nix file"), overwrite: bool = typer.Option(default=True, help="Overwrites nix file"),
debug: bool = typer.Option(default=True, help="Shows more information and plots the results"), debug: bool = typer.Option(default=True, help="Shows more information and plots the results"),
verbose: Annotated[int, typer.Option("--verbose", "-v", count=True)] = 0,
) -> None: ) -> None:
"""Combines open ephys data with relacs data from data_path to a new nix file.""" """Combines open ephys data with relacs data from data_path to a new nix file."""
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")) relacs_data_paths = list(Path(data_path).rglob("*relacs/*.nix"))
@ -88,10 +91,10 @@ def main(
stim = StimulusToNix(open_ephys, str(relacs), str(nix_path)) stim = StimulusToNix(open_ephys, str(relacs), str(nix_path))
stim.create_repros_automatically() stim.create_repros_automatically()
stim.print_table() stim.print_table()
stim.checks() # stim.checks()
if debug: # if debug:
stim.plot_stimulus() # stim.plot_stimulus()
if __name__ == "__main__": if __name__ == "__main__":