# a synthetic square grayscale image stands in for a real base face photo
base_face <- tempfile(fileext = ".png")
png::writePNG(matrix(runif(32 * 32), 32, 32), base_face)
stimulus_path <- tempdir()
generateStimuli2IFC(
base_face_files = list(face = base_face),
n_trials = 6,
img_size = 32,
stimulus_path = stimulus_path,
seed = 1,
ncores = 1,
nscales = 1,
save_as_png = FALSE
)
rdata_file <- list.files(stimulus_path, pattern = "\\.Rdata$", full.names = TRUE)[1]
# compute (and cache in rdata_file) a reference distribution; iter is kept
# tiny here for a fast example, in practice use iter >= 10000.
suppressWarnings(generateReferenceDistribution2IFC(rdata_file, iter = 3, ncores = 1))
responses <- sample(c(1, -1), 6, replace = TRUE)
target_ci <- generateCI(
stimuli = 1:6, responses = responses, baseimage = "face",
rdata = rdata_file, save_as_png = FALSE
)
computeInfoVal2IFC(target_ci = target_ci, rdata = rdata_file)
Run the code above in your browser using DataLab