"""Recompute the separately predeclared cohort, never replace the original failure.""" from pathlib import Path import hashlib,json,math import numpy as np from scipy.stats import kstest from science.population import sample_plummer def compute(): body=(Path(__file__).parent/'projection-cohort-plan.json').read_bytes();plan=json.loads(body);n=plan['nPerRealization'];rows=[] bound=math.sqrt(math.log(2*plan['familyTests']/plan['familyFailureProbability'])/(2*n)) for kind in plan['newIndependentGenerators']: for seed in plan['newIndependentSeeds']: rng=np.random.Generator(getattr(np.random,kind)(seed));u=rng.uniform(1e-10,1-1e-10,n);v=rng.uniform(-1,1,n);w=rng.uniform(0,2*np.pi,n) position=sample_plummer(u,v,w);projected=np.hypot(position[:,0],position[:,1]) for name,values,cdf in [('radial',u,'uniform'),('polar',(v+1)/2,'uniform'),('azimuth',w/(2*np.pi),'uniform'),('projection',projected,lambda radius:radius**2/(1+radius**2))]: result=kstest(values,cdf);rows.append({'generator':kind,'seed':seed,'test':name,'KS':float(result.statistic),'familyGatePassed':bool(result.statistic