private double SafeGet(GrowthCurveDoubleValueGetter dataFunction, GrowthCurve gc) { try { return(dataFunction(gc)); } catch { return(Double.NaN); } }
public void SetValue(GrowthCurveDoubleValueGetter dataFunction) { if (pcurPlateType != PlateType.None) { double[,] dataToPlot = new double[PT.NumRows, PT.NumCols]; var data = from x in curGCC select new { Name = x.DataSetName, Value = SafeGet(dataFunction, x) }; var cleanedData = (from x in data where SimpleFunctions.IsARealNumber(x.Value) & x.Value != 0 select x).ToList(); double max = cleanedData.Max((x) => x.Value); double min = cleanedData.Min((x) => x.Value); foreach (var d in cleanedData) { int index = -1; if (PT.CellNameToInts.TryGetValue(d.Name, out index)) { int row = PT.RowColArray[index, 0]; int col = PT.RowColArray[index, 1]; dataToPlot[row, col] = d.Value; } } this.SetMatrixForPlotting(dataToPlot, PT.RowNames, PT.ColNames); } }