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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_RETINO_PHASE_METADATA = Metadata(
    id="3db78d8b872cbcd25d2278819aa85d3e6ecbba57.boutiques",
    name="3dRetinoPhase",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dRetinoPhaseOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_retino_phase(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    ecc_plus: OutputPathType
    """Output file for positive (expanding) eccentricity"""
    ecc_minus: OutputPathType
    """Output file for negative (contracting) eccentricity"""
    pol_plus: OutputPathType
    """Output file for clockwise polar angle mapping"""
    pol_minus: OutputPathType
    """Output file for counterclockwise polar angle mapping"""


def v_3d_retino_phase(
    prefix: str,
    dataset: InputPathType,
    exp: str | None = None,
    con: str | None = None,
    clw: str | None = None,
    ccw: str | None = None,
    spectra: bool = False,
    tstim: float | None = None,
    nrings: float | None = None,
    nwedges: float | None = None,
    ort_adjust: float | None = None,
    pre_stim: float | None = None,
    sum_adjust: str | None = None,
    phase_estimate: str | None = None,
    ref_ts: InputPathType | None = None,
    multi_ref_ts: InputPathType | None = None,
    runner: Runner | None = None,
) -> V3dRetinoPhaseOutputs:
    """
    Process time series from retinotopy stimuli to create phase datasets and visual
    field angle datasets.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        prefix: Prefix of output datasets.
        dataset: Time series from a retinotopy stimulus.
        exp: Expanding rings stimulus.
        con: Contracting rings stimulus.
        clw: Clockwise moving polar angle mapping stimulus.
        ccw: Counterclockwise moving polar angle mapping stimulus.
        spectra: Output amplitude and phase spectra datasets.
        tstim: Period of stimulus in seconds.
        nrings: Number of rings in the stimulus. Default is 1.
        nwedges: Number of wedges in the stimulus. Default is 1.
        ort_adjust: Number of DOF lost in detrending outside of this program.
        pre_stim: Blank period, in seconds, before stimulus began.
        sum_adjust: Adjust sum of angles for wrapping based on the angle\
            difference. Default is 'y'.
        phase_estimate: Method of phase estimation.
        ref_ts: 0 lag reference time series of response for DELAY phase\
            estimation method.
        multi_ref_ts: Multiple 0 lag reference time series. This allows you to\
            test multiple regressors.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dRetinoPhaseOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_RETINO_PHASE_METADATA)
    cargs = []
    cargs.append("3dRetinoPhase")
    cargs.append(prefix)
    cargs.append(execution.input_file(dataset))
    if exp is not None:
        cargs.extend([
            "-exp",
            exp
        ])
    if con is not None:
        cargs.extend([
            "-con",
            con
        ])
    if clw is not None:
        cargs.extend([
            "-clw",
            clw
        ])
    if ccw is not None:
        cargs.extend([
            "-ccw",
            ccw
        ])
    if spectra:
        cargs.append("-spectra")
    if tstim is not None:
        cargs.extend([
            "-Tstim",
            str(tstim)
        ])
    if nrings is not None:
        cargs.extend([
            "-nrings",
            str(nrings)
        ])
    if nwedges is not None:
        cargs.extend([
            "-nwedges",
            str(nwedges)
        ])
    if ort_adjust is not None:
        cargs.extend([
            "-ort_adjust",
            str(ort_adjust)
        ])
    if pre_stim is not None:
        cargs.extend([
            "-pre_stim",
            str(pre_stim)
        ])
    if sum_adjust is not None:
        cargs.extend([
            "-sum_adjust",
            sum_adjust
        ])
    if phase_estimate is not None:
        cargs.extend([
            "-phase_estimate",
            phase_estimate
        ])
    if ref_ts is not None:
        cargs.extend([
            "-ref_ts",
            execution.input_file(ref_ts)
        ])
    if multi_ref_ts is not None:
        cargs.extend([
            "-multi_ref_ts",
            execution.input_file(multi_ref_ts)
        ])
    ret = V3dRetinoPhaseOutputs(
        root=execution.output_file("."),
        ecc_plus=execution.output_file(prefix + ".ecc+"),
        ecc_minus=execution.output_file(prefix + ".ecc-"),
        pol_plus=execution.output_file(prefix + ".pol+"),
        pol_minus=execution.output_file(prefix + ".pol-"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dRetinoPhaseOutputs",
    "V_3D_RETINO_PHASE_METADATA",
    "v_3d_retino_phase",
]
