Skip to content

Commit

Permalink
Fix weird violin plots
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkingRobot committed Mar 23, 2024
1 parent 5ea3922 commit e0a60d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Craftimizer/ImGuiUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@ public ViolinData(IEnumerable<int> samples, float min, float max, int resolution
.Select(n => Lerp(min, max, n / (float)resolution))
.Select(n => (n, (float)KernelDensity.EstimateGaussian(n, bandwidth, samplesList)))
.Select(n => new Point(n.n, n.Item2, -n.Item2));
DataArray = [.. data];
// ParallelQuery doesn't support [.. data] correctly. The plots look very wrong.
#pragma warning disable IDE0305 // Simplify collection initialization
DataArray = data.ToArray();
#pragma warning restore IDE0305 // Simplify collection initialization
s.Stop();
Log.Debug($"Violin plot processing took {s.Elapsed.TotalMilliseconds:0.00}ms");
});
Expand Down

1 comment on commit e0a60d5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: e0a60d5 Previous: 895e2a4 Ratio
Craftimizer.Benchmark.Bench.Solve(State: 49D422D4, Config: 3F264C68) 122017022.66666667 ns (± 1481379.1007198405)
Craftimizer.Benchmark.Bench.Solve(State: A48CCE73, Config: 3F264C68) 82060648.61111112 ns (± 2122357.020419419)

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.