Skip to content

Commit

Permalink
Fix Unit tests for Concatenation
Browse files Browse the repository at this point in the history
Issue #186 Fixed tests which failed when I did work on this issue.
Also removed an attempt to combine two index matrices into one.
  • Loading branch information
towsey committed Aug 30, 2019
1 parent 498c468 commit 53def22
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,17 @@ public static (Dictionary<string, double[,]>, Dictionary<string, IndexProperties
analysisTag,
keys.ToArray());

/*
// THE FOLLOWING IDEA TO MAKE A COMBINED MATRIX OF BGN and RHZ was rejected.
// Anthony was concerned that the BGN matrix alone was not conveying much information at high resolutions.
// The idea was to combine another matrix with the BGN matrix.
// I tried three combinations, BGN-RHZ, BGN-OSC and BGN-SPT. None of them appeard to provide additional useful information at high resolution.
// The problem is that at high resolution, i.e. approaching 0.1s for an analysis unit, there are not many orthogonal features in a single frequency bin.
// Make a BNG COMBINATION Spectral matrix.
//var comboMatrix = MatrixTools.MaxOfTwoMatrices(spectra["BNG"], spectra["RHZ"]);
var comboMatrix = MatrixTools.AddMatricesWeightedSum(spectra["BGN"], 1.0, spectra[comboIndexID], 10.0);
spectra["BGN"] = comboMatrix;
*/

return (spectra, relevantIndexProperties);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void ConcatenateEverythingYouCanLayYourHandsOn()
var actualImage = ImageTools.ReadImage2Bitmap(imageFileInfo.FullName);
Assert.That.ImageIsSize(722, 632, actualImage);
Assert.That.PixelIsColor(new Point(100, 100), Color.FromArgb(211, 211, 211), actualImage);
Assert.That.PixelIsColor(new Point(200, 125), Color.FromArgb(47, 34, 255), actualImage);
Assert.That.PixelIsColor(new Point(200, 125), Color.FromArgb(60, 44, 255), actualImage);
Assert.That.PixelIsColor(new Point(675, 600), Color.FromArgb(255, 105, 180), actualImage);
}

Expand Down Expand Up @@ -160,8 +160,8 @@ public void ConcatenateIndexFilesTest24Hour()

// we expect only the second half (past midnight) of the image to be rendered
Assert.That.ImageIsSize(512, 632, actualImage);
Assert.That.PixelIsColor(new Point(105, 154), Color.FromArgb(21, 200, 255), actualImage);
Assert.That.PixelIsColor(new Point(100, 160), Color.FromArgb(0, 69, 131), actualImage);
Assert.That.PixelIsColor(new Point(105, 154), Color.FromArgb(34, 30, 255), actualImage);
Assert.That.PixelIsColor(new Point(100, 160), Color.FromArgb(0, 79, 132), actualImage);
}

/// <summary>
Expand Down Expand Up @@ -217,7 +217,7 @@ public void ConcatenateIndexFilesTest24HourWithoutDateRange()
var actualImage1 = ImageTools.ReadImage2Bitmap(image1FileInfo.FullName);
Assert.That.ImageIsSize(210, 632, actualImage1);
Assert.That.PixelIsColor(new Point(100, 100), Color.FromArgb(211, 211, 211), actualImage1);
Assert.That.PixelIsColor(new Point(50, 50), Color.FromArgb(66, 17, 14), actualImage1);
Assert.That.PixelIsColor(new Point(50, 50), Color.FromArgb(86, 27, 16), actualImage1);

// IMAGE 2: Compare image files - check that image exists and dimensions are correct
var dateString2 = "20160726";
Expand All @@ -232,7 +232,7 @@ public void ConcatenateIndexFilesTest24HourWithoutDateRange()

var actualImage2 = ImageTools.ReadImage2Bitmap(image2FileInfo.FullName);
Assert.That.ImageIsSize(512, 632, actualImage2);
Assert.That.PixelIsColor(new Point(50, 124), Color.FromArgb(57, 28, 255), actualImage2);
Assert.That.PixelIsColor(new Point(50, 124), Color.FromArgb(70, 37, 255), actualImage2);
Assert.That.PixelIsColor(new Point(460, 600), Color.FromArgb(255, 105, 180), actualImage2);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ZoomCommonTests()

/// <summary>
/// This test is designed to ensure that images are produced at the correct length.
/// We had a beviour where they were being trimmed by a whole pixel at the end of
/// We had a behaviour where they were being trimmed by a whole pixel at the end of
/// recordings that didn't wholly fill a minute. At very low scales this is acceptable, but
/// at high scales just because 1/6th of a pixel's worth of data is absent does not mean
/// that we shouldn't render the other 5/6ths of the pixel. And if we don't, it creates
Expand Down

0 comments on commit 53def22

Please sign in to comment.