Running 'test-07-member.R' [1s]
  Running 'testDeficit.R' [174s]
  Running 'testXform.R' [1s]
  Comparing 'testXform.Rout' to 'testXform.Rout.save' ... OK
Running the tests in 'tests/testDeficit.R' failed.
Complete output:
  > library(Polychrome)
  > library(colorspace)
  > 
  > #########################################
  > ## Test the background algorithm
  > 
  > ## checking the conversion between RGB and sRGB
  > y <- seq(0, 1, length=500)
  > liny <- Polychrome:::srgb2rgb(y)
  > plot(y, liny)
  > 
  > yback <- Polychrome:::rgb2srgb(liny)
  > plot(y, yback)
  > abline(0,1)
  > summary(y - yback)
        Min.    1st Qu.     Median       Mean    3rd Qu.       Max. 
  -1.110e-16  0.000e+00  0.000e+00  5.239e-19  0.000e+00  1.110e-16 
  > 
  > ## comparing with colorspace
  > 
  > p36 <- palette36.colors(36)
  > srgb <- hex2RGB(p36)
  > mat <- srgb@coords
  > linrgb <- as(srgb, "RGB")
  > linmat <- Polychrome:::srgb2rgb(mat)
  > summary(linmat - linrgb@coords) # all 0, so we are doing the same thing
         R           G           B    
   Min.   :0   Min.   :0   Min.   :0  
   1st Qu.:0   1st Qu.:0   1st Qu.:0  
   Median :0   Median :0   Median :0  
   Mean   :0   Mean   :0   Mean   :0  
   3rd Qu.:0   3rd Qu.:0   3rd Qu.:0  
   Max.   :0   Max.   :0   Max.   :0  
  > 
  > ## since our structures have row vectors instead of columns,
  > ## we need to transpose stuff
  > xyz <- linmat %*% t(Polychrome:::RGB2XYZ)
  > rgb.back <- xyz %*% t(Polychrome:::XYZ2RGB)
  > summary(linmat - rgb.back) # accurate to 4 decimal places
         R                    G                    B             
   Min.   :-2.293e-05   Min.   :-5.203e-05   Min.   :-1.412e-05  
   1st Qu.:-1.402e-05   1st Qu.:-2.877e-05   1st Qu.:-9.873e-06  
   Median :-4.252e-06   Median :-1.650e-05   Median :-4.349e-06  
   Mean   :-6.340e-06   Mean   :-1.927e-05   Mean   :-5.645e-06  
   3rd Qu.: 6.788e-07   3rd Qu.:-6.768e-06   3rd Qu.:-1.928e-06  
   Max.   : 8.001e-06   Max.   : 6.712e-06   Max.   :-4.517e-07  
  > 
  > ## multiple options for convertiong XYZ spoace to LMS perceptual space
  > 
  > ## check that these are projections
  > all(Polychrome:::lms2lmsd == Polychrome:::lms2lmsd %*% Polychrome:::lms2lmsd)
  [1] TRUE
  > all(Polychrome:::lms2lmsp == Polychrome:::lms2lmsp %*% Polychrome:::lms2lmsp)
  [1] TRUE
  > all(Polychrome:::lms2lmst == Polychrome:::lms2lmst %*% Polychrome:::lms2lmst)
  [1] TRUE
  > 
  > ## check the complete round trip
  > M <- Polychrome:::backward(Polychrome:::forward(mat))
  > summary(round(M - mat, 3))
         V1          V2          V3   
   Min.   :0   Min.   :0   Min.   :0  
   1st Qu.:0   1st Qu.:0   1st Qu.:0  
   Median :0   Median :0   Median :0  
   Mean   :0   Mean   :0   Mean   :0  
   3rd Qu.:0   3rd Qu.:0   3rd Qu.:0  
   Max.   :0   Max.   :0   Max.   :0  
  > 
  > 
  > #########################################
  > ## Test user-visible commands
  > 
  > ## three input types
  > p36 <- palette36.colors(36)
  > srgb <- hex2RGB(p36)
  > class(srgb)
  [1] "sRGB"
  attr(,"package")
  [1] "colorspace"
  > mat <- srgb@coords
  > 
  > ## check that each one works
  > daltMat <- colorDeficit(mat, target="deut") # matrix conversion
  > daltRGB <- colorDeficit(srgb, target="deut") # object conversion
  > all(daltMat == daltRGB@coords) # agreement
  [1] TRUE
  > 
  > daltP36 <- colorDeficit(p36, "deut") # hex string conversion
  > all(daltP36 == hex(daltRGB)) # agreement
  [1] TRUE
  > 
  > # invariance
  > reup <- colorDeficit(daltMat, "deut")
  > all(daltMat == reup) # why false?
  [1] FALSE
  > summary(daltMat - reup)
         V1                   V2                   V3            
   Min.   :-0.0000082   Min.   :-2.789e-02   Min.   :-0.0067999  
   1st Qu.: 0.0000000   1st Qu.:-1.579e-05   1st Qu.:-0.0000063  
   Median : 0.0000000   Median : 0.000e+00   Median : 0.0045747  
   Mean   : 0.0111090   Mean   :-1.124e-03   Mean   : 0.0196263  
   3rd Qu.: 0.0000000   3rd Qu.: 0.000e+00   3rd Qu.: 0.0478768  
   Max.   : 0.3999611   Max.   : 3.163e-02   Max.   : 0.0599644  
  > 
  > sndP36 <- hex(new("sRGB", coords=reup))
  > 
  > opar <- par(mfrow=c(3,1))
  > swatch(p36)
  > swatch(daltP36)
  > swatch(sndP36)
  > par(opar)
  > 
  > swatchHue(daltP36)
  > uvscatter(daltP36)
  > luminance(daltP36)
  > plotDistances(daltP36, cex=2)
  > 
  > 
  > cp <- createPalette(25, c("#111111", "#eeeeee"),
  +                     target="deuteranope", M=10000)
  > swatch(cp)
  > plotDistances(cp)
  > 
  > cp <- createPalette(25, c("#111111", "#eeeeee"),
  +                     target="prot", M=10000)
  > swatch(cp)
  > plotDistances(cp)
  > 
  > cp <- createPalette(25, c("#111111", "#eeeeee"),
  +                     target="trit", M=10000)
  > swatch(cp)
  > plotDistances(cp)
  > 
  > 
  > proc.time()
     user  system elapsed 
     2.42    0.20    2.59