収差のある点像が残差の基準に収まる試験を追加する
このコミットが含まれているのは:
1ファイル変更
+28
@@ -1,4 +1,6 @@
|
||||
using WaveOptics.Abstractions;
|
||||
using WaveOptics.Effects;
|
||||
using WaveOptics.Optics;
|
||||
|
||||
namespace WaveOptics.Tests;
|
||||
|
||||
@@ -43,6 +45,32 @@ public sealed class WaveOpticsSettingsTests
|
||||
Assert.Equal(WaveOpticsSettings.WeightsLength, offsets[^1] + WaveOpticsSettings.MaximumKernelSize);
|
||||
}
|
||||
|
||||
public static readonly TheoryData<string, WavefrontAberration> Aberrations = new()
|
||||
{
|
||||
{ "defocus", new WavefrontAberration(defocusWaves: 1) },
|
||||
{ "astigmatism", new WavefrontAberration(astigmatismObliqueWaves: 1) },
|
||||
{ "coma", new WavefrontAberration(comaHorizontalWaves: 3) },
|
||||
{ "spherical", new WavefrontAberration(sphericalWaves: 1) },
|
||||
{ "every term at the limit", new WavefrontAberration(defocusWaves: 10, astigmatismVerticalWaves: 10, astigmatismObliqueWaves: 10, comaHorizontalWaves: 10, comaVerticalWaves: 10, sphericalWaves: 10) },
|
||||
};
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(Aberrations))]
|
||||
public void TheRankLimitKeepsEveryAberrationWithinTheResidualBudget(string aberrationName, WavefrontAberration aberration)
|
||||
{
|
||||
var gridSize = WaveOpticsSettings.GetPupilGridSize(WaveOpticsQuality.Standard);
|
||||
var descriptor = new PsfDescriptor(
|
||||
gridSize,
|
||||
WaveOpticsSettings.GetPupilDiameterSamples(gridSize),
|
||||
WaveOpticsSettings.MaximumKernelSize,
|
||||
550, 8, 4, ApertureShape.Circular, 6, 0, 0, aberration);
|
||||
var kernel = new FraunhoferPsfGenerator().Generate(descriptor).Kernel;
|
||||
|
||||
var separable = SeparableKernel.Decompose(kernel.Values.Span, kernel.Size, WaveOpticsSettings.SeparableResidualRatio, WaveOpticsSettings.MaximumRank);
|
||||
|
||||
Assert.True(separable.ResidualEnergyRatio <= WaveOpticsSettings.SeparableResidualRatio, $"{aberrationName}: {separable.ResidualEnergyRatio}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheCanvasMarginHoldsTheWidestBlurOnAFourPixelGrid()
|
||||
{
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする