diffneusim 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (682) hide show
  1. diffneusim/__init__.py +1 -0
  2. diffneusim/_cache.py +42 -0
  3. diffneusim/_paths.py +5 -0
  4. diffneusim/bindings/rew14_ext.cu +115 -0
  5. diffneusim/bindings/soft14_capi.cpp +443 -0
  6. diffneusim/bindings/soft14_engine_ext.cu +596 -0
  7. diffneusim/bindings/soft_capi.cpp +782 -0
  8. diffneusim/bindings/soft_engine_ext.cu +495 -0
  9. diffneusim/core/cpu_engine/build.sh +40 -0
  10. diffneusim/core/cpu_engine/fiber/cuda_runtime.h +445 -0
  11. diffneusim/core/cpu_engine/x14_cpu.cpp +283 -0
  12. diffneusim/core/diff/dual.h +126 -0
  13. diffneusim/core/include/diffneusim/macros.h +35 -0
  14. diffneusim/core/kin/kinematic_tree.h +273 -0
  15. diffneusim/core/math/so3.h +182 -0
  16. diffneusim/core/soft/adj/out_adj.h +102 -0
  17. diffneusim/core/soft/adj/rnea_adj.h +425 -0
  18. diffneusim/core/soft/adj/rows_adj.h +439 -0
  19. diffneusim/core/soft/adj/rows_functor.h +89 -0
  20. diffneusim/core/soft/adj/rows_lanes.h +443 -0
  21. diffneusim/core/soft/adj/shell_adj.h +243 -0
  22. diffneusim/core/soft/adj/tree_adj.h +356 -0
  23. diffneusim/core/soft/collide.h +183 -0
  24. diffneusim/core/soft/gpu/adj14.cuh +233 -0
  25. diffneusim/core/soft/gpu/adj14_mus.cuh +98 -0
  26. diffneusim/core/soft/gpu/adj_shell.cuh +50 -0
  27. diffneusim/core/soft/gpu/adj_tab.cuh +49 -0
  28. diffneusim/core/soft/gpu/body14.cuh +47 -0
  29. diffneusim/core/soft/gpu/chol_rn.cuh +458 -0
  30. diffneusim/core/soft/gpu/chol_small.cuh +123 -0
  31. diffneusim/core/soft/gpu/chol_split.cuh +193 -0
  32. diffneusim/core/soft/gpu/engine_launch.cuh +263 -0
  33. diffneusim/core/soft/gpu/fk_rn.cuh +109 -0
  34. diffneusim/core/soft/gpu/generated/body_019e20820f86_mmfloor.cuh +28 -0
  35. diffneusim/core/soft/gpu/generated/body_62f77a4bb16b_mmfloor.cuh +52 -0
  36. diffneusim/core/soft/gpu/generated/body_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +28 -0
  37. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +28 -0
  38. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +28 -0
  39. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +28 -0
  40. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +28 -0
  41. diffneusim/core/soft/gpu/generated/body_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +52 -0
  42. diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor.cuh +25 -0
  43. diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +25 -0
  44. diffneusim/core/soft/gpu/generated/g1_soft_5db44fd45286.cuh +74 -0
  45. diffneusim/core/soft/gpu/generated/split_62f77a4bb16b_mmfloor.cuh +18 -0
  46. diffneusim/core/soft/gpu/generated/split_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +18 -0
  47. diffneusim/core/soft/gpu/generated/x14_soft_019e20820f86_mmfloor.cuh +123 -0
  48. diffneusim/core/soft/gpu/generated/x14_soft_62f77a4bb16b_mmfloor.cuh +129 -0
  49. diffneusim/core/soft/gpu/generated/x14_soft_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +123 -0
  50. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +123 -0
  51. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +123 -0
  52. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +123 -0
  53. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +123 -0
  54. diffneusim/core/soft/gpu/generated/x14_soft_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +129 -0
  55. diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor.cuh +123 -0
  56. diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +123 -0
  57. diffneusim/core/soft/gpu/k_mus.cuh +1038 -0
  58. diffneusim/core/soft/gpu/k_mus_host.cuh +377 -0
  59. diffneusim/core/soft/gpu/k_pre.cuh +52 -0
  60. diffneusim/core/soft/gpu/kernel_p.cuh +490 -0
  61. diffneusim/core/soft/gpu/kp14.cuh +465 -0
  62. diffneusim/core/soft/gpu/l2v2.cuh +367 -0
  63. diffneusim/core/soft/gpu/l2x14.cuh +319 -0
  64. diffneusim/core/soft/gpu/l3.cuh +1483 -0
  65. diffneusim/core/soft/gpu/model_view.cuh +48 -0
  66. diffneusim/core/soft/gpu/mus_case_fits.h +15 -0
  67. diffneusim/core/soft/gpu/mus_classes.h +182 -0
  68. diffneusim/core/soft/gpu/mus_row_cf.h +44 -0
  69. diffneusim/core/soft/gpu/rew14.cuh +177 -0
  70. diffneusim/core/soft/gpu/rows_ctab.cuh +44 -0
  71. diffneusim/core/soft/gpu/tree_m.cuh +247 -0
  72. diffneusim/core/soft/gpu/x14_engine_kernels.cuh +260 -0
  73. diffneusim/core/soft/gpu/x14_rowcf.h +14 -0
  74. diffneusim/core/soft/hand.h +124 -0
  75. diffneusim/core/soft/impedance.h +115 -0
  76. diffneusim/core/soft/jvp.h +202 -0
  77. diffneusim/core/soft/kin.h +250 -0
  78. diffneusim/core/soft/muscle.h +1208 -0
  79. diffneusim/core/soft/newton.h +371 -0
  80. diffneusim/core/soft/rows.h +176 -0
  81. diffneusim/core/soft/step.h +188 -0
  82. diffneusim/core/soft/tape.h +313 -0
  83. diffneusim/core/soft/x14/collide14.h +69 -0
  84. diffneusim/core/soft/x14/jvp14.h +182 -0
  85. diffneusim/core/soft/x14/law14.h +453 -0
  86. diffneusim/core/soft/x14adj/collide14_adj.h +134 -0
  87. diffneusim/core/soft/x14adj/passive14_adj.h +162 -0
  88. diffneusim/core/soft/x14adj/reward14.h +484 -0
  89. diffneusim/core/soft/x14adj/rows14_adj.h +400 -0
  90. diffneusim/core/soft/x14adj/scan14.h +349 -0
  91. diffneusim/core/soft/x14adj/shell14_adj.h +122 -0
  92. diffneusim/core/soft/x14adj/sweep14.h +255 -0
  93. diffneusim/core/soft/x14adj/tree14_adj.h +500 -0
  94. diffneusim/core/soft/x14adj/x14adj_common.h +96 -0
  95. diffneusim/data/mirror/H1622v2k_geyer_hfdeq.npz +0 -0
  96. diffneusim/data/mirror/H1622v2k_hfd.npz +0 -0
  97. diffneusim/data/mirror/H1622v2k_millard_hfdeq.npz +0 -0
  98. diffneusim/data/mirror/fullbody_contact.npz +0 -0
  99. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard.npz +0 -0
  100. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str.npz +0 -0
  101. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str_rigid.npz +0 -0
  102. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.npz +0 -0
  103. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.npz +0 -0
  104. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq.npz +0 -0
  105. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin.npz +0 -0
  106. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_calf2_pe.npz +0 -0
  107. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
  108. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfix.npz +0 -0
  109. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.npz +0 -0
  110. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01.npz +0 -0
  111. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01legs.npz +0 -0
  112. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01lumbar.npz +0 -0
  113. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfix.npz +0 -0
  114. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfixlegs01.npz +0 -0
  115. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
  116. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
  117. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
  118. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
  119. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair.npz +0 -0
  120. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
  121. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_hinge.npz +0 -0
  122. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
  123. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
  124. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
  125. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
  126. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_lspine_girdle_osimeq.npz +0 -0
  127. diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_millard.npz +0 -0
  128. diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_osimeq.npz +0 -0
  129. diffneusim/data/mirror/myoleg26_3d_compound_g14eq.npz +0 -0
  130. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq.npz +0 -0
  131. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose.npz +0 -0
  132. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin.npz +0 -0
  133. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30.npz +0 -0
  134. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30.npz +0 -0
  135. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_luispe.npz +0 -0
  136. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_trunk0701.npz +0 -0
  137. diffneusim/data/muscle_fit/wang_mass_volume_14t.json +91 -0
  138. diffneusim/data/muscle_fit/wang_mass_volume_14t_axfix.json +91 -0
  139. diffneusim/data/muscle_fit/wang_mass_volume_14t_axfixlegs01.json +91 -0
  140. diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01.json +91 -0
  141. diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01legs.json +91 -0
  142. diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01lumbar.json +91 -0
  143. diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfix.json +91 -0
  144. diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfixlegs01.json +91 -0
  145. diffneusim/data/muscle_fit/wang_mass_volume_14t_n1.json +91 -0
  146. diffneusim/data/muscle_fit/wang_mass_volume_14t_n1a.json +91 -0
  147. diffneusim/data/muscle_fit/wang_mass_volume_14t_n2.json +91 -0
  148. diffneusim/data/muscle_fit/wang_mass_volume_14t_rom23.json +91 -0
  149. diffneusim/data/reference/musclemimic/myofullbody_mimic_sites.json +261 -0
  150. diffneusim/data/reference/pose3/pose3_scone.json +305 -0
  151. diffneusim/data/reference/pose3/pose3_scone.txt +3 -0
  152. diffneusim/data/reference/pose3/pose3_scone_gait.npz +0 -0
  153. diffneusim/data/reference/pose3/pose3_scone_mirror.npz +0 -0
  154. diffneusim/data/reference/pose3/pose3_scone_stand.npz +0 -0
  155. diffneusim/data/reference/x016run/MD5SUMS +241 -0
  156. diffneusim/data/reference/x016run/x016run_states.txt +240 -0
  157. diffneusim/data/reference/x016run/x016run_v3p00_s0_l0.npz +0 -0
  158. diffneusim/data/reference/x016run/x016run_v3p00_s0_l1.npz +0 -0
  159. diffneusim/data/reference/x016run/x016run_v3p00_s0_l2.npz +0 -0
  160. diffneusim/data/reference/x016run/x016run_v3p00_s0_l3.npz +0 -0
  161. diffneusim/data/reference/x016run/x016run_v3p00_s0_r0.npz +0 -0
  162. diffneusim/data/reference/x016run/x016run_v3p00_s0_r1.npz +0 -0
  163. diffneusim/data/reference/x016run/x016run_v3p00_s0_r2.npz +0 -0
  164. diffneusim/data/reference/x016run/x016run_v3p00_s0_r3.npz +0 -0
  165. diffneusim/data/reference/x016run/x016run_v3p00_s1_l0.npz +0 -0
  166. diffneusim/data/reference/x016run/x016run_v3p00_s1_l1.npz +0 -0
  167. diffneusim/data/reference/x016run/x016run_v3p00_s1_l2.npz +0 -0
  168. diffneusim/data/reference/x016run/x016run_v3p00_s1_l3.npz +0 -0
  169. diffneusim/data/reference/x016run/x016run_v3p00_s1_r0.npz +0 -0
  170. diffneusim/data/reference/x016run/x016run_v3p00_s1_r1.npz +0 -0
  171. diffneusim/data/reference/x016run/x016run_v3p00_s1_r2.npz +0 -0
  172. diffneusim/data/reference/x016run/x016run_v3p00_s1_r3.npz +0 -0
  173. diffneusim/data/reference/x016run/x016run_v3p00_s2_l0.npz +0 -0
  174. diffneusim/data/reference/x016run/x016run_v3p00_s2_l1.npz +0 -0
  175. diffneusim/data/reference/x016run/x016run_v3p00_s2_l2.npz +0 -0
  176. diffneusim/data/reference/x016run/x016run_v3p00_s2_l3.npz +0 -0
  177. diffneusim/data/reference/x016run/x016run_v3p00_s2_r0.npz +0 -0
  178. diffneusim/data/reference/x016run/x016run_v3p00_s2_r1.npz +0 -0
  179. diffneusim/data/reference/x016run/x016run_v3p00_s2_r2.npz +0 -0
  180. diffneusim/data/reference/x016run/x016run_v3p00_s2_r3.npz +0 -0
  181. diffneusim/data/reference/x016run/x016run_v3p00_s3_l0.npz +0 -0
  182. diffneusim/data/reference/x016run/x016run_v3p00_s3_l1.npz +0 -0
  183. diffneusim/data/reference/x016run/x016run_v3p00_s3_l2.npz +0 -0
  184. diffneusim/data/reference/x016run/x016run_v3p00_s3_l3.npz +0 -0
  185. diffneusim/data/reference/x016run/x016run_v3p00_s3_r0.npz +0 -0
  186. diffneusim/data/reference/x016run/x016run_v3p00_s3_r1.npz +0 -0
  187. diffneusim/data/reference/x016run/x016run_v3p00_s3_r2.npz +0 -0
  188. diffneusim/data/reference/x016run/x016run_v3p00_s3_r3.npz +0 -0
  189. diffneusim/data/reference/x016run/x016run_v3p00_s4_l0.npz +0 -0
  190. diffneusim/data/reference/x016run/x016run_v3p00_s4_l1.npz +0 -0
  191. diffneusim/data/reference/x016run/x016run_v3p00_s4_l2.npz +0 -0
  192. diffneusim/data/reference/x016run/x016run_v3p00_s4_l3.npz +0 -0
  193. diffneusim/data/reference/x016run/x016run_v3p00_s4_r0.npz +0 -0
  194. diffneusim/data/reference/x016run/x016run_v3p00_s4_r1.npz +0 -0
  195. diffneusim/data/reference/x016run/x016run_v3p00_s4_r2.npz +0 -0
  196. diffneusim/data/reference/x016run/x016run_v3p00_s4_r3.npz +0 -0
  197. diffneusim/data/reference/x016run/x016run_v3p00_s5_l0.npz +0 -0
  198. diffneusim/data/reference/x016run/x016run_v3p00_s5_l1.npz +0 -0
  199. diffneusim/data/reference/x016run/x016run_v3p00_s5_l2.npz +0 -0
  200. diffneusim/data/reference/x016run/x016run_v3p00_s5_l3.npz +0 -0
  201. diffneusim/data/reference/x016run/x016run_v3p00_s5_r0.npz +0 -0
  202. diffneusim/data/reference/x016run/x016run_v3p00_s5_r1.npz +0 -0
  203. diffneusim/data/reference/x016run/x016run_v3p00_s5_r2.npz +0 -0
  204. diffneusim/data/reference/x016run/x016run_v3p00_s5_r3.npz +0 -0
  205. diffneusim/data/reference/x016run/x016run_v3p00_s6_l0.npz +0 -0
  206. diffneusim/data/reference/x016run/x016run_v3p00_s6_l1.npz +0 -0
  207. diffneusim/data/reference/x016run/x016run_v3p00_s6_l2.npz +0 -0
  208. diffneusim/data/reference/x016run/x016run_v3p00_s6_l3.npz +0 -0
  209. diffneusim/data/reference/x016run/x016run_v3p00_s6_r0.npz +0 -0
  210. diffneusim/data/reference/x016run/x016run_v3p00_s6_r1.npz +0 -0
  211. diffneusim/data/reference/x016run/x016run_v3p00_s6_r2.npz +0 -0
  212. diffneusim/data/reference/x016run/x016run_v3p00_s6_r3.npz +0 -0
  213. diffneusim/data/reference/x016run/x016run_v3p00_s7_l0.npz +0 -0
  214. diffneusim/data/reference/x016run/x016run_v3p00_s7_l1.npz +0 -0
  215. diffneusim/data/reference/x016run/x016run_v3p00_s7_l2.npz +0 -0
  216. diffneusim/data/reference/x016run/x016run_v3p00_s7_l3.npz +0 -0
  217. diffneusim/data/reference/x016run/x016run_v3p00_s7_r0.npz +0 -0
  218. diffneusim/data/reference/x016run/x016run_v3p00_s7_r1.npz +0 -0
  219. diffneusim/data/reference/x016run/x016run_v3p00_s7_r2.npz +0 -0
  220. diffneusim/data/reference/x016run/x016run_v3p00_s7_r3.npz +0 -0
  221. diffneusim/data/reference/x016run/x016run_v3p25_s0_l0.npz +0 -0
  222. diffneusim/data/reference/x016run/x016run_v3p25_s0_l1.npz +0 -0
  223. diffneusim/data/reference/x016run/x016run_v3p25_s0_l2.npz +0 -0
  224. diffneusim/data/reference/x016run/x016run_v3p25_s0_l3.npz +0 -0
  225. diffneusim/data/reference/x016run/x016run_v3p25_s0_r0.npz +0 -0
  226. diffneusim/data/reference/x016run/x016run_v3p25_s0_r1.npz +0 -0
  227. diffneusim/data/reference/x016run/x016run_v3p25_s0_r2.npz +0 -0
  228. diffneusim/data/reference/x016run/x016run_v3p25_s0_r3.npz +0 -0
  229. diffneusim/data/reference/x016run/x016run_v3p25_s1_l0.npz +0 -0
  230. diffneusim/data/reference/x016run/x016run_v3p25_s1_l1.npz +0 -0
  231. diffneusim/data/reference/x016run/x016run_v3p25_s1_l2.npz +0 -0
  232. diffneusim/data/reference/x016run/x016run_v3p25_s1_l3.npz +0 -0
  233. diffneusim/data/reference/x016run/x016run_v3p25_s1_r0.npz +0 -0
  234. diffneusim/data/reference/x016run/x016run_v3p25_s1_r1.npz +0 -0
  235. diffneusim/data/reference/x016run/x016run_v3p25_s1_r2.npz +0 -0
  236. diffneusim/data/reference/x016run/x016run_v3p25_s1_r3.npz +0 -0
  237. diffneusim/data/reference/x016run/x016run_v3p25_s2_l0.npz +0 -0
  238. diffneusim/data/reference/x016run/x016run_v3p25_s2_l1.npz +0 -0
  239. diffneusim/data/reference/x016run/x016run_v3p25_s2_l2.npz +0 -0
  240. diffneusim/data/reference/x016run/x016run_v3p25_s2_l3.npz +0 -0
  241. diffneusim/data/reference/x016run/x016run_v3p25_s2_r0.npz +0 -0
  242. diffneusim/data/reference/x016run/x016run_v3p25_s2_r1.npz +0 -0
  243. diffneusim/data/reference/x016run/x016run_v3p25_s2_r2.npz +0 -0
  244. diffneusim/data/reference/x016run/x016run_v3p25_s2_r3.npz +0 -0
  245. diffneusim/data/reference/x016run/x016run_v3p25_s3_l0.npz +0 -0
  246. diffneusim/data/reference/x016run/x016run_v3p25_s3_l1.npz +0 -0
  247. diffneusim/data/reference/x016run/x016run_v3p25_s3_l2.npz +0 -0
  248. diffneusim/data/reference/x016run/x016run_v3p25_s3_l3.npz +0 -0
  249. diffneusim/data/reference/x016run/x016run_v3p25_s3_r0.npz +0 -0
  250. diffneusim/data/reference/x016run/x016run_v3p25_s3_r1.npz +0 -0
  251. diffneusim/data/reference/x016run/x016run_v3p25_s3_r2.npz +0 -0
  252. diffneusim/data/reference/x016run/x016run_v3p25_s3_r3.npz +0 -0
  253. diffneusim/data/reference/x016run/x016run_v3p25_s4_l0.npz +0 -0
  254. diffneusim/data/reference/x016run/x016run_v3p25_s4_l1.npz +0 -0
  255. diffneusim/data/reference/x016run/x016run_v3p25_s4_l2.npz +0 -0
  256. diffneusim/data/reference/x016run/x016run_v3p25_s4_l3.npz +0 -0
  257. diffneusim/data/reference/x016run/x016run_v3p25_s4_r0.npz +0 -0
  258. diffneusim/data/reference/x016run/x016run_v3p25_s4_r1.npz +0 -0
  259. diffneusim/data/reference/x016run/x016run_v3p25_s4_r2.npz +0 -0
  260. diffneusim/data/reference/x016run/x016run_v3p25_s4_r3.npz +0 -0
  261. diffneusim/data/reference/x016run/x016run_v3p25_s5_l0.npz +0 -0
  262. diffneusim/data/reference/x016run/x016run_v3p25_s5_l1.npz +0 -0
  263. diffneusim/data/reference/x016run/x016run_v3p25_s5_l2.npz +0 -0
  264. diffneusim/data/reference/x016run/x016run_v3p25_s5_l3.npz +0 -0
  265. diffneusim/data/reference/x016run/x016run_v3p25_s5_r0.npz +0 -0
  266. diffneusim/data/reference/x016run/x016run_v3p25_s5_r1.npz +0 -0
  267. diffneusim/data/reference/x016run/x016run_v3p25_s5_r2.npz +0 -0
  268. diffneusim/data/reference/x016run/x016run_v3p25_s5_r3.npz +0 -0
  269. diffneusim/data/reference/x016run/x016run_v3p25_s6_l0.npz +0 -0
  270. diffneusim/data/reference/x016run/x016run_v3p25_s6_l1.npz +0 -0
  271. diffneusim/data/reference/x016run/x016run_v3p25_s6_l2.npz +0 -0
  272. diffneusim/data/reference/x016run/x016run_v3p25_s6_l3.npz +0 -0
  273. diffneusim/data/reference/x016run/x016run_v3p25_s6_r0.npz +0 -0
  274. diffneusim/data/reference/x016run/x016run_v3p25_s6_r1.npz +0 -0
  275. diffneusim/data/reference/x016run/x016run_v3p25_s6_r2.npz +0 -0
  276. diffneusim/data/reference/x016run/x016run_v3p25_s6_r3.npz +0 -0
  277. diffneusim/data/reference/x016run/x016run_v3p25_s7_l0.npz +0 -0
  278. diffneusim/data/reference/x016run/x016run_v3p25_s7_l1.npz +0 -0
  279. diffneusim/data/reference/x016run/x016run_v3p25_s7_l2.npz +0 -0
  280. diffneusim/data/reference/x016run/x016run_v3p25_s7_l3.npz +0 -0
  281. diffneusim/data/reference/x016run/x016run_v3p25_s7_r0.npz +0 -0
  282. diffneusim/data/reference/x016run/x016run_v3p25_s7_r1.npz +0 -0
  283. diffneusim/data/reference/x016run/x016run_v3p25_s7_r2.npz +0 -0
  284. diffneusim/data/reference/x016run/x016run_v3p25_s7_r3.npz +0 -0
  285. diffneusim/data/reference/x016run/x016run_v3p50_s0_l0.npz +0 -0
  286. diffneusim/data/reference/x016run/x016run_v3p50_s0_l1.npz +0 -0
  287. diffneusim/data/reference/x016run/x016run_v3p50_s0_l2.npz +0 -0
  288. diffneusim/data/reference/x016run/x016run_v3p50_s0_l3.npz +0 -0
  289. diffneusim/data/reference/x016run/x016run_v3p50_s0_r0.npz +0 -0
  290. diffneusim/data/reference/x016run/x016run_v3p50_s0_r1.npz +0 -0
  291. diffneusim/data/reference/x016run/x016run_v3p50_s0_r2.npz +0 -0
  292. diffneusim/data/reference/x016run/x016run_v3p50_s0_r3.npz +0 -0
  293. diffneusim/data/reference/x016run/x016run_v3p50_s1_l0.npz +0 -0
  294. diffneusim/data/reference/x016run/x016run_v3p50_s1_l1.npz +0 -0
  295. diffneusim/data/reference/x016run/x016run_v3p50_s1_l2.npz +0 -0
  296. diffneusim/data/reference/x016run/x016run_v3p50_s1_l3.npz +0 -0
  297. diffneusim/data/reference/x016run/x016run_v3p50_s1_r0.npz +0 -0
  298. diffneusim/data/reference/x016run/x016run_v3p50_s1_r1.npz +0 -0
  299. diffneusim/data/reference/x016run/x016run_v3p50_s1_r2.npz +0 -0
  300. diffneusim/data/reference/x016run/x016run_v3p50_s1_r3.npz +0 -0
  301. diffneusim/data/reference/x016run/x016run_v3p50_s2_l0.npz +0 -0
  302. diffneusim/data/reference/x016run/x016run_v3p50_s2_l1.npz +0 -0
  303. diffneusim/data/reference/x016run/x016run_v3p50_s2_l2.npz +0 -0
  304. diffneusim/data/reference/x016run/x016run_v3p50_s2_l3.npz +0 -0
  305. diffneusim/data/reference/x016run/x016run_v3p50_s2_r0.npz +0 -0
  306. diffneusim/data/reference/x016run/x016run_v3p50_s2_r1.npz +0 -0
  307. diffneusim/data/reference/x016run/x016run_v3p50_s2_r2.npz +0 -0
  308. diffneusim/data/reference/x016run/x016run_v3p50_s2_r3.npz +0 -0
  309. diffneusim/data/reference/x016run/x016run_v3p50_s3_l0.npz +0 -0
  310. diffneusim/data/reference/x016run/x016run_v3p50_s3_l1.npz +0 -0
  311. diffneusim/data/reference/x016run/x016run_v3p50_s3_l2.npz +0 -0
  312. diffneusim/data/reference/x016run/x016run_v3p50_s3_l3.npz +0 -0
  313. diffneusim/data/reference/x016run/x016run_v3p50_s3_r0.npz +0 -0
  314. diffneusim/data/reference/x016run/x016run_v3p50_s3_r1.npz +0 -0
  315. diffneusim/data/reference/x016run/x016run_v3p50_s3_r2.npz +0 -0
  316. diffneusim/data/reference/x016run/x016run_v3p50_s3_r3.npz +0 -0
  317. diffneusim/data/reference/x016run/x016run_v3p50_s5_l0.npz +0 -0
  318. diffneusim/data/reference/x016run/x016run_v3p50_s5_l1.npz +0 -0
  319. diffneusim/data/reference/x016run/x016run_v3p50_s5_l2.npz +0 -0
  320. diffneusim/data/reference/x016run/x016run_v3p50_s5_l3.npz +0 -0
  321. diffneusim/data/reference/x016run/x016run_v3p50_s5_r0.npz +0 -0
  322. diffneusim/data/reference/x016run/x016run_v3p50_s5_r1.npz +0 -0
  323. diffneusim/data/reference/x016run/x016run_v3p50_s5_r2.npz +0 -0
  324. diffneusim/data/reference/x016run/x016run_v3p50_s5_r3.npz +0 -0
  325. diffneusim/data/reference/x016run/x016run_v3p50_s6_l0.npz +0 -0
  326. diffneusim/data/reference/x016run/x016run_v3p50_s6_l1.npz +0 -0
  327. diffneusim/data/reference/x016run/x016run_v3p50_s6_l2.npz +0 -0
  328. diffneusim/data/reference/x016run/x016run_v3p50_s6_l3.npz +0 -0
  329. diffneusim/data/reference/x016run/x016run_v3p50_s6_r0.npz +0 -0
  330. diffneusim/data/reference/x016run/x016run_v3p50_s6_r1.npz +0 -0
  331. diffneusim/data/reference/x016run/x016run_v3p50_s6_r2.npz +0 -0
  332. diffneusim/data/reference/x016run/x016run_v3p50_s6_r3.npz +0 -0
  333. diffneusim/data/reference/x016run/x016run_v3p50_s7_l0.npz +0 -0
  334. diffneusim/data/reference/x016run/x016run_v3p50_s7_l1.npz +0 -0
  335. diffneusim/data/reference/x016run/x016run_v3p50_s7_l2.npz +0 -0
  336. diffneusim/data/reference/x016run/x016run_v3p50_s7_l3.npz +0 -0
  337. diffneusim/data/reference/x016run/x016run_v3p50_s7_r0.npz +0 -0
  338. diffneusim/data/reference/x016run/x016run_v3p50_s7_r1.npz +0 -0
  339. diffneusim/data/reference/x016run/x016run_v3p50_s7_r2.npz +0 -0
  340. diffneusim/data/reference/x016run/x016run_v3p50_s7_r3.npz +0 -0
  341. diffneusim/data/reference/x016run/x016run_v3p75_s0_l0.npz +0 -0
  342. diffneusim/data/reference/x016run/x016run_v3p75_s0_l1.npz +0 -0
  343. diffneusim/data/reference/x016run/x016run_v3p75_s0_l2.npz +0 -0
  344. diffneusim/data/reference/x016run/x016run_v3p75_s0_l3.npz +0 -0
  345. diffneusim/data/reference/x016run/x016run_v3p75_s0_r0.npz +0 -0
  346. diffneusim/data/reference/x016run/x016run_v3p75_s0_r1.npz +0 -0
  347. diffneusim/data/reference/x016run/x016run_v3p75_s0_r2.npz +0 -0
  348. diffneusim/data/reference/x016run/x016run_v3p75_s0_r3.npz +0 -0
  349. diffneusim/data/reference/x016run/x016run_v3p75_s1_l0.npz +0 -0
  350. diffneusim/data/reference/x016run/x016run_v3p75_s1_l1.npz +0 -0
  351. diffneusim/data/reference/x016run/x016run_v3p75_s1_l2.npz +0 -0
  352. diffneusim/data/reference/x016run/x016run_v3p75_s1_l3.npz +0 -0
  353. diffneusim/data/reference/x016run/x016run_v3p75_s1_r0.npz +0 -0
  354. diffneusim/data/reference/x016run/x016run_v3p75_s1_r1.npz +0 -0
  355. diffneusim/data/reference/x016run/x016run_v3p75_s1_r2.npz +0 -0
  356. diffneusim/data/reference/x016run/x016run_v3p75_s1_r3.npz +0 -0
  357. diffneusim/data/reference/x016run/x016run_v3p75_s2_l0.npz +0 -0
  358. diffneusim/data/reference/x016run/x016run_v3p75_s2_l1.npz +0 -0
  359. diffneusim/data/reference/x016run/x016run_v3p75_s2_l2.npz +0 -0
  360. diffneusim/data/reference/x016run/x016run_v3p75_s2_l3.npz +0 -0
  361. diffneusim/data/reference/x016run/x016run_v3p75_s2_r0.npz +0 -0
  362. diffneusim/data/reference/x016run/x016run_v3p75_s2_r1.npz +0 -0
  363. diffneusim/data/reference/x016run/x016run_v3p75_s2_r2.npz +0 -0
  364. diffneusim/data/reference/x016run/x016run_v3p75_s2_r3.npz +0 -0
  365. diffneusim/data/reference/x016run/x016run_v3p75_s3_l0.npz +0 -0
  366. diffneusim/data/reference/x016run/x016run_v3p75_s3_l1.npz +0 -0
  367. diffneusim/data/reference/x016run/x016run_v3p75_s3_l2.npz +0 -0
  368. diffneusim/data/reference/x016run/x016run_v3p75_s3_l3.npz +0 -0
  369. diffneusim/data/reference/x016run/x016run_v3p75_s3_r0.npz +0 -0
  370. diffneusim/data/reference/x016run/x016run_v3p75_s3_r1.npz +0 -0
  371. diffneusim/data/reference/x016run/x016run_v3p75_s3_r2.npz +0 -0
  372. diffneusim/data/reference/x016run/x016run_v3p75_s3_r3.npz +0 -0
  373. diffneusim/data/reference/x016run/x016run_v3p75_s5_l0.npz +0 -0
  374. diffneusim/data/reference/x016run/x016run_v3p75_s5_l1.npz +0 -0
  375. diffneusim/data/reference/x016run/x016run_v3p75_s5_l2.npz +0 -0
  376. diffneusim/data/reference/x016run/x016run_v3p75_s5_l3.npz +0 -0
  377. diffneusim/data/reference/x016run/x016run_v3p75_s5_r0.npz +0 -0
  378. diffneusim/data/reference/x016run/x016run_v3p75_s5_r1.npz +0 -0
  379. diffneusim/data/reference/x016run/x016run_v3p75_s5_r2.npz +0 -0
  380. diffneusim/data/reference/x016run/x016run_v3p75_s5_r3.npz +0 -0
  381. diffneusim/data/reference/x016run/x016run_v3p75_s6_l0.npz +0 -0
  382. diffneusim/data/reference/x016run/x016run_v3p75_s6_l1.npz +0 -0
  383. diffneusim/data/reference/x016run/x016run_v3p75_s6_l2.npz +0 -0
  384. diffneusim/data/reference/x016run/x016run_v3p75_s6_l3.npz +0 -0
  385. diffneusim/data/reference/x016run/x016run_v3p75_s6_r0.npz +0 -0
  386. diffneusim/data/reference/x016run/x016run_v3p75_s6_r1.npz +0 -0
  387. diffneusim/data/reference/x016run/x016run_v3p75_s6_r2.npz +0 -0
  388. diffneusim/data/reference/x016run/x016run_v3p75_s6_r3.npz +0 -0
  389. diffneusim/data/reference/x016run/x016run_v3p75_s7_l0.npz +0 -0
  390. diffneusim/data/reference/x016run/x016run_v3p75_s7_l1.npz +0 -0
  391. diffneusim/data/reference/x016run/x016run_v3p75_s7_l2.npz +0 -0
  392. diffneusim/data/reference/x016run/x016run_v3p75_s7_l3.npz +0 -0
  393. diffneusim/data/reference/x016run/x016run_v3p75_s7_r0.npz +0 -0
  394. diffneusim/data/reference/x016run/x016run_v3p75_s7_r1.npz +0 -0
  395. diffneusim/data/reference/x016run/x016run_v3p75_s7_r2.npz +0 -0
  396. diffneusim/data/reference/x016run/x016run_v3p75_s7_r3.npz +0 -0
  397. diffneusim/data/state_prior/lumbar_poly_fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
  398. diffneusim/engine/__init__.py +0 -0
  399. diffneusim/engine/build_tag.py +52 -0
  400. diffneusim/engine/case_tables.py +46 -0
  401. diffneusim/engine/d16_body.py +80 -0
  402. diffneusim/engine/engine14.py +367 -0
  403. diffneusim/engine/gen_split.py +159 -0
  404. diffneusim/engine/hand_format.py +69 -0
  405. diffneusim/engine/live14.py +149 -0
  406. diffneusim/engine/phase_b_tree.py +137 -0
  407. diffneusim/engine/soft14.py +130 -0
  408. diffneusim/engine/soft_capi.py +373 -0
  409. diffneusim/engine/soft_engine.py +165 -0
  410. diffneusim/engine/step14.py +132 -0
  411. diffneusim/engine/tape_format.py +89 -0
  412. diffneusim/engine/x14cpu.py +163 -0
  413. diffneusim/env/__init__.py +0 -0
  414. diffneusim/env/absent.py +20 -0
  415. diffneusim/env/cpu14.py +105 -0
  416. diffneusim/env/e0loop14.py +224 -0
  417. diffneusim/env/env14.py +568 -0
  418. diffneusim/env/kin_contact14.py +193 -0
  419. diffneusim/env/mimic_sites_x14.json +366 -0
  420. diffneusim/env/old_count.py +78 -0
  421. diffneusim/env/rew14.py +114 -0
  422. diffneusim/env/rew14_hook.py +105 -0
  423. diffneusim/g1/__init__.py +1 -0
  424. diffneusim/g1/arm_a2.py +165 -0
  425. diffneusim/g1/arm_a3.py +576 -0
  426. diffneusim/g1/read_a3.py +79 -0
  427. diffneusim/g1/rg1_read.py +89 -0
  428. diffneusim/model/__init__.py +66 -0
  429. diffneusim/model/case.py +17 -0
  430. diffneusim/model/dnmodel.py +79 -0
  431. diffneusim/model/fuse_fixed.py +281 -0
  432. diffneusim/model/monitor.py +834 -0
  433. diffneusim/models/BODIES.toml +48 -0
  434. diffneusim/models/MANIFEST.toml +979 -0
  435. diffneusim/models/cases/G290/case.bin +0 -0
  436. diffneusim/models/cases/G290/case.json +1 -0
  437. diffneusim/models/cases/G356-SRC/case.bin +0 -0
  438. diffneusim/models/cases/G356-SRC/case.json +1 -0
  439. diffneusim/models/cases/G416/case.bin +0 -0
  440. diffneusim/models/cases/G416/case.json +1 -0
  441. diffneusim/models/cases/M290C-SRC/case.bin +0 -0
  442. diffneusim/models/cases/M290C-SRC/case.json +1 -0
  443. diffneusim/models/cases/M290R-SRC/case.bin +0 -0
  444. diffneusim/models/cases/M290R-SRC/case.json +1 -0
  445. diffneusim/models/cases/M356C-SRC/case.bin +0 -0
  446. diffneusim/models/cases/M356C-SRC/case.json +1 -0
  447. diffneusim/models/cases/M356R-SRC/case.bin +0 -0
  448. diffneusim/models/cases/M356R-SRC/case.json +1 -0
  449. diffneusim/models/cases/M416C-SRC/case.bin +0 -0
  450. diffneusim/models/cases/M416C-SRC/case.json +1 -0
  451. diffneusim/models/derived/d16_expanded_62f77a4bb16b1e67_mmfloor.xml +673 -0
  452. diffneusim/models/derived/d16_expanded_a1e8b196b2cd7b3c_mmfloor.xml +673 -0
  453. diffneusim/models/derived/d16_soft_law_019e20820f8633b9_mmfloor.json +7844 -0
  454. diffneusim/models/derived/d16_soft_law_62f77a4bb16b1e67_mmfloor.json +16855 -0
  455. diffneusim/models/derived/d16_soft_law_77dbb7213f26e821_mmfloor_rampsb3l_n6t12.json +7883 -0
  456. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rampsb3l_n6t12.json +7883 -0
  457. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsd05_n6t12.json +7868 -0
  458. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsdef_n6t12.json +7868 -0
  459. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsmjd_n6t12.json +7868 -0
  460. diffneusim/models/derived/d16_soft_law_a1e8b196b2cd7b3c_mmfloor_rampsb3l_n6t12.json +16894 -0
  461. diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor.json +12655 -0
  462. diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor_rampsb3l_n6t12.json +12700 -0
  463. diffneusim/models/derived/unitree_g1_soft_law.json +15580 -0
  464. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +28913 -0
  465. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
  466. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +29202 -0
  467. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
  468. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.dnmodel +1 -0
  469. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
  470. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
  471. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +46970 -0
  472. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
  473. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
  474. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
  475. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +38570 -0
  476. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
  477. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +38923 -0
  478. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
  479. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
  480. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
  481. diffneusim/models/fullbody_meshes/1mc.stl +0 -0
  482. diffneusim/models/fullbody_meshes/2distph.stl +0 -0
  483. diffneusim/models/fullbody_meshes/2mc.stl +0 -0
  484. diffneusim/models/fullbody_meshes/2midph.stl +0 -0
  485. diffneusim/models/fullbody_meshes/2proxph.stl +0 -0
  486. diffneusim/models/fullbody_meshes/3distph.stl +0 -0
  487. diffneusim/models/fullbody_meshes/3mc.stl +0 -0
  488. diffneusim/models/fullbody_meshes/3midph.stl +0 -0
  489. diffneusim/models/fullbody_meshes/3proxph.stl +0 -0
  490. diffneusim/models/fullbody_meshes/4distph.stl +0 -0
  491. diffneusim/models/fullbody_meshes/4mc.stl +0 -0
  492. diffneusim/models/fullbody_meshes/4midph.stl +0 -0
  493. diffneusim/models/fullbody_meshes/4proxph.stl +0 -0
  494. diffneusim/models/fullbody_meshes/5distph.stl +0 -0
  495. diffneusim/models/fullbody_meshes/5mc.stl +0 -0
  496. diffneusim/models/fullbody_meshes/5midph.stl +0 -0
  497. diffneusim/models/fullbody_meshes/5proxph.stl +0 -0
  498. diffneusim/models/fullbody_meshes/NOTICE +2 -0
  499. diffneusim/models/fullbody_meshes/capitate.stl +0 -0
  500. diffneusim/models/fullbody_meshes/clavicle.stl +0 -0
  501. diffneusim/models/fullbody_meshes/hamate.stl +0 -0
  502. diffneusim/models/fullbody_meshes/hat_cervical.stl +0 -0
  503. diffneusim/models/fullbody_meshes/hat_jaw.stl +0 -0
  504. diffneusim/models/fullbody_meshes/hat_skull.stl +0 -0
  505. diffneusim/models/fullbody_meshes/humerus.stl +0 -0
  506. diffneusim/models/fullbody_meshes/l_bofoot.stl +0 -0
  507. diffneusim/models/fullbody_meshes/l_femur.stl +0 -0
  508. diffneusim/models/fullbody_meshes/l_fibula.stl +0 -0
  509. diffneusim/models/fullbody_meshes/l_foot.stl +0 -0
  510. diffneusim/models/fullbody_meshes/l_patella.stl +0 -0
  511. diffneusim/models/fullbody_meshes/l_pelvis.stl +0 -0
  512. diffneusim/models/fullbody_meshes/l_talus.stl +0 -0
  513. diffneusim/models/fullbody_meshes/l_tibia.stl +0 -0
  514. diffneusim/models/fullbody_meshes/lumbar1.stl +0 -0
  515. diffneusim/models/fullbody_meshes/lumbar2.stl +0 -0
  516. diffneusim/models/fullbody_meshes/lumbar3.stl +0 -0
  517. diffneusim/models/fullbody_meshes/lumbar4.stl +0 -0
  518. diffneusim/models/fullbody_meshes/lumbar5.stl +0 -0
  519. diffneusim/models/fullbody_meshes/lunate.stl +0 -0
  520. diffneusim/models/fullbody_meshes/pisiform.stl +0 -0
  521. diffneusim/models/fullbody_meshes/r_bofoot.stl +0 -0
  522. diffneusim/models/fullbody_meshes/r_femur.stl +0 -0
  523. diffneusim/models/fullbody_meshes/r_fibula.stl +0 -0
  524. diffneusim/models/fullbody_meshes/r_foot.stl +0 -0
  525. diffneusim/models/fullbody_meshes/r_patella.stl +0 -0
  526. diffneusim/models/fullbody_meshes/r_pelvis.stl +0 -0
  527. diffneusim/models/fullbody_meshes/r_talus.stl +0 -0
  528. diffneusim/models/fullbody_meshes/r_tibia.stl +0 -0
  529. diffneusim/models/fullbody_meshes/radius.stl +0 -0
  530. diffneusim/models/fullbody_meshes/sacrum.stl +0 -0
  531. diffneusim/models/fullbody_meshes/scaphoid.stl +0 -0
  532. diffneusim/models/fullbody_meshes/scapula.stl +0 -0
  533. diffneusim/models/fullbody_meshes/thoracic10_s.stl +0 -0
  534. diffneusim/models/fullbody_meshes/thoracic11_s.stl +0 -0
  535. diffneusim/models/fullbody_meshes/thoracic12_s.stl +0 -0
  536. diffneusim/models/fullbody_meshes/thoracic1_s.stl +0 -0
  537. diffneusim/models/fullbody_meshes/thoracic2_s.stl +0 -0
  538. diffneusim/models/fullbody_meshes/thoracic3_s.stl +0 -0
  539. diffneusim/models/fullbody_meshes/thoracic4_s.stl +0 -0
  540. diffneusim/models/fullbody_meshes/thoracic5_s.stl +0 -0
  541. diffneusim/models/fullbody_meshes/thoracic6_s.stl +0 -0
  542. diffneusim/models/fullbody_meshes/thoracic7_s.stl +0 -0
  543. diffneusim/models/fullbody_meshes/thoracic8_s.stl +0 -0
  544. diffneusim/models/fullbody_meshes/thoracic9_s.stl +0 -0
  545. diffneusim/models/fullbody_meshes/thorax.stl +0 -0
  546. diffneusim/models/fullbody_meshes/thumbdist.stl +0 -0
  547. diffneusim/models/fullbody_meshes/thumbprox.stl +0 -0
  548. diffneusim/models/fullbody_meshes/trapezium.stl +0 -0
  549. diffneusim/models/fullbody_meshes/trapezoid.stl +0 -0
  550. diffneusim/models/fullbody_meshes/triquetrum.stl +0 -0
  551. diffneusim/models/fullbody_meshes/ulna.stl +0 -0
  552. diffneusim/models/source/myo_fullbody/UPSTREAM.md +91 -0
  553. diffneusim/models/source/myoleg/UPSTREAM.md +52 -0
  554. diffneusim/models/source/unitree_g1/LICENSE.mjlab +202 -0
  555. diffneusim/models/source/unitree_g1/UPSTREAM.md +38 -0
  556. diffneusim/models/source/unitree_g1/assets/head_link.STL +0 -0
  557. diffneusim/models/source/unitree_g1/assets/left_ankle_pitch_link.STL +0 -0
  558. diffneusim/models/source/unitree_g1/assets/left_ankle_roll_link.STL +0 -0
  559. diffneusim/models/source/unitree_g1/assets/left_elbow_link.STL +0 -0
  560. diffneusim/models/source/unitree_g1/assets/left_hip_pitch_link.STL +0 -0
  561. diffneusim/models/source/unitree_g1/assets/left_hip_roll_link.STL +0 -0
  562. diffneusim/models/source/unitree_g1/assets/left_hip_yaw_link.STL +0 -0
  563. diffneusim/models/source/unitree_g1/assets/left_knee_link.STL +0 -0
  564. diffneusim/models/source/unitree_g1/assets/left_rubber_hand.STL +0 -0
  565. diffneusim/models/source/unitree_g1/assets/left_shoulder_pitch_link.STL +0 -0
  566. diffneusim/models/source/unitree_g1/assets/left_shoulder_roll_link.STL +0 -0
  567. diffneusim/models/source/unitree_g1/assets/left_shoulder_yaw_link.STL +0 -0
  568. diffneusim/models/source/unitree_g1/assets/left_wrist_pitch_link.STL +0 -0
  569. diffneusim/models/source/unitree_g1/assets/left_wrist_roll_link.STL +0 -0
  570. diffneusim/models/source/unitree_g1/assets/left_wrist_yaw_link.STL +0 -0
  571. diffneusim/models/source/unitree_g1/assets/logo_link.STL +0 -0
  572. diffneusim/models/source/unitree_g1/assets/pelvis.STL +0 -0
  573. diffneusim/models/source/unitree_g1/assets/pelvis_contour_link.STL +0 -0
  574. diffneusim/models/source/unitree_g1/assets/right_ankle_pitch_link.STL +0 -0
  575. diffneusim/models/source/unitree_g1/assets/right_ankle_roll_link.STL +0 -0
  576. diffneusim/models/source/unitree_g1/assets/right_elbow_link.STL +0 -0
  577. diffneusim/models/source/unitree_g1/assets/right_hip_pitch_link.STL +0 -0
  578. diffneusim/models/source/unitree_g1/assets/right_hip_roll_link.STL +0 -0
  579. diffneusim/models/source/unitree_g1/assets/right_hip_yaw_link.STL +0 -0
  580. diffneusim/models/source/unitree_g1/assets/right_knee_link.STL +0 -0
  581. diffneusim/models/source/unitree_g1/assets/right_rubber_hand.STL +0 -0
  582. diffneusim/models/source/unitree_g1/assets/right_shoulder_pitch_link.STL +0 -0
  583. diffneusim/models/source/unitree_g1/assets/right_shoulder_roll_link.STL +0 -0
  584. diffneusim/models/source/unitree_g1/assets/right_shoulder_yaw_link.STL +0 -0
  585. diffneusim/models/source/unitree_g1/assets/right_wrist_pitch_link.STL +0 -0
  586. diffneusim/models/source/unitree_g1/assets/right_wrist_roll_link.STL +0 -0
  587. diffneusim/models/source/unitree_g1/assets/right_wrist_yaw_link.STL +0 -0
  588. diffneusim/models/source/unitree_g1/assets/torso_link_rev_1_0.STL +0 -0
  589. diffneusim/models/source/unitree_g1/assets/waist_roll_link_rev_1_0.STL +0 -0
  590. diffneusim/models/source/unitree_g1/assets/waist_yaw_link_rev_1_0.STL +0 -0
  591. diffneusim/models/source/unitree_g1/dump_mjlab_reference.py +30 -0
  592. diffneusim/models/source/unitree_g1/g1.xml +308 -0
  593. diffneusim/models/source/unitree_g1/g1_constants.py +298 -0
  594. diffneusim/models/source/unitree_g1/mjlab_compiled_reference.json +857 -0
  595. diffneusim/models/unitree_g1.dnmodel +4393 -0
  596. diffneusim/models/unitree_g1_selfcol.dnmodel +20824 -0
  597. diffneusim/rl/__init__.py +2 -0
  598. diffneusim/rl/dynsyn_layer.py +146 -0
  599. diffneusim/rl/footstep_plan.py +337 -0
  600. diffneusim/rl/g1_bm_env.py +572 -0
  601. diffneusim/rl/g1_bm_eval.py +168 -0
  602. diffneusim/rl/g1_bm_fused.py +275 -0
  603. diffneusim/rl/g1_bm_ppo.py +622 -0
  604. diffneusim/rl/g1_bm_sapo.py +551 -0
  605. diffneusim/rl/g1_ppo.py +395 -0
  606. diffneusim/rl/g1_sapo_soft.py +240 -0
  607. diffneusim/rl/g1_soft_env.py +452 -0
  608. diffneusim/rl/g1_soft_grad.py +145 -0
  609. diffneusim/rl/geyer_curves_torch.py +108 -0
  610. diffneusim/rl/gpu_fullbody_vec_env.py +1241 -0
  611. diffneusim/rl/imitation.py +2027 -0
  612. diffneusim/rl/imitation_reward_v2.py +248 -0
  613. diffneusim/rl/imitation_reward_v3.py +349 -0
  614. diffneusim/rl/latent_task.py +175 -0
  615. diffneusim/rl/llc_reward.py +316 -0
  616. diffneusim/rl/millard_curves_torch.py +154 -0
  617. diffneusim/rl/mirror_symmetry.py +212 -0
  618. diffneusim/rl/model_path.py +35 -0
  619. diffneusim/rl/mvae_recon.py +123 -0
  620. diffneusim/rl/nets_shac.py +599 -0
  621. diffneusim/rl/reset_pool.py +154 -0
  622. diffneusim/rl/sapo_capture.py +873 -0
  623. diffneusim/rl/sapo_vec.py +1051 -0
  624. diffneusim/rl/shac_vec.py +346 -0
  625. diffneusim/rl/state_prior.py +151 -0
  626. diffneusim/rl/step_library.py +105 -0
  627. diffneusim/rl/task_walk_env.py +1793 -0
  628. diffneusim/rl/task_walk_reward.py +3300 -0
  629. diffneusim/run.py +23 -0
  630. diffneusim/run_env.py +46 -0
  631. diffneusim/tasks/__init__.py +147 -0
  632. diffneusim/tasks/legacy_names.py +63 -0
  633. diffneusim/tasks/paths.py +79 -0
  634. diffneusim/tasks/settings.py +202 -0
  635. diffneusim/third_party/instantmimic_947430ee/LICENSE +202 -0
  636. diffneusim/third_party/instantmimic_947430ee/NOTICE +19 -0
  637. diffneusim/third_party/instantmimic_947430ee/README.md +31 -0
  638. diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/benchmark_protocol.py +106 -0
  639. diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/metrics.py +214 -0
  640. diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/reference.py +513 -0
  641. diffneusim/third_party/instantmimic_947430ee/instantmimic/motion/quaternion.py +193 -0
  642. diffneusim/train/__init__.py +0 -0
  643. diffneusim/train/eval_ckpt.py +239 -0
  644. diffneusim/train/eval_mimic.py +133 -0
  645. diffneusim/train/gait_report.py +203 -0
  646. diffneusim/train/gcot_chain.py +51 -0
  647. diffneusim/train/levers.py +135 -0
  648. diffneusim/train/masked_reset.py +314 -0
  649. diffneusim/train/rl_algorithm_suite.py +917 -0
  650. diffneusim/train/train14.py +240 -0
  651. diffneusim/train/train_tw14.py +674 -0
  652. diffneusim/viz/__init__.py +5 -0
  653. diffneusim/viz/__main__.py +41 -0
  654. diffneusim/viz/camera.py +115 -0
  655. diffneusim/viz/dnrec.py +118 -0
  656. diffneusim/viz/dnrec_io.py +686 -0
  657. diffneusim/viz/hud.py +565 -0
  658. diffneusim/viz/meshes.py +458 -0
  659. diffneusim/viz/play.py +237 -0
  660. diffneusim/viz/record.py +74 -0
  661. diffneusim/viz/render.py +1402 -0
  662. diffneusim/viz/renderer.py +268 -0
  663. diffneusim/viz/rl_env_render.py +635 -0
  664. diffneusim/viz/snapshot.py +54 -0
  665. diffneusim/viz/strobe.py +124 -0
  666. diffneusim/viz/to_mp4.py +58 -0
  667. diffneusim/viz/ui.py +481 -0
  668. diffneusim/viz/viewer.py +2086 -0
  669. diffneusim-1.0.0.dist-info/METADATA +226 -0
  670. diffneusim-1.0.0.dist-info/RECORD +682 -0
  671. diffneusim-1.0.0.dist-info/WHEEL +5 -0
  672. diffneusim-1.0.0.dist-info/licenses/LICENSE +201 -0
  673. diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-ARMS-hand-wrist-4.3.txt +20 -0
  674. diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-MoBL-ARMS.txt +25 -0
  675. diffneusim-1.0.0.dist-info/licenses/LICENSES/CC-BY-3.0-OpenSim-geometry.txt +25 -0
  676. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Christophy2012-lumbarspine.txt +10 -0
  677. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lai2017-model-high-flex.txt +10 -0
  678. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lee2015-hand_muscle.txt +11 -0
  679. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Rajagopal2016-full_body.txt +11 -0
  680. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Uhlrich2022-fbmodpassivecal.txt +10 -0
  681. diffneusim-1.0.0.dist-info/licenses/NOTICE +274 -0
  682. diffneusim-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,79 @@
1
+ """A3's reader (PREREG_A3.md, Amendment 1, the review's decision for A0 / A2 / A3): the three crossing rules from a run's eval.jsonl, per
2
+ actor (ema = the primary actor, raw beside), plus the gradient health over the updates before each crossing from train.jsonl.
3
+ primary InstantMimic's frozen convergence_iteration: the earliest checkpoint meeting benchmark_protocol.meets_quality_threshold
4
+ (vendored 947430ee: success_rate >= 0.96, mpkpe <= 0.120, r_mpkpe <= 0.033, ee_pos_error <= 0.052, ee_ori_error <= 0.180)
5
+ secondary the first checkpoint with mpkpe <= 0.107 AND success_rate >= 0.96
6
+ third their docs' figure rule, only beside their 7 min 48 s: the first checkpoint with mpkpe <= 0.107, its time interpolated
7
+ linearly from the previous checkpoint's, FLAGGED when success_rate < 0.96 at that checkpoint
8
+ Never MPKPE alone: every row carries the checkpoint's success_rate.
9
+ usage: python tools/g1_seconds/read_a3.py RUN_DIR [RUN_DIR ...] -> one JSON line per run and actor; writes RUN_DIR/read_a3.json"""
10
+ import json
11
+ import pathlib
12
+ import sys
13
+
14
+ # (3a) was: sys.path.insert(0, str(ROOT / "python"))
15
+ from diffneusim.rl import g1_bm_eval as E # noqa: E402
16
+
17
+ MPKPE_FIG = 0.107
18
+ SUCCESS_MIN = E._P.QUALITY_THRESHOLDS["success_rate"]
19
+
20
+
21
+ def health(train, it_lo, it_hi):
22
+ """The per-update gradient-health sums over updates it_lo < it <= it_hi (the review's prereg addition)."""
23
+ rows = [r for r in train if it_lo < r["it"] <= it_hi]
24
+ if not rows:
25
+ return None
26
+ s = lambda k: sum(r[k] for r in rows) # noqa: E731
27
+ return dict(updates=len(rows), windows=s("windows"), grad_rows=s("grad_rows"), grad_clipped=s("grad_clipped"),
28
+ grad_nonfinite=s("grad_nonfinite"), clipped_frac=s("grad_clipped") / s("grad_rows"))
29
+
30
+
31
+ def read(run):
32
+ run = pathlib.Path(run)
33
+ ev = [json.loads(x) for x in (run / "eval.jsonl").read_text().splitlines() if x.strip()]
34
+ tt = (run / "train.jsonl").read_text()
35
+ lines = [x for x in tt.splitlines() if x.strip()]
36
+ if tt and not tt.endswith("\n"): # a run killed mid-write (its chain's cap): only the LAST line can be cut, and is dropped
37
+ print(f"[read_a3] {run}: train.jsonl's last line is incomplete (killed mid-write); dropped: {lines[-1][:80]}")
38
+ lines = lines[:-1]
39
+ train = [json.loads(x) for x in lines]
40
+ out = {}
41
+ for w in sorted({r.get("which", "ema") for r in ev}):
42
+ rows = sorted((r for r in ev if r.get("which", "ema") == w), key=lambda r: r["iteration"])
43
+ assert len({r["iteration"] for r in rows}) == len(rows), f"{run}: duplicate checkpoints for {w}"
44
+ res = dict(which=w, checkpoints=len(rows), last=dict(iteration=rows[-1]["iteration"], active_s=rows[-1]["active_s"],
45
+ success_rate=rows[-1]["success_rate"], mpkpe=rows[-1]["mpkpe"]))
46
+ prev_it = 0
47
+ hit = {}
48
+ for k, r in enumerate(rows):
49
+ m = {n: float(r[n]) for n in E._P.QUALITY_THRESHOLDS}
50
+ if "primary" not in hit and E._P.meets_quality_threshold(m):
51
+ hit["primary"] = (k, r)
52
+ if "secondary" not in hit and m["mpkpe"] <= MPKPE_FIG and m["success_rate"] >= SUCCESS_MIN:
53
+ hit["secondary"] = (k, r)
54
+ if "third" not in hit and m["mpkpe"] <= MPKPE_FIG:
55
+ hit["third"] = (k, r)
56
+ for rule in ("primary", "secondary", "third"):
57
+ if rule not in hit:
58
+ res[rule] = dict(reached=False, censored_at_iteration=rows[-1]["iteration"])
59
+ continue
60
+ k, r = hit[rule]
61
+ prev = rows[k - 1] if k > 0 else None
62
+ d = dict(reached=True, iteration=r["iteration"], active_s=r["active_s"], success_rate=r["success_rate"], mpkpe=r["mpkpe"],
63
+ r_mpkpe=r["r_mpkpe"], ee_pos_error=r["ee_pos_error"], ee_ori_error=r["ee_ori_error"],
64
+ health=health(train, prev["iteration"] if prev else 0, r["iteration"]))
65
+ if rule == "third":
66
+ if prev is not None and prev["mpkpe"] > MPKPE_FIG: # their figure's linear interpolation between the bracket
67
+ f = (prev["mpkpe"] - MPKPE_FIG) / (prev["mpkpe"] - r["mpkpe"])
68
+ d["active_s_interp"] = prev["active_s"] + f * (r["active_s"] - prev["active_s"])
69
+ d["flag_success_below_gate"] = bool(r["success_rate"] < SUCCESS_MIN)
70
+ res[rule] = d
71
+ out[w] = res
72
+ (run / "read_a3.json").write_text(json.dumps(out, indent=1))
73
+ return out
74
+
75
+
76
+ if __name__ == "__main__":
77
+ for rd in sys.argv[1:]:
78
+ for w, res in read(rd).items():
79
+ print(json.dumps(dict(run=rd, **res)))
@@ -0,0 +1,89 @@
1
+ """PREREG_RG1's reader (the reading rule, Amendments 1-2), on the pulled results (rg1_job.sh's tarballs, unpacked) and, if given, the
2
+ sim2sim JSON lines (rg1_sim2sim.py). Per run (learner, seed) and actor:
3
+ primary the first benchmark row with >= 29 / 32 complete AND MPKPE <= 80.5 mm (passed): update / iteration, active s, samples
4
+ (n x steps per update x the updates), n_success, MPKPE, r-MPKPE, ee errors
5
+ rate alone the first row with >= 29 / 32 complete regardless of MPKPE (what binds: the rate or the bar)
6
+ secondary the first row with each secondary flag (mpkpe_107, primary_thresholds); past the primary pass these rows are every 50
7
+ per step s per update; the GPU's busy SM clock, power and peak memory from smi.csv; the training-path probe
8
+ Then the medians per learner, the zero control, and sim2sim per policy and backend. One JSON line per run, then "RG1 READ".
9
+ python tools/g1_seconds/rg1_read.py RESULTS_DIR [--sim2sim s2s.jsonl]"""
10
+ import argparse
11
+ import csv
12
+ import json
13
+ import pathlib
14
+ import statistics
15
+
16
+
17
+ def first(rows, pred):
18
+ return next((r for r in rows if pred(r)), None)
19
+
20
+
21
+ def brief(r, spu):
22
+ if r is None:
23
+ return None
24
+ return dict(it=r["it"], active_s=round(r["active_s"], 2), samples=r["it"] * spu, n_success=r["n_success"],
25
+ mpkpe_mm=round(1e3 * r["mpkpe"], 1), r_mpkpe_mm=round(1e3 * r["r_mpkpe"], 1), ee_pos_mm=round(1e3 * r["ee_pos_error"], 1),
26
+ ee_ori_rad=round(r["ee_ori_error"], 3))
27
+
28
+
29
+ def smi(p):
30
+ rows = [r for r in csv.reader(open(p)) if len(r) >= 5 and r[2].strip().isdigit()]
31
+ busy = [r for r in rows if int(r[2]) >= 50]
32
+ if not busy:
33
+ return None
34
+ return dict(busy_samples=len(busy), sm_mhz=statistics.median(float(r[1]) for r in busy),
35
+ power_w=statistics.median(float(r[3]) for r in busy), peak_mem_mib=max(float(r[4]) for r in rows))
36
+
37
+
38
+ def main():
39
+ ap = argparse.ArgumentParser()
40
+ ap.add_argument("results")
41
+ ap.add_argument("--sim2sim", default=None)
42
+ a = ap.parse_args()
43
+ R = pathlib.Path(a.results)
44
+ out = {}
45
+ for d in sorted(p for p in R.iterdir() if p.is_dir() and (p / "meta.json").exists()):
46
+ meta = json.loads((d / "meta.json").read_text())
47
+ tr = [json.loads(x) for x in (d / "train.jsonl").read_text().splitlines() if x.strip()]
48
+ ez = [json.loads(x) for x in (d / "easy.jsonl").read_text().splitlines() if x.strip()]
49
+ learner = "sapo" if "H" in meta else "ppo"
50
+ spu = meta["n"] * (meta["H"] if learner == "sapo" else meta["cfg"]["rollouts"])
51
+ last = tr[-1]
52
+ row = dict(run=d.name, learner=learner, seed=meta["seed"], residual=meta.get("residual"), ship=meta["ship"],
53
+ s_per_update=last["active_s"] / last["it"], updates=last["it"], samples_per_update=spu,
54
+ probe=[json.loads(p.read_text()) for p in sorted(d.glob("probe_it*.json"))],
55
+ gpu=smi(d / "smi.csv") if (d / "smi.csv").exists() else None, actors={})
56
+ for w in sorted({r["which"] for r in ez}):
57
+ rw = [r for r in ez if r["which"] == w]
58
+ row["actors"][w] = dict(
59
+ primary=brief(first(rw, lambda r: r["passed"]), spu),
60
+ rate_alone=brief(first(rw, lambda r: r["n_success"] >= 29), spu),
61
+ # the bar alone (MPKPE <= 80.5 mm regardless of the rate): note a failing policy's MPKPE covers only its steps alive, so the
62
+ # bar alone is met trivially early (the zero control: 49.5 mm at 0 / 32)
63
+ bar_alone=brief(first(rw, lambda r: r["mpkpe"] <= 0.0805), spu),
64
+ binding=None,
65
+ secondary={k: brief(first(rw, lambda r, _k=k: r.get("secondary", {}).get(_k)), spu) for k in ("mpkpe_107", "primary_thresholds")},
66
+ benchmarks=len(rw))
67
+ for w, v in row["actors"].items(): # which condition bound at the primary crossing: the one met last
68
+ p, ra = v["primary"], v["rate_alone"]
69
+ if p is not None and ra is not None:
70
+ v["binding"] = "the 80.5 mm bar" if ra["it"] < p["it"] else ("the 29 / 32 rate" if ra["it"] == p["it"] else "?")
71
+ row["bench_interval"] = meta.get("easy", {}).get("every")
72
+ out[d.name] = row
73
+ print(json.dumps(row, default=float), flush=True)
74
+ med = {}
75
+ for learner, w in (("sapo", "ema"), ("sapo", "raw"), ("ppo", "current")):
76
+ xs = [r["actors"][w]["primary"]["active_s"] for r in out.values() if r["learner"] == learner and w in r["actors"]
77
+ and r["actors"][w]["primary"]]
78
+ n = sum(1 for r in out.values() if r["learner"] == learner)
79
+ med[f"{learner}_{w}"] = dict(crossed=len(xs), of=n, median_s=statistics.median(xs) if xs else None, draws=sorted(xs))
80
+ zc = R / "zero_control.json"
81
+ s2s = [json.loads(x) for x in open(a.sim2sim)] if a.sim2sim else []
82
+ print("RG1 READ " + json.dumps(dict(medians=med, zero_control=json.loads(zc.read_text()) if zc.exists() else None,
83
+ sim2sim=[{k: r.get(k) for k in ("run", "policy", "actor", "backend", "n_success", "mpkpe", "passed",
84
+ "secondary", "drift", "ours_end_step", "mujoco_end_step")}
85
+ for r in s2s]), default=float), flush=True)
86
+
87
+
88
+ if __name__ == "__main__":
89
+ main()
@@ -0,0 +1,66 @@
1
+ """DiffNeuSim's model files, torch-free (json, numpy): the body, its fused form, the muscle case and the contact law.
2
+
3
+ from diffneusim.model import read_model, fuse_fixed_bodies, read_case, read_law
4
+ jm = read_model("models/<body>.dnmodel") # the body file as a dict (JSON with // and /* */ comments)
5
+ fused, body_map = fuse_fixed_bodies(jm) # every welded body merged into its moving parent; body_map[i] = (new, pos, quat)
6
+ case = read_case("<case dir>") # case.json + case.bin: named numpy arrays (the engine's muscle tables)
7
+ law = read_law("models/derived/<law>.json") # the body's soft-contact law parameters
8
+ path = body_path("M356C-SRC") # a shipped body by name (bodies() lists them) -> its .dnmodel
9
+ """
10
+ import json
11
+ import pathlib
12
+ import sys
13
+
14
+ from diffneusim._paths import ROOT
15
+ from diffneusim.model.case import read_case
16
+ from diffneusim.model.fuse_fixed import fuse_fixed_bodies
17
+ from diffneusim.model.dnmodel import model_dims, parse as read_model
18
+
19
+ __all__ = ["read_model", "fuse_fixed_bodies", "read_case", "read_law", "model_dims", "bodies", "body_info", "body_of", "body_path"]
20
+
21
+
22
+ def read_law(path):
23
+ """the soft-contact law file (plain JSON) as a dict"""
24
+ return json.loads(pathlib.Path(path).read_text())
25
+
26
+
27
+ def _table():
28
+ if sys.version_info >= (3, 11):
29
+ import tomllib
30
+ else: # Python 3.10: the same parser, as a package
31
+ import tomli as tomllib
32
+ return tomllib.loads((ROOT / "models" / "BODIES.toml").read_text(encoding="utf-8"))
33
+
34
+
35
+ def bodies():
36
+ """the shipped bodies, name -> .dnmodel path (models/BODIES.toml)"""
37
+ return {name: ROOT / "models" / b["model"] for name, b in _table().items()}
38
+
39
+
40
+ def body_info(name):
41
+ """a shipped body's entry: model (path), tag (the engine build, D16_BODY), floors (other contact-floor builds), case (path); a body
42
+ without muscles (the G1) has no tag or case"""
43
+ t = _table()
44
+ assert name in t, f"{name!r} is not a shipped body ({', '.join(sorted(t))})"
45
+ b = dict(t[name])
46
+ b["model"] = ROOT / "models" / b["model"]
47
+ if "case" in b:
48
+ b["case"] = ROOT / "models" / b["case"]
49
+ return b
50
+
51
+
52
+ def body_of(path):
53
+ """the shipped body a .dnmodel path is (by its resolved path), or None"""
54
+ p = pathlib.Path(path).resolve()
55
+ hit = [n for n, m in bodies().items() if m.resolve() == p]
56
+ return hit[0] if hit else None
57
+
58
+
59
+ def body_path(body):
60
+ """a shipped body's name (see bodies()) or a .dnmodel file's path -> the .dnmodel path"""
61
+ known = bodies()
62
+ if str(body) in known:
63
+ return known[str(body)]
64
+ p = pathlib.Path(body)
65
+ assert p.suffix in (".dnmodel", ".jmodel") and p.is_file(), f"{body!r} is neither a shipped body ({', '.join(sorted(known))}) nor a .dnmodel file"
66
+ return p
@@ -0,0 +1,17 @@
1
+ """The muscle case reader: case.json (the array table: name, dtype, shape, byte offset) + case.bin (the arrays, packed). The one reader
2
+ of the format (the engine, the CPU engine and the muscle curves all call it)."""
3
+ import json
4
+ import pathlib
5
+
6
+ import numpy as np
7
+
8
+
9
+ def read_case(d):
10
+ meta = json.loads((pathlib.Path(d) / "case.json").read_text())
11
+ raw = (pathlib.Path(d) / "case.bin").read_bytes()
12
+ out = {}
13
+ for a in meta["arrays"]:
14
+ dt = {"f8": np.float64, "f4": np.float32, "i4": np.int32}[a["dtype"]]
15
+ cnt = int(np.prod(a["shape"]))
16
+ out[a["name"]] = np.frombuffer(raw, dtype=dt, count=cnt, offset=a["offset"]).reshape(a["shape"]).copy()
17
+ return out
@@ -0,0 +1,79 @@
1
+ """The one .dnmodel reader: JSON with `//` line comments, inline trailing `//` and `/* */` blocks, string literals respected. Torch-free and
2
+ dependency-free (json, pathlib), so the engine's model tools, the viewer and the record writer read a body through the same code."""
3
+ import json
4
+ import pathlib
5
+
6
+
7
+ def parse(path):
8
+ """the .dnmodel at `path` as a dict (the scanner moved here verbatim from mtu_gpu._dnmodel_json)"""
9
+ text = pathlib.Path(path).read_text()
10
+ out = []
11
+ i = 0
12
+ in_string = False
13
+ escaped = False
14
+ while i < len(text):
15
+ c = text[i]
16
+ n = text[i + 1] if i + 1 < len(text) else ""
17
+ if in_string:
18
+ out.append(c)
19
+ if escaped:
20
+ escaped = False
21
+ elif c == "\\":
22
+ escaped = True
23
+ elif c == '"':
24
+ in_string = False
25
+ i += 1
26
+ elif c == '"':
27
+ in_string = True
28
+ out.append(c)
29
+ i += 1
30
+ elif c == "/" and n == "/":
31
+ i += 2
32
+ while i < len(text) and text[i] not in "\r\n":
33
+ i += 1
34
+ elif c == "/" and n == "*":
35
+ end = text.find("*/", i + 2)
36
+ assert end >= 0
37
+ i = end + 2
38
+ else:
39
+ out.append(c)
40
+ i += 1
41
+ assert not in_string
42
+ return json.loads("".join(out))
43
+
44
+
45
+ def joint_dims(joint):
46
+ """(nq, nv) of one joint primitive"""
47
+ return {
48
+ "fixed": (0, 0),
49
+ "free": (7, 6),
50
+ "ball": (4, 3),
51
+ "hinge": (1, 1),
52
+ "revolute": (1, 1),
53
+ "slide": (1, 1),
54
+ "prismatic": (1, 1),
55
+ }[joint]
56
+
57
+
58
+ def body_dims(b):
59
+ """(nq, nv) a body adds: 0 for a driven (coupled) joint, the sum of a compound stack's primitives, else its joint's"""
60
+ if "coupled" in b:
61
+ return 0, 0
62
+ if "joints" in b:
63
+ qs = vs = 0
64
+ for p in b["joints"]:
65
+ q, v = joint_dims(p["type"]); qs += q; vs += v
66
+ return qs, vs
67
+ return joint_dims(b["joint"])
68
+
69
+
70
+ def model_dims(jm):
71
+ """(nq, nv, nm, nbody, ncontact, dynamics_backend) of a parsed model"""
72
+ nq = max(int(b["qadr"]) + body_dims(b)[0] for b in jm["bodies"])
73
+ nv = max(int(b["vadr"]) + body_dims(b)[1] for b in jm["bodies"])
74
+ nm = len(jm.get("muscles", [])) # a rigid body (the G1) has none
75
+ nbody = len(jm["bodies"])
76
+ ncontact = len(jm.get("contact", {}).get("geoms", []))
77
+ backend = jm.get("dynamics_backend", "auto")
78
+ assert backend in ("auto", "dense", "aba")
79
+ return nq, nv, nm, nbody, ncontact, backend
@@ -0,0 +1,281 @@
1
+ """Fuse every FIXED (welded, 0-dof) body into the moving body it is rigidly attached to.
2
+
3
+ WHY. The engine's per-body sweeps (FK, ABA/CRBA/RNE, contact chains, the coupling env cache) loop over
4
+ EVERY body, and a welded body costs the same spatial transform + 6x6 inertia congruence per sweep as a
5
+ moving one. The full-body lane carries 156 bodies of which 128 are welded (27 moving + the world), and a
6
+ probe that appended leaf bodies measured ~28.7 ms of GPU time per body per training epoch, linear over
7
+ NB 156..356 (docs/logs/perf-log.md, 2026-09-23). MuJoCo removes such bodies at compile time
8
+ (`fusestatic`); this is the same compile step, done as a pure .dnmodel -> .dnmodel transform so the C++
9
+ engine is unchanged.
10
+
11
+ EXACT, NOT AN APPROXIMATION. A welded body moves rigidly with its target, so merging it is a change of
12
+ bookkeeping: its mass/COM/inertia join the target's by the parallel-axis theorem, every point stated in
13
+ its frame (muscle origin/insertion/via-points, moving-via polynomial coefficients, wrap geometry, contact
14
+ spheres, self-collision capsules) is re-expressed in the target's frame, and its moving children are
15
+ re-parented with the composed tree transform. DOF layout (qadr/vadr) is untouched, so q, qd and every
16
+ per-dof array mean exactly what they meant before. Results differ from the unfused model only by f64/f32
17
+ roundoff (gated by python/tests/test_fuse_fixed.py and tools/fuse_fixed_gpu_parity.py).
18
+
19
+ CONVENTIONS (core/kin/kinematic_tree.h, core/math/spatial.h): pose_i = pose_parent . T(pos_i, quat_i) .
20
+ T_joint(q); a joint axis is stated in the body's own frame; quaternions are [w,x,y,z]; inertia is mcI --
21
+ `com` in the body frame and `inertia` [Ixx,Iyy,Izz,Ixy,Ixz,Iyz] about the COM in body axes.
22
+
23
+ SCOPE, fail-fast. Only the fields the engine reads are carried; render-only fields (`visual_geoms`,
24
+ `render_couplings`, `render_path`) and `_`-prefixed metadata are dropped, because they index bodies the
25
+ fused file no longer has and the renderer reads the SOURCE .dnmodel anyway. Any key this module does not
26
+ know raises, so a new body-referencing field cannot be carried through silently un-remapped.
27
+ """
28
+ import hashlib
29
+ import json
30
+ import math
31
+
32
+ import numpy as np
33
+
34
+ # The .dnmodel compute field that asks for the fusion (a computational option of the same physical
35
+ # model, like `precision` / `dynamics_backend`: see tools/model_variant.py).
36
+ FIELD = "fuse_fixed_bodies"
37
+
38
+ _BODY_KEYS = {"parent", "joint", "joints", "axis", "quat", "pos", "qadr", "vadr", "mass", "com", "inertia",
39
+ "damping", "name", "joint_name", "limited", "range", "d_lim", "stiffness", "limit", "ball_rom",
40
+ "coupled"}
41
+ _TOP_COPY = {"precision", "contact_mode", "dynamics_backend", "fiber_precision", "muscle_coupling", "stick",
42
+ "muscle_model", "passive", "armature", "millard", "millard_sets", "hyfydy", "gravity", "dt",
43
+ "fiber_solve_tol", "fiber_warm_start", "muscle_imex", "coord_springs", "integrator", "name"}
44
+ _TOP_DROP = {"visual_geoms", "render_couplings", FIELD,
45
+ "muscles_stub"} # export metadata written by tools/export_myoleg.py, read by nothing
46
+ # A muscle carries its source's own scalar spellings (Song gainprm, OpenSim property names, ...; see
47
+ # read_muscle_scalars in core/io/dnmodel.h), too many and too open-ended to list. So a muscle key is COPIED
48
+ # when it references no body at all (checked recursively, _mentions_body), TRANSFORMED when it is one of
49
+ # the geometric keys, and anything else that names a body fails.
50
+ _MUSCLE_GEOM = {"origin", "insertion", "path", "wrap"}
51
+ _MUSCLE_DROP = {"render_path"}
52
+ _WRAP_KEYS = {"type", "body", "radius", "center", "p1", "p2", "seg", "sidesite", "sidesite_body"}
53
+ _CONTACT_GEOM_KEYS = {"type", "body", "center", "radius", "render_group", "render_rgba"}
54
+ _SHAPE_KEYS = {"body", "radius", "center", "p0", "p1"}
55
+
56
+
57
+ def _qmul(a, b):
58
+ aw, ax, ay, az = a
59
+ bw, bx, by, bz = b
60
+ return np.array([aw * bw - ax * bx - ay * by - az * bz,
61
+ aw * bx + ax * bw + ay * bz - az * by,
62
+ aw * by - ax * bz + ay * bw + az * bx,
63
+ aw * bz + ax * by - ay * bx + az * bw])
64
+
65
+
66
+ def _rot(q):
67
+ w, x, y, z = q
68
+ return np.array([[1 - 2 * (y * y + z * z), 2 * (x * y - w * z), 2 * (x * z + w * y)],
69
+ [2 * (x * y + w * z), 1 - 2 * (x * x + z * z), 2 * (y * z - w * x)],
70
+ [2 * (x * z - w * y), 2 * (y * z + w * x), 1 - 2 * (x * x + y * y)]])
71
+
72
+
73
+ def _unit(q):
74
+ q = np.asarray(q, dtype=np.float64)
75
+ n = math.sqrt(float(q @ q))
76
+ assert abs(n - 1.0) < 1e-9, f"non-unit quaternion {q.tolist()} (|q|={n})"
77
+ return q / n
78
+
79
+
80
+ def _mentions_body(v):
81
+ if isinstance(v, dict):
82
+ return any(k == "body" or k.endswith("_body") or _mentions_body(x) for k, x in v.items())
83
+ if isinstance(v, list):
84
+ return any(_mentions_body(x) for x in v)
85
+ return False
86
+
87
+
88
+ def _is_fixed(b):
89
+ return b.get("joint") == "fixed" and "joints" not in b and "coupled" not in b
90
+
91
+
92
+ def fuse_fixed_bodies(jm):
93
+ """Return (fused_dnmodel_dict, body_map). body_map[i] = (new_index, pos, quat): old body i is rigidly
94
+ attached to new body `new_index` at pose (pos, quat) in that body's frame (identity for survivors)."""
95
+ jm = json.loads(json.dumps(jm)) # deep copy, JSON types only
96
+ bodies = jm["bodies"]
97
+ n = len(bodies)
98
+ assert int(jm.get("nbody", n)) == n
99
+ for i, b in enumerate(bodies):
100
+ unknown = set(b) - _BODY_KEYS
101
+ assert not unknown, f"body {i} ({b.get('name')}): unknown keys {sorted(unknown)} -- classify them in fuse_fixed.py"
102
+ assert b["parent"] < i, f"body {i}: parent {b['parent']} is not earlier in the list (tree order required)"
103
+
104
+ # target[i] = the surviving (old) body i is welded to; (tp[i], tq[i]) = pose of i in target's frame.
105
+ target = [0] * n
106
+ tp = [None] * n
107
+ tq = [None] * n
108
+ for i, b in enumerate(bodies):
109
+ p = b["parent"]
110
+ if _is_fixed(b) and p >= 0:
111
+ target[i] = target[p]
112
+ tp[i] = tp[p] + _rot(tq[p]) @ np.asarray(b["pos"], dtype=np.float64)
113
+ tq[i] = _unit(_qmul(tq[p], _unit(b["quat"])))
114
+ else:
115
+ target[i] = i
116
+ tp[i] = np.zeros(3)
117
+ tq[i] = np.array([1.0, 0.0, 0.0, 0.0])
118
+ survivors = [i for i in range(n) if target[i] == i]
119
+ new_of = {old: k for k, old in enumerate(survivors)}
120
+ body_map = [(new_of[target[i]], tp[i], tq[i]) for i in range(n)]
121
+
122
+ def point(old_body, x):
123
+ """(new body index, point re-expressed in its frame) for point x stated in old_body's frame."""
124
+ k, p, q = body_map[old_body]
125
+ return k, (p + _rot(q) @ np.asarray(x, dtype=np.float64)).tolist()
126
+
127
+ def vector(old_body, v):
128
+ _, _, q = body_map[old_body]
129
+ return (_rot(q) @ np.asarray(v, dtype=np.float64)).tolist()
130
+
131
+ # --- bodies: survivors, re-parented, with the composite inertia of everything welded to them ---
132
+ new_bodies = []
133
+ for s in survivors:
134
+ b = dict(bodies[s])
135
+ p = b["parent"]
136
+ if p >= 0:
137
+ b["parent"] = new_of[target[p]]
138
+ b["pos"] = (tp[p] + _rot(tq[p]) @ np.asarray(b["pos"], dtype=np.float64)).tolist()
139
+ b["quat"] = _unit(_qmul(tq[p], _unit(b["quat"]))).tolist()
140
+ members = [i for i in range(n) if target[i] == s]
141
+ m_tot, first = 0.0, np.zeros(3)
142
+ parts = []
143
+ for i in members:
144
+ bi = bodies[i]
145
+ m = float(bi["mass"])
146
+ R = _rot(tq[i])
147
+ c = tp[i] + R @ np.asarray(bi["com"], dtype=np.float64)
148
+ Ixx, Iyy, Izz, Ixy, Ixz, Iyz = (float(v) for v in bi["inertia"])
149
+ Ic = R @ np.array([[Ixx, Ixy, Ixz], [Ixy, Iyy, Iyz], [Ixz, Iyz, Izz]]) @ R.T
150
+ parts.append((m, c, Ic))
151
+ m_tot += m
152
+ first += m * c
153
+ com = first / m_tot if m_tot > 0.0 else np.asarray(bodies[s]["com"], dtype=np.float64)
154
+ I = np.zeros((3, 3))
155
+ for m, c, Ic in parts:
156
+ d = c - com
157
+ I += Ic + m * (float(d @ d) * np.eye(3) - np.outer(d, d))
158
+ b["mass"] = m_tot
159
+ b["com"] = com.tolist()
160
+ b["inertia"] = [I[0, 0], I[1, 1], I[2, 2], I[0, 1], I[0, 2], I[1, 2]]
161
+ new_bodies.append(b)
162
+
163
+ out = {}
164
+ for k, v in jm.items():
165
+ if k in _TOP_DROP or k.startswith("_"):
166
+ continue
167
+ if k in _TOP_COPY:
168
+ out[k] = v
169
+ elif k in ("nbody", "bodies", "muscles", "contact", "self_collision"):
170
+ pass # rebuilt below
171
+ else:
172
+ raise AssertionError(f"top-level key {k!r} is not classified in fuse_fixed.py")
173
+ out["nbody"] = len(new_bodies)
174
+ out["bodies"] = new_bodies
175
+
176
+ # --- muscles: every body-local point and moving-via polynomial re-expressed in the target frame ---
177
+ if "muscles" in jm:
178
+ muscles = []
179
+ for mi, mu in enumerate(jm["muscles"]):
180
+ nm = {}
181
+ for k, v in mu.items():
182
+ if k in _MUSCLE_GEOM or k in _MUSCLE_DROP:
183
+ continue
184
+ assert not _mentions_body(v), f"muscle {mi} ({mu.get('name')}): key {k!r} names a body -- classify it"
185
+ nm[k] = v
186
+ for end in ("origin", "insertion"):
187
+ if end in mu:
188
+ assert set(mu[end]) == {"body", "pos"}, (mi, end, sorted(mu[end]))
189
+ kb, x = point(mu[end]["body"], mu[end]["pos"])
190
+ nm[end] = {"body": kb, "pos": x}
191
+ if "path" in mu:
192
+ path = []
193
+ for v in mu["path"]:
194
+ ob = v["body"]
195
+ if "off" in v:
196
+ assert set(v) == {"body", "off"}, (mi, sorted(v))
197
+ kb, x = point(ob, v["off"])
198
+ path.append({"body": kb, "off": x})
199
+ else:
200
+ assert set(v) == {"body", "cdof", "coef"}, (mi, sorted(v))
201
+ assert len(v["coef"]) == 5
202
+ kb, c0 = point(ob, v["coef"][0]) # the constant term is a point
203
+ coef = [c0] + [vector(ob, c) for c in v["coef"][1:]] # higher terms are vectors
204
+ path.append({"body": kb, "cdof": v["cdof"], "coef": coef})
205
+ nm["path"] = path
206
+ if "wrap" in mu:
207
+ wraps = []
208
+ for w in mu["wrap"]:
209
+ unknown = set(w) - _WRAP_KEYS
210
+ assert not unknown, (mi, sorted(unknown))
211
+ nw = {k: w[k] for k in ("type", "radius", "seg") if k in w}
212
+ kb, _ = point(w["body"], [0.0, 0.0, 0.0])
213
+ nw["body"] = kb
214
+ for key in ("center", "p1", "p2"):
215
+ if key in w:
216
+ nw[key] = point(w["body"], w[key])[1]
217
+ if "sidesite" in w:
218
+ ks, x = point(w["sidesite_body"], w["sidesite"])
219
+ nw["sidesite_body"], nw["sidesite"] = ks, x
220
+ wraps.append(nw)
221
+ nm["wrap"] = wraps
222
+ muscles.append(nm)
223
+ out["muscles"] = muscles
224
+
225
+ # --- ground contact spheres ---
226
+ if "contact" in jm:
227
+ c = dict(jm["contact"])
228
+ geoms = []
229
+ for g in c.get("geoms", []):
230
+ unknown = set(g) - _CONTACT_GEOM_KEYS
231
+ assert not unknown, sorted(unknown)
232
+ ng = dict(g)
233
+ ng["body"], ng["center"] = point(g["body"], g["center"])
234
+ geoms.append(ng)
235
+ c["geoms"] = geoms
236
+ out["contact"] = c
237
+
238
+ # --- self-collision capsules. A pair whose two shapes land on the SAME fused body is dropped: both
239
+ # shapes now belong to one rigid composite, so their penalty force is internal (equal and opposite at
240
+ # zero relative velocity) and cancels exactly; the loader also refuses a body-against-itself pair. ---
241
+ dropped_pairs = 0
242
+ if "self_collision" in jm:
243
+ sc = dict(jm["self_collision"])
244
+ assert set(sc) <= {"pairs", "params"}, sorted(sc)
245
+ pairs = []
246
+ for pr in sc["pairs"]:
247
+ assert set(pr) == {"a", "b"}, sorted(pr)
248
+ npr = {}
249
+ for side in ("a", "b"):
250
+ sh = pr[side]
251
+ unknown = set(sh) - _SHAPE_KEYS
252
+ assert not unknown, sorted(unknown)
253
+ ns = {"radius": sh["radius"]}
254
+ for key in ("center", "p0", "p1"):
255
+ if key in sh:
256
+ ns["body"], ns[key] = point(sh["body"], sh[key])
257
+ npr[side] = ns
258
+ if npr["a"]["body"] == npr["b"]["body"]:
259
+ dropped_pairs += 1
260
+ continue
261
+ pairs.append(npr)
262
+ assert pairs, "every self-collision pair fused onto one body; drop the self_collision block instead"
263
+ sc["pairs"] = pairs
264
+ out["self_collision"] = sc
265
+
266
+ out["_fused_from"] = {
267
+ "nbody_source": n,
268
+ "dropped_self_collision_pairs": dropped_pairs,
269
+ "body_map": [[k, [float(x) for x in p], [float(x) for x in q]] for k, p, q in body_map],
270
+ }
271
+ return out, body_map
272
+
273
+
274
+ def fused_text(jm):
275
+ """The fused .dnmodel as canonical JSON text (sorted keys; float repr round-trips f64 exactly)."""
276
+ fused, _ = fuse_fixed_bodies(jm)
277
+ return json.dumps(fused, sort_keys=True, separators=(",", ":"))
278
+
279
+
280
+ def content_tag(text):
281
+ return hashlib.sha256(text.encode()).hexdigest()[:16]