[R-gregmisc-users] SF.net SVN: r-gregmisc:[1410] trunk/SII
Brought to you by:
warnes
From: <wa...@us...> - 2010-01-24 23:26:23
|
Revision: 1410 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1410&view=rev Author: warnes Date: 2010-01-24 23:26:17 +0000 (Sun, 24 Jan 2010) Log Message: ----------- Add code to apply the examples from the 'official' C PROGRAM DEVELOPER'S KIT Added Paths: ----------- trunk/SII/test/ trunk/SII/test/test_sii.R Added: trunk/SII/test/test_sii.R =================================================================== --- trunk/SII/test/test_sii.R (rev 0) +++ trunk/SII/test/test_sii.R 2010-01-24 23:26:17 UTC (rev 1410) @@ -0,0 +1,82 @@ +## This file runs the R 'sii' code on the examples provided with the +## 'official' C PROGRAM DEVELOPER-F\xA2S KIT available at-A +## http://www.sii.to/html/programs.html to ensure that it yields the +## correct results. + +library(SII) + +## OCTAVE.TST 0.491 Octave Procedure +OCTAVE.TST=sii( + speech=c(50.00,40,40,30,20,0.0), + noise=c(70,65,45,25,1.00,-15.00), + threshold=c(0.00,0,0,0,0,7.10), + method="octave" + ) +stopifnot(round(OCTAVE.TST$sii,3)==0.491) + +## OCTAVE_1.TST 0.323 Octave Procedure With Alternative Band Importance +OCTAVE_1.TST=sii( + speech=c(50.00,40,40,30,20,0.0), + noise=c(70,65,45,25,1.00,-15.00), + threshold=c(0.00,0,0,0,0,7.10), + importance=c(0,0,1,0,0,0), + method="octave" + ) +stopifnot(round(OCTAVE_1.TST$sii,3)==0.323) + +## TO.TST 0.445 1/3-Octave Procedure +TO.TST=sii( + speech=c(90,5,40,40,40,40,40,40,40,40,40,40,40,40,-10,-10,-10,-10), + noise=c(10,-10,-10,75,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,10,10,10,10), + threshold=c(90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + method="one-third octave" + ) +stopifnot(round(TO.TST$sii,3)==0.445) + +## TO_1.TST 0.438 1/3-Octave Procedure With Alternative Band Importance Function +TO_1.TST=sii( + speech=c(90,5,40,40,40,40,40,40,40,40,40,40,40,40,-10,-10,-10,-10), + noise=c(10,-10,-10,75,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,10,10,10,10), + threshold=c(90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + importance=c(0,0,0,0,0,0,0,0,0,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.3,0), + method="one-third octave" + ) +stopifnot(round(TO_1.TST$sii,3)==0.438) + + +## CB.TST 0.273 Critical Band Procedure +CB.TST=sii( + speech=c(-10,-10,-10,90,5,40,40,40,40,40,40,40,40,40,40,40,40,-10,-10,-10,-10), + noise=c(10,10,10,10,-10,-10,70,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,10,10,10,10), + threshold=c(0,0,0,90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + ) +stopifnot(round(CB.TST$sii,3)==0.273) + +## CB_1.TST 0.410 Critical Band Procedure With Alternative Band Importance Function +CB_1.TST=sii( + speech=c(-10,-10,-10,90,5,40,40,40,40,40,40,40,40,40,40,40,40,-10,-10,-10,-10), + noise=c(10,10,10,10,-10,-10,70,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,10,10,10,10), + threshold=c(0,0,0,90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + importance=c(0,0,0,0,0,0,0,0,0,0,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.3,0,0,0) + ) +stopifnot(round(CB_1.TST$sii,3)==0.410) + +# ECB.TST 0.278 Equally-Contributing Critical Band Procedure +ECB.TST=sii( + speech=c(-10,90,5,40,40,40,40,40,40,40,40,40,40,40,40,-10,-10), + noise=c(10,10,-10,-10,70,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,10,10), + threshold=c(0,90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + method="equal-contributing" + ) +stopifnot(round(ECB.TST$sii,3)==0.278) + +# ECB_1.TST 0.410 Equally-Contribution Critical Band Procedure With Alternative Band Importance Function +ECB_1.TST=sii( + speech=c(-10,90,5,40,40,40,40,40,40,40,40,40,40,40,40,-10,-10), + noise=c(10,10,-10,-10,70,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,10,10), + threshold=c(0,90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + importance=c(0,0,0,0,0,0,0,0,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.3,0), + method="equal-contributing" + ) +stopifnot(round(ECB_1.TST$sii,3)==0.410) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |