R Under development (unstable) (2024-01-23 r85822 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ################################## > # Check that Speeds are consistent > # A vector with low speed should have stop before vetor with hi speed, cet par. > ################################## > > require(OPI) Loading required package: OPI Loading required package: Rfast Loading required package: Rcpp Loading required package: RcppZiggurat Loading required package: RcppParallel Attaching package: 'RcppParallel' The following object is masked from 'package:Rcpp': LdFlags Rfast: 2.1.0 ___ __ __ __ __ __ __ __ __ __ _ _ __ __ __ __ __ __ __ __ __ __ __ | __ __ __ __ | | __ __ __ __ _/ / \ | __ __ __ __ / /__ __ _ _ __ __\ | | | | | | / _ \ | | / / | | | | | | / / \ \ | | / / | | | | | | / / \ \ | | / / | |__ __ __ __| | | |__ __ __ __ / / \ \ | |__ __ __ __ _ / /__/\ | __ __ __ __| | __ __ __ __| / /__ _ __\ \ |_ __ __ __ _ | / ___ / | \ | | / _ _ _ _ _ _ \ | | \/ / / | |\ \ | | / / \ \ | | / / | | \ \ | | / / \ \ | | / / | | \ \ | | / / \ \ | | / / | | \ \__ __ _ | | / / \ \ _ __ __ __ _| | / / |_| \__ __ __\ |_| /_/ \_\ /_ __ __ __ ___| \/ team Loading required package: abind Loading required package: openssl Linking to: OpenSSL 3.1.2 1 Aug 2023 > chooseOpi("SimHensonRT") [1] TRUE > > rtData <- as.data.frame(cbind(Rt=rep(0, 100),Dist=rep(0, 100), Person=rep(0, 100))) > > e <- opiInitialize(type="C", A=NA, B=NA, cap=6, display=NA, maxStim=10000/pi, rtData=rtData, rtFP=1:1600) > > get_mean_dist<- function(speed) + { + LEVEL = dbTocd(20,10000) + + stim <- list(path=list(x=c(20,0), y=c(20,0)),sizes=(0.43), colors=("white"), levels=(LEVEL), speeds=c(speed)) + class(stim) <- "opiKineticStimulus" + + result <- opiPresent(stim, tt= list(c(0,40)), fpr=0, fnr=0) + + return(sqrt((result$x - 20)^2 + (result$y-20)^2)) + } > > > test.speed <- function() + { + + d1 <- median(replicate(100, get_mean_dist(1))) + d5 <- median(replicate(100, get_mean_dist(5))) + + checkTrue(d1 < d5, "d1 (speed 1) should be less than d5 (speed 5)") + } > > proc.time() user system elapsed 0.37 0.12 0.48