) c_red_stag = solve_route1_supercell_fixed_pitch( label=f"CONTROL_Redistributed2x2_R1_390_Staggered_CoupledPlus10_16p5um_nx{nx_t}", top_diams_um=[68.0, d_comp_68_uneven, d_comp_68_uneven, 68.0], bot_diams_um=[68.0, d_comp_68_uneven, d_comp_68_uneven, 68.0], slab_um=390.0, staggered=True, ocr_mult=1.097 * 1.10, standoff_phys_um=16.5, nx_tot=nx_t, nz=nz_r1, ) assert c_red_pure_aligned["passes_15_and_5"] and c_red_pure_stag["passes_15_and_5"] assert c_red_aligned["passes_15_and_5"] and c_red_stag["passes_15_and_5"] redistributed_8site_controls.extend([c_red_pure_aligned, c_red_pure_stag, c_red_aligned, c_red_stag]) # 32-site (4x4 per layer) supercell across staggered meshes + nx=80 aligned/pure checks: for nx_t, _, _, nz_r1 in meshes: c_32_stag_m = solve_route1_supercell_fixed_pitch( label=f"COUNTEREXAMPLE_Supercell32_R1_390_Staggered_CoupledPlus10_16p5um_nx{nx_t}", top_diams_um=top_32, bot_diams_um=bot_32, slab_um=390.0, staggered=True, ocr_mult=1.097 * 1.10, standoff_phys_um=16.5, nx_tot=nx_t, nz=nz_r1, ) assert not c_32_stag_m["passes_15_and_5"] spatial_counterexamples.append(c_32_stag_m) c_32_aligned = solve_route1_supercell_fixed_pitch( label="COUNTEREXAMPLE_Supercell32_R1_390_Aligned_CoupledPlus10_16p5um_nx80", top_diams_um=top_32, bot_diams_um=bot_32, slab_um=390.0, staggered=False, ocr_mult=1.097 * 1.10, standoff_phys_um=16.5, nx_tot=80, nz=78, ) c_32_pure = solve_route1_supercell_fixed_pitch( label="COUNTEREXAMPLE_Supercell32_R1_390_Aligned_PurePlus10_15p0um_nx80", top_diams_um=top_32, bot_diams_um=bot_32, slab_um=390.0, staggered=False, ocr_mult=1.097 * 1.10, standoff_phys_um=15.0, nx_tot=80, nz=78, ) assert not c_32_aligned["passes_15_and_5"] assert not c_32_pure["passes_15_and_5"] spatial_counterexamples.extend([c_32_aligned, c_32_pure]) # Axial-grid refinement audit for the marginal 32-site pure +10% OCR case (nz = 78, 117, 156 at nx = 80): c_32_pure_nz117 = solve_route1_supercell_fixed_pitch( label="AXIAL_REFINEMENT_Supercell32_R1_390_Aligned_PurePlus10_15p0um_nx80_nz117", top_diams_um=top_32, bot_diams_um=bot_32, slab_um=390.0, staggered=False, ocr_mult=1.097 * 1.10, standoff_phys_um=15.0, nx_tot=80, nz=117, ) c_32_pure_nz156 = solve_route1_supercell_fixed_pitch( label="AXIAL_REFINEMENT_Supercell32_R1_390_Aligned_PurePlus10_15p0um_nx80_nz156", top_diams_um=top_32, bot_diams_um=bot_32, slab_um=390.0, staggered=False, ocr_mult=1.097 * 1.10, standoff_phys_um=15.0, nx_tot=80, nz=156, ) assert c_32_pure_nz117["passes_15_and_5"] and c_32_pure_nz156["passes_15_and_5"] axial_refinement_32site_pure_plus10 = [c_32_pure, c_32_pure_nz117, c_32_pure_nz156] # Route 2 Design Z 140 um staggered check on both uneven counterexample distributions c_z_un = solve_design_z_supercell_fixed_pitch( label="CHECK_Uneven2x2_R2_140Stag_Chr30_NoFBR_nx40", top_diams_um=[68.0] * 4, bot_diams_um=[d_comp_68_uneven] * 4, slab_h_um=140.0, z_c_um=27.5, staggered=True, bed_po2_mmhg=30.0, standoff_um=15.0, standoff_d_factor=1.0, nx_tot=40, nz=28, ) c_z_32 = solve_design_z_supercell_fixed_pitch( label="CHECK_Supercell32_R2_140Stag_Chr30_NoFBR_nx80", top_diams_um=top_32, bot_diams_um=bot_32, slab_h_um=140.0, z_c_um=27.5, staggered=True, bed_po2_mmhg=30.0, standoff_um=15.0, standoff_d_factor=1.0, nx_tot=80, nz=28, ) assert c_z_un["passes_15_and_5"] and c_z_32["passes_15_and_5"] _seg_pure_nx40 = next( r for r in spatial_counterexamples if r["label"] == "COUNTEREXAMPLE_Uneven2x2_R1_390_Aligned_PurePlus10_15p0um_nx40" ) _red_pure_nx40 = next( r for r in redistributed_8site_controls if r["label"] == "CONTROL_Redistributed2x2_R1_390_Aligned_PurePlus10_15p0um_nx40" ) _seg_ref = next( (r for r in spatial_counterexamples if r["label"].startswith("COUNTEREXAMPLE_Uneven2x2_R1_390_Staggered_PurePlus10_15p0um_nx80")), spatial_counterexamples[2], ) _red_ref = next( (r for r in redistributed_8site_controls if r["label"].endswith("_Staggered_PurePlus10_15p0um_nx80")), redistributed_8site_controls[1], ) assert abs(_seg_pure_nx40["worst_face_mmhg"] - 14.2990) < 1e-3 assert abs(_red_pure_nx40["worst_face_mmhg"] - 15.7151) < 1e-3 _d0_30 = avascular_runs[0] _d0_38 = avascular_runs[1] _d0_40_1x = avascular_runs[2] _d0_40_1097 = avascular_runs[3] return { "fixed_pitch_um": round(fixed_pitch_um, 4), "nominal_loading_ieq_cm2": 1500.0, "route1_fvm_model_scope_note": ( "Route 1 3D FVM runs model chronic vascularized hydrogel perfusion (k_perf = 0.1358 s^-1, zero active CaO2 source) " "across both aligned and staggered 2-layer registries on all 3 meshes, and explicitly separate pure +10% OCR (15.0 um standoff) " "from coupled +10% OCR + 16.5 um standoff. On 8-site supercells, one-68 and one-70 tails carry cell maxima of 68.0/70.0 um and " "exact 8-site Type-7 p95 of 66.95/68.25 um (both serialized per run). Aggregate lot histogram tolerances (p05 >= 58, d_rms3 <= 65, " f"p95 <= 68, d_max <= 70, <= 1,500 IEQ/cm^2) are necessary-not-sufficient: segregated 8-site placement " f"({_seg_pure_nx40['worst_face_mmhg']:.4f} vs computed redistributed control {_red_pure_nx40['worst_face_mmhg']:.4f} mmHg at nx=40, " f"and {_seg_ref['worst_face_mmhg']:.4f} vs {_red_ref['worst_face_mmhg']:.4f} mmHg staggered at nx={_seg_ref['nx_tot']}, all at 15.0 um standoff " f"and identical histogram) and coupled 32-site stress " f"({c_32_aligned['worst_face_mmhg']:.4f} mmHg) robustly fail < 15.0 mmHg on Route 1 390 um (while the marginal 32-site pure +10% OCR " f"case is axially mesh-sensitive: {c_32_pure['worst_face_mmhg']:.4f} / {c_32_pure_nz117['worst_face_mmhg']:.4f} / " f"{c_32_pure_nz156['worst_face_mmhg']:.4f} mmHg at nz = 78 / 117 / 156), mandating explicit worst-location stress pO2 >= 15.0 mmHg " "across BOTH Route 1 350 um and Route 1 390 um plus direct loaded-coupon verification." ), "day0_bed_40mmhg_policy_floor_note": ( "40.0 mmHg Day-0 avascular bed pO2 is a conservative Stage-0 policy floor rather than the physical minimum: " f"at 40.0 mmHg bed pO2, paired (face, core) minima are {_d0_40_1x['worst_face_mmhg']:.2f} / {_d0_40_1x['worst_core_mmhg']:.2f} mmHg " f"at 1.00x OCR and {_d0_40_1097['worst_face_mmhg']:.2f} / {_d0_40_1097['worst_core_mmhg']:.2f} mmHg at 1.097x OCR; " f"at 1.097x demand, 38.0 mmHg bed pO2 passes at {_d0_38['worst_face_mmhg']:.4f} mmHg face / {_d0_38['worst_core_mmhg']:.4f} mmHg core, " f"whereas 30.0 mmHg fails at {_d0_30['worst_face_mmhg']:.2f} / {_d0_30['worst_core_mmhg']:.2f} mmHg." ), "gy027_monolayer_packing_check": gy027_packing_check, "pass_runs_multimesh": pass_runs, "hold_proofs_all_fail": hold_runs, "spatial_counterexamples_necessary_not_sufficient": { "route1_390um_failing_counterexamples": spatial_counterexamples, "route1_390um_redistributed_8site_controls": redistributed_8site_controls, "axial_refinement_sensitivity_32site_pure_plus10": axial_refinement_32site_pure_plus10, "axial_refinement_note": ( "For 32-site Route 1 390 um pure +10% OCR at nx = 80, axial refinement nz = 78 -> 117 -> 156 shifts worst face " f"from {c_32_pure['worst_face_mmhg']:.4f} mmHg (below 15.0) to {c_32_pure_nz117['worst_face_mmhg']:.4f} and " f"{c_32_pure_nz156['worst_face_mmhg']:.4f} mmHg (above 15.0). That single marginal case is mesh-sensitive; " f"the segregated 8-site placement counterexample ({_seg_pure_nx40['worst_face_mmhg']:.4f} vs computed redistributed control " f"{_red_pure_nx40['worst_face_mmhg']:.4f} mmHg at nx = 40, 15.0 um standoff) and coupled +10% OCR + 16.5 um standoff stress " f"({c_32_aligned['worst_face_mmhg']:.4f} mmHg) carry the robust failure signal." ), "route2_140um_design_z_uneven_checks": [c_z_un, c_z_32], }, "day0_avascular_split": avascular_runs, } def verify_cylindrical_traps() -> Dict[str, Any]: """Re-verify GY-028 cylindrical pre-vascularized channel traps at 500,000 IEQ scale.""" r500 = solve_3d_preperf_microtrack_fvm( label="GY028_Cylindrical_R500um_1mmID_Day0_Anoxia", r_lumen_um=500.0, tissue_bridge_um=500.0, phi_lumen=0.15, bed_po2_mmhg=35.0, k_perf_wall_s_inv=25.0, nx_cross=40, ) assert r500["core_min_mmhg"] == 0.0 and r500["worst_face_mmhg"] == 0.0 r120_15 = solve_3d_preperf_microtrack_fvm( label="GY028_Cylindrical_R120um_30umDenseThrombus_Stroma15", r_lumen_um=120.0, tissue_bridge_um=160.0, phi_lumen=0.15, bed_po2_mmhg=35.0, sleeve_um=30.0, sleeve_d_factor=0.5, k_perf_wall_s_inv=25.0, k_perf_lumen_s_inv=0.0, stromal_frac=0.15, nx_cross=40, ) r120_25 = solve_3d_preperf_microtrack_fvm( label="GY028_Cylindrical_R120um_30umDenseThrombus_VPIOStroma25", r_lumen_um=120.0, tissue_bridge_um=160.0, phi_lumen=0.15, bed_po2_mmhg=35.0, sleeve_um=30.0, sleeve_d_factor=0.5, k_perf_wall_s_inv=25.0, k_perf_lumen_s_inv=0.0, stromal_frac=0.25, nx_cross=40, ) assert abs(r120_15["core_min_mmhg"] - 1.4106) < 0.01 assert abs(r120_25["core_min_mmhg"] - 0.5908) < 0.01 mech = [] for r_um, bridge_um, phi in [(100.0, 150.0, 0.15), (120.0, 160.0, 0.15)]: d_um = 2.0 * r_um r_m = r_um * 1e-6 d_m = d_um * 1e-6 v_lum_m3 = (VOL_500K_CM3 / phi) * 1e-6 l_tot_m = v_lum_m3 / (math.pi * r_m ** 2) pitch_um = d_um + bridge_um area_cm2 = (l_tot_m * 100.0) * (pitch_um * 1e-4) pad_side_cm = math.sqrt(0.5 * area_cm2) n_tracks = 2 * int(round((pad_side_cm * 1e4) / pitch_um)) l_single_m = pad_side_cm / 100.0 f_pull_all_N = n_tracks * (math.pi * d_m * l_single_m * 2000.0) mech.append({ "r_um": r_um, "d_um": d_um, "phi": phi, "total_track_length_m": round(l_tot_m, 1), "total_area_cm2": round(area_cm2, 1), "two_square_pads_side_cm": round(pad_side_cm, 2), "n_tracks_total": n_tracks, "aspect_ratio_L_over_D": round(l_single_m / d_m, 1), "pull_force_all_rods_2kPa_N": round(f_pull_all_N, 1), "vpio_jamming_d_over_D_100um": round(100.0 / d_um, 3), "vpio_jamming_d_over_D_150um": round(150.0 / d_um, 3), }) return { "r500_anoxia_3d_fvm": r500, "r120_30um_clot_stroma15_3d_fvm": r120_15, "r120_30um_clot_vpio25_3d_fvm": r120_25, "r100_r120_mechanics_and_anatomy": mech, } def verify_live_oq016_baseline() -> Dict[str, Any]: """Programmatically verify 2,160-stack Layer-1 parity vs committed Pareto JSON & pre-IIP-0033 subset and OQ-016 live tree.""" oq016_spec = rank_mod._build_odds_composition_and_profile_scope_audit_iip_0003() ref_notes = oq016_spec["multiplied_conditional_totals"]["iip_0020_sensitivity_and_calibration_notes"] ref_tree = ref_notes["programmatic_2pow12_generator_audit_iip_0022"] lck = float(ref_tree["locked_2route_shared_ax_pouch_exact"]) mod = float(ref_tree["modular_2route_shared_ax_pouch_exact"]) # Also verify independent recomputation from reassessed_hurdles and live rank_islet1_stacks helper hurdles = oq016_spec["reassessed_hurdles"] pa0 = [float(h["one_design_design_a"]) for h in hurdles] pb0 = [float(h["one_design_design_b"]) for h in hurdles] px0 = [float(h["one_design_design_x"]) for h in hurdles] assert pa0 == ref_tree["recovered_marginals_check"]["design_a"] assert pb0 == ref_tree["recovered_marginals_check"]["design_b"] assert px0 == ref_tree["recovered_marginals_check"]["design_x"] c0 = [0.88, 0.87, 0.89, 0.85] recomputed_tree = rank_mod.compute_common_shock_2pow12_portfolio_tree(pa0, pb0, px0, c0) recomputed_lck = float(recomputed_tree["locked_2route_shared_ax_pouch_exact"]) recomputed_mod = float(recomputed_tree["modular_2route_shared_ax_pouch_exact"]) ceil = math.prod(c0) pareto_path = ROOT / "data" / "extracted" / "islet1_combinatorial_pareto_and_ladder_v0.8.0.json" pareto_doc = json.loads(pareto_path.read_text(encoding="utf-8")) committed_stacks = pareto_doc["evaluated_stacks"] _, studies_all, omics = rank_mod.load_inputs() iip0033_pmids = {"19555051", "25893782", "31527312", "36591328", "41536981", "42176117"} studies_pre = [s for s in studies_all if str(s.get("study_metadata", {}).get("pmid")) not in iip0033_pmids] combos_post = rank_mod.run_combinatorial_multi_gate_search(rank_mod.build_target_evidence_profiles(studies_all, omics)) combos_pre = rank_mod.run_combinatorial_multi_gate_search(rank_mod.build_target_evidence_profiles(studies_pre, omics)) assert len(combos_post) == len(combos_pre) == len(committed_stacks) == 2160 mutated_vs_pre = sum(1 for a, b in zip(combos_post, combos_pre) if a != b) mutated_vs_committed = sum( 1 for a, c in zip(combos_post, committed_stacks) if a["combination_id"] != c["combination_id"] or a["global_rank_among_all_combinations"] != c["rank"] or round(float(a["composite_series_system_utility"]), 4) != float(c["composite_score"]) ) max_abs_score_delta = max( abs(float(a["composite_series_system_utility"]) - float(b["composite_series_system_utility"])) for a, b in zip(combos_post, combos_pre) ) max_abs_committed_delta = max( abs(round(float(a["composite_series_system_utility"]), 4) - float(c["composite_score"])) for a, c in zip(combos_post, committed_stacks) ) computed_delta_pp = round( 100.0 * abs(recomputed_lck - lck) + 100.0 * abs(recomputed_mod - mod) + 100.0 * max_abs_score_delta + 100.0 * max_abs_committed_delta, 6, ) assert mutated_vs_pre == 0 and mutated_vs_committed == 0 assert abs(100.0 * lck - 50.778198) < 1e-4 assert abs(100.0 * mod - 54.116275) < 1e-4 assert abs(100.0 * ceil - 57.917640) < 1e-4