Coverage for polars_analysis / cli_cross_talk.py: 75%

16 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-13 13:37 -0400

1import logging 

2from pathlib import Path 

3from typing import Annotated 

4 

5import typer 

6 

7from polars_analysis.cross_talk import load_derived_data 

8from polars_analysis.plotting import cross_talk_plotting as plotting 

9 

10# Instantiate logger 

11log = logging.getLogger(__name__) 

12 

13app = typer.Typer( 

14 no_args_is_help=True, 

15 help="Remake specific cross talk plots from existing derived values", 

16) 

17 

18 

19@app.command("overlay", no_args_is_help=True) 

20def load_plot_cross_talk_overlay( 

21 run_number: Annotated[int, typer.Argument(help="Run number to plot")], 

22 derived_dir: Annotated[Path, typer.Option(help="path to directory with derived values")] = Path("derived"), 

23 plot_dir: Annotated[Path, typer.Option(envvar="RUNS_PLOT_DIR", help="path to directory to save plots")] = Path( 

24 "plots" 

25 ), 

26): 

27 """ 

28 Cross talk overlay for a given run number. 

29 """ 

30 derived_df = load_derived_data(derived_dir, run_number) 

31 plotting.plot_ct_overlay(derived_df, plot_dir) 

32 

33 

34@app.command("table", no_args_is_help=True) 

35def load_plot_cross_talk_table( 

36 run_number: Annotated[int, typer.Argument(help="Run number to plot")], 

37 derived_dir: Annotated[Path, typer.Option(help="path to directory with derived values")] = Path("derived"), 

38 plot_dir: Annotated[Path, typer.Option(envvar="RUNS_PLOT_DIR", help="path to directory to save plots")] = Path( 

39 "plots" 

40 ), 

41): 

42 """ 

43 Cross talk table for a given run number. 

44 """ 

45 derived_df = load_derived_data(derived_dir, run_number) 

46 plotting.plot_ct_table(derived_df, plot_dir)