private void UpdateUi() { GridValsVm.UpdateData(Star3Grid.CurValuesAsP2Vs()); AbsDelta = A2dUt.flattenRowMajor(Star3Grid.Stars).Sum(st => st.AbsDelta); OnPropertyChanged("Generation"); OnPropertyChanged("ElapsedTime"); }
public void UpdateGraphVm() { if (Values == null) { return; } var bins = A2dUt.ToP2V(Histos.Histogram2d( bounds: Bounds, binCount: BinCounts.Sz2Int, vals: Values)).ToArray(); var counts = bins.Select(b => b.V.V).ToArray(); var colorLeg = ColorLegger(counts); LegendVm = new LegendVm( minVal: "<" + colorLeg.minV, midVal: ColorSets.GetLegMidVal(colorLeg).ToString(), maxVal: ">" + colorLeg.maxV, minCol: colorLeg.minC, midColors: colorLeg.spanC, maxColor: colorLeg.maxC ); GraphVm.Watermark = $"Bins count: [{BinCounts.X}, {BinCounts.Y}]"; GraphVm.SetData( boundingRect: Bounds, plotPoints: Enumerable.Empty <P2V <float, Color> >(), plotLines: Enumerable.Empty <LS2V <float, Color> >(), filledRects: MakePlotRectangles(colorLeg: colorLeg, hist: bins), openRects: Enumerable.Empty <RV <float, Color> >()); }
public void UpdateP(float step, float noise) { var zippy = A2dUt.flattenRowMajor(Stars) .Zip(Noise.Take(A2dUt.Count(Stars)), (a, b) => new Tuple <Star, float>(a, b)); Parallel.ForEach(zippy, tup => tup.Item1.Update(step, tup.Item2 * noise)); Generation++; }
private void UpdateUi() { GridValsVm.UpdateData(Star5Grid.CurValuesAsP2Vs()); GridDeltasVm.UpdateData(Star5Grid.CurDeltasAsP2Vs()); AbsDelta = A2dUt.flattenRowMajor(Star5Grid.Stars).Average(st => st.AbsDelta); NoiseField = A2dUt.flattenRowMajor(Star5Grid.Stars).Average(st => st.NoiseField); NoiseLevelVm.Value = (NoiseField > AbsDeltaTargetVm.Value) ? NoiseLevelVm.Value - 0.0025f : NoiseLevelVm.Value + 0.0025f; OnPropertyChanged("Generation"); OnPropertyChanged("ElapsedTime"); }
public void UpdateS(float step, float noise) { var zippy = A2dUt.flattenRowMajor(Stars) .Zip(Noise.Take(A2dUt.Count(Stars)), (a, b) => new Tuple <Star, float>(a, b)); foreach (var tup in zippy) { tup.Item1.Update(step, tup.Item2 * noise); } Generation++; }
public Grid2D2IVm(Sz2 <int> strides, ColorLeg2I <float> colorLeg, string title = "") { Strides = strides; ColorLeg2I = colorLeg; WbImageVm = new WbImageVm(); Title = title; var sp = A2dUt.GetColumn(colorLeg.spanC, colorLeg.spanC.GetLength(1) - 1); LegendVm = new LegendVm( minVal: "<" + colorLeg.rangeV.MinY, midVal: ColorSets2I.GetLegMidVal(colorLeg).ToString(), maxVal: ">" + colorLeg.rangeV.MaxY, minCol: colorLeg.exteriorC, midColors: sp, maxColor: colorLeg.exteriorC ); }
public void Update(float step, float noise, float nfDecay, float absDeltaToNoise, float nfCpl, float ffCpl) { var zippy = A2dUt.flattenRowMajor(Stars) .Zip(Noise.Take(A2dUt.Count(Stars)), (a, b) => new Tuple <Star5, float>(a, b)); zippy.ToArray().AsParallel().ForEach( tup => tup.Item1.Update( step: step, noise: tup.Item2 * noise, nfDecay: nfDecay, absDeltaToNoise: absDeltaToNoise, nfCpl: nfCpl, ffCpl: ffCpl) ); //zippy.ForEach( // tup => tup.Item1.UpdateP( // step: step, // noiseLevel: tup.Item2 * noiseLevel, // nfDecay: nfDecay, // absDeltaToNoise: absDeltaToNoise, // nfCpl: nfCpl, // ffCpl: ffCpl) // ); //Parallel.ForEach(zippy, tup => tup.Item1.UpdateP( // step: step, // noiseLevel: tup.Item2 * noiseLevel, // nfDecay: nfDecay, // absDeltaToNoise: absDeltaToNoise, // nfCpl: nfCpl, // ffCpl: ffCpl)); Generation++; }
public void Update(float step, float noise, float nfDecay, float absDeltaToNoise, float nfCpl) { var zippy = A2dUt.flattenRowMajor(Stars) .Zip(Noise.Take(A2dUt.Count(Stars)), (a, b) => new Tuple <Star2, float>(a, b)); Parallel.ForEach(zippy, tup => tup.Item1.Update( step: step, noise: tup.Item2 * noise, nfDecay: nfDecay, absDeltaToNoise: absDeltaToNoise, nfCpl: nfCpl)); Generation++; }
public static IEnumerable <P2V <int, float> > CurValuesAsP2Vs(this StarGrid starGrid) { return(A2dUt.ToP2V(starGrid.Stars).Select(s => new P2V <int, float>(x: s.X, y: s.Y, v: s.V.CurValue))); }
public static IEnumerable <P2V <int, float> > CurDeltasAsP2Vs(this Star5Grid starGrid) { return(A2dUt.ToP2V(starGrid.Stars).Select(s => new P2V <int, float>(x: s.X, y: s.Y, v: s.V.NoiseField))); }
public void GetDeltas() { A2dUt.flattenRowMajor(Stars).ForEach(s => s.CalcDelta()); }