---
title: "`r paste0('Estimation Report for ', params$aberr_module)`"
author: "`r paste0('Biodose Tools', ' v', utils::packageVersion(pkg = 'biodosetools'))`"
date: "`r format(Sys.time(), '%d %B, %Y %H:%M:%S')`"
always_allow_html: true
output: pdf_document
header-includes:
  - \usepackage{titling}
  - \usepackage{booktabs}
  - \usepackage{tabularx}
  - \usepackage{float}
  - \usepackage{colortbl}
  - \pretitle{
    \vspace{-50pt}
    \includegraphics[width=2.0625in,height=0.5in]{`r system.file("/app/reports/logo.pdf", package = "biodosetools")`}\LARGE\\
    \begin{center}}
  - \posttitle{\end{center}}
params:
  aberr_module: ""
  comments: ""
  case_description: ""
  table_dose_g: NULL 
  table_dose_n: NULL 
  table_dose_t: NULL 
  table_yield_g: NULL 
  table_yield_n: NULL 
  table_yield_t: NULL 
  data_input: NULL 
  curve_input_neutrons: NULL 
  curve_input_gamma: NULL 
  curve_formula_gamma: NULL
  curve_formula_neutrons: NULL
  plot_gamma: NULL
  plot_neutron: NULL
  manual_cov_gamma: NULL
  manual_cov_neutrons: NULL 
  
---
<h2>1. Case description</h2> 

`r params$case_description`

<h2>2. Data input</h2>

<h3>Gamma curve</h3> 
```{r, echo=FALSE, results='asis'}
library(knitr)
cat("$$", params$curve_formula_gamma, "$$")
kable(params$curve_input_gamma, format = "markdown", align = "c", caption = "Coefficients")
if(!is.null(params$manual_cov_gamma)){
  kable(params$manual_cov_gamma, format = "markdown", align = "c", caption = "Variance-covariance matrix")
}
```

<h3>Neutron curve</h3> 
```{r, echo=FALSE, results='asis'}
cat("$$", params$curve_formula_neutrons, "$$")
kable(params$curve_input_neutrons, format = "markdown", align = "c", caption = "Coefficients")
if(!is.null(params$manual_cov_neutrons)){
  kable(params$manual_cov_neutrons, format = "markdown", align = "c", caption = "Variance-covariance matrix")
}
```

<h3>Case data analysed</h3> 
```{r, echo=FALSE, results='asis'}
kable(params$data_input, format = "markdown", align = "c", caption = "Provided case data")
```



<h2>3. Dose estimation results</h2>
```{r, echo=FALSE, results='asis'}
kable(params$table_dose_g, format = "markdown", align = "c", caption = "Dose estimation Gamma (Gy)", row.names = TRUE)
kable(params$table_yield_g, format = "markdown", align = "c", caption = "Yield estimation Gamma (dic/cell)", row.names = TRUE)

kable(params$table_dose_n, format = "markdown", align = "c", caption = "Dose estimation Neutrons (Gy)",  row.names = TRUE)
kable(params$table_yield_n, format = "markdown", align = "c", caption = "Yield estimation Neutrons (dic/cell)",  row.names = TRUE)

kable(params$table_dose_t, format = "markdown", align = "c", caption = "Dose estimation total (Gy)",  row.names = TRUE)
kable(params$table_yield_t, format = "markdown", align = "c", caption = "Yield estimation total (dic/cell)",  row.names = TRUE)
 
```

<h2>4. Curve plot</h2>
<h3>Gamma</h3>
```{r, echo=FALSE, results='asis', out.width="\\linewidth"}
knitr::include_graphics(params$plot_gamma)
```
<h3>Neutron</h3>
```{r, echo=FALSE, results='asis', out.width="\\linewidth"}
knitr::include_graphics(params$plot_neutron)
```

<h2>5. Comments</h2>

`r params$comments`

