R/device_diving_pam.R

Defines functions validate_diving_pam_II_data read_diving_pam_II_data

Documented in read_diving_pam_II_data

#' Read and Process Diving PAM II Data
#'
#' Reads raw CSV files generated by Diving PAM II software, calculates electron transport rate (ETR) values, and returns a cleaned dataset.
#'
#' @param csv_path File path to the CSV file.
#' @param remove_recovery Logical. Removes recovery measurements if \code{TRUE}. Default is \code{TRUE}.
#' @param etr_factor Numeric. Factor for ETR calculation. Default is \code{0.84}.
#' @param fraction_photosystem_I Numeric. Relative distribution of absorbed PAR to photosystem I. Default is \code{0.5}.
#' @param fraction_photosystem_II Numeric. Relative distribution of absorbed PAR to photosystem II. Default is \code{0.5}.
#'
#' @details
#' Calculates ETR II using:
#' \deqn{\text{ETR II} = \text{PAR} \cdot \text{ETR-Factor} \cdot \text{Fraction of Photosystem (II)} \cdot \text{Yield (II)}}
#'
#' A detailed documentation can be found under \url{https://github.com/biotoolbox/pam/tree/main#functions}
#'
#' @return A \code{data.table} containing:
#' \itemize{
#'   \item \code{par}: Photosynthetically active radiation.
#'   \item \code{yield_1}: Yield for photosystem I.
#'   \item \code{yield_2}: Yield for photosystem II.
#'   \item \code{etr_1}: Calculated ETR for photosystem I.
#'   \item \code{etr_2}: Calculated ETR for photosystem II.
#' }
#'
#' @references{
#'   Heinz Walz GmbH. (2024). \emph{DUAL-PAM-100 DUAL-PAM/F MANUAL, 5th Edition, April 2024, Chapter 7 (pp. 162-172).}
#'   Heinz Walz GmbH, Effeltrich, Germany.
#'   Available at: \url{https://www.walz.com/downloads/?filter=dual-pam-100}
#' }
#' @examples
#' path <- file.path(
#'   system.file("extdata/diving_pam_II_data", package = "pam"),
#'   "2026_07_06_diving_pam_II.csv"
#' )
#' data <- read_diving_pam_II_data(path)
#' @export
read_diving_pam_II_data <- function(
    csv_path,
    remove_recovery = TRUE,
    etr_factor = 0.84,
    fraction_photosystem_I = 0.5,
    fraction_photosystem_II = 0.5) {
  # diving_pam csv is formatted the same as the junior_pam csv
  return(read_junior_pam_data(
    csv_path = csv_path,
    remove_recovery = remove_recovery,
    etr_factor = etr_factor,
    fraction_photosystem_I = fraction_photosystem_I,
    fraction_photosystem_II = fraction_photosystem_II
  ))
}

validate_diving_pam_II_data <- function(data) {
  return(validate_junior_pam_data(
    data = data
  ))
}

Try the pam package in your browser

Any scripts or data that you put into this service are public.

pam documentation built on July 8, 2026, 5:07 p.m.