Adrià Vilanova Martínez | 20de409 | 2023-03-21 17:53:14 +0100 | [diff] [blame^] | 1 | library(svglite) |
| 2 | |
| 3 | filename = 'Co' |
| 4 | |
| 5 | args = commandArgs(trailingOnly=TRUE) |
| 6 | |
| 7 | table <- read.table(paste0('dades/', filename, '.txt'), sep="\t", dec='.', header=TRUE) |
| 8 | |
| 9 | # Plot the data |
| 10 | plotall <- 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 | |
| 33 | pdf(paste0('output/', filename, '.pdf'), width = 6, height = 5) |
| 34 | plotall() |
| 35 | dev.off() |
| 36 | |
| 37 | if (length(args) < 1 || args[1] != "preview") { |
| 38 | svg(paste0('output/', filename, '.svg'), width = 6, height = 5) |
| 39 | plotall() |
| 40 | dev.off() |
| 41 | } |