Files
DCCONSTRUCTIONS 69dc566665 feat(research): preserve urban geometry pipelines and qualification suites
Preserve offline geometry, marking, replay and evaluation pipelines with source manifests and synthetic tests. Research qualification does not activate these methods as production navigation.
2026-10-29 09:10:00 +03:00

52 lines
2.7 KiB
Python

"""Use observed dash edges with the original periodic-family evidence rules.
A fitted period describes the family; it does not supply replacement endpoints.
The existing body/gap predicates are evaluated at the measured intervals before
one complete candidate is returned. This is not the isolated-strip verifier.
"""
import numpy as np
from interval_profiles import rectangle
from beta_profiles import section_evidence,supported,POLICY
def measured_rows(candidates,views):
out=[];sections={}
def evidence(lo,hi,bright=True):
key=(float(lo),float(hi),bright)
if key not in sections:sections[key]=[section_evidence(v,lo,hi,bright)for v in views]
return sections[key]
for candidate in candidates:
if candidate['kind']!='periodic-row':
out.append(candidate);continue
polygons=[];proof=[];intervals=[];okay=True
for observation in candidate['observations']:
edges=np.asarray(observation['edges'],float)
if edges.shape!=(2,2) or np.max(abs(edges[0]-edges[1]))>POLICY['max_edge_disagreement_m']:
okay=False;break
lo,hi=np.mean(edges,axis=0);length=hi-lo;center=(hi+lo)/2
ev=evidence(center-length*.35,center+length*.35)
if len(ev)!=2 or not all(supported(e)for e in ev):okay=False;break
polygons.append(rectangle(candidate['origin'],candidate['axis'],lo,hi,candidate['width'],candidate['offset']))
proof.append(ev);intervals.append((float(lo),float(hi)))
if not okay or not polygons:continue
gaps=[]
for left,right in zip(intervals,intervals[1:]):
if right[0]-left[1]<POLICY['min_gap_m']:okay=False;break
for vi,v in enumerate(views):
ev=dict(evidence(left[1]+.04,right[0]-.04,False)[vi])
if candidate['mode']=='peak_intervals':
def body(ab):
c=(ab[0]+ab[1])/2;length=ab[1]-ab[0]
return evidence(c-length*.3,c+length*.3)[vi]['contrast']
paint=min(body(left),body(right));ev['contrast_drop']=paint-ev['contrast']
passed=ev['valid']>=POLICY['min_valid']and ev['contrast_drop']>=18 and ev['contrast']<paint*.65
else:passed=supported(ev,False)
if not passed:okay=False;break
gaps.append(ev)
if not okay:break
if not okay:continue
observed_domain=rectangle(candidate['origin'],candidate['axis'],intervals[0][0],intervals[-1][1],candidate['width']+.16,candidate['offset'])
domain=candidate['domain'].union(observed_domain)
out.append({**candidate,'polygons':polygons,'domain':domain,'measured_body_evidence':proof,'measured_gap_evidence':gaps})
return out