blob: 62cabdc7b4c8128e6f0059387c5670bb61056424 [file] [log] [blame]
Adrià Vilanova Martínez20de4092023-03-21 17:53:14 +01001library(svglite)
2
3filename = 'Co'
4
5args = commandArgs(trailingOnly=TRUE)
6
7table <- read.table(paste0('dades/', filename, '.txt'), sep="\t", dec='.', header=TRUE)
8
9# Plot the data
10plotall <- function() {
11 plot(table$ChannelNumber, table$Impulses, type="l", col="#EEEEFF", xlab="Número de canal", ylab="Comptes")
12 lines(table$ChannelNumber, table$ImpulsesSmooth, type="l")
13
14 # Add arrows and text labels to the peaks
15 i <- 2094 + 1
16 arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+14.6, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.64, length = 0.05, code = 1, col = "#514E7E")
17 text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+20.64, bquote(atop(gamma["3,1"] * (Ni), 1173 ~ keV)), col = "#514E7E", cex = 0.75)
18
19 i <- 2362 + 1
20 arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+9.6, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.64, length = 0.05, code = 1, col = "#514E7E")
21 text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+16.64, bquote(atop(gamma["1,0"] * (Ni), 1332 ~ keV)), col = "#514E7E", cex = 0.75)
22
23 i <- 409 + 1
24 arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+17.6, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.64, length = 0.05, code = 1, col = "#799B6F")
25 text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+24.64, bquote(atop(BS ~ gamma["3,1"] * (Ni), 209 ~ keV)), col = "#799B6F", cex = 0.75)
26
27 i <- 417 + 1
28 arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+11.6, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.64, length = 0, col = "#799B6F")
29 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")
30 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)
31}
32
33pdf(paste0('output/', filename, '.pdf'), width = 6, height = 5)
34plotall()
35dev.off()
36
37if (length(args) < 1 || args[1] != "preview") {
38 svg(paste0('output/', filename, '.svg'), width = 6, height = 5)
39 plotall()
40 dev.off()
41}