from research import *
s=begin(904,'Connect the complete festival walks to the49/70 interface','Which scaled prefix durations belong to the shared490 measure?',{'scale':7,'grids':[49,70,490]},['C839–841','C869'])
out={}
for name in ['forward','reverse']:
 p=json.loads((ROOT/('model/festival_'+name+'_path.json')).read_text())
 out[name]=[{'count':c,'duration':7*c,'on49':c%7==0,'on70':c%10==0,'on490':c%70==0} for c in p['prefix_counts']]
art=artifact('model/festival_common_measure.json',json.dumps(out,indent=2)+'\n')
finish(s,{'classification':art,'shared490':{k:[r['count'] for r in v if r['on490']] for k,v in out.items()}},'For countc,7c lies in49Z,70Z or490Z exactly when7,10 or70 dividesc. Both complete walks meet the common490 grid only at count0 and140. Their other shared prefixes59 and199 are outside it. Equal duration membership does not identify events across anchors.','Extend the insertion comparison across the source-specific Cainan measurements.',{'full18':sum(map(len,out.values()))==18,'common':all([r['count'] for r in v if r['on490']]==[0,140] for v in out.values()),'duration980':7*140==2*490,'limits':7*59%490!=0 and 7*199%490!=0})
