Files
MeltMind/tools/s1_seed_vectors.py
T

26 lines
1.8 KiB
Python

"""Small synthetic replay vectors for the independent RNG/formula review."""
import json
import sys
import numpy as np
import s1_scoring as s
def vectors():
gaps=np.concatenate([np.zeros((7,2)),np.tile([0,.2],(8,1)),np.tile([.3,0],(8,1)),np.tile([.2,.3],(8,1))])
counts=np.array([1,2,1,1,1,1,1,1,1,1]);p=s.Part('synthetic','synthetic',993,np.arange(10),np.zeros((10,10)),counts,np.ones(10,bool),np.ones(10,bool),np.repeat(np.arange(10),counts))
permutations={}
for seed in s.PERMUTATION_SEEDS:
ordinary,stratified,strata=s.permutation_maps(993,seed,gaps)
permutations[str(seed)]=dict(ordinary=ordinary.tolist(),stratified=stratified.tolist(),ordinary_digest=s.digest(ordinary),stratified_digest=s.digest(stratified))
query=s.query_bootstrap_counts(p);keys,source=s.source_bootstrap_indices([f's{i:02d}' for i in range(24)])
return dict(numpy_version=np.__version__,digest_definition='sha256(dtype.str ASCII + str(shape) ASCII + C-order bytes); int64 little-endian in this environment',
prefix=993,gaps=gaps.tolist(),permutations=permutations,
query=dict(seed=2026111406,replicates=200,draw_to_unique=p.draw_to_unique.tolist(),first_three_counts=query[:3].tolist(),digest=s.digest(query)),
source=dict(seed=2026111407,replicates=2000,source_order=keys,first_three_indices=source[:3].tolist(),digest=s.digest(source)),
midrank_hand_fixture=dict(P=3,parts=[dict(values=[0,1,2],counts=[1,2,1],eligible=[True,True,False]),dict(values=[0,2],counts=[1,1],eligible=[True,True]),dict(values=[1,2],counts=[3,1],eligible=[True,True])],
eligible_weights=['1/9,2/9','1/6,1/6','1/4,1/12'],query=[-1,0,1,1.5,2,3],expected=['0','5/36','37/72','3/4','7/8','1']))
if __name__=='__main__':
with open(sys.argv[1],'w') as f:json.dump(vectors(),f,indent=2,allow_nan=False);f.write('\n')