CI / Build and test (pull_request) Failing after 2m3s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / Docker image (pull_request) Skipped
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 4s
The owner renamed the product and moved the repository to the self-hosted Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control, and asked for Actions and a first automatic release with the server package and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md). - Chronos everywhere: a byte-exact rename of contents and paths, then a per-language review of the forms the old name's ending had dictated. - Gitea instead of GitHub: the update check, licence, issue and support links read ChronosReleasesUrl; the update check takes the highest stable version, offers a pre-release build its final release and reports a repository it cannot see as a failed check. EULA, security policy and Gitea issue forms live at the repository root. - Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release, nightly image and performance gates in the .NET SDK container with git checkout. The release cross-compiles the Windows programs, checks their icon, version and DPI manifest, packs installers and zips, publishes the Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER). - New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the docker-exec script, which Gitea's service containers do not allow) and pe-check. BREAKING CHANGE: programs, settings, data folders, file types, environment variables and the Docker image use the new name; nothing is migrated from Titano, which never had a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67 lines
2.4 KiB
C#
67 lines
2.4 KiB
C#
using System.Globalization;
|
|
using Chronos.Core.Analysis;
|
|
using Chronos.Core.Diagnostics.Synthetic;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.Core.Tests.Analysis;
|
|
|
|
public sealed class FlickerSpectrumTests(TestContext context)
|
|
{
|
|
[Theory]
|
|
[Case(12.0)]
|
|
[Case(7.5)]
|
|
[Case(20.0)]
|
|
public void RecoversAKnownPeriodFromRenderedFrames(double period)
|
|
{
|
|
var sequence = SyntheticSequence.Create(new SyntheticSequenceOptions
|
|
{
|
|
Width = 48,
|
|
Height = 32,
|
|
FrameCount = 240,
|
|
Seed = 12,
|
|
StartEv = 0,
|
|
EndEv = -2,
|
|
FlickerEv = 0.1,
|
|
FlickerPeriodFrames = period,
|
|
LandFlickerEv = 0.02,
|
|
});
|
|
var measured = AnalysisFixtures.MeasureSeries(sequence);
|
|
var result = FlickerSpectrum.Analyze(measured);
|
|
context.Log(string.Create(CultureInfo.InvariantCulture,
|
|
$"true period {period}, found {result.DominantPeriod:F3} (r = {result.PeakCorrelation:F3}), window {result.RecommendedWindow}"));
|
|
var found = Assert.NotNull(result.DominantPeriod);
|
|
Assert.Approximately(period, found, 0.5);
|
|
Assert.Equal(1, result.RecommendedWindow % 2);
|
|
Assert.InRange(result.RecommendedWindow, 4 * period - 1, 4 * period + 2);
|
|
}
|
|
|
|
[Test]
|
|
public void WhiteFlickerHasNoPeriodAndGetsTheMinimumWindow()
|
|
{
|
|
var random = new Random(2);
|
|
var series = Enumerable.Range(0, 300).Select(i => -0.01 * i + 0.1 * (2 * random.NextDouble() - 1)).ToArray();
|
|
var result = FlickerSpectrum.Analyze(series);
|
|
Assert.Null(result.DominantPeriod);
|
|
Assert.Less(result.CorrelationLength, 1.5);
|
|
Assert.Equal(FlickerSpectrumOptions.Default.MinimumWindow, result.RecommendedWindow);
|
|
}
|
|
|
|
[Test]
|
|
public void SlowCorrelatedFlickerWidensTheWindow()
|
|
{
|
|
// AR(1) flicker with correlation 0.9 per frame: e-folding length about 9.5 frames.
|
|
var random = new Random(4);
|
|
var series = new double[400];
|
|
var state = 0.0;
|
|
for (var i = 0; i < series.Length; i++)
|
|
{
|
|
state = 0.9 * state + 0.05 * (2 * random.NextDouble() - 1);
|
|
series[i] = state;
|
|
}
|
|
var result = FlickerSpectrum.Analyze(series);
|
|
Assert.InRange(result.CorrelationLength, 4, 15);
|
|
Assert.Greater(result.RecommendedWindow, 15);
|
|
Assert.Equal(1, result.RecommendedWindow % 2);
|
|
}
|
|
}
|