/* Deliberately synthetic edge/phase/hotspot/wing fixture, not a benchmark * substitute for captured catalog events. Output round-trips all doubles. */ #include "optics.h" #include int main(int argc,char **argv) { if(argc!=2)return 2; PsfKernelCache cache={0};const PointSpreadFunction psf={2.7,4.5}; if(psf_kernel_cache_init(&cache,&psf,1e-8))return 1; FILE *out=fopen(argv[1],"wx");if(!out)return 2; fprintf(out,"PSFEVENTS1 128 96 32771 2.7 4.5 1e-8\n"); int clipped=0; for(int i=0;i<32771;++i) { const double phases[]={0,0.25,0.5,0.999999999}; double x=-12+(i*7)%152+phases[i%4], y=-10+(i*11)%116+phases[(i/4)%4]; if(i%5==0){x=63.25;y=47.75;} PsfCachedEvent e;LinearRgb color={0.7,0.2,0.5}; const int state=psf_prepare_cached_event(&e,x,y,color,i%1024==0?1000:0.01,&psf,&cache,1e8,1e-8,0); if(state!=0 && state!=2)return 1; clipped+=state==2; fprintf(out,"%.17g %.17g %.17g %.17g %.17g %.17g %.17g\n",e.x,e.y,e.color.r,e.color.g,e.color.b,e.flux,e.support_radius); } fprintf(stderr,"synthetic fixture: events=32771 wing_clipped=%d; three chunks, exact/in-between phases, edges, hotspots\n",clipped); const int failed=ferror(out);const int close_result=fclose(out); psf_kernel_cache_destroy(&cache); return failed || close_result ? 1:0; }