Example #1
0
 public void TestArrayData()
 {
     ArrayDataSet data = new ArrayDataSet();
     data.FromFile("Test/array-data.txt");
     Assert.AreEqual(5, data.NumColumns);
     Assert.AreEqual(3, data.NumRows);
 }
Example #2
0
		/// <summary>
		/// Default constructor.
		/// </summary>
		public TestAxes3D()
			: base()
		{

			// make the array data set
			arrayData = new ArrayDataSet(1024, 4);
			Random rand = new Random();
			for (int r = 0; r < arrayData.NumRows; r++)
			{
				arrayData[r, 0] = rand.NextDouble() * 2 * Math.PI;
				arrayData[r, 1] = rand.NextDouble() * Math.PI;
				arrayData[r, 2] = Math.Sin(arrayData[r, 0]) * Math.Cos(arrayData[r, 1]);
				arrayData[r, 3] = arrayData[r, 0] + arrayData[r, 1];
			}
			arrayData[512, 2] = Double.NaN; // just to test out the handling of NaN
			arrayData.SetColumnName(0, "x");
			arrayData.SetColumnName(1, "y");
			arrayData.SetColumnName(2, "sin(x)*cos(y)");
			arrayData.SetColumnName(3, "x + y");
						

			// add an axes box and plot
			pointPlot = new PointPlot(this);
			pointPlot.DataSet = arrayData;
			pointPlot.Shape = PlotShape.Square;
		}
Example #3
0
		public void TestMissingCells()
		{
			ArrayDataSet data = new ArrayDataSet();
			data.FromFile("Test/array-data-missing.txt");
			Assert.AreEqual(3, data.NumColumns);
			Assert.AreEqual(32, data.NumRows);
			Assert.IsTrue(Double.IsNaN(data[7, 1]));
		}
Example #4
0
		public void TestHmsTime()
		{
			ArrayDataSet data = new ArrayDataSet();
			data.FromFile("Test/array-data-hms.txt");
			Assert.AreEqual(5, data.NumColumns);
			Assert.AreEqual(338, data.NumRows);
			Assert.AreEqual(34283.1, data[1,0]);
		}
Example #5
0
		public void TestParseBits()
		{
			ArrayDataSet data = new ArrayDataSet();
			data.FromFile("Test/array-data-byte.csv");
			data.ParseBits("one byte");
			Assert.AreEqual(11, data.NumColumns);
			Assert.AreEqual(256, data.NumRows);

			// test the column naming
			Assert.AreEqual("one byte bit0", data.GetColumnName(3));
			Assert.AreEqual("one byte bit1", data.GetColumnName(4));
			Assert.AreEqual("one byte bit2", data.GetColumnName(5));

			// check the range of the computed values
			double min, max;
			data.ColumnMinMax(6, out min, out max);
			Assert.AreEqual(0, min);
			Assert.AreEqual(1, max);

			// test some actual values
			Assert.AreEqual(1, data[7, 4]);
		}
Example #6
0
		/// <summary>
		/// Default constructor.
		/// </summary>
		public TestAxes2D()
			: base()
		{

			// make the array data set
			arrayData = new ArrayDataSet(1024*1, 4);
			double dt = 0.02; // time step
			for (int r = 0; r < arrayData.NumRows; r++)
			{
				double t = r * dt;
				arrayData[r, 0] = t;
				arrayData[r, 1] = Math.Sin(t) * 10;
				arrayData[r, 2] = Math.Cos(t*2) * t;
				arrayData[r, 3] = 0;
			}
			arrayData.SetColumnName(0, "time");
			arrayData.SetColumnName(1, "10*sin(t)");
			arrayData.SetColumnName(2, "cos(2t)*t");
			arrayData.SetColumnName(3, "zero");
						

			// add a plot
			pointPlot1 = new PointPlot(this);
			pointPlot1.DataSet = arrayData;
			pointPlot1.Columns[2] = 1;
			pointPlot1.Shape = PlotShape.Square;
			pointPlot1.LineVisible = true;
			
			// add a plot
			pointPlot2 = new PointPlot(this);
			pointPlot2.DataSet = arrayData;
			pointPlot2.Shape = PlotShape.Circle;
			pointPlot2.Color = new Color(0, 1f, 0);
			pointPlot2.LineVisible = true;
			pointPlot2.LineWidth = 1;
		}
Example #7
0
		public void TestWriting()
		{
			ArrayDataSet data = new ArrayDataSet();
			data.FromFile("Test/array-data-missing.txt");
			data.ToFile("Test/array-data-out.txt");
		}