diff --git a/turbidity/turbidity.go b/turbidity/turbidity.go index d5757441..75eac3d6 100644 --- a/turbidity/turbidity.go +++ b/turbidity/turbidity.go @@ -1,5 +1,5 @@ -//go:build !ignore -// +build !ignore +//go:build !nocv +// +build !nocv /* DESCRIPTION diff --git a/turbidity/turbidity_test.go b/turbidity/turbidity_test.go index 1bb51777..79c4252a 100644 --- a/turbidity/turbidity_test.go +++ b/turbidity/turbidity_test.go @@ -1,3 +1,6 @@ +//go:build !nocv +// +build !nocv + /* DESCRIPTION Testing functions for the turbidity sensor using images from @@ -36,11 +39,13 @@ import ( ) const ( - nImages = 13 // Number of images to test. (Max 13) - nSamples = 10 // Number of samples for each image. (Max 10) + nImages = 10 // Number of images to test. (Max 13) + nSamples = 1 // Number of samples for each image. (Max 10) increment = 2.5 // Increment of the turbidity level. ) +// TestImages will read a library of test images and calculate the sharpness and contrast scores. +// A plot of the results will be generated and stored in the plots directory. func TestImages(t *testing.T) { const ( k1, k2 = 8, 8 @@ -63,12 +68,12 @@ func TestImages(t *testing.T) { ts, err := NewTurbiditySensor(template, standard, k1, k2, filterSize, scale, alpha) if err != nil { - t.Fatal("could not create turbidity sensor: %w", err) + t.Fatalf("could not create turbidity sensor: %v", err) } results, err := NewResults(nImages) if err != nil { - t.Fatal("could not create results: %w", err) + t.Fatalf("could not create results: %v", err) } // Score each image by calculating the average score from camera burst. @@ -92,6 +97,7 @@ func TestImages(t *testing.T) { t.Logf("Contrast: %v", results.Contrast) } +// plotResults plots sharpness and contrast scores against the level of almond milk in the container func plotResults(x, sharpness, contrast []float64) error { err := plotToFile( "Results",