% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scr-event-windows.R
\name{summarise_gazepoint_scr_event_windows}
\alias{summarise_gazepoint_scr_event_windows}
\title{Summarise Gazepoint SCR responses in event windows}
\usage{
summarise_gazepoint_scr_event_windows(
  data = NULL,
  scr_peaks,
  events = NULL,
  time_col = NULL,
  event_time_col = NULL,
  event_id_col = NULL,
  event_label_col = NULL,
  group_cols = NULL,
  ttl_cols = NULL,
  ttl_valid_col = NULL,
  event_detection = c("rising", "active"),
  analysis_window = c(0, 6),
  response_window = c(1, 4),
  amplitude_col = "amplitude",
  peak_time_col = "peak_time",
  onset_time_col = "onset_time",
  rise_time_col = "rise_time",
  recovery_time_col = "recovery_time_after_peak",
  peak_status_col = "status",
  peak_selection = c("largest_amplitude", "first_peak"),
  collapse_simultaneous_events = FALSE
)
}
\arguments{
\item{data}{Optional Gazepoint biometric data frame. Required when \code{events}
is \code{NULL} and events should be derived from TTL columns.}

\item{scr_peaks}{A \code{gazepoint_scr_peak_detection} object returned by
\code{detect_gazepoint_scr_peaks()}, or a data frame of detected peaks.}

\item{events}{Optional event data frame. If \code{NULL}, events are derived from
TTL columns in \code{data}.}

\item{time_col}{Optional time/counter column in \code{data}. Used for TTL-derived
events.}

\item{event_time_col}{Optional event-time column in \code{events}. If \code{NULL},
common event-time column names are detected.}

\item{event_id_col}{Optional event identifier column in \code{events}.}

\item{event_label_col}{Optional event label/condition column in \code{events}.}

\item{group_cols}{Optional grouping columns used to match events and peaks.}

\item{ttl_cols}{Optional TTL marker columns used when \code{events = NULL}.}

\item{ttl_valid_col}{Optional TTL validity column. If supplied, TTL-derived
events require this column to be non-zero.}

\item{event_detection}{Event-detection rule for TTL columns. \code{"rising"}
detects rising edges; \code{"active"} treats every active TTL row as an event.}

\item{analysis_window}{Numeric length-two vector giving the event-relative
analysis window in the same units as \code{time_col} or \code{event_time_col}.}

\item{response_window}{Numeric length-two vector giving the event-relative
response window used for the binary SCR response flag.}

\item{amplitude_col}{Column in the peak table containing SCR amplitude.}

\item{peak_time_col}{Column in the peak table containing peak time.}

\item{onset_time_col}{Column in the peak table containing onset time.}

\item{rise_time_col}{Column in the peak table containing SCR rise time.}

\item{recovery_time_col}{Column in the peak table containing recovery time
after peak.}

\item{peak_status_col}{Column in the peak table containing peak status.}

\item{peak_selection}{How to choose one peak when several peaks fall in the
response window. \code{"largest_amplitude"} selects the largest response;
\code{"first_peak"} selects the earliest peak.}

\item{collapse_simultaneous_events}{Logical. If \code{TRUE}, events with the same
group and event time are collapsed into one row before matching peaks. This
is useful when Gazepoint TTL0--TTL6 channels mark the same event
simultaneously.}
}
\value{
A list with \code{overview}, \code{event_table}, \code{window_qc}, \code{events},
\code{peaks}, and \code{settings}.
}
\description{
Creates one row per event or TTL marker and links detected SCR peaks to
event-relative analysis and response windows. The helper is intended to
produce transparent event-level EDA/SCR features for downstream mixed models,
hurdle models, and reporting.
}
