generateStimuli2IFC: Generates 2IFC stimuli

View source: R/generateStimuli2IFC.R

generateStimuli2IFCR Documentation

Generates 2IFC stimuli

Description

Generate stimuli for 2 images forced choice reverse correlation task.

Usage

generateStimuli2IFC(
  base_face_files,
  n_trials = 770,
  img_size = 512,
  stimulus_path = "./stimuli",
  label = "rcic",
  use_same_parameters = TRUE,
  seed = 1,
  maximize_baseimage_contrast = TRUE,
  noise_type = "sinusoid",
  nscales = 5,
  sigma = 25,
  ncores = parallel::detectCores() - 1,
  return_as_dataframe = FALSE,
  save_as_png = TRUE,
  save_rdata = TRUE
)

Arguments

base_face_files

List containing base face file names used as base images for stimuli. Accepts JPEG and PNG images.

n_trials

Number specifying how many trials the task will have (function will generate two images for each trial per base image: original and inverted/negative noise).

img_size

Number specifying the number of pixels that the stimulus image will span horizontally and vertically (will be square, so only one integer needed).

stimulus_path

Path to save stimuli and .Rdata file to.

label

Label to prepend to each file for your convenience.

use_same_parameters

Boolean specifying whether for each base image the same set of parameters is used (TRUE) or a unique set is created for each base image (FALSE).

seed

Integer seeding the random number generator (for reproducibility).

maximize_baseimage_contrast

Boolean specifying wheter the pixel values of the base image should be rescaled to maximize its contrast.

noise_type

String specifying noise pattern type (defaults to sinusoid; other options: gabor).

nscales

Integer specifying the number of incremental spatial scales. Defaults to 5. Higher numbers will add higher spatial frequency scales.

sigma

Number specifying the sigma of the Gabor patch if noise_type is set to gabor (defaults to 25).

ncores

Number of CPU cores to use (default: detectCores()-1).

return_as_dataframe

Boolean specifying whether to return a data frame with the raw noise of the stimuli that were generated (default: FALSE). Data frame columns represent pixel values, data frame rows represent stimuli.

save_as_png

Boolean specifying whether to write the stimuli as images to disk (default: TRUE).

save_rdata

Boolean specifying whether .RData file with stimulus parameters will be saved (default: TRUE). Note: you always need to save the .RData file so that you can retrieve the stimulus parameters to compute classifciation images. This function argument exists primarily for internal rcicr use.

Details

Will save the stimuli as #' PNGs to a folder, including .Rdata file needed for analysis of data after data collection. This .Rdata file contains the parameters that were used to generate each stimulus.

Value

Nothing, everything is saved to files, unless return_as_dataframe is set to TRUE.


rdotsch/rcicr documentation built on Feb. 5, 2023, 10:15 p.m.