Download src/export_hf_tables.py from PureOne/VSCE-Vacuum-State-Cognitive-Engineering-v6: direct link, hf CLI and curl.
- Browser
- Download file 6.68 kB
-
https://huggingface.co/datasets/PureOne/VSCE-Vacuum-State-Cognitive-Engineering-v6/resolve/main/src/export_hf_tables.py
- Command line
-
hf download hf://datasets/PureOne/VSCE-Vacuum-State-Cognitive-Engineering-v6/src/export_hf_tables.py
-
curl -L -o export_hf_tables.py https://huggingface.co/datasets/PureOne/VSCE-Vacuum-State-Cognitive-Engineering-v6/resolve/main/src/export_hf_tables.py
6.68 kB
| """Deterministically flatten the original VSCE v6 evidence into Hub tables. | |
| No scientific experiments are rerun and no values are imputed. Raw original | |
| JSON remains authoritative; each exported row includes a source file/pointer. | |
| """ | |
| from pathlib import Path | |
| import json | |
| ROOT=Path(__file__).resolve().parents[1] | |
| def read(path): | |
| return json.loads((ROOT/path).read_text(encoding='utf8')) | |
| def main(): | |
| output=ROOT/'data';output.mkdir(exist_ok=True) | |
| tables={} | |
| claims=read('docs/CLAIM_REGISTRY.json')['claims'] | |
| tables['claims']=[dict(row,row_id=row['id'],source_file='docs/CLAIM_REGISTRY.json', | |
| source_pointer=f'/claims/{i}') for i,row in enumerate(claims)] | |
| cases=read('results/reliability_comparison.json')['cases'] | |
| bounds=[];grids=[] | |
| for i,case in enumerate(cases): | |
| base={key:case[key] for key in ['radius','kappa','diffusion','T']} | |
| grid800=next(g for g in case['grid_convergence'] if g['cells']==800) | |
| bounds.append(dict(base,**case['bounds'],row_id=f'bound_{i:03}', | |
| pde_exit_estimate=grid800['exit_estimate'], | |
| pde_exit_resolved=grid800['exit_resolved'],pde_cells=800, | |
| source_file='results/reliability_comparison.json', | |
| source_pointer=f'/cases/{i}')) | |
| for j,g in enumerate(case['grid_convergence']): | |
| grids.append(dict(base,**g,row_id=f'grid_{i:03}_{g["cells"]}', | |
| source_file='results/reliability_comparison.json', | |
| source_pointer=f'/cases/{i}/grid_convergence/{j}')) | |
| tables['reliability_bounds']=bounds;tables['grid_refinement']=grids | |
| m=read('results/nested_monitoring.json') | |
| tables['sampled_monitoring']=[] | |
| for stride in sorted(m['counts'],key=int): | |
| tables['sampled_monitoring'].append({ | |
| 'row_id':f'monitor_stride_{stride}','stride':int(stride), | |
| 'observation_interval':int(stride)*m['fine_dt'],'fine_dt':m['fine_dt'], | |
| 'trials':m['trials'],'seed':m['seed'],'radius':m['radius'], | |
| 'kappa':m['kappa'],'diffusion':m['diffusion'],'T':m['T'], | |
| 'detected_exits':m['counts'][stride],'sampled_exit_rate':m['rates'][stride], | |
| 'wilson_95_low':m['wilson_95'][stride][0], | |
| 'wilson_95_high':m['wilson_95'][stride][1], | |
| 'continuous_pde_estimate':m['continuous_pde_estimate'], | |
| 'same_nested_paths':True,'continuous_monitoring':False, | |
| 'source_file':'results/nested_monitoring.json','source_pointer':f'/counts/{stride}'}) | |
| c=read('results/clearance_design.json') | |
| tables['clearance_design']=[{ | |
| 'row_id':f'clearance_{i:03}','T':T,'kappa':c['kappa'], | |
| 'diffusion':c['diffusion'],'error_budget':c['budget'],'events':c['events'], | |
| 'poisson_radius':c['poisson_radius'][i],'v5_direct_radius':c['v5_direct_radius'][i], | |
| 'source_file':'results/clearance_design.json','source_pointer':f'/times/{i}'} | |
| for i,T in enumerate(c['times'])] | |
| g=read('results/graph_budget.json') | |
| tables['graph_budget']=[{ | |
| 'row_id':f'graph_random_{i:04}','allocation_index':i,'seed':g['seed'], | |
| 'nodes':g['nodes'],'gain_budget':g['gain_budget'],'kappa':g['kappa'], | |
| 'noise_covariance_q0':g['noise_covariance_q0'], | |
| 'worst_pair_stationary_variance':v,'proved_uniform_optimum':g['exact_optimum'], | |
| 'computed_uniform_value':g['uniform_value'],'edge_gains_recorded':False, | |
| 'source_file':'results/graph_budget.json','source_pointer':f'/random_values/{i}'} | |
| for i,v in enumerate(g['random_values'])] | |
| q=read('results/quantum_checks.json') | |
| tables['quantum_holonomy']=[] | |
| for i,row in enumerate(q['cat_holonomy']): | |
| flat={key:value for key,value in row.items() if key!='single_photon_parity_jump_rates_per_kappa1'} | |
| flat.update({'row_id':f'cat_{i:02}', | |
| 'parity_jump_rate_even_per_kappa1':row['single_photon_parity_jump_rates_per_kappa1'][0], | |
| 'parity_jump_rate_odd_per_kappa1':row['single_photon_parity_jump_rates_per_kappa1'][1], | |
| 'source_file':'results/quantum_checks.json','source_pointer':f'/cat_holonomy/{i}'}) | |
| tables['quantum_holonomy'].append(flat) | |
| tables['quantum_cutoff']=[] | |
| for i,row in enumerate(q['finite_cutoff']): | |
| flat={key:value for key,value in row.items() if key!='exact_all_jump_eigenvalues'} | |
| # The source pair is real/imaginary parts of the common eigenvalue, | |
| # not a list of two distinct eigenvalues. | |
| flat.update({'row_id':f'cutoff_{i:02}', | |
| 'common_jump_eigenvalue_real':row['exact_all_jump_eigenvalues'][0], | |
| 'common_jump_eigenvalue_imag':row['exact_all_jump_eigenvalues'][1], | |
| 'source_file':'results/quantum_checks.json','source_pointer':f'/finite_cutoff/{i}'}) | |
| tables['quantum_cutoff'].append(flat) | |
| s=read('results/computation_verification.json')['stationary_averaging_cases'] | |
| tables['stationary_averaging']=[dict(row,row_id=f'average_{i:02}', | |
| source_file='results/computation_verification.json', | |
| source_pointer=f'/stationary_averaging_cases/{i}') for i,row in enumerate(s)] | |
| a=read('results/calibration_coverage.json') | |
| tables['calibration_coverage']=[dict( | |
| {key:value for key,value in a.items() if key!='wilson_95'}, | |
| row_id='coverage_aggregate',wilson_95_low=a['wilson_95'][0], | |
| wilson_95_high=a['wilson_95'][1],source_file='results/calibration_coverage.json', | |
| source_pointer='')] | |
| manifest={'release_version':'6.0.0','table_export_version':'1.0.0', | |
| 'suggested_repo_id':'PureOne/VSCE-Vacuum-State-Cognitive-Engineering-v6', | |
| 'split_name':'train','split_interpretation':'Hub table convention; not an ML training dataset', | |
| 'all_numerical_data':'synthetic dimensionless model evidence', | |
| 'tables':[]} | |
| for name,rows in tables.items(): | |
| path=output/(name+'.jsonl') | |
| path.write_text(''.join(json.dumps(row,ensure_ascii=False,allow_nan=False)+'\n' for row in rows),encoding='utf8') | |
| manifest['tables'].append({'config_name':name,'path':f'data/{name}.jsonl', | |
| 'rows':len(rows),'columns':list(rows[0])}) | |
| manifest['total_rows']=sum(x['rows'] for x in manifest['tables']) | |
| (ROOT/'docs/HF_TABLES_MANIFEST.json').write_text(json.dumps(manifest,indent=2)+'\n') | |
| print(json.dumps({x['config_name']:x['rows'] for x in manifest['tables']})) | |
| if __name__=='__main__':main() | |