Update charts to account for new datafile/charts folders
This commit is contained in:
@@ -4,25 +4,33 @@ library(readr)
|
||||
library(stringr)
|
||||
library(tidyr)
|
||||
|
||||
# Usage: Rscript combined_fault_correlation.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Usage: Rscript combined_fault_count_correlation.r exp1 exp2 ... queries_dir charts_dir [resultsdata_file]
|
||||
# Plots correlation between raw aot and interp fault counts (no C baseline).
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 2) {
|
||||
stop("Need at least 2 experiments")
|
||||
}
|
||||
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"resultsdata.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
tail_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
if (length(tail_args) < 4) {
|
||||
stop(paste(
|
||||
"Usage: combined_fault_count_correlation.r",
|
||||
"<exp1> <exp2> ... <queries_dir> <charts_dir> [resultsdata_file]"
|
||||
))
|
||||
}
|
||||
|
||||
charts_dir <- tail_args[length(tail_args)]
|
||||
queries_dir <- tail_args[length(tail_args) - 1]
|
||||
exp_args <- tail_args[-c(length(tail_args) - 1, length(tail_args))]
|
||||
|
||||
extract_info <- function(path) {
|
||||
dir_name <- basename(path)
|
||||
match <- str_match(
|
||||
@@ -44,7 +52,7 @@ for (arg in exp_args) {
|
||||
next
|
||||
}
|
||||
|
||||
csv_file <- file.path(info$path, csv_suffix)
|
||||
csv_file <- file.path(queries_dir, paste0(arg, "_", csv_suffix))
|
||||
if (!file.exists(csv_file)) {
|
||||
warning(paste("Missing:", csv_file))
|
||||
next
|
||||
@@ -123,6 +131,10 @@ plot <- ggplot(
|
||||
)
|
||||
|
||||
suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/fault_count_correlation", suffix, ".svg")
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
outfile <- file.path(
|
||||
charts_dir,
|
||||
paste0("fault_count_correlation", suffix, ".svg")
|
||||
)
|
||||
ggsave(outfile, plot = plot, width = 10, height = 8)
|
||||
print(paste("Saved", outfile))
|
||||
|
||||
Reference in New Issue
Block a user