pam

Fast and Efficient Processing of PAM Data

https://github.com/biotoolbox/pam

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 14 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.7%) to scientific vocabulary

Keywords

biological-data-analysis pam photosynthesis
Last synced: 9 months ago · JSON representation ·

Repository

Fast and Efficient Processing of PAM Data

Basic Info
  • Host: GitHub
  • Owner: biotoolbox
  • License: gpl-3.0
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 10.1 MB
Statistics
  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • Open Issues: 0
  • Releases: 8
Topics
biological-data-analysis pam photosynthesis
Created almost 2 years ago · Last pushed 9 months ago
Metadata Files
Readme License Citation

README.md

library 'pam'

CRAN status CRAN checks CRAN downloads CRAN total downloads

Introduction

The library ‘pam’ was developed to process PAM raw data (chlorophyll fluorometry to analyze photosystem II and dual wavelength absorbance spectrometry to analyze photosystem I), for example from the DUAL PAM of the manufacturer WALZ. Four different models are provided for the regression of the light curve (Vollenweider (1965), Platt (1980), Eilers and Peeters (1988) and Walsby (1997)). To select the most suitable model for the respective data set, the models can be compared with each other. To avoid confusion in the naming of the variables and calculated factors such as $$ETR_{max}$$, it is possible to output both with publication-compliant naming and with homogenised naming. Generated control plots make it possible to check each individual regression fit and calculated data.

Test coverage

r cov <- covr::package_coverage() covr::percent_coverage(cov) 90.12146 %

Install

GitHub

r install.packages("remotes") remotes::install_github("biotoolbox/pam", subdir = "src")

CRAN

r install.packages("pam")

Examples

Examples of usage can be found in the examples directory.

Functions

readdualpam_data()

Description

This function reads the original CSV file as created by the DualPAM software, processes it by calculating $$ETR$$ values, and returns a cleaned dataset. Functionality with raw data from other PAM devices cannot be guaranteed. Individual customisation may be necessary when reading data.

Parameters

  • csv_path: A string representing the file path to the CSV file.
  • remove_recovery: Automatic removal of recovery measurements after the actual Pi curve for an accurate regression. Default is TRUE.
  • etr_factor: A numeric value used as a factor for calculating ETR. Default is 0.84.
  • fractionphotosystemI: A numeric value representing the relative distribution of absorbed PAR to photosystem I used in the ETR calculation formula. Default is 0.5. Calculated as: $$\textit{Fraction of Photosystem I} = \frac{PPS 1}{PPS 1+2}$$
  • fractionphotosystemII: A numeric value representing the relative distribution of absorbed PAR to photosystem II used in the ETR calculation formula. Default is 0.5. Calculated as: $$\textit{Fraction of Photosystem II} = \frac{PPS 2}{PPS 1+2}$$

Details

ETR values are calculated using the following formula:

$$ \textit{ETR (I or II)} = PAR \cdot \textit{ETR–Factor} \cdot \textit{Fraction of Photosystem (I or II)} \cdot \textit{Yield (I or II)} $$

The function processes the provided CSV file by:

  • Reading the CSV data using read.csv().
  • Filtering rows where the column ID equals SP.
  • Combining the Date and Time columns to create a new DateTime column.
  • Calculating the ETR values for both Y.I. and Y.II. using the function calc_etr().
  • Removing rows from the recovery period if remove_recovery = TRUE.

Return

A data.table containing the processed data with additional columns for recalculated ETR values.

Example

r data <- read_dual_pam_data("path/to/data.csv", remove_recovery = TRUE, etr_factor = 0.84, fraction_photosystem_I = 0.5, fraction_photosystem_II = 0.5)

References

  • Heinz Walz GmbH. (2024). DUAL-PAM-100 DUAL-PAM/F MANUAL, 5th Edition, April 2024, Chapter 7 (pp. 162-172). Heinz Walz GmbH, Effeltrich, Germany. Available at: DUAL-PAM-100 Manual

readjuniorpam_data()

Description

This function reads the original CSV file as created by the WinControl software, processes it by calculating $$ETR$$ values, and returns a cleaned dataset. Functionality with raw data from other PAM devices cannot be guaranteed. Individual customisation may be necessary when reading data.

Parameters

  • csv_path: A string representing the file path to the CSV file.
  • remove_recovery: Automatic removal of recovery measurements after the actual Pi curve for an accurate regression. Default is TRUE.
  • etr_factor: A numeric value used as a factor for calculating ETR. Default is 0.84.
  • fractionphotosystemI: A numeric value representing the relative distribution of absorbed PAR to photosystem I used in the ETR calculation formula. Default is 0.5. Calculated as: $$\textit{Fraction of Photosystem I} = \frac{PPS 1}{PPS 1+2}$$
  • fractionphotosystemII: A numeric value representing the relative distribution of absorbed PAR to photosystem II used in the ETR calculation formula. Default is 0.5. Calculated as: $$\textit{Fraction of Photosystem II} = \frac{PPS 2}{PPS 1+2}$$

Details

ETR values are calculated using the following formula:

$$ \textit{ETR (II)} = PAR \cdot \textit{ETR–Factor} \cdot \textit{Fraction of Photosystem (II)} \cdot \textit{Yield (II)} $$

The function processes the provided CSV file by:

  • Reading the CSV data using read.csv().
  • Standardizing column names to match the Dual-PAM CSV format, due to inconsistent naming conventions across Walz devices.
  • Filtering rows where the column ID equals SP.
  • Combining the Date and Time columns to create a new DateTime column.
  • Calculating the ETR values for Y.II. using the function calc_etr().
  • Removing rows from the recovery period if remove_recovery = TRUE.

Return

A data.table containing the processed data with additional columns for recalculated ETR values.

Example

r data <- read_junior_pam_data("path/to/data.csv", remove_recovery = TRUE, etr_factor = 0.84, fraction_photosystem_I = 0.5, fraction_photosystem_II = 0.5)

References

  • Heinz Walz GmbH. (2024). DUAL-PAM-100 DUAL-PAM/F MANUAL, 5th Edition, April 2024, Chapter 7 (pp. 162-172). Heinz Walz GmbH, Effeltrich, Germany. Available at: DUAL-PAM-100 Manual

vollenweidergenerateregressionETRI() and vollenweidergenerateregressionETRII()

This function generates a regression model based on Vollenweider (1965). Original naming conventions from the publication are used.

Parameters

  • data: A data.table containing the input data from read_dual_pam_data.
  • etr_type: A character string specifying the column name of the response variable (ETR I or ETR II) to be used in the model.
  • pmaxstartvalue: Numeric. The starting value for the parameter $$p{max}$$ in the model. Defaults to `pmaxstartvaluesvollenweider_default`.
  • astartvalue: Numeric. The starting value for the parameter $$a$$ in the model. Defaults to a_start_values_vollenweider_default.
  • alphastartvalue: Numeric. The starting value for the parameter $$\alpha$$ in the model. Defaults to alpha_start_values_vollenweider_default.
  • nstartvalue: Numeric. The starting value for the parameter $$n$$ in the model. Defaults to n_start_values_vollenweider_default.

Return

A list containing the following elements:

  • etrregressiondata: A data.table with the predicted values of ETR I or ETR II to each PAR based on the fitted model.
  • sdiff: The deviation between the actual and predicted ETR values.
  • pmax: The maximum electron transport rate without photoinhibition ($$p_{max}$$).
  • a: The obtained parameter $$a$$.
  • alpha: The obtained parameter $$\alpha$$.
  • n: The obtained parameter $$n$$.
  • popt: The maximum electron transport rate with photoinhibition ($$p_{opt}$$). A function computes predicted photosynthetic rates for each PAR value and tracks the maximum rate observed and is therefore modified from the original approach:

```r popt <- 0 pars <- c() predictions <- c() for (p in min(data$PAR):max(data$PAR)) { pars <- c(pars, p) prediction <- pmax * (((a * p) / (sqrt(1 + (a * p)^2))) * (1 / (sqrt(1 + (alpha * p)^2)^n))) predictions <- c( predictions, prediction )

    if (prediction > popt) {
      popt <- prediction
    }
  }

```

  • ik: PAR where the transition point from light limitation to light saturation is achieved without photoinhibition ($$I_k$$). Calculated as:

$$I_k = \frac{1}{a}$$

  • iik: PAR where the transition point from light limitation to light saturation is achieved with photoinhibition ($$I_k^\prime$$). Calculated as:

$$Ik^\prime = \frac{Ik \cdot p{opt}}{p{max}}$$

  • pmaxpoptandikiik_ratio: Ratio of $$p{max}$$ to $$p{opt}$$ and $$Ik$$ to $$Ik^\prime$$ ($$p{max} / p{opt}$$). Calculated as:

$$\pmax\_popt\_and\_ik\_iik\_ratio = \frac{Ik}{I_k^\prime}$$

Details

This function uses non-linear least squares fitting to estimate the parameters for the Vollenweider model, which describes the relationship between PAR and ETR. The model used is:

$$p = p_{max} \cdot \frac{a \cdot i}{\sqrt{1 + (a \cdot i)^2}} \cdot \frac{1}{\left(\sqrt{1 + (\alpha \cdot i)^2}\right)^n}$$

It is valid: $$i = PAR; p = ETR$$

Example

r result_vollenweider_ETR_II <- vollenweider_generate_regression_ETR_II(data, pmax_start_value = 40, a_start_value = 0.1, alpha_start_value = -0.0001, n_start_value = 350)

References

Vollenweider, R. A. (1965). Calculation models of photosynthesis-depth curves and some implications regarding day rate estimates in primary production measurements, p. 427-457. In C. R. Goldman [ed.], Primary Productivity in Aquatic Environments. Mem. Ist. Ital. Idrobiol., 18 Suppl., University of California Press, Berkeley.

plattgenerateregressionETRI() and plattgenerateregressionETRII()

This function generates a regression model based on Platt (1980). Original naming conventions from the publication are used.

Parameters

  • data: A data.table containing the input data from read_dual_pam_data.
  • alphastartvalue: Numeric. The starting value for the parameter $$\alpha$$ in the model. Defaults to alpha_start_value_platt_default.
  • betastartvalue: Numeric. The starting value for the parameter $$\beta$$ in the model. Defaults to beta_start_value_platt_default.
  • psstartvalue: Numeric. The starting value for the parameter $$ps$$ in the model. Defaults to `psstartvalueplatt_default`.

Return

A list containing the following elements:

  • etrregressiondata: A data.table with the predicted values of ETR I or ETR II to each PAR based on the fitted model.
  • sdiff: The deviation between the actual and predicted ETR values.
  • ps: The maximum electron transport rate without photoinhibition ($$P_s$$).
  • alpha: The initial slope of the light curve ($$\alpha$$).
  • beta: The photoinhibition of the light curve ($$\beta$$).
  • pm: The maximum electron transport rate with photoinhibition ($$P_m$$). Calculated as:

$$Pm = Ps \cdot \left(\frac{\alpha}{\alpha + \beta}\right) \cdot \left(\left(\frac{\beta}{\alpha + \beta}\right)^{\frac{\beta}{\alpha}}\right)$$

  • ik: PAR where the transition point from light limitation to light saturation is achieved with photoinhibition ($$I_k$$). Calculated as:

$$Ik = \frac{Pm}{\alpha}$$

  • is: PAR where the transition point from light limitation to light saturation is achieved without photoinhibition ($$I_s$$). Calculated as:

$$Is = \frac{Ps}{\alpha}$$

  • im: The PAR at which the maximum electron transport rate is achieved with photoinhibition ($$I_m$$). Calculated as:

$$Im = \left(\frac{Ps}{\alpha}\right) \cdot \log\left(\frac{\alpha + \beta}{\beta}\right)$$

  • ib: ($$I_b$$) Calculated as:

$$Ib = \frac{Ps}{\beta}$$

Details

This function uses non-linear least squares fitting to estimate the parameters for the Platt model, which describes the relationship between PAR and ETR. The model used is:

$$P = Ps \cdot \left(1 - e^\frac{{-\alpha \cdot I}}{Ps}\right) \cdot e^\left(\frac{{-\beta \cdot I}}{P_s}\right)$$

It is valid: $$I = PAR; p = ETR$$

Example

r result_platt_ETR_II <- platt_generate_regression_ETR_II(data, alpha_start_value = 0.3, beta_start_value = 0.01, ps_start_value = 30)

References

Platt, T., Gallegos, C. L., & Harrison, W. G. (1980). Photoinhibition of photosynthesis in natural assemblages of marine phytoplankton. Journal of Marine Research, 38(4). Retrieved from https://elischolar.library.yale.edu/journal_of_marine_research/1525.

eilerspeetersgenerateregressionETRI() and eilerspeetersgenerateregressionETRII()

This function generates a regression model based on Eilers-Peeters (1988). Original naming conventions from the publication are used. All parameters are calculated taking photoinhibition into account.

Parameters

  • data: A data.table containing the input data from read_dual_pam_data.
  • astartvalue: Numeric. The starting value for the parameter $$a$$ in the model. Defaults to a_start_values_eilers_peeters_default.
  • bstartvalue: Numeric. The starting value for the parameter $$b$$ in the model. Defaults to b_start_values_eilers_peeters_default.
  • cstartvalue: Numeric. The starting value for the parameter $$c$$ in the model. Defaults to c_start_values_eilers_peeters_default.

Return

A list containing the following elements:

  • etrregressiondata: A data.table with the predicted values of ETR I or ETR II to each PAR based on the fitted model.
  • sdiff: The deviation between the actual and predicted ETR values.
  • a: The obtained parameter $$a$$.
  • b: The obtained parameter $$b$$.
  • c: The obtained parameter $$c$$.
  • pm: The maximum electron transport rate ($$p_m$$). Calculated as:

$$p_m = \frac{1}{b + 2 \sqrt{a \cdot c}}$$

  • s: The initial slope of the light curve ($$s$$). Calculated as:

$$s = \frac{1}{c}$$

  • ik: PAR where the transition point from light limitation to light saturation is achieved ($$I_k$$). Calculated as:

$$I_k = \frac{c}{b + 2 \sqrt{a \cdot c}}$$

  • im: The PAR at which the maximum electron transport rate is achieved ($$I_m$$). Calculated as:

$$I_m = \sqrt{\frac{c}{a}}$$

  • w: The sharpness of the peak ($$w$$). Calculated as:

$$w = \frac{b}{\sqrt{a \cdot c}}$$

Details

This function uses non-linear least squares fitting to estimate the parameters for the Eilers-Peeters model, which describes the relationship between PAR and ETR. The model used is:

$$ p = \frac{I}{a \cdot I^2 + b \cdot I + c} $$

It is valid: $$I = PAR$$; $$p = ETR$$

Example

r result_eilers_peeters_ETR_II <- eilers_peeters_generate_regression_ETR_II(data, a_start_value = 0.00004, b_start_value = 0.004, c_start_value = 5)

References

Eilers, P. H. C., & Peeters, J. C. H. (1988). A model for the relationship between light intensity and the rate of photosynthesis in phytoplankton. Ecological Modelling, 42(3-4), 199-215. doi:10.1016/0304-3800(88)90057-9.

walsbygenerateregressionETRI() and walsbygenerateregressionETRII()

This function generates a regression model based on Walsby (1997) in a modified version without the respiration term. Naming conventions from Romoth (2019) are used. ETRmax is calculated without taking photoinhibition into account.

Parameters

  • data: A data.table containing the input data from read_dual_pam_data.
  • etrmaxstart_value: Numeric. The starting value for the parameter $$ETR{max}$$ in the model. Defaults to `etrmaxstartvaluewalsbydefault`.
  • alphastartvalue: Numeric. The starting value for the parameter $$\alpha$$ in the model. Defaults to alpha_start_value_walsby_default.
  • betastartvalue: Numeric. The starting value for the parameter $$\beta$$ in the model. Defaults to beta_start_value_walsby_default.

Return

A list containing the following elements:

  • etrregressiondata: A data.table with the predicted values of ETR I or ETR II to each PAR based on the fitted model.
  • sdiff: The deviation between the actual and predicted ETR values.
  • etr_max: The maximum electron transport rate without photoinhibition ($$ETR_{max}$$).
  • alpha: The initial slope of the light curve ($$\alpha$$).
  • beta: The photoinhibition of the light curve ($$\beta$$).

Details

This function uses non-linear least squares fitting to estimate the parameters for the Walsby model, which describes the relationship between PAR and ETR I. The model used is:

$$ETR = ETR{max} \cdot \left(1 - e^{\left(-\frac{\alpha \cdot I}{ETR{max}}\right)}\right) + \beta \cdot I$$

It is valid: $$I = PAR$$

References

Walsby, A. E. (1997). Numerical integration of phytoplankton photosynthesis through time and depth in a water column. New Phytologist, 136(2), 189-209. https://doi.org/10.1046/j.1469-8137.1997.00736.x

Romoth, K., Nowak, P., Kempke, D., Dietrich, A., Porsche, C., & Schubert, H. (2019). Acclimation limits of Fucus evanescens along the salinity gradient of the southwestern Baltic Sea. Botanica Marina, 62(1), 1-12. https://doi.org/10.1515/bot-2018-0098

vollenweider_modified()

This function adds parameters that were not originally included in the Vollenweider (1965) model, but were introduced by other models and renames the parameters to a standardised one for all models. See the table below.

Parameters

  • model_result: A list containing the results of the model, including parameters such as pmax, alpha, and ik.

Return

Returns a modified model result as a list with the following elements:

  • etr_type: ETR Type based on the model result.
  • etrregressiondata: Regression data with ETR predictions based on the fitted model.
  • sdiff: The difference between observed and predicted ETR values.
  • a: obtained paramter a, here equal to etrmax_without_photoinhibition
  • b: obtained paramter b, transfered as a
  • c: obtained paramter c, here transfered as alpha
  • d: obtained paramter c, here transfered as n
  • alpha: The initial slope of the light curve, calculated as:

$${alpha} = \frac{{etrmax\_with\_photoinhibition}}{{ik\_with\_photoinhibition}}$$

  • beta: Not available, here set to NA_real_
  • etrmaxwithphotoinhibition: The maximum electron transport rate with photoinhibition, transfered as popt
  • etrmaxwithoutphotoinhibition: The maximum electron transport rate without photoinhibition, transfered as: pmax
  • ikwithphotoinhibition: PAR where the transition point from light limitation to light saturation is achieved taking photoinhibition into account, transfered as: iik
  • ikwithoutphotoinhibition: PAR where the transition point from light limitation to light saturation is achieved not taking photoinhibition into account, transfered as: ik
  • imwithphotoinhibition: The PAR at which the maximum electron transport rate is achieved by taking photoinhibition into account. Although $I_m$ was mentioned in the original publication, no general solution was presented. Therefore, we decided to include it only in the modified version. Determined as:

r etr_regression_data <- get_etr_regression_data_from_model_result(model_result) im_with_photoinhibition <- etr_regression_data[etr_regression_data[[prediction_name]] == max(etr_regression_data[[prediction_name]]), ][[PAR_name]]

  • w: Not available, here set to NA_real_
  • ib: Not available, here set to NA_real_
  • etrmaxwithwithout_ratio: Ratio of etrmax_with_photoinhibition to etrmax_without_photoinhibition and ik_with_photoinhibition to ik_without_photoinhibition, transfered as: pmax_popt_and_ik_iik_ratio

Details

This function validates the model_result input and processes relevant parameters for the Vollenweider model, creating a structured list using create_modified_model_result. This standardized output allows for consistent analysis and comparison across different models.

Examples

r modified_result_vollenweider <- vollenweider_modified(model_result_vollenweider)

platt_modified()

This function adds parameters that were not originally included in the Platt (1980) model, but were introduced by other models and renames the parameters to a standardised one for all models. See the table below.

Parameters

  • model_result: A list containing the results of the model, including parameters such as etr_max, alpha, and beta.

Return

Returns a modified model result as a list with the following elements:

  • etr_type: ETR Type based on the model result.
  • etrregressiondata: Regression data with ETR predictions based on the fitted model.
  • sdiff: The difference between observed and predicted ETR values.
  • a: obtained paramter a, here equal to etrmax_without_photoinhibition
  • b: obtained paramter b, here equal to alpha
  • c: obtained paramter c, here equal to beta
  • d: not available, here set to NA_real_
  • alpha: The initial slope of the light curve, transfered unchanged as alpha
  • beta: The photoinhibition of the light curve, transfered unchanged as beta
  • etrmaxwithphotoinhibition: The maximum electron transport rate with photoinhibition, transfered as pm
  • etrmaxwithoutphotoinhibition: The maximum electron transport rate without photoinhibition, transfered as: ps
  • ikwithphotoinhibition: PAR where the transition point from light limitation to light saturation is achieved taking photoinhibition into account, transfered as: ik
  • ikwithoutphotoinhibition: PAR where the transition point from light limitation to light saturation is achieved not taking photoinhibition into account, transfered as: is
  • imwithphotoinhibition: The PAR at which the maximum electron transport rate is achieved by taking photoinhibition into account, transfered as: im
  • w: Not available, here set to NA_real_
  • ib: Transfered unchange as: ib
  • etrmaxwithwithout_ratio: Ratio of etrmax_with_photoinhibition to etrmax_without_photoinhibition and ik_with_photoinhibition to ik_without_photoinhibition. Calculated as:

$${{etrmax\_with\_without\_ratio}} = \frac{{etrmax\_with\_photoinhibition}}{{etrmax\_without\_photoinhibition}}$$

Details

This function validates the model_result input and processes relevant parameters for the Platt model, creating a structured list using create_modified_model_result. This standardized output allows for consistent analysis and comparison across different models.

Examples

r modified_result_platt <- platt_modified(model_result_platt)

eilerspeetersmodified()

This function adds parameters that were not originally included in the Eilers and Peeters (1988) model, but were introduced by other models and renames the parameters to a standardised one for all models. See the table below.

Parameters

  • model_result: A list containing the results of the model, including parameters such as a, b, c, s, pm, ik, im, and w.

Return

Returns a modified model result as a list with the following elements:

  • etr_type: ETR Type based on the model result.
  • etrregressiondata: Regression data with ETR predictions based on the fitted model.
  • sdiff: The difference between observed and predicted ETR values.
  • a: The obtained parameter $$a$$
  • b: The obtained parameter $$b$$
  • c: The obtained parameter $$c$$
  • d: Not available, here set to NA_real_
  • alpha: The initial slope of the light curve, transfered unchanged as s
  • beta: Not available, here set to NA_real_
  • etrmaxwithphotoinhibition: The maximum electron transport rate with photoinhibition, transfered as pm
  • etrmaxwithoutphotoinhibition: Not available, here set to NA_real_
  • ikwithphotoinhibition: PAR where the transition point from light limitation to light saturation is achieved taking photoinhibition into account, transfered as ik
  • ikwithoutphotoinhibition: Not available, here set to NA_real_
  • imwithphotoinhibition: The PAR at which the maximum electron transport rate is achieved by taking photoinhibition into account, transfered asim
  • w: The sharpness of the peak, transfered as w
  • ib: Not available, here set to NA_real_
  • etrmaxwithwithout_ratio: Not available, here set to NA_real_

Details

This function validates the model_result input, extracts relevant parameters for the modified Eilers-Peeters model, and creates a structured list using create_modified_model_result. The list serves as a standardized output format for further analysis.

Examples

```r

Example usage for eilerspeetersmodified

modifiedresult <- eilerspeetersmodified(modelresulteilerspeeters) ```

walsby_modified()

This function adds parameters that were not originally included in the Walsby (1997) model, but were introduced by other models and renames the parameters to a standardised one for all models. See the table below.

Parameters

  • model_result: A list containing the results of the model, including parameters such as etr_max, alpha, and beta.

Return

Returns a modified model result as a list with the following elements:

  • etr_type: ETR Type based on the model result.
  • etrregressiondata: Regression data with ETR predictions based on the fitted model.
  • sdiff: The difference between observed and predicted ETR values.
  • a: obtained paramter a, here equal to etrmax_without_photoinhibition
  • b: obtained paramter b, here equal to alpha
  • c: obtained paramter c, here equal to beta
  • d: not available, here set to NA_real_
  • alpha: The initial slope of the light curve, transfered unchanged as alpha
  • beta: The photoinhibition of the light curve, transfered unchanged as beta
  • etrmaxwithphotoinhibition: The maximum electron transport rate with photoinhibition, determined as:

r etr_regression_data <- get_etr_regression_data_from_model_result(model_result) etr_max_row <- etr_regression_data[etr_regression_data[[prediction_name]] == max(etr_regression_data[[prediction_name]]), ] etrmax_with_photoinhibition <- etr_max_row[[prediction_name]]

  • etrmaxwithoutphotoinhibition: The maximum electron transport rate without photoinhibition, transfered as: etr_max
  • ikwithphotoinhibition: PAR where the transition point from light limitation to light saturation is achieved taking photoinhibition into account, calculated as:

$$ik\_with\_photoinhibition = \frac{etrmax\_with\_photoinhibition}{alpha}$$

  • ikwithoutphotoinhibition: PAR where the transition point from light limitation to light saturation is achieved not taking photoinhibition into account, calculated as:

$$ik\_without\_photoinhibition = \frac{etrmax\_without\_photoinhibition}{alpha}$$

  • imwithphotoinhibition: The PAR at which the maximum electron transport rate is achieved by taking photoinhibition into account, calculated as:

r etr_regression_data <- get_etr_regression_data_from_model_result(model_result) etr_max_row <- etr_regression_data[etr_regression_data[[prediction_name]] == max(etr_regression_data[[prediction_name]]), ] im_with_photoinhibition <- etr_max_row[[PAR_name]]

  • w: Not available, here set to NA_real_
  • ib: Not available, here set to NA_real_
  • etrmaxwithwithout_ratio: Ratio of etrmax_with_photoinhibition to etrmax_without_photoinhibition and ik_with_photoinhibition to ik_without_photoinhibition. Calculated as:

$${{etrmax\_with\_without\_ratio}} = \frac{{etrmax\_with\_photoinhibition}}{{etrmax\_without\_photoinhibition}}$$

Details

This function validates the model_result input and processes relevant parameters for the Walsby model, creating a structured list using create_modified_model_result. This standardized output allows for consistent analysis and comparison across different photosynthesis models.

Examples

r modified_result <- walsby_modified(model_result_walsby)

Naming overview

Publication-accurate naming and the respective modified naming

modified |Eilers and Peeters |Platt |Walsby |Vollenweider | |-|-|-|-|-| |a |a |ps |etrmax |pmax | |b |b |alpha |alpha |a | |c |c |beta |beta |alpha | |d |NA |NA |NA |n | |alpha |s |alpha |alpha |NA | |beta |NA |beta |beta |NA | |etrmaxwithphotoinhibition |pm |pm |NA |popt | |etrmaxwithoutphotoinhibition |NA |ps |etrmax |pmax | |ikwithphotoinhibition |ik |ik |NA |iik | |ikwithoutphotoinhibition |NA |is |NA |ik | |imwithphotoinhibition |im |im |NA |NA | |w |w |NA |NA |NA | |ib |NA |ib |NA |NA | |etrmaxwithwithoutratio |NA |NA |NA |pmaxpoptandikiikratio | |sdiff |sdiff |sdiff |sdiff |sdiff |

Publication-accurate naming and the respective modified naming with additional calculations not included in the original publication

|modified |Eilers and Peeters |Platt |Walsby |Vollenweider | |-|-|-|-|-| |sdiff |sdiff |sdiff |sdiff |sdiff | |a |a |ps |etrmax |pmax | |b |b |alpha |alpha |a | |c |c |beta |beta |alpha | |d |NA |NA |NA |n | |alpha |s |alpha |alpha |realalpha | |beta |NA |beta |beta |NA | |etrmaxwithphotoinhibition |pm |pm |etrmaxwithphotoinhibition |popt | |etrmaxwithoutphotoinhibition |NA |ps |etrmax |pmax | |ikwithphotoinhibition |ik |ik |ikwithphotoinhibition |iik | |ikwithoutphotoinhibition |NA |is |ikwithoutphotoinhibition |ik | |imwithphotoinhibition |im |im |imwithphotoinhibition |imwithphotoinhibition | |w |w |NA |NA |NA | |ib |NA |ib |NA |NA | |etrmaxwithwithoutratio |NA |etrmaxwithwithoutratio |etrmaxwithwithoutratio |pmaxpoptandikiik_ratio |

compareregressionmodelsETRI() and compareregressionmodelsETRII()

This function compares different regression models.

Parameters

  • data_dir: A character string specifying the directory where the input data files are located.

Return

A vector containing the total points assigned to each regression model based on their performance. Models are ranked based on the calculated deviation of the difference between observed and predicted values. Rating:

  • 1st: 3 points
  • 2nd: 2 points
  • 3rd: 1 point
  • 4th: 0 points

Details

This function allows a straightforward comparison of the models: Eilers-Peeters (1988), Platt (1980), Vollenweider (1965), and Walsby (1997). The results can guide users in selecting the most appropriate model for their data. If regression is not possible for a model, no points are awarded for the file for any of the models. Start values cannot be adjusted in this function.

Example

```r

raw data file directory

datadircompare <- file.path(getwd(), "data")

compare regression models

compareregressionmodelsETRII <- compareregressionmodelsETRII(datadircompare) print(compareregressionmodelsETRII) ```

References

Eilers, P. H. C., & Peeters, J. C. H. (1988). A model for the relationship between light intensity and the rate of photosynthesis in phytoplankton. Ecological Modelling, 42(3-4), 199-215. doi:10.1016/0304-3800(88)90057-9.

Platt, T., Gallegos, C. L., & Harrison, W. G. (1980). Photoinhibition of photosynthesis in natural assemblages of marine phytoplankton. Journal of Marine Research, 38(4). Retrieved from https://elischolar.library.yale.edu/journal_of_marine_research/1525.

Romoth, K., Nowak, P., Kempke, D., Dietrich, A., Porsche, C., & Schubert, H. (2019). Acclimation limits of Fucus evanescens along the salinity gradient of the southwestern Baltic Sea. Botanica Marina, 62(1), 1-12. https://doi.org/10.1515/bot-2018-0098

Vollenweider, R. A. (1965). Calculation models of photosynthesis-depth curves and some implications regarding day rate estimates in primary production measurements, p. 427-457. In C. R. Goldman [ed.], Primary Productivity in Aquatic Environments. Mem. Ist. Ital. Idrobiol., 18 Suppl., University of California Press, Berkeley.

Walsby, A. E. (1997). Numerical integration of phytoplankton photosynthesis through time and depth in a water column. New Phytologist, 136(2), 189-209. https://doi.org/10.1046/j.1469-8137.1997.00736.x

plot_control()

This function creates a control plot for the used model based on the provided data and model results.

Parameters

  • data: A data.table containing the original ETR and yield data for the plot.
  • model_result: A list containing the fitting results of the used model and the calculated parameters (alpha, ik, etc.).
  • title: A character string that specifies the title of the plot.
  • color: A color specification for the regression line in the plot.

Return

A plot displaying the original ETR and Yield values and the regression data. A table below the plot shows the calculated data (alpha, ik, etc.).

Example

r plot_control_eilers_peeters_ETR_II <- plot_control( data = pam_data, model_result = modified_model_result_eilers_peeters_ETR_II, title = "eilers_peeters ETR II modified 20231122_01.csv", color = "purple" ) print(plot_control_eilers_peeters_ETR_II)

Plot

combocontrolplot()

The combo_control_plot function generates a combined plot of electron transport rate (ETR) data and regression model predictions, along with a customized table summarizing the parameters for each model.

Parameters

  • title: A character string specifying the title for the plot.
  • data: A data frame containing the raw input data for ETR and Photosynthetically Active Radiation (PAR).
  • model_results: A list of model results, where each model result is a list containing regression data and parameters for ETR.
  • name_list: A list of names corresponding to each model result. These names will be used in the legend and table.
  • color_list: A list of color values for each model result. Colors are used to differentiate lines on the plot.

Return

A plot displaying the original ETR and Yield values and the regression data from different models. A table below the plot shows the calculated data (alpha, ik, etc.).

Examples

```r testdatafile <- file.path(getwd(), "data", "2023112201.csv") data <- readdualpamdata(testdatafile)

eilers_peeters <- eilers_peeters_modified(eilers_peeters_generate_regression_ETR_II(data))
platt <- platt_modified(platt_generate_regression_ETR_II(data))
walsby <- walsby_modified(walsby_generate_regression_ETR_II(data))
vollenweider <- vollenweider_modified(vollenweider_generate_regression_ETR_II(data))

plot <- combo_control_plot(
  "etr II test-combo_plot_control_20231122_01.csv",
  data,
  list(eilers_peeters, platt, walsby, vollenweider),
  list("eilers_peeters", "platt", "walsby", "vollenweider"),
  list("purple", "blue", "green", "red")
)

```

combo Plot

writemodelresult_csv()

This function exports the raw input data, regression data, and model parameters into separate CSV files for easy access and further analysis.

Parameters

  • dest_dir: A character string specifying the directory where the CSV files will be saved.
  • name: A character string specifying the base name for the output files.
  • data: A data frame containing the raw input data used in the model.
  • model_result: A list containing the model results, including parameter values and regression data.

Details

This function creates three CSV files:

  1. name_raw_data.csv: Contains the original raw data used in the model.
  2. name_regression_data.csv: Contains the regression data with predictions for electron transport rate (ETR).
  3. name_model_result.csv: Contains the parameter values from the model results (excluding regression data), including parameters like alpha, beta, and etr_max.

Each file will be named using the name parameter as a prefix, followed by a specific suffix for clarity.

Examples

r write_model_result_csv( dest_dir = "output", name = "eilers_peeters_experiment_001", data = raw_data, model_result = model_result_eilers_peeters )

known issues

subscript out of bounds

Skipped file: 20231214_14_W6_T5_ML.csv because of error: Error in eilers_peeters[["sdiff"]]: subscript out of bounds

This could indicate that Pm lable in the Action column is at the wrong position in the csv raw data file. Error could be caused by WALZ-Software.

Removed rows in comboplotcontrol

Warnings: 1: Removed 1 row containing missing values or values outside the scale range (`geom_point()`). 2: Removed 1 row containing missing values or values outside the scale range (`geom_point()`). 3: Removed 1 row containing missing values or values outside the scale range (`geom_line()`).

All points and lines present. Reason for warning messages unknown. Possibly a problem in the library ggplot2.

test all

r library(devtools); devtools::test();

test specific file

R library(devtools); devtools::load_all(); library(testthat); test_file('$$path')"

Linux dependencies for devtools

Ubuntu: libxml2-dev libssl-dev libcurl4-openssl-dev libfontconfig1-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev

Debian: libxml2-dev libssl-dev libcurl4-openssl-dev libfontconfig1-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libjpeg-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev

R Packages: install.packages("data.table") install.packages("dplyr") install.packages("ggplot2") install.packages("minpack.lm") install.packages("SciViews") install.packages("ggthemes") install.packages("gridExtra") install.packages("cowplot")

packages <- readLines("packages.txt") install.packages(packages)

Owner

  • Name: biotoolbox
  • Login: biotoolbox
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Böhm"
  given-names: "Julien"
  orcid: "https://orcid.org/0009-0002-2704-2289"
- family-names: "Schrag"
  given-names: "Philipp"
  orcid: "https://orcid.org/0009-0002-7697-5536"
title: "pam"
version: 1.0.6
date-released: 2025-07-29
url: "https://github.com/biotoolbox/pam"
doi: "10.32614/CRAN.package.pam"

GitHub Events

Total
  • Release event: 5
  • Watch event: 1
  • Delete event: 2
  • Issue comment event: 1
  • Push event: 24
  • Pull request event: 4
  • Fork event: 2
  • Create event: 6
Last Year
  • Release event: 5
  • Watch event: 1
  • Delete event: 2
  • Issue comment event: 1
  • Push event: 24
  • Pull request event: 4
  • Fork event: 2
  • Create event: 6

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 0
  • Total pull requests: 6
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 month
  • Total issue authors: 0
  • Total pull request authors: 3
  • Average comments per issue: 0
  • Average comments per pull request: 0.33
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 6
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 month
  • Issue authors: 0
  • Pull request authors: 3
  • Average comments per issue: 0
  • Average comments per pull request: 0.33
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • JulienBoehm (2)
  • Phi-S (2)
  • kalibera (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 317 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 1
cran.r-project.org: pam

Fast and Efficient Processing of PAM Data

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 317 Last month
Rankings
Dependent packages count: 27.4%
Dependent repos count: 33.8%
Average: 49.4%
Downloads: 87.0%
Maintainers (1)
Last synced: 9 months ago

Dependencies

src/DESCRIPTION cran
  • SciViews * imports
  • cowplot * imports
  • data.table * imports
  • dplyr * imports
  • ggplot2 * imports
  • ggthemes * imports
  • glue * imports
  • gridExtra * imports
  • magrittr * imports
  • minpack.lm * imports
  • testthat >= 3.0.0 suggests