% Created 2025-06-11 Wed 14:02
% Intended LaTeX compiler: pdflatex
\documentclass[usenames,dvipsnames,colorlinks,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{color}
\usepackage{listings}
\usepackage{pdfpages}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{xspace}
\usepackage{siunitx}
\usepackage{libertine}
\usepackage{fontawesome}
\mode<beamer>{\usetheme{Boadilla}}
\setbeamertemplate{navigation symbols}{}
\setbeamerfont{alerted text}{series=\bfseries}
\setbeamercolor{alerted text}{fg=blue}
\usecolortheme{default}
\usefonttheme{serif}
\usefonttheme{professionalfonts}
\lstloadlanguages{[ISO]C++}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.50,0,0.82}
\definecolor{codeorange}{rgb}{0.95,0.3,0.1}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{mystyle}{
commentstyle=\color{codegreen},
keywordstyle=\color{codeorange},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=mystyle}
\usetheme{default}
\author{Brett Viren}
\date{\today}
\title{Wire-Cell Python}
\subtitle{With a focus on ``\texttt{wcpy dnn}''}
\hypersetup{
 pdfauthor={Brett Viren},
 pdftitle={Wire-Cell Python},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 28.2 (Org mode 9.8-pre)},
 pdflang={English}}

% Setup for code blocks [1/2]

\usepackage{fvextra}

\fvset{%
  commandchars=\\\{\},
  highlightcolor=white!95!black!80!blue,
  breaklines=true,
  breaksymbol=\color{white!60!black}\tiny\ensuremath{\hookrightarrow}}

% Make line numbers smaller and grey.
\renewcommand\theFancyVerbLine{\footnotesize\color{black!40!white}\arabic{FancyVerbLine}}

\usepackage{xcolor}

% In case engrave-faces-latex-gen-preamble has not been run.
\providecolor{EfD}{HTML}{f7f7f7}
\providecolor{EFD}{HTML}{28292e}

% Define a Code environment to prettily wrap the fontified code.
\usepackage[breakable,xparse]{tcolorbox}
\DeclareTColorBox[]{Code}{o}%
{colback=EfD!98!EFD, colframe=EfD!95!EFD,
  fontupper=\footnotesize\setlength{\fboxsep}{0pt},
  colupper=EFD,
  IfNoValueTF={#1}%
  {boxsep=2pt, arc=2.5pt, outer arc=2.5pt,
    boxrule=0.5pt, left=2pt}%
  {boxsep=2.5pt, arc=0pt, outer arc=0pt,
    boxrule=0pt, leftrule=1.5pt, left=0.5pt},
  right=2pt, top=1pt, bottom=0.5pt,
  breakable}

% Support listings with captions
\usepackage{float}
\floatstyle{plain}
\newfloat{listing}{htbp}{lst}
\newcommand{\listingsname}{Listing}
\floatname{listing}{\listingsname}
\newcommand{\listoflistingsname}{List of Listings}
\providecommand{\listoflistings}{\listof{listing}{\listoflistingsname}}


% Setup for code blocks [2/2]: syntax highlighting colors

\newcommand\efstrut{\vrule height 2.1ex depth 0.8ex width 0pt}
\definecolor{EFD}{HTML}{000000}
\definecolor{EfD}{HTML}{ffffff}
\newcommand{\EFD}[1]{\textcolor{EFD}{#1}} % default
\definecolor{EFvp}{HTML}{000000}
\newcommand{\EFvp}[1]{\textcolor{EFvp}{#1}} % variable-pitch
\definecolor{EFh}{HTML}{7f7f7f}
\newcommand{\EFh}[1]{\textcolor{EFh}{#1}} % shadow
\definecolor{EFsc}{HTML}{228b22}
\newcommand{\EFsc}[1]{\textcolor{EFsc}{\textbf{#1}}} % success
\definecolor{EFw}{HTML}{ff8e00}
\newcommand{\EFw}[1]{\textcolor{EFw}{\textbf{#1}}} % warning
\definecolor{EFe}{HTML}{ff0000}
\newcommand{\EFe}[1]{\textcolor{EFe}{\textbf{#1}}} % error
\definecolor{EFl}{HTML}{ff0000}
\newcommand{\EFl}[1]{\textcolor{EFl}{#1}} % link
\definecolor{EFlv}{HTML}{ff0000}
\newcommand{\EFlv}[1]{\textcolor{EFlv}{#1}} % link-visited
\definecolor{EFhi}{HTML}{ff0000}
\newcommand{\EFhi}[1]{\textcolor{EFhi}{#1}} % highlight
\definecolor{EFc}{HTML}{b22222}
\newcommand{\EFc}[1]{\textcolor{EFc}{#1}} % font-lock-comment-face
\definecolor{EFcd}{HTML}{b22222}
\newcommand{\EFcd}[1]{\textcolor{EFcd}{#1}} % font-lock-comment-delimiter-face
\definecolor{EFs}{HTML}{8b2252}
\newcommand{\EFs}[1]{\textcolor{EFs}{#1}} % font-lock-string-face
\definecolor{EFd}{HTML}{8b2252}
\newcommand{\EFd}[1]{\textcolor{EFd}{#1}} % font-lock-doc-face
\definecolor{EFm}{HTML}{008b8b}
\newcommand{\EFm}[1]{\textcolor{EFm}{#1}} % font-lock-doc-markup-face
\definecolor{EFk}{HTML}{9370db}
\newcommand{\EFk}[1]{\textcolor{EFk}{#1}} % font-lock-keyword-face
\definecolor{EFb}{HTML}{483d8b}
\newcommand{\EFb}[1]{\textcolor{EFb}{#1}} % font-lock-builtin-face
\definecolor{EFf}{HTML}{0000ff}
\newcommand{\EFf}[1]{\textcolor{EFf}{#1}} % font-lock-function-name-face
\definecolor{EFv}{HTML}{a0522d}
\newcommand{\EFv}[1]{\textcolor{EFv}{#1}} % font-lock-variable-name-face
\definecolor{EFt}{HTML}{228b22}
\newcommand{\EFt}[1]{\textcolor{EFt}{#1}} % font-lock-type-face
\definecolor{EFo}{HTML}{008b8b}
\newcommand{\EFo}[1]{\textcolor{EFo}{#1}} % font-lock-constant-face
\definecolor{EFwr}{HTML}{ff0000}
\newcommand{\EFwr}[1]{\textcolor{EFwr}{\textbf{#1}}} % font-lock-warning-face
\newcommand{\EFnc}[1]{#1} % font-lock-negation-char-face
\definecolor{EFpp}{HTML}{483d8b}
\newcommand{\EFpp}[1]{\textcolor{EFpp}{#1}} % font-lock-preprocessor-face
\newcommand{\EFrc}[1]{\textbf{#1}} % font-lock-regexp-grouping-construct
\newcommand{\EFrb}[1]{\textbf{#1}} % font-lock-regexp-grouping-backslash
\newcommand{\EFob}[1]{#1} % org-block
\newcommand{\EFobb}[1]{#1} % org-block-begin-line
\newcommand{\EFobe}[1]{#1} % org-block-end-line
\definecolor{EFOa}{HTML}{0000ff}
\newcommand{\EFOa}[1]{\textcolor{EFOa}{#1}} % outline-1
\definecolor{EFOb}{HTML}{a0522d}
\newcommand{\EFOb}[1]{\textcolor{EFOb}{#1}} % outline-2
\definecolor{EFOc}{HTML}{a020f0}
\newcommand{\EFOc}[1]{\textcolor{EFOc}{#1}} % outline-3
\definecolor{EFOd}{HTML}{b22222}
\newcommand{\EFOd}[1]{\textcolor{EFOd}{#1}} % outline-4
\definecolor{EFOe}{HTML}{228b22}
\newcommand{\EFOe}[1]{\textcolor{EFOe}{#1}} % outline-5
\definecolor{EFOf}{HTML}{008b8b}
\newcommand{\EFOf}[1]{\textcolor{EFOf}{#1}} % outline-6
\definecolor{EFOg}{HTML}{483d8b}
\newcommand{\EFOg}[1]{\textcolor{EFOg}{#1}} % outline-7
\definecolor{EFOh}{HTML}{8b2252}
\newcommand{\EFOh}[1]{\textcolor{EFOh}{#1}} % outline-8
\definecolor{EFhn}{HTML}{008b8b}
\newcommand{\EFhn}[1]{\textcolor{EFhn}{#1}} % highlight-numbers-number
\definecolor{EFhq}{HTML}{9370db}
\newcommand{\EFhq}[1]{\textcolor{EFhq}{#1}} % highlight-quoted-quote
\definecolor{EFhs}{HTML}{008b8b}
\newcommand{\EFhs}[1]{\textcolor{EFhs}{#1}} % highlight-quoted-symbol
\definecolor{EFrda}{HTML}{707183}
\newcommand{\EFrda}[1]{\textcolor{EFrda}{#1}} % rainbow-delimiters-depth-1-face
\definecolor{EFrdb}{HTML}{7388d6}
\newcommand{\EFrdb}[1]{\textcolor{EFrdb}{#1}} % rainbow-delimiters-depth-2-face
\definecolor{EFrdc}{HTML}{909183}
\newcommand{\EFrdc}[1]{\textcolor{EFrdc}{#1}} % rainbow-delimiters-depth-3-face
\definecolor{EFrdd}{HTML}{709870}
\newcommand{\EFrdd}[1]{\textcolor{EFrdd}{#1}} % rainbow-delimiters-depth-4-face
\definecolor{EFrde}{HTML}{907373}
\newcommand{\EFrde}[1]{\textcolor{EFrde}{#1}} % rainbow-delimiters-depth-5-face
\definecolor{EFrdf}{HTML}{6276ba}
\newcommand{\EFrdf}[1]{\textcolor{EFrdf}{#1}} % rainbow-delimiters-depth-6-face
\definecolor{EFrdg}{HTML}{858580}
\newcommand{\EFrdg}[1]{\textcolor{EFrdg}{#1}} % rainbow-delimiters-depth-7-face
\definecolor{EFrdh}{HTML}{80a880}
\newcommand{\EFrdh}[1]{\textcolor{EFrdh}{#1}} % rainbow-delimiters-depth-8-face
\definecolor{EFrdi}{HTML}{887070}
\newcommand{\EFrdi}[1]{\textcolor{EFrdi}{#1}} % rainbow-delimiters-depth-9-face
\definecolor{EFany}{HTML}{CDCD00}
\newcommand{\EFany}[1]{\textcolor{EFany}{#1}} % ansi-color-yellow
\definecolor{EFanr}{HTML}{CD0000}
\newcommand{\EFanr}[1]{\textcolor{EFanr}{#1}} % ansi-color-red
\definecolor{EFanb}{HTML}{000000}
\newcommand{\EFanb}[1]{\textcolor{EFanb}{#1}} % ansi-color-black
\definecolor{EFang}{HTML}{00CD00}
\newcommand{\EFang}[1]{\textcolor{EFang}{#1}} % ansi-color-green
\definecolor{EFanB}{HTML}{0000EE}
\newcommand{\EFanB}[1]{\textcolor{EFanB}{#1}} % ansi-color-blue
\definecolor{EFanc}{HTML}{00CDCD}
\newcommand{\EFanc}[1]{\textcolor{EFanc}{#1}} % ansi-color-cyan
\definecolor{EFanw}{HTML}{E5E5E5}
\newcommand{\EFanw}[1]{\textcolor{EFanw}{#1}} % ansi-color-white
\definecolor{EFanm}{HTML}{CD00CD}
\newcommand{\EFanm}[1]{\textcolor{EFanm}{#1}} % ansi-color-magenta
\definecolor{EFANy}{HTML}{EEEE00}
\newcommand{\EFANy}[1]{\textcolor{EFANy}{#1}} % ansi-color-bright-yellow
\definecolor{EFANr}{HTML}{EE0000}
\newcommand{\EFANr}[1]{\textcolor{EFANr}{#1}} % ansi-color-bright-red
\newcommand{\EFANb}[1]{#1} % ansi-color-bright-black
\definecolor{EFANg}{HTML}{00EE00}
\newcommand{\EFANg}[1]{\textcolor{EFANg}{#1}} % ansi-color-bright-green
\definecolor{EFANB}{HTML}{0000FF}
\newcommand{\EFANB}[1]{\textcolor{EFANB}{#1}} % ansi-color-bright-blue
\definecolor{EFANc}{HTML}{00EEEE}
\newcommand{\EFANc}[1]{\textcolor{EFANc}{#1}} % ansi-color-bright-cyan
\newcommand{\EFANw}[1]{#1} % ansi-color-bright-white
\newcommand{\EFANm}[1]{#1} % ansi-color-bright-magenta
\begin{document}

\maketitle
\begin{frame}[label={sec:orgd36df82},fragile]{Topics}
 \begin{itemize}
\item Introduction to \texttt{wire-cell-python}.
\item Focus on the \texttt{wirecell.dnn} module and \texttt{wcpy dnn} command.
\item Specifics about how DNNROI is implemented in this mini-framework.
\item Future work needed.
\end{itemize}

\vfill

Reference info in backup slides:
\begin{itemize}
\item Packaging and installation for users and developers.
\end{itemize}
\end{frame}
\begin{frame}[label={sec:orgde5908e},fragile]{Overview of  \href{https://github.com/wirecell/wire-cell-python}{wire-cell-python}}
 Some of the features
\begin{itemize}
\item \texttt{wirecell.*} Python module tree and \texttt{wcpy} command line program.

\item Standard Python packaging, enabling flexible installation and development.

\item Converters to produce WCT ``data'' configuration files.
\begin{itemize}
\item response, wires, noise, \ldots{}.
\end{itemize}
\item Visualize and summarize WCT inputs/outputs.
\begin{itemize}
\item Interoperate with the \href{https://www.phy.bnl.gov/twister/bee/}{Wire-Cell Bee} online event display.
\item Produce plots and images with \texttt{matplotlib}, Paraview, SVG.
\end{itemize}
\item Train and evaluate Deep Neural Networks including DNNROI.
\item Provide CLI tools used by some WCT unit tests.
\item And more\ldots{}.
\end{itemize}
\end{frame}
\begin{frame}[label={sec:org2872f8b},fragile]{Command line interface(s)}
 \begin{block}{The \alert{new} unified command line interface: \texttt{wcpy}}
One command to collect all ``mains'' from the \texttt{wirecell.*} modules as sub-commands.
\begin{itemize}
\item Bundles the older \texttt{wirecell-*} command line programs into one.
\end{itemize}
\end{block}
\begin{block}{Why the change?}
A single \texttt{wcpy} collects all the top-level help into a single \texttt{wcpy -{}-{}help} command.
\begin{itemize}
\item Better command discovery and documentation.
\item Enables more uniform conventions (eg log handling, default args).
\end{itemize}
\end{block}
\end{frame}
\begin{frame}[label={sec:org874fae3},fragile,shrink=10]{General usage help}
 \begin{verbatim}
$ wcpy
Usage: wcpy [OPTIONS] COMMAND [ARGS]...

  Main wcpy

Options:
  --help  Show this message and exit.

Commands:
  aux       Commands for Wire-Cell Toolkit's "aux" package.
  bee       Wire Cell Bee helpers
  dnn       Wire Cell Deep Neural Network commands.
  gen       Wire Cell Signal Simulation Commands
  img       Wire-Cell Toolkit commands related to imaging.
  ls4gan    Wire Cell Toolkit Utility Commands
  pgraph    Wire Cell Signal Processing Features
  plot      wirecell-plot command line interface
  pytorch   wirecell-pytorch command line interface
  sigproc   Wire Cell Signal Processing
  test      Wire Cell Test Commands
  util      Wire Cell Toolkit Utility Commands
  validate  Wire Cell Validation
\end{verbatim}
\end{frame}
\begin{frame}[label={sec:orgc1fda45},fragile]{Wire Cell Python support for DNNs}
 A focus on the sub-command:

\begin{verbatim}
$ wcpy dnn
\end{verbatim}

and the module:

\begin{verbatim}
wirecell.dnn
\end{verbatim}

These provide \alert{DNN training} and related functionality.
\begin{itemize}
\item Designed to accommodate a variety of \alert{different}:
\begin{itemize}
\item DNN architectures and variants
\item datasets
\item tasks
\item etc
\end{itemize}
\item While providing a uniform user interface and configuration.
\end{itemize}
Initial implementation provides DNNROI.
\end{frame}
\begin{frame}[label={sec:orga194f5c},fragile,shrink=10]{}
 \begin{verbatim}
$ wcpy dnn --help
Usage: wcpy dnn [OPTIONS] COMMAND [ARGS]...

  Wire Cell Deep Neural Network commands.

Options:
  -l, --log-output TEXT  log to a file [default:stdout]
  -L, --log-level TEXT   set logging level [default:info]
  -h, --help             Show this message and exit.

Commands:
  dump         Dump info about a checkpoint file.
  dump-config
  extract      Extract samples from a dataset.
  plot3p1      Plot 3 layers from first tensor and 1 image from second...
  train        Train a model.
  vizmod       Produce a text summary and if -o/--output given also a...
\end{verbatim}
Main command: \alert{wcpy dnn train [\ldots{}]}
\end{frame}
\begin{frame}[label={sec:orgb7d12fb},fragile]{Concept and structure of \alert{wirecell.dnn}}
 \begin{block}{Parameterized DNN model definitions: \texttt{wirecell.dnn.models.*}}
Currently \alert{UNet} in published and DNNROI variants are provided.
\end{block}
\begin{block}{Support for Torch datasets: \texttt{wirecell.dnn.data.*}}
Flexible, parameterized \alert{HDF5} datasets \alert{with caching}.
\end{block}
\begin{block}{Training ``engines'': \texttt{wirecell.dnn.train}}
Currently one implemented: \texttt{Classifier}.
\end{block}
\begin{block}{An \alert{app} bundles network, dataset and engine: \texttt{wirecell.dnn.apps.*}}
So far we have one app: \alert{DNNROI}.
\end{block}
\begin{block}{Example config files: \texttt{wirecell/dnn/cfg/*.cfg}}
Specify options and local information for easy reproduction by others.
\end{block}
\end{frame}
\begin{frame}[label={sec:org4e7640b},fragile]{The ``app'' assembles the parts needed for training}
 A \alert{wirecell.dnn} ``app'' is simply a Python module providing these attributes:

\begin{description}
\item[{\texttt{.Network}}] an \texttt{torch.nn.Module} class providing the network architecture.
\item[{\texttt{.Dataset}}] a torch \texttt{Dataset} class representing training data.
\item[{\texttt{.Trainer}}] a class with \texttt{loss()}, \texttt{evaluate()} and \texttt{epoch()} methods
\begin{itemize}
\item \emph{eg} \texttt{wirecell.dnn.train.Classifier}
\end{itemize}
\item[{\texttt{.Criterion}}] a loss function like \texttt{torch.nn.BCELoss}.
\end{description}
\end{frame}
\begin{frame}[label={sec:orgd26dbbd},fragile]{HDF5 support \texttt{wirecell.dnn.data.hdf5}}
 Flexible loading of training data from HDF5 files.
\begin{itemize}
\item Handles users' different file naming and data organization conventions.
\end{itemize}
\begin{block}{Main classes in the \texttt{.hdf5} module:}
\begin{description}
\item[{\texttt{.Multi}}] a set of \texttt{Single}'s, yields a tuple of tensor,
\item[{\texttt{.Single}}] a \texttt{Domain} that yields a single tensor from files.
\item[{\texttt{.Domain}}] apply a \texttt{ReMatcher} and optional transform, implement caching
\item[{\texttt{.ReMatcher}}] match HDF5 file and path names to tensors with \alert{regular expressions}.
\end{description}

Support for other file formats can be implemented.
\end{block}
\end{frame}
\begin{frame}[label={sec:org752ea94},fragile]{\texttt{dnnroi.Dataset}}
 The DNNROI \texttt{Dataset} is an ``\texttt{hdf5.Multi}''.
\begin{itemize}
\item \texttt{Rec} and \texttt{Tru} \alert{datasets} as \texttt{hdf5.Single}'s.
\item Corresponding \alert{data transforms}, also named \texttt{Rec} and \texttt{Tru}.
\item These \alert{match} up to specific data in users' files via regular expressions.
\item Matching is \alert{configurable}, examples for known datasets included.
\end{itemize}
\end{frame}
\begin{frame}[label={sec:org95d33a3},fragile]{\texttt{dnnroi.Network}}
 The full DNNROI \texttt{Network} is almost literally just this code:
\begin{Code}
\begin{Verbatim}
\color{EFD}\EFk{from} wirecell.dnn.models.unet \EFk{import} UNet
\EFk{class} \EFt{Network}(nn.Module):

  \EFk{def} \EFf{\_\_init\_\_}(\EFk{self}):
      \EFb{super}().\_\_init\_\_()
      \EFk{self}.\EFv{unet} = UNet(n\_channels=3, n\_classes=1,
                       batch\_norm=\EFo{True}, bilinear=\EFo{True}, padding=\EFo{True})
  \EFk{def} \EFf{forward}(\EFk{self}, x):
      x = \EFk{self}.unet(x)
      \EFk{return} torch.sigmoid(x)
\end{Verbatim}
\end{Code}

\begin{itemize}
\item Default constructor, \texttt{UNet()} produces the published version of UNet.
\begin{itemize}
\item DNNROI variant in in/out dimensions an application of \texttt{sigmoid()}.
\end{itemize}
\item Other available constructor parameters: \texttt{shape} and \texttt{nskips}.
\begin{itemize}
\item Can easily construct smaller/larger UNets.
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}[label={sec:orge10132e},fragile,shrink=10]{}
 \begin{verbatim}
$ wcpy dnn train --help
Usage: wcpy dnn train [OPTIONS] [FILES]...

  Train a model.

Options:
  -e, --epochs INTEGER            Number of epochs over which to train.  This
                                  is a relative count if the training starts
                                  with a -l/--load'ed state.
  -b, --batch INTEGER             Batch size
  -d, --device TEXT               The compute device
  --cache / --no-cache            Cache data in memory
  --debug-torch / --no-debug-torch
                                  Debug torch-level problems
  --checkpoint-save TEXT          Checkpoint path.  An {epoch} pattern can be
                                  given to use the absolute epoch number
  --checkpoint-modulus INTEGER    Checkpoint modulus.  If checkpoint path is
                                  given, the training is checkpointed ever
                                  this many epochs..
  -a, --app TEXT                  The application name
  -l, --load TEXT                 File name providing the initial model state
                                  dict (def=None - construct fresh)
  -s, --save TEXT                 File name to save model state dict after
                                  training (def=None - results not saved)
  --train-ratio FLOAT             Fraction of samples to use for training
                                  (default=1.0, no evaluation loss calculated)
  -c, --config TEXT               Set Configuration file.
  -h, --help                      Show this message and exit.
\end{verbatim}
\end{frame}
\begin{frame}[label={sec:org0335e9f},fragile]{Example DNNROI training}
 \begin{block}{Prepare}
\begin{verbatim}
$ cp wirecell/dnn/cfg/hyu-pdvd.cfg my-pdvd.cfg
$ emacs my-pdvd.cfg
\end{verbatim}
\end{block}
\begin{block}{Can fully drive training with configuration file}
\begin{verbatim}
$ wcpy dnn train -c my-pdvd.cfg
\end{verbatim}
\end{block}
\begin{block}{Or, \alert{override} info from configuration file}
\begin{verbatim}
$ wirecell-dnn -L debug train --device cuda --cache \
               --epochs 10 \
               --config my-pdvd.cfg \
               --checkpoint-save 'my-pdvd-{epoch}.pt' \
               --save my-pdvd.pt \
               /path/to/my/data/files/*.h5
\end{verbatim}
\end{block}
\end{frame}
\begin{frame}[label={sec:org23a46a5},fragile,shrink=10]{Example DNNROI configuration file}
 \begin{verbatim}
$ ls wirecell/dnn/cfg

hyu-pdvd.cfg  renny-pdhd.cfg

$ cat  wirecell/dnn/cfg/renny-pdhd.cfg
[train]
app=dnnroi
device=gpu
files=/nfs/data/1/bviren/dnnroi/data/renney/train_data_PDHD_fixedbug_separateWC/*.h5
batch=10
epochs=25

[dataset]
tru_path_res=[r'/(\d+)/frame_deposplat\d']
\end{verbatim}

A single \texttt{[dataset]} config line allows matching the different conventions in the
``renny'' (Sergei) dataset compared to the default (Haiwang) dataset.
\begin{itemize}
\item This one maps info held in file path to determine type of data.
\end{itemize}
\end{frame}
\begin{frame}[label={sec:org1f797cc},fragile]{Future development}
 \texttt{wcpy dnn} is ready for use \alert{now} for ``standard'' DNNROI training tasks.
\begin{block}{Development of more features is expected}
\begin{itemize}
\item More DNNROI configurability: chunking, rebin, crop, choice of network.
\begin{itemize}
\item Core has some of this but it is not exposed to config layer yet.
\item Capture more configurations (eg, SBND/ICARUS's).
\end{itemize}
\item Codify additional network architectures.
\begin{itemize}
\item Eg, MobileNet.
\end{itemize}
\item Add support for datasets in Zenodo
\begin{itemize}
\item And upload popular DNNROI datasets to Zenodo.
\end{itemize}
\item Add ``apps'' for other tasks (eg, GNN-based ideas, etc).
\item Better documentation (as always).
\item {[}Your favorite thing here]
\end{itemize}
If something that you want is missing, please add it!
\end{block}
\end{frame}
\begin{frame}[label={sec:org5c4e263}]{}
\Huge \[\mathcal{FIN}\]
\end{frame}
\begin{frame}[label={sec:orgcc7d958}]{}
\end{frame}



\begin{frame}[label={sec:org459c38d},fragile]{Packaging of \texttt{wire-cell-python}}
 \begin{block}{\texttt{wire-cell-python} provides ``standard'' Python packaging.}
\begin{itemize}
\item Use your ``favorite method'' to install/develop/use.

\item Virtual env, \texttt{pip}, \texttt{uv}, etc.
\end{itemize}
\end{block}
\begin{block}{Recomend to use \texttt{uv}}
\begin{itemize}
\item \texttt{uv} is a relatively new Python packaging tool but already one of the best.
\end{itemize}
\end{block}
\end{frame}
\begin{frame}[label={sec:org582d5bc},fragile]{Installing \texttt{uv} itself - pick your favorite method.}
 \begin{block}{Official method - installs to \texttt{\$HOME/.local/bin/}}
\begin{verbatim}
$ curl -LsSf https://astral.sh/uv/install.sh | sh
\end{verbatim}
\end{block}
\begin{block}{Or, do same but manually if you don't trust ``\texttt{curl | sh}''}
Download binary \texttt{tar} file from \url{https://github.com/astral-sh/uv/releases}, unpack, move executables to \texttt{\$PATH}.
\end{block}
\begin{block}{Or, install into your existing virtual environment}
\begin{verbatim}
$ pip install uv
\end{verbatim}
\end{block}
\begin{block}{Or, if on BNL WCWC computers it's already installed}
\texttt{/usr/local/bin/uv}
\end{block}
\end{frame}
\begin{frame}[label={sec:orgd5c4ab3},fragile,shrink=10]{Using \texttt{uv} to install \texttt{wire-cell-python} - for end users}
 \begin{block}{No commitment one-shot running}
\begin{verbatim}
$ uv run --with git+https://github.com/wirecell/wire-cell-python wcpy
\end{verbatim}
\end{block}
\begin{block}{Install for easier reuse}
\begin{verbatim}
$ uv tool install git+https://github.com/wirecell/wire-cell-python
$ wcpy
\end{verbatim}

Later upgrade or removal

\begin{verbatim}
$ uv tool upgrade wirecell
$ uv tool uninstall wirecell
\end{verbatim}
\end{block}
\begin{block}{Optional dependencies}
Add ``\texttt{-{}-{}with torch}'' to ``\texttt{uv run}'' or ``\texttt{uv tool}''.

\begin{verbatim}
$ uv tool --with torch install git+https://github.com/wirecell/wire-cell-python
$ wcpy dnn
\end{verbatim}
\end{block}
\end{frame}
\begin{frame}[label={sec:orgbda5b18},fragile]{Installing with \texttt{uv} - for developers}
 \begin{block}{Basic setup to directly run from source}
\begin{verbatim}
$ git clone git@github.com:WireCell/wire-cell-python.git
$ cd wire-cell-python
$ uv sync
$ uv run wcpy
\end{verbatim}
\end{block}
\begin{block}{Include optional dependencies (ie torch)}
\begin{verbatim}
$ uv sync --all-extras
\end{verbatim}
\end{block}
\begin{block}{Activiate the virtual env to avoid needing \texttt{uv run} command prefix}
\begin{verbatim}
$ source .venv/bin/activate
$ wcpy
\end{verbatim}
\end{block}
\end{frame}
\end{document}
