/// <summary> /// Gets the raw data of the specified type from this measurement. /// </summary> /// <param name="arrayType">The data type of the array.</param> /// <returns></returns> /// <exception cref="System.ArgumentException">This SimpleMeasurement does not contain data of the specified array type</exception> public double[] GetRawData(DataArrayType arrayType) { if (!AvailableDataTypes.Contains(arrayType)) { throw new ArgumentException("This SimpleMeasurement does not contain data of the specified array type"); } DataArray[] dataArrays = Measurement.DataSet.GetDataArrays().Where(a => a.ArrayType == (int)arrayType).ToArray(); return(dataArrays[0].GetValues()); }
/// <summary> /// Add a new SimpleCurve to the measurement with the specified X and Y-Axis data types. /// </summary> /// <param name="xAxisArrayType">Data type of the x axis.</param> /// <param name="yAxisArrayType">Data type of the y axis.</param> /// <param name="title">The title of the SimpleCurve.</param> /// <param name="silent">if set to <c>true</c> [silent] the SimpleCurveAdded even is not raised.</param> /// <returns></returns> /// <exception cref="System.ArgumentException"> /// This SimpleMeasurement does not contain the specified X-Axis array type /// or /// This SimpleMeasurement does not contain the specified Y-Axis array type /// </exception> public List <SimpleCurve> NewSimpleCurve(DataArrayType xAxisArrayType, DataArrayType yAxisArrayType, string title = "", bool silent = false) { if (!AvailableDataTypes.Contains(xAxisArrayType)) { throw new ArgumentException("This SimpleMeasurement does not contain the specified X-Axis array type"); } if (!AvailableDataTypes.Contains(yAxisArrayType)) { throw new ArgumentException("This SimpleMeasurement does not contain the specified Y-Axis array type"); } List <SimpleCurve> simpleCurves = new List <SimpleCurve>(); DataArray[] xDataArrays = Measurement.DataSet.GetDataArrays().Where(a => a.ArrayType == (int)xAxisArrayType).ToArray(); DataArray[] yDataArrays = Measurement.DataSet.GetDataArrays().Where(a => a.ArrayType == (int)yAxisArrayType).ToArray(); if (xDataArrays.Length > 1 && xDataArrays.Length == yDataArrays.Length) { for (int i = 0; i < xDataArrays.Length; i++) { Curve c = new Curve(xDataArrays[i], yDataArrays[i], $"{xDataArrays[i].Description}:{title}", Measurement.DataSet.IsFinished); if (Measurement.DataSet.IsFinished) { c.Finish(); } simpleCurves.Add(new SimpleCurve(c, this)); } } else if (xDataArrays.Length > 1 && yDataArrays.Length == 1) { for (int i = 0; i < xDataArrays.Length; i++) { Curve c = new Curve(xDataArrays[i], yDataArrays[0], $"{xDataArrays[i].Description}:{title}", Measurement.DataSet.IsFinished); if (Measurement.DataSet.IsFinished) { c.Finish(); } simpleCurves.Add(new SimpleCurve(c, this)); } } else if (yDataArrays.Length > 1 && xDataArrays.Length == 1) { for (int i = 0; i < yDataArrays.Length; i++) { Curve c = new Curve(xDataArrays[0], yDataArrays[i], $"{yDataArrays[i].Description}:{title}", Measurement.DataSet.IsFinished); if (Measurement.DataSet.IsFinished) { c.Finish(); } simpleCurves.Add(new SimpleCurve(c, this)); } } else { Curve c = new Curve(xDataArrays[0], yDataArrays[0], title, Measurement.DataSet.IsFinished); if (Measurement.DataSet.IsFinished) { c.Finish(); } simpleCurves.Add(new SimpleCurve(c, this)); } AddSimpleCurves(simpleCurves, silent); return(simpleCurves); }