Skip to content

Commit eca7766

Browse files
BuchBuch
authored andcommitted
Add R history file
1 parent fce798e commit eca7766

File tree

1 file changed

+40
-40
lines changed
  • code/postprocessing/postprocessing-behavior

1 file changed

+40
-40
lines changed

code/postprocessing/postprocessing-behavior/.Rhistory

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
source("functions/check_inclusion_criteria.R")
2-
source("functions/validate_against_eeg.R")
3-
# === user input: define subject list ===
4-
# slash-separated string of subject IDs to be processed in this run
5-
# leave empty ("") to process all available subjects
6-
# subjects_to_process = "390002/390003/390004/390005/390006/390007/390008/390009/390010/390011/390012/390013/390014/390015/390020/390021/390022/390023/390024/390025/390026/390027/390028/390030/390031/390032/390033/390034/390036/390037/390038/390039/390041/390042";
7-
subjects_to_process = "390002"
8-
# parse subject list
9-
if (subjects_to_process == "") {
10-
subjects_list <- NULL # process all subjects
11-
cat("processing all available subjects\n")
12-
} else {
13-
subjects_list <- str_split(subjects_to_process, "/")[[1]]
14-
subjects_list <- subjects_list[subjects_list != ""]
15-
cat("processing", length(subjects_list), "specified subjects\n")
16-
}
17-
# create output directories
18-
create_output_dirs()
191
# start logging
202
log_file <- file.path(logs_dir,
213
paste0("console_log_",
@@ -100,6 +82,15 @@ cat("\nsaved validation results to:", validation_file, "\n")
10082
} else {
10183
cat("\nwarning: no eeg postprocessing folders found, skipping validation\n")
10284
}
85+
# generate final summary report (needs validation results)
86+
summary_report <- generate_postprocessing_summary(
87+
behavioral_with_rt,
88+
inclusion_summary,
89+
validation_results,
90+
output_dir,
91+
processing_params,
92+
verbose = TRUE
93+
)
10394
# batch_behavioral_postprocessing.r - main pipeline for behavioral postprocessing
10495
# author: marlene buch
10596
# === setup ===
@@ -118,6 +109,26 @@ source("functions/apply_eeg_exclusions.R")
118109
source("functions/apply_rt_trimming.R")
119110
source("functions/check_inclusion_criteria.R")
120111
source("functions/validate_against_eeg.R")
112+
source("functions/generate_report.R")
113+
# batch_behavioral_postprocessing.r - main pipeline for behavioral postprocessing
114+
# author: marlene buch
115+
# === setup ===
116+
cat("=== BEHAVIORAL POSTPROCESSING STARTED ===\n")
117+
cat("session started:", as.character(Sys.time()), "\n\n")
118+
# clear environment
119+
rm(list = ls())
120+
# load configuration & functions
121+
source("config/paths.R")
122+
# get repo root from paths
123+
repo_root <- file.path(here::here(), "..", "..", "..")
124+
source("config/settings.R")
125+
source("functions/load_behavioral_data.R")
126+
source("functions/load_eeg_trial_info.R")
127+
source("functions/apply_eeg_exclusions.R")
128+
source("functions/apply_rt_trimming.R")
129+
source("functions/check_inclusion_criteria.R")
130+
source("functions/validate_against_eeg.R")
131+
source("functions/generate_reports.R")
121132
# === user input: define subject list ===
122133
# slash-separated string of subject IDs to be processed in this run
123134
# leave empty ("") to process all available subjects
@@ -184,7 +195,6 @@ saveRDS(inclusion_summary, inclusion_file)
184195
cat("saved inclusion summary to:", inclusion_file, "\n")
185196
# generate reports
186197
cat("\n=== GENERATING REPORTS ===\n")
187-
source("functions/generate_reports.R")
188198
# subject summary table
189199
subject_table <- generate_subject_summary_table(
190200
behavioral_with_rt,
@@ -245,25 +255,6 @@ source("functions/apply_eeg_exclusions.R")
245255
source("functions/apply_rt_trimming.R")
246256
source("functions/check_inclusion_criteria.R")
247257
source("functions/validate_against_eeg.R")
248-
source("functions/generate_report.R")
249-
# batch_behavioral_postprocessing.r - main pipeline for behavioral postprocessing
250-
# author: marlene buch
251-
# === setup ===
252-
cat("=== BEHAVIORAL POSTPROCESSING STARTED ===\n")
253-
cat("session started:", as.character(Sys.time()), "\n\n")
254-
# clear environment
255-
rm(list = ls())
256-
# load configuration & functions
257-
source("config/paths.R")
258-
# get repo root from paths
259-
repo_root <- file.path(here::here(), "..", "..", "..")
260-
source("config/settings.R")
261-
source("functions/load_behavioral_data.R")
262-
source("functions/load_eeg_trial_info.R")
263-
source("functions/apply_eeg_exclusions.R")
264-
source("functions/apply_rt_trimming.R")
265-
source("functions/check_inclusion_criteria.R")
266-
source("functions/validate_against_eeg.R")
267258
source("functions/generate_reports.R")
268259
# === user input: define subject list ===
269260
# slash-separated string of subject IDs to be processed in this run
@@ -373,6 +364,16 @@ output_dir,
373364
processing_params,
374365
verbose = TRUE
375366
)
367+
cat("\n=== SUMMARY ===\n")
368+
cat("total subjects processed:", n_distinct(behavioral_data$subject), "\n")
369+
cat("subjects included:", sum(inclusion_summary$included), "\n")
370+
cat("subjects excluded:", sum(!inclusion_summary$included), "\n")
371+
cat("\nprocessed data saved to:", output_dir, "\n")
372+
# stop logging
373+
sink()
374+
cat("\n=== BEHAVIORAL POSTPROCESSING COMPLETE ===\n")
375+
cat("session ended:", as.character(Sys.time()), "\n")
376+
cat("log saved to:", log_file, "\n")
376377
# batch_behavioral_postprocessing.r - main pipeline for behavioral postprocessing
377378
# author: marlene buch
378379
# === setup ===
@@ -395,8 +396,7 @@ source("functions/generate_reports.R")
395396
# === user input: define subject list ===
396397
# slash-separated string of subject IDs to be processed in this run
397398
# leave empty ("") to process all available subjects
398-
# subjects_to_process = "390002/390003/390004/390005/390006/390007/390008/390009/390010/390011/390012/390013/390014/390015/390020/390021/390022/390023/390024/390025/390026/390027/390028/390030/390031/390032/390033/390034/390036/390037/390038/390039/390041/390042";
399-
subjects_to_process = "390002"
399+
subjects_to_process = "390002/390003/390004/390005/390006/390007/390008/390009/390010/390011/390012/390013/390014/390015/390020/390021/390022/390023/390024/390025/390026/390027/390028/390030/390031/390032/390033/390034/390036/390037/390038/390039/390041/390042";
400400
# parse subject list
401401
if (subjects_to_process == "") {
402402
subjects_list <- NULL # process all subjects

0 commit comments

Comments
 (0)