Allow to select datafile for charts/explore/compare (filtered/non-filtered)

This commit is contained in:
2026-06-14 17:06:43 +02:00
parent 1d1ed3581a
commit e3be326c42
7 changed files with 226 additions and 70 deletions

View File

@ -6,13 +6,16 @@ library(ggalluvial)
args <- commandArgs(trailingOnly = TRUE)
argc <- length(args)
if (argc != 2) {
print("Expecting two input files")
if (argc < 2 || argc > 3) {
print("Expecting two or three arguments: exp1 exp2 [faults_file]")
stop()
}
for (experiment in args) {
datafile <- paste(experiment, "/faults.csv", sep = "")
faults_file <- if (argc == 3) args[3] else "faults.csv"
suffix <- gsub("^faults|\\.csv$", "", faults_file)
for (experiment in args[1:2]) {
datafile <- file.path(experiment, faults_file)
if (!file.exists(datafile)) {
print(paste("Input file", datafile, "is missing"))
stop()
@ -30,13 +33,13 @@ resulttype_labels <- c(
)
# Read data
datafile1 <- paste(args[1], "/faults.csv", sep = "")
datafile1 <- file.path(args[1], faults_file)
data1 <- readr::read_csv(datafile1)
data1$fault_address <- strtoi(data1$fault_address)
data1$resulttype <- resulttype_labels[data1$resulttype]
# tibble::glimpse(data1)
datafile2 <- paste(args[2], "/faults.csv", sep = "")
datafile2 <- file.path(args[2], faults_file)
data2 <- readr::read_csv(datafile2)
data2$fault_address <- strtoi(data2$fault_address)
data2$resulttype <- resulttype_labels[data2$resulttype]
@ -75,6 +78,6 @@ plot <- ggplot(
# TODO: Name the file according to the benchmarks
ggsave(
paste(args[2], "/../sankey.svg", sep = ""),
paste0(args[2], "/../sankey", suffix, ".svg"),
plot = plot,
)