Add p2
Change-Id: I1c8a8389a1cafaed791c738f91cede5b2e22ca0a
diff --git a/quad12/labmoderna/p2/r/Co.r b/quad12/labmoderna/p2/r/Co.r
new file mode 100644
index 0000000..62cabdc
--- /dev/null
+++ b/quad12/labmoderna/p2/r/Co.r
@@ -0,0 +1,41 @@
+library(svglite)
+
+filename = 'Co'
+
+args = commandArgs(trailingOnly=TRUE)
+
+table <- read.table(paste0('dades/', filename, '.txt'), sep="\t", dec='.', header=TRUE)
+
+# Plot the data
+plotall <- function() {
+ plot(table$ChannelNumber, table$Impulses, type="l", col="#EEEEFF", xlab="Número de canal", ylab="Comptes")
+ lines(table$ChannelNumber, table$ImpulsesSmooth, type="l")
+
+ # Add arrows and text labels to the peaks
+ i <- 2094 + 1
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+14.6, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.64, length = 0.05, code = 1, col = "#514E7E")
+ text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+20.64, bquote(atop(gamma["3,1"] * (Ni), 1173 ~ keV)), col = "#514E7E", cex = 0.75)
+
+ i <- 2362 + 1
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+9.6, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.64, length = 0.05, code = 1, col = "#514E7E")
+ text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+16.64, bquote(atop(gamma["1,0"] * (Ni), 1332 ~ keV)), col = "#514E7E", cex = 0.75)
+
+ i <- 409 + 1
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+17.6, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.64, length = 0.05, code = 1, col = "#799B6F")
+ text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+24.64, bquote(atop(BS ~ gamma["3,1"] * (Ni), 209 ~ keV)), col = "#799B6F", cex = 0.75)
+
+ i <- 417 + 1
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+11.6, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.64, length = 0, col = "#799B6F")
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+11.6, table$ChannelNumber[i]+100, table$ImpulsesSmooth[i]+11.6, length = 0.05, code = 2, col = "#799B6F")
+ text(table$ChannelNumber[i]+60, table$ImpulsesSmooth[i]+6.6, bquote(atop(BS ~ gamma["1,0"] * (Ni), 214 ~ keV)), col = "#799B6F", cex = 0.75, pos = 4)
+}
+
+pdf(paste0('output/', filename, '.pdf'), width = 6, height = 5)
+plotall()
+dev.off()
+
+if (length(args) < 1 || args[1] != "preview") {
+ svg(paste0('output/', filename, '.svg'), width = 6, height = 5)
+ plotall()
+ dev.off()
+}
diff --git a/quad12/labmoderna/p2/r/Cs.r b/quad12/labmoderna/p2/r/Cs.r
new file mode 100644
index 0000000..9a3cbab
--- /dev/null
+++ b/quad12/labmoderna/p2/r/Cs.r
@@ -0,0 +1,33 @@
+library(svglite)
+
+filename = 'Cs'
+scale <- 110 # Scale compared to the Na_smoothest (for the arrows and text)
+
+args = commandArgs(trailingOnly=TRUE)
+
+table <- read.table(paste0('dades/', filename, '.txt'), sep="\t", dec='.', header=TRUE)
+
+# Plot the data
+plotall <- function() {
+ plot(table$ChannelNumber, table$Impulses, type="l", col="#EEEEFF", xlab="Número de canal", ylab="Comptes")
+ lines(table$ChannelNumber, table$ImpulsesSmooth, type="l")
+
+ # Add arrows and text labels to the peaks
+ i <- 1197 + 1
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*(3 + 2), table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*0.2, length = 0.05, code = 1, col = "#514E7E")
+ text(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*(5.2 + 2), bquote(atop(gamma["2,0"] * (Ba), 662 ~ keV)), col = "#514E7E", cex = 0.75)
+
+ i <- 365 + 1
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*3, table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*0.2, length = 0.05, code = 1, col = "#799B6F")
+ text(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*5.2, bquote(atop(BS ~ gamma["2,0"] * (Ba), 184 ~ keV)), col = "#799B6F", cex = 0.75)
+}
+
+pdf(paste0('output/', filename, '.pdf'), width = 6, height = 5)
+plotall()
+dev.off()
+
+if (length(args) < 1 || args[1] != "preview") {
+ svg(paste0('output/', filename, '.svg'), width = 6, height = 5)
+ plotall()
+ dev.off()
+}
diff --git a/quad12/labmoderna/p2/r/Cs_amb_plom.r b/quad12/labmoderna/p2/r/Cs_amb_plom.r
new file mode 100644
index 0000000..3f29d25
--- /dev/null
+++ b/quad12/labmoderna/p2/r/Cs_amb_plom.r
@@ -0,0 +1,37 @@
+library(svglite)
+
+filename = 'Cs_amb_plom'
+scale <- 100 # Scale compared to the Na_smoothest (for the arrows and text)
+
+args = commandArgs(trailingOnly=TRUE)
+
+table <- read.table(paste0('dades/', filename, '.txt'), sep="\t", dec='.', header=TRUE)
+
+# Plot the data
+plotall <- function() {
+ plot(table$ChannelNumber, table$Impulses, type="l", col="#EEEEFF", xlab="Número de canal", ylab="Comptes")
+ lines(table$ChannelNumber, table$ImpulsesSmooth, type="l")
+
+ # Add arrows and text labels to the peaks
+ i <- 1197 + 1
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*(3 + 2), table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*0.2, length = 0.05, code = 1, col = "#799B6F")
+ text(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*(5.2 + 2), bquote(atop(gamma["2,0"] * (Ba), 662 ~ keV)), col = "#799B6F", cex = 0.75)
+
+ i <- 365 + 1
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*3, table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*0.2, length = 0.05, code = 1, col = "#799B6F")
+ text(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*5.2, bquote(atop(BS ~ gamma["2,0"] * (Ba), 184 ~ keV)), col = "#799B6F", cex = 0.75)
+
+ i <- 150 + 1
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*13, table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*0.2, length = 0.05, code = 1, col = "#F9627D")
+ text(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*15.2, bquote(atop("Raigs X", atop("Canal 150", 61 ~ keV))), col = "#F9627D", cex = 0.75)
+}
+
+pdf(paste0('output/', filename, '.pdf'), width = 6, height = 5)
+plotall()
+dev.off()
+
+if (length(args) < 1 || args[1] != "preview") {
+ svg(paste0('output/', filename, '.svg'), width = 6, height = 5)
+ plotall()
+ dev.off()
+}
diff --git a/quad12/labmoderna/p2/r/KCl.r b/quad12/labmoderna/p2/r/KCl.r
new file mode 100644
index 0000000..4c9857b
--- /dev/null
+++ b/quad12/labmoderna/p2/r/KCl.r
@@ -0,0 +1,33 @@
+library(svglite)
+
+filename = 'KCl'
+scale <- 1.5 # Scale compared to the Na_smoothest (for the arrows and text)
+
+args = commandArgs(trailingOnly=TRUE)
+
+table <- read.table(paste0('dades/', filename, '.txt'), sep="\t", dec='.', header=TRUE)
+
+# Plot the data
+plotall <- function() {
+ plot(table$ChannelNumber, table$Impulses, type="l", col="#EEEEFF", xlab="Número de canal", ylab="Comptes")
+ lines(table$ChannelNumber, table$ImpulsesSmooth, type="l")
+
+ # Add arrows and text labels to the peaks
+ i <- 2499 + 1
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*(3 + 2), table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*0.2, length = 0.05, code = 1, col = "#514E7E")
+ text(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*(5.2 + 2), bquote(atop(gamma["1,0"] * (Ar), 1409 ~ keV)), col = "#514E7E", cex = 0.75)
+
+ i <- 423 + 1
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*3, table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*0.2, length = 0.05, code = 1, col = "#799B6F")
+ text(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*5.2, bquote(atop(BS ~ gamma["1,0"] * (Ar), 217 ~ keV)), col = "#799B6F", cex = 0.75)
+}
+
+pdf(paste0('output/', filename, '.pdf'), width = 6, height = 5)
+plotall()
+dev.off()
+
+if (length(args) < 1 || args[1] != "preview") {
+ svg(paste0('output/', filename, '.svg'), width = 6, height = 5)
+ plotall()
+ dev.off()
+}
diff --git a/quad12/labmoderna/p2/r/Na_smoothest.r b/quad12/labmoderna/p2/r/Na_smoothest.r
new file mode 100644
index 0000000..4bd3013
--- /dev/null
+++ b/quad12/labmoderna/p2/r/Na_smoothest.r
@@ -0,0 +1,36 @@
+library(svglite)
+
+filename = 'Na_smoothest'
+
+args = commandArgs(trailingOnly=TRUE)
+
+table <- read.table(paste0('dades/', filename, '.txt'), sep="\t", dec='.', header=TRUE)
+
+# Plot the data
+plotall <- function() {
+ plot(table$ChannelNumber, table$Impulses, type="l", col="#EEEEFF", xlab="Número de canal", ylab="Comptes")
+ lines(table$ChannelNumber, table$ImpulsesSmooth, type="l")
+
+ # Add arrows and text labels to the peaks
+ i <- 934 + 1
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+3, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.2, length = 0.05, code = 1, col = "#514E7E")
+ text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+5.2, bquote(atop(gamma ^ "±" * (Ne), 511 ~ keV)), col = "#514E7E", cex = 0.75)
+
+ i <- 341 + 1
+ arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+3, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.2, length = 0.05, code = 1, col = "#799B6F")
+ text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+5.2, bquote(atop(BS ~ gamma ^ "±" * (Ne), 170 ~ keV)), col = "#799B6F", cex = 0.75)
+}
+
+indexes <- c()
+labels <- c()
+peaks <- data.frame(indexes, labels)
+
+pdf(paste0('output/', filename, '.pdf'), width = 6, height = 5)
+plotall()
+dev.off()
+
+if (length(args) < 1 || args[1] != "preview") {
+ svg(paste0('output/', filename, '.svg'), width = 6, height = 5)
+ plotall()
+ dev.off()
+}