Release 1.1.3: reveal faint nebula structure with human-readable preview modes
All checks were successful
Release AstroFrame / packages (push) Successful in 1m6s

This commit is contained in:
Elijah 2026-10-04 13:52:01 -07:00
parent 5ad7a6a79e
commit d3362c8341
15 changed files with 300 additions and 24 deletions

View file

@ -11,7 +11,20 @@ static class PreviewRegression
List<double> diff=[];for(int y=0;y<reduced.Height;y++)for(int x=0;x<reduced.Width-1;x++)diff.Add(Math.Abs(frame[y*reduced.Width+x]-frame[y*reduced.Width+x+1])/255.0);
check(Robust.Median(diff)<.06&&Robust.Median(frame.Select(v=>v/255.0))<.25,"preview transfer keeps background grain subordinate to the image");
check(untouched.SequenceEqual(pixels),"preview reduction, stretching and nebula mode never alter analysis pixels");
check(frame.Max()>frame[0]+80&&diffuse.Length<frame.Length,"preview preserves conspicuous stars and exposes a distinct diffuse-detail view");
check(frame.Max()>frame[0]+80&&diffuse.Length==frame.Length&&!diffuse.SequenceEqual(frame),"frame preview preserves conspicuous stars and diffuse view retains the full preview geometry");
float[] filament=new float[w*h];random=new Random(8461);
for(int y=0;y<h;y++)for(int x=0;x<w;x++)filament[y*w+x]=(float)(1000+10*Math.Exp(-Math.Pow((x-160-25*Math.Sin(y/120.0))/5,2))+(random.NextDouble()-.5)*60);
float[] original=(float[])filament.Clone();var enhanced=PreviewRenderer.Prepare(new(w,h,filament),true);var enhancedPixels=PreviewRenderer.Render(enhanced);List<double> core=[],sky=[];
for(int y=20;y<h-20;y++){int x=(int)Math.Round(160+25*Math.Sin(y/120.0));core.Add(enhancedPixels[y*w+x]);sky.Add(enhancedPixels[y*w+x+30]);}
check(Robust.Median(core)-Robust.Median(sky)>20,"nebula preview makes a faint narrow filament visible above adjacent sky");
check(original.SequenceEqual(filament),"faint-detail smoothing never modifies the original linear preview samples");
var alternate=PreviewRenderer.Render(enhanced,.18,true);var brighter=PreviewRenderer.Render(enhanced,.30,true);
check(!alternate.SequenceEqual(enhancedPixels)&&alternate.Zip(brighter).All(pair=>pair.Second>=pair.First),"asinh offers a distinct monotonic stretch and responds to brightness adjustments");
var highMedian=new PreviewDisplay(new(1,1,[.7f]),0,1,.7,true);
check(Math.Abs(PreviewRenderer.Render(highMedian,.18,true)[0]-255*.25)<2&&PreviewRenderer.Render(highMedian,.30,true)[0]>PreviewRenderer.Render(highMedian,.18,true)[0],"asinh brightness remains adjustable when the source median already exceeds the display target");
var flat=PreviewRenderer.Prepare(new(32,32,Enumerable.Repeat(1000f,1024).ToArray()),true);
check(PreviewRenderer.Render(flat).Distinct().Count()==1&&PreviewRenderer.Render(flat,.18,true).Distinct().Count()==1,"constant fields remain constant without invented diffuse structure");
using(var cancel=new CancellationTokenSource()){cancel.Cancel();bool cancelled=false;try{PreviewRenderer.Diffuse(new(w,h,filament),cancel.Token);}catch(OperationCanceledException){cancelled=true;}check(cancelled,"diffuse preview preparation cancels while smoothing");}
string path=Path.Combine(Path.GetTempPath(),"AstroFrame-preview-"+Guid.NewGuid()+".bin");var f=new Frame{Length=7654,Modified=4321};
try
{