Close custody main-review checks for named B0 units and coordinate scaling
This commit is contained in:
1 parent
6e4d991d78
commit
522ee84f6a
7 files changed
+233
-7
No files matched your search
@@ -3,6 +3,7 @@ import json
|
||||
from pathlib import Path
|
||||
import numpy as np
|
||||
from freeze_g1_components import sha
|
||||
from s2_models.features import BASE_COLUMNS,R2_COLUMNS
|
||||
|
||||
|
||||
def read_json(path):
|
||||
@@ -29,6 +30,11 @@ def test_rows(c, fold):
|
||||
def prediction_inputs(row):
|
||||
"""Only base/queries/R2 features: no training-cache or archive access."""
|
||||
prep=row['preparation'];root=Path(prep['preparation_root'])
|
||||
metadata=read_json(checked(root/'result.json',prep['result_sha256']))
|
||||
if metadata['base_columns']!=list(BASE_COLUMNS) or tuple(BASE_COLUMNS[:3])!=('x_star','y_star','z_star'):
|
||||
raise ValueError('Base coordinate column names differ from centred (x-center)/Rg contract')
|
||||
if metadata['r2']['columns']!=list(R2_COLUMNS) or R2_COLUMNS[0]!='Vf':
|
||||
raise ValueError('B0 requires named dimensionless relative flow volume Vf at column0')
|
||||
for name in ['base.npy','queries.npz','r2.npz']:
|
||||
checked(root/name,prep['output_sha256'][name])
|
||||
base=np.load(root/'base.npy',allow_pickle=False)
|
||||
@@ -40,6 +46,7 @@ def prediction_inputs(row):
|
||||
if base.shape!=(row['nodes'],10) or x.shape!=(len(ids),20) or not len(ids): raise ValueError('Feature/query shape')
|
||||
if not all(np.isfinite(a).all() for a in [base,x,d['gaps'],d['edge']]):raise ValueError('Nonfinite feature')
|
||||
if not np.all(x[:,-1]==prep['t_set']):raise ValueError('Process setting mismatch')
|
||||
if np.any((x[:,0]<0)|(x[:,0]>1)):raise ValueError('Dimensionless relative flow volume outside [0,1]')
|
||||
if np.any(np.diff(d['raw_ids'])<=0):raise ValueError('Ascending unique original IDs required')
|
||||
return dict(**d,base=base,x=x,coordinates_over_Rg=base[ids,:3],t_set=prep['t_set'])
|
||||
|
||||
|
||||
Reference in new issue
Block a user