# This file was auto generated by Styx.
# Do not edit this file directly.

import typing
import pathlib
from styxdefs import *
import dataclasses

XMAT_TOOL_PY_METADATA = Metadata(
    id="4b94463278ab4a58788f4e96808b817f9c5901eb.boutiques",
    name="xmat_tool.py",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class XmatToolPyOutputs(typing.NamedTuple):
    """
    Output object returned when calling `xmat_tool_py(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_fitts: OutputPathType
    """Output fit time series"""


def xmat_tool_py(
    no_gui: bool = False,
    load_xmat: InputPathType | None = None,
    load_1d: InputPathType | None = None,
    choose_cols: str | None = None,
    choose_nonzero_cols: bool = False,
    chrono: bool = False,
    cormat_cutoff: float | None = None,
    cosmat_cutoff: float | None = None,
    cosmat_motion: bool = False,
    verb: float | None = None,
    show_col_types: bool = False,
    show_conds: bool = False,
    show_cormat: bool = False,
    show_cormat_warnings: bool = False,
    show_cosmat: bool = False,
    show_cosmat_warnings: bool = False,
    show_fit_betas: bool = False,
    show_fit_ts: bool = False,
    show_xmat: bool = False,
    show_1d: bool = False,
    gui_plot_xmat_as_one: bool = False,
    runner: Runner | None = None,
) -> XmatToolPyOutputs:
    """
    A tool for evaluating an AFNI X-matrix.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/xmat_tool.py.html
    
    Args:
        no_gui: Do not start the GUI.
        load_xmat: Load the AFNI X-matrix.
        load_1d: Load the 1D time series.
        choose_cols: Select columns to fit against.
        choose_nonzero_cols: Select only non-zero columns.
        chrono: Apply options chronologically.
        cormat_cutoff: Set min cutoff for correlation matrix warnings.
        cosmat_cutoff: Set min cutoff for cosine matrix warnings.
        cosmat_motion: Include motion in cosine matrix warnings.
        verb: Set the verbose level. Valid levels are currently 0..5.
        show_col_types: Display columns by regressor types.
        show_conds: Display a list of condition numbers.
        show_cormat: Display the correlation matrix.
        show_cormat_warnings: Show correlation matrix warnings.
        show_cosmat: Display the cosine matrix.
        show_cosmat_warnings: Show cosine matrix warnings.
        show_fit_betas: Show fit betas.
        show_fit_ts: Show fit time series.
        show_xmat: Display general X-matrix information.
        show_1d: Display general 1D information.
        gui_plot_xmat_as_one: Plot Xmat columns on single axis.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `XmatToolPyOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(XMAT_TOOL_PY_METADATA)
    cargs = []
    cargs.append("xmat_tool.py")
    if no_gui:
        cargs.append("-no_gui")
    if load_xmat is not None:
        cargs.extend([
            "-load_xmat",
            execution.input_file(load_xmat)
        ])
    if load_1d is not None:
        cargs.extend([
            "-load_1D",
            execution.input_file(load_1d)
        ])
    if choose_cols is not None:
        cargs.extend([
            "-choose_cols",
            choose_cols
        ])
    if choose_nonzero_cols:
        cargs.append("-choose_nonzero_cols")
    if chrono:
        cargs.append("-chrono")
    if cormat_cutoff is not None:
        cargs.extend([
            "-cormat_cutoff",
            str(cormat_cutoff)
        ])
    if cosmat_cutoff is not None:
        cargs.extend([
            "-cosmat_cutoff",
            str(cosmat_cutoff)
        ])
    if cosmat_motion:
        cargs.append("-cosmat_motion")
    if verb is not None:
        cargs.extend([
            "-verb",
            str(verb)
        ])
    if show_col_types:
        cargs.append("-show_col_types")
    if show_conds:
        cargs.append("-show_conds")
    if show_cormat:
        cargs.append("-show_cormat")
    if show_cormat_warnings:
        cargs.append("-show_cormat_warnings")
    if show_cosmat:
        cargs.append("-show_cosmat")
    if show_cosmat_warnings:
        cargs.append("-show_cosmat_warnings")
    if show_fit_betas:
        cargs.append("-show_fit_betas")
    if show_fit_ts:
        cargs.append("-show_fit_ts")
    if show_xmat:
        cargs.append("-show_xmat")
    if show_1d:
        cargs.append("-show_1D")
    if gui_plot_xmat_as_one:
        cargs.append("-gui_plot_xmat_as_one")
    ret = XmatToolPyOutputs(
        root=execution.output_file("."),
        output_fitts=execution.output_file("fitts.1D"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "XMAT_TOOL_PY_METADATA",
    "XmatToolPyOutputs",
    "xmat_tool_py",
]
