| autoscale | R Documentation |
Determines optimal scaling constant for a list of CIs
autoscale(cis, save_as_pngs = TRUE, targetpath)
cis |
List of classification images, each a list of pixel matrices holding at least the noise ( |
save_as_pngs |
Boolean: combine each autoscaled noise pattern with its base image and save it as a PNG, named after its key in |
targetpath |
Directory to save PNGs to. Required when |
The input cis list, with each element's $scaled matrix replaced by its
autoscaled version. The scaling constant is printed to the console, not returned.
Look at $scaled, not $combined. $combined is returned exactly
as it was passed in, on purpose, so that existing scripts that plot it keep producing the same
image. Only $scaled holds the autoscaled result. To show the autoscaled noise over the
base image, compute (ci$scaled + ci$base) / 2: that is exactly what
save_as_pngs = TRUE writes to disk.
This catches people out after batchGenerateCI or
batchGenerateCI2IFC. Both scale with 'none' before calling this
function, so their $combined overlays the unscaled noise and looks almost blank,
while $scaled is the image you want.
cis <- list(
participant1 = list(ci = matrix(runif(64, -0.2, 0.2), 8, 8), base = matrix(0.5, 8, 8)),
participant2 = list(ci = matrix(runif(64, -0.3, 0.3), 8, 8), base = matrix(0.5, 8, 8))
)
scaled_cis <- autoscale(cis, save_as_pngs = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.