diffct 2.5.2__tar.gz → 2.5.4__tar.gz

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 (226) hide show
  1. {diffct-2.5.2 → diffct-2.5.4}/CHANGELOG.md +141 -0
  2. {diffct-2.5.2 → diffct-2.5.4}/CITATION.cff +2 -2
  3. diffct-2.5.4/PKG-INFO +218 -0
  4. diffct-2.5.4/README.md +185 -0
  5. {diffct-2.5.2 → diffct-2.5.4}/diffct/__init__.py +21 -1
  6. {diffct-2.5.2 → diffct-2.5.4}/diffct/_solver_state.py +380 -63
  7. {diffct-2.5.2 → diffct-2.5.4}/diffct/analytical.py +21 -2
  8. {diffct-2.5.2 → diffct-2.5.4}/diffct/analytical_execution.py +2 -2
  9. {diffct-2.5.2 → diffct-2.5.4}/diffct/backends.py +18 -7
  10. diffct-2.5.4/diffct/clinical.py +291 -0
  11. {diffct-2.5.2 → diffct-2.5.4}/diffct/distribution.py +22 -6
  12. {diffct-2.5.2 → diffct-2.5.4}/diffct/kernels/geometry_vjp.py +7 -5
  13. {diffct-2.5.2 → diffct-2.5.4}/diffct/kernels/parallel_beam.py +4 -4
  14. diffct-2.5.4/diffct/mayo.py +292 -0
  15. {diffct-2.5.2 → diffct-2.5.4}/diffct/operators.py +80 -50
  16. {diffct-2.5.2 → diffct-2.5.4}/diffct/pipeline.py +190 -31
  17. {diffct-2.5.2 → diffct-2.5.4}/diffct/solvers.py +228 -125
  18. {diffct-2.5.2 → diffct-2.5.4}/diffct/utils.py +299 -22
  19. {diffct-2.5.2 → diffct-2.5.4}/docs/assets/gallery/NOTICE +3 -2
  20. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/full-model.spec.mjs +2 -2
  21. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/harness.mjs +42 -5
  22. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/item1-ordering.spec.mjs +6 -2
  23. diffct-2.5.4/docs/search/tests/item10-index-retry.spec.mjs +333 -0
  24. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/item5-errors.spec.mjs +5 -6
  25. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/item8-failures.spec.mjs +3 -9
  26. diffct-2.5.4/docs/search/tests/item9-toggle-cache.spec.mjs +593 -0
  27. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/semantic-opt-in.spec.mjs +1 -1
  28. diffct-2.5.4/docs/search/tests/site-pages.spec.mjs +429 -0
  29. diffct-2.5.4/docs/search/tests/worker-lifecycle.spec.mjs +189 -0
  30. {diffct-2.5.2 → diffct-2.5.4}/examples/_block_cgls.py +60 -11
  31. {diffct-2.5.2 → diffct-2.5.4}/formal/README.md +3 -0
  32. {diffct-2.5.2 → diffct-2.5.4}/pyproject.toml +2 -1
  33. diffct-2.5.4/tests/_numba_cuda.py +18 -0
  34. {diffct-2.5.2 → diffct-2.5.4}/tests/test_analytical_regressions.py +16 -7
  35. diffct-2.5.4/tests/test_audit_admission_failures.py +515 -0
  36. diffct-2.5.4/tests/test_audit_default_device.py +69 -0
  37. diffct-2.5.4/tests/test_audit_example_resume_binding.py +401 -0
  38. diffct-2.5.4/tests/test_audit_solver_callback_order.py +520 -0
  39. {diffct-2.5.2 → diffct-2.5.4}/tests/test_block_cgls.py +28 -3
  40. {diffct-2.5.2 → diffct-2.5.4}/tests/test_block_storage.py +2 -0
  41. diffct-2.5.4/tests/test_cgls_guard_exact_local.py +667 -0
  42. {diffct-2.5.2 → diffct-2.5.4}/tests/test_chunked_projector.py +5 -1
  43. diffct-2.5.4/tests/test_clinical.py +255 -0
  44. {diffct-2.5.2 → diffct-2.5.4}/tests/test_cuda_exit_deallocations.py +4 -0
  45. {diffct-2.5.2 → diffct-2.5.4}/tests/test_execution_schedules.py +5 -3
  46. diffct-2.5.4/tests/test_execution_state_ownership.py +903 -0
  47. diffct-2.5.4/tests/test_execution_state_ownership_gpu.py +253 -0
  48. {diffct-2.5.2 → diffct-2.5.4}/tests/test_gradcheck.py +40 -3
  49. {diffct-2.5.2 → diffct-2.5.4}/tests/test_lazy_native_observers.py +37 -6
  50. diffct-2.5.4/tests/test_mapped_solver_io_and_checkpoint.py +1585 -0
  51. diffct-2.5.4/tests/test_mayo.py +229 -0
  52. {diffct-2.5.2 → diffct-2.5.4}/tests/test_native_stream_cache_threads.py +5 -14
  53. {diffct-2.5.2 → diffct-2.5.4}/tests/test_projector_api.py +2 -1
  54. {diffct-2.5.2 → diffct-2.5.4}/tests/test_reconstruction_work_reuse.py +15 -7
  55. {diffct-2.5.2 → diffct-2.5.4}/tests/test_solver_api.py +68 -0
  56. {diffct-2.5.2 → diffct-2.5.4}/tests/test_solver_device_scalars.py +209 -10
  57. {diffct-2.5.2 → diffct-2.5.4}/tests/test_surface_pipeline_contracts.py +2 -1
  58. {diffct-2.5.2 → diffct-2.5.4}/tests/test_weights.py +27 -0
  59. diffct-2.5.2/PKG-INFO +0 -282
  60. diffct-2.5.2/README.md +0 -251
  61. {diffct-2.5.2 → diffct-2.5.4}/.gitignore +0 -0
  62. {diffct-2.5.2 → diffct-2.5.4}/LICENSE +0 -0
  63. {diffct-2.5.2 → diffct-2.5.4}/NOTICE +0 -0
  64. {diffct-2.5.2 → diffct-2.5.4}/diffct/_solver_tv.py +0 -0
  65. {diffct-2.5.2 → diffct-2.5.4}/diffct/chunking.py +0 -0
  66. {diffct-2.5.2 → diffct-2.5.4}/diffct/constants.py +0 -0
  67. {diffct-2.5.2 → diffct-2.5.4}/diffct/differentiable.py +0 -0
  68. {diffct-2.5.2 → diffct-2.5.4}/diffct/geometry.py +0 -0
  69. {diffct-2.5.2 → diffct-2.5.4}/diffct/kernels/__init__.py +0 -0
  70. {diffct-2.5.2 → diffct-2.5.4}/diffct/kernels/analytical_transpose.py +0 -0
  71. {diffct-2.5.2 → diffct-2.5.4}/diffct/kernels/cone_beam.py +0 -0
  72. {diffct-2.5.2 → diffct-2.5.4}/diffct/kernels/fan_beam.py +0 -0
  73. {diffct-2.5.2 → diffct-2.5.4}/diffct/kernels/parallel3d_beam.py +0 -0
  74. {diffct-2.5.2 → diffct-2.5.4}/diffct/kernels/spacing.py +0 -0
  75. {diffct-2.5.2 → diffct-2.5.4}/diffct/kernels/surface_geometry.py +0 -0
  76. {diffct-2.5.2 → diffct-2.5.4}/diffct/projectors.py +0 -0
  77. {diffct-2.5.2 → diffct-2.5.4}/diffct/reconstruction.py +0 -0
  78. {diffct-2.5.2 → diffct-2.5.4}/diffct/storage.py +0 -0
  79. {diffct-2.5.2 → diffct-2.5.4}/diffct/streaming.py +0 -0
  80. {diffct-2.5.2 → diffct-2.5.4}/diffct/surface_gradients.py +0 -0
  81. {diffct-2.5.2 → diffct-2.5.4}/diffct/surfaces.py +0 -0
  82. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/.gitignore +0 -0
  83. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/fixtures/make_tiny_model.py +0 -0
  84. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/fixtures/runtime-cancel/search.html +0 -0
  85. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/fixtures/tiny-model/config.json +0 -0
  86. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/fixtures/tiny-model/onnx/model_quantized.onnx +0 -0
  87. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/fixtures/tiny-model/onnx/model_quantized.onnx_data +0 -0
  88. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/fixtures/tiny-model/tokenizer.json +0 -0
  89. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/fixtures/tiny-model/tokenizer_config.json +0 -0
  90. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/item2-single-load.spec.mjs +0 -0
  91. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/item3-cancel.spec.mjs +0 -0
  92. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/item4-leaks.spec.mjs +0 -0
  93. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/item6-a11y.spec.mjs +0 -0
  94. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/item7-security.spec.mjs +0 -0
  95. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/playwright.config.mjs +0 -0
  96. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/runtime-cancel.config.mjs +0 -0
  97. {diffct-2.5.2 → diffct-2.5.4}/docs/search/tests/runtime-cancel.spec.mjs +0 -0
  98. {diffct-2.5.2 → diffct-2.5.4}/docs/video/README.md +0 -0
  99. {diffct-2.5.2 → diffct-2.5.4}/examples/README.md +0 -0
  100. {diffct-2.5.2 → diffct-2.5.4}/examples/_common.py +0 -0
  101. {diffct-2.5.2 → diffct-2.5.4}/examples/data/NOTICE +0 -0
  102. {diffct-2.5.2 → diffct-2.5.4}/examples/data/preprocess_walnut.py +0 -0
  103. {diffct-2.5.2 → diffct-2.5.4}/examples/walnut_reconstruction.py +0 -0
  104. {diffct-2.5.2 → diffct-2.5.4}/formal/tla/README.md +0 -0
  105. {diffct-2.5.2 → diffct-2.5.4}/pytest.ini +0 -0
  106. {diffct-2.5.2 → diffct-2.5.4}/tests/__init__.py +0 -0
  107. {diffct-2.5.2 → diffct-2.5.4}/tests/_multiprocessing.py +0 -0
  108. {diffct-2.5.2 → diffct-2.5.4}/tests/_native_per_axis_spacing.py +0 -0
  109. {diffct-2.5.2 → diffct-2.5.4}/tests/_phantoms.py +0 -0
  110. {diffct-2.5.2 → diffct-2.5.4}/tests/benchmarks/README.md +0 -0
  111. {diffct-2.5.2 → diffct-2.5.4}/tests/benchmarks/__init__.py +0 -0
  112. {diffct-2.5.2 → diffct-2.5.4}/tests/benchmarks/_common.py +0 -0
  113. {diffct-2.5.2 → diffct-2.5.4}/tests/benchmarks/test_bench_cone.py +0 -0
  114. {diffct-2.5.2 → diffct-2.5.4}/tests/benchmarks/test_bench_fan.py +0 -0
  115. {diffct-2.5.2 → diffct-2.5.4}/tests/benchmarks/test_bench_parallel.py +0 -0
  116. {diffct-2.5.2 → diffct-2.5.4}/tests/distributed_projector_check.py +0 -0
  117. {diffct-2.5.2 → diffct-2.5.4}/tests/fixtures/native_scalar_spacing_main.npz +0 -0
  118. {diffct-2.5.2 → diffct-2.5.4}/tests/test_adjoint_inner_product.py +0 -0
  119. {diffct-2.5.2 → diffct-2.5.4}/tests/test_allocator_capacity.py +0 -0
  120. {diffct-2.5.2 → diffct-2.5.4}/tests/test_analytical_autograd.py +0 -0
  121. {diffct-2.5.2 → diffct-2.5.4}/tests/test_analytical_distribution.py +0 -0
  122. {diffct-2.5.2 → diffct-2.5.4}/tests/test_analytical_input_alias.py +0 -0
  123. {diffct-2.5.2 → diffct-2.5.4}/tests/test_analytical_input_alias_bfloat16.py +0 -0
  124. {diffct-2.5.2 → diffct-2.5.4}/tests/test_analytical_weight_distribution.py +0 -0
  125. {diffct-2.5.2 → diffct-2.5.4}/tests/test_angular_low_precision.py +0 -0
  126. {diffct-2.5.2 → diffct-2.5.4}/tests/test_axis_aligned_chords.py +0 -0
  127. {diffct-2.5.2 → diffct-2.5.4}/tests/test_batch_execution_edges.py +0 -0
  128. {diffct-2.5.2 → diffct-2.5.4}/tests/test_batched_surfaces.py +0 -0
  129. {diffct-2.5.2 → diffct-2.5.4}/tests/test_call_trajectory.py +0 -0
  130. {diffct-2.5.2 → diffct-2.5.4}/tests/test_cgls_readonly_callback.py +0 -0
  131. {diffct-2.5.2 → diffct-2.5.4}/tests/test_cgls_state_admission.py +0 -0
  132. {diffct-2.5.2 → diffct-2.5.4}/tests/test_checkpoint_metadata_validation.py +0 -0
  133. {diffct-2.5.2 → diffct-2.5.4}/tests/test_completed_transfer_reuse.py +0 -0
  134. {diffct-2.5.2 → diffct-2.5.4}/tests/test_cone_backprojection_transpose.py +0 -0
  135. {diffct-2.5.2 → diffct-2.5.4}/tests/test_cone_projector_autograd.py +0 -0
  136. {diffct-2.5.2 → diffct-2.5.4}/tests/test_cpu_install.py +0 -0
  137. {diffct-2.5.2 → diffct-2.5.4}/tests/test_cuda_sink_lifetimes.py +0 -0
  138. {diffct-2.5.2 → diffct-2.5.4}/tests/test_cuda_smoke.py +0 -0
  139. {diffct-2.5.2 → diffct-2.5.4}/tests/test_detector_surface_dtypes.py +0 -0
  140. {diffct-2.5.2 → diffct-2.5.4}/tests/test_detector_surface_mapping.py +0 -0
  141. {diffct-2.5.2 → diffct-2.5.4}/tests/test_detector_surface_units.py +0 -0
  142. {diffct-2.5.2 → diffct-2.5.4}/tests/test_detector_surfaces.py +0 -0
  143. {diffct-2.5.2 → diffct-2.5.4}/tests/test_distributed_numeric_failure.py +0 -0
  144. {diffct-2.5.2 → diffct-2.5.4}/tests/test_distributed_numeric_failure_native.py +0 -0
  145. {diffct-2.5.2 → diffct-2.5.4}/tests/test_distributed_training_transforms.py +0 -0
  146. {diffct-2.5.2 → diffct-2.5.4}/tests/test_example_psnr.py +0 -0
  147. {diffct-2.5.2 → diffct-2.5.4}/tests/test_execution_buffers.py +0 -0
  148. {diffct-2.5.2 → diffct-2.5.4}/tests/test_execution_features.py +0 -0
  149. {diffct-2.5.2 → diffct-2.5.4}/tests/test_fbp_fan_accuracy.py +0 -0
  150. {diffct-2.5.2 → diffct-2.5.4}/tests/test_fbp_fan_offsets.py +0 -0
  151. {diffct-2.5.2 → diffct-2.5.4}/tests/test_fbp_parallel_accuracy.py +0 -0
  152. {diffct-2.5.2 → diffct-2.5.4}/tests/test_fdk_cone_accuracy.py +0 -0
  153. {diffct-2.5.2 → diffct-2.5.4}/tests/test_fdk_cone_offsets.py +0 -0
  154. {diffct-2.5.2 → diffct-2.5.4}/tests/test_geometry_autograd.py +0 -0
  155. {diffct-2.5.2 → diffct-2.5.4}/tests/test_geometry_conversions.py +0 -0
  156. {diffct-2.5.2 → diffct-2.5.4}/tests/test_geometry_gradients.py +0 -0
  157. {diffct-2.5.2 → diffct-2.5.4}/tests/test_geometry_input_validation.py +0 -0
  158. {diffct-2.5.2 → diffct-2.5.4}/tests/test_gpu_performance_contracts.py +0 -0
  159. {diffct-2.5.2 → diffct-2.5.4}/tests/test_live_trajectory_validation.py +0 -0
  160. {diffct-2.5.2 → diffct-2.5.4}/tests/test_mps_backend.py +0 -0
  161. {diffct-2.5.2 → diffct-2.5.4}/tests/test_multi_gpu_exit.py +0 -0
  162. {diffct-2.5.2 → diffct-2.5.4}/tests/test_multiprocessing.py +0 -0
  163. {diffct-2.5.2 → diffct-2.5.4}/tests/test_native_endpoint_precision.py +0 -0
  164. {diffct-2.5.2 → diffct-2.5.4}/tests/test_native_per_axis_admission.py +0 -0
  165. {diffct-2.5.2 → diffct-2.5.4}/tests/test_native_per_axis_extremes.py +0 -0
  166. {diffct-2.5.2 → diffct-2.5.4}/tests/test_native_per_axis_helical.py +0 -0
  167. {diffct-2.5.2 → diffct-2.5.4}/tests/test_native_per_axis_spacing.py +0 -0
  168. {diffct-2.5.2 → diffct-2.5.4}/tests/test_native_per_axis_spacing_gpu.py +0 -0
  169. {diffct-2.5.2 → diffct-2.5.4}/tests/test_native_surface_transforms.py +0 -0
  170. {diffct-2.5.2 → diffct-2.5.4}/tests/test_native_volume_layout.py +0 -0
  171. {diffct-2.5.2 → diffct-2.5.4}/tests/test_native_volume_layout_distributed.py +0 -0
  172. {diffct-2.5.2 → diffct-2.5.4}/tests/test_output_pipeline_overlap.py +0 -0
  173. {diffct-2.5.2 → diffct-2.5.4}/tests/test_parallel3d.py +0 -0
  174. {diffct-2.5.2 → diffct-2.5.4}/tests/test_parallel3d_native.py +0 -0
  175. {diffct-2.5.2 → diffct-2.5.4}/tests/test_parallel3d_native_distributed.py +0 -0
  176. {diffct-2.5.2 → diffct-2.5.4}/tests/test_parallel3d_surface_oracle.py +0 -0
  177. {diffct-2.5.2 → diffct-2.5.4}/tests/test_partition_lifecycle.py +0 -0
  178. {diffct-2.5.2 → diffct-2.5.4}/tests/test_plan_memory_bounds.py +0 -0
  179. {diffct-2.5.2 → diffct-2.5.4}/tests/test_portable_accuracy.py +0 -0
  180. {diffct-2.5.2 → diffct-2.5.4}/tests/test_portable_bounded_autograd.py +0 -0
  181. {diffct-2.5.2 → diffct-2.5.4}/tests/test_portable_cuda_budget.py +0 -0
  182. {diffct-2.5.2 → diffct-2.5.4}/tests/test_portable_distributed_geometry.py +0 -0
  183. {diffct-2.5.2 → diffct-2.5.4}/tests/test_portable_endpoint_precision.py +0 -0
  184. {diffct-2.5.2 → diffct-2.5.4}/tests/test_portable_execution_bounds.py +0 -0
  185. {diffct-2.5.2 → diffct-2.5.4}/tests/test_portable_into_default_dtype.py +0 -0
  186. {diffct-2.5.2 → diffct-2.5.4}/tests/test_portable_into_snapshots.py +0 -0
  187. {diffct-2.5.2 → diffct-2.5.4}/tests/test_portable_into_state_edges.py +0 -0
  188. {diffct-2.5.2 → diffct-2.5.4}/tests/test_portable_into_work_plan.py +0 -0
  189. {diffct-2.5.2 → diffct-2.5.4}/tests/test_portable_numeric_regressions.py +0 -0
  190. {diffct-2.5.2 → diffct-2.5.4}/tests/test_portable_sampler_snapshot.py +0 -0
  191. {diffct-2.5.2 → diffct-2.5.4}/tests/test_portable_surface_admission.py +0 -0
  192. {diffct-2.5.2 → diffct-2.5.4}/tests/test_pr42_review_regressions.py +0 -0
  193. {diffct-2.5.2 → diffct-2.5.4}/tests/test_projector_degenerate_geometry.py +0 -0
  194. {diffct-2.5.2 → diffct-2.5.4}/tests/test_projector_geometry_devices.py +0 -0
  195. {diffct-2.5.2 → diffct-2.5.4}/tests/test_projector_thread_safety.py +0 -0
  196. {diffct-2.5.2 → diffct-2.5.4}/tests/test_ramp_filter_windows.py +0 -0
  197. {diffct-2.5.2 → diffct-2.5.4}/tests/test_reconstruction_api.py +0 -0
  198. {diffct-2.5.2 → diffct-2.5.4}/tests/test_reference_backend.py +0 -0
  199. {diffct-2.5.2 → diffct-2.5.4}/tests/test_release_2_0_1.py +0 -0
  200. {diffct-2.5.2 → diffct-2.5.4}/tests/test_review_230.py +0 -0
  201. {diffct-2.5.2 → diffct-2.5.4}/tests/test_review_regressions.py +0 -0
  202. {diffct-2.5.2 → diffct-2.5.4}/tests/test_runtime_store_failures.py +0 -0
  203. {diffct-2.5.2 → diffct-2.5.4}/tests/test_solver_admission_regressions.py +0 -0
  204. {diffct-2.5.2 → diffct-2.5.4}/tests/test_solver_checkpoint_edges.py +0 -0
  205. {diffct-2.5.2 → diffct-2.5.4}/tests/test_solver_collective_failures.py +0 -0
  206. {diffct-2.5.2 → diffct-2.5.4}/tests/test_spatial_partition.py +0 -0
  207. {diffct-2.5.2 → diffct-2.5.4}/tests/test_store_runtime_contract.py +0 -0
  208. {diffct-2.5.2 → diffct-2.5.4}/tests/test_surface_collective_failures.py +0 -0
  209. {diffct-2.5.2 → diffct-2.5.4}/tests/test_surface_composition_kernel.py +0 -0
  210. {diffct-2.5.2 → diffct-2.5.4}/tests/test_surface_compute_shards.py +0 -0
  211. {diffct-2.5.2 → diffct-2.5.4}/tests/test_surface_geometry_cudasim.py +0 -0
  212. {diffct-2.5.2 → diffct-2.5.4}/tests/test_surface_gpu_execution.py +0 -0
  213. {diffct-2.5.2 → diffct-2.5.4}/tests/test_surface_gradient_replay.py +0 -0
  214. {diffct-2.5.2 → diffct-2.5.4}/tests/test_surface_host_sampling_budget.py +0 -0
  215. {diffct-2.5.2 → diffct-2.5.4}/tests/test_surface_native_regressions.py +0 -0
  216. {diffct-2.5.2 → diffct-2.5.4}/tests/test_surface_parameter_updates.py +0 -0
  217. {diffct-2.5.2 → diffct-2.5.4}/tests/test_surface_saved_snapshot_budget.py +0 -0
  218. {diffct-2.5.2 → diffct-2.5.4}/tests/test_surface_snapshot_admission.py +0 -0
  219. {diffct-2.5.2 → diffct-2.5.4}/tests/test_surface_trajectory_transform.py +0 -0
  220. {diffct-2.5.2 → diffct-2.5.4}/tests/test_training_transforms.py +0 -0
  221. {diffct-2.5.2 → diffct-2.5.4}/tests/test_trajectory_admission_cost.py +0 -0
  222. {diffct-2.5.2 → diffct-2.5.4}/tests/test_trajectory_surface_integration.py +0 -0
  223. {diffct-2.5.2 → diffct-2.5.4}/tests/test_transfer_pipeline.py +0 -0
  224. {diffct-2.5.2 → diffct-2.5.4}/tests/test_transfer_retirement_lifetimes.py +0 -0
  225. {diffct-2.5.2 → diffct-2.5.4}/tests/test_tv_zero_dependency.py +0 -0
  226. {diffct-2.5.2 → diffct-2.5.4}/tests/test_two_far_endpoints.py +0 -0
@@ -5,6 +5,147 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ## [2.5.4] - 2026-12-06
11
+
12
+ ### Fixed
13
+
14
+ - Distributed `Projector` construction and calls, and distributed `fbp_into` and
15
+ `fdk_into`, now reject an exception of any `Exception` class from a detector
16
+ surface, a `ParameterizedSurface` sampler or a custom store on every rank,
17
+ instead of only `TypeError`, `ValueError` and `RuntimeError`. Before, one rank
18
+ raised and its peers waited for the process group timeout. Native
19
+ `project_into` and `backproject_into` now report a store validation failure
20
+ on every rank through their geometry layout agreement
21
+ ([#96](https://github.com/sypsyp97/diffct/pull/96)).
22
+ - Ranks that observe a peer's numerical-stage failure now include the peer's
23
+ error message in their `RuntimeError`, and a single process receives the
24
+ original exception object from every request validation phase
25
+ ([#96](https://github.com/sypsyp97/diffct/pull/96)).
26
+ - `cgls_into` creates its zero-fill blocks on the target store's device, so a
27
+ caller's `torch.set_default_device` (for example `"meta"`) no longer breaks
28
+ CPU solves ([#96](https://github.com/sypsyp97/diffct/pull/96)).
29
+ - `sirt` and `tv_reconstruction` run the callback before they record history
30
+ entry `k` and publish checkpoint `k`. History, the stop decision and
31
+ checkpoints now describe the volume after the callback, which is the volume
32
+ that the solve continues from and returns. Projection counts per iteration
33
+ are unchanged, except that the first iteration after a resume with a
34
+ callback does one more projection
35
+ ([#97](https://github.com/sypsyp97/diffct/pull/97)).
36
+ - The example `examples/_block_cgls.py` binds measurement values, trajectory
37
+ and detector rays into its checkpoint metadata. Resume with different
38
+ measurements or geometry raises `ValueError` before any write. Checkpoints
39
+ from earlier versions of the example are rejected
40
+ ([#97](https://github.com/sypsyp97/diffct/pull/97)).
41
+ - After a failed load of its index, the documentation search loads the index
42
+ again on the next query change or focus on the search box, instead of
43
+ staying unavailable until the page reloads. Semantic search starts when the
44
+ index load was the only failure. A switch to keyword only while the index
45
+ loads shows at once and stays in force after the index recovers
46
+ ([#95](https://github.com/sypsyp97/diffct/pull/95)).
47
+
48
+ ### Documentation
49
+
50
+ - Linked the interactive browser playground from the English and Chinese
51
+ READMEs ([#94](https://github.com/sypsyp97/diffct/pull/94)).
52
+ - Documented SIRT and TV callback ordering, history, checkpointing and
53
+ normalizer/optimizer-moment semantics in `docs/EXECUTION.md`, and added TLA+
54
+ protocol coverage for solver callbacks and distributed narrow-catch failures
55
+ ([#96](https://github.com/sypsyp97/diffct/pull/96),
56
+ [#97](https://github.com/sypsyp97/diffct/pull/97)).
57
+
58
+ ## [2.5.3] - 2026-12-02
59
+
60
+ ### Added
61
+
62
+ - `Projector.last_execution` exposes a caller-owned per-thread execution handle
63
+ (`generation`, `owner`, `phase`, `forward_stats`, `backward_stats`,
64
+ `latest_stats`) that preserves caller attribution across bound-trajectory and
65
+ `ParameterizedSurface` calls and isolates stale or higher-order autograd
66
+ backward passes from newer forward reports; `last_execution_stats` remains a
67
+ compatibility view ([#92](https://github.com/sypsyp97/diffct/pull/92)).
68
+ - Optional `diffct[dicom]` reader for sparse DICOM-CT-PD projections and
69
+ `clinical_geometry` for measured cylindrical detectors and flying focal
70
+ spots on CPU or GPU. The clinical gallery uses the scan's water calibration
71
+ ([#82](https://github.com/sypsyp97/diffct/pull/82)).
72
+ - Mayo 2016/2020 public dataset helpers in `diffct.mayo`: patient folder
73
+ discovery, `load_mayo_case` returning `ClinicalScan` plus the vendor
74
+ reference image series, `read_dicom_ct_images` with HU conversion, and
75
+ `attenuation_to_hu`/`hu_to_attenuation` water calibration in both directions
76
+ ([#84](https://github.com/sypsyp97/diffct/pull/84),
77
+ [#88](https://github.com/sypsyp97/diffct/pull/88)).
78
+ - `probe_dicom_ct_pd` reads only CT-PD headers with `stop_before_pixels=True`
79
+ and returns file-count, detector, manufacturer and manufacturer-model
80
+ metadata for cohort selection. `ClinicalScan.manufacturer_model_name`
81
+ exposes the optional DICOM manufacturer model as a constant series property
82
+ ([#88](https://github.com/sypsyp97/diffct/pull/88)).
83
+
84
+ ### Changed
85
+
86
+ - DICOM-CT-PD projection reading accepts `.ima` as well as `.dcm`, unwraps the
87
+ instance-sorted scan angles, and writes pixels into one preallocated array
88
+ rather than forming a second full `np.stack` copy
89
+ ([#88](https://github.com/sypsyp97/diffct/pull/88)).
90
+
91
+ ### Fixed
92
+
93
+ - Distributed mapped CGLS (`cgls_into`) gates rank-local store reads, updates,
94
+ mapped norm reads and flushes before the next collective or return so a local
95
+ I/O failure raises promptly on every rank while keeping the parent process
96
+ group reusable. Pure-tensor `squared_norm` skips I/O gating so `cgls`, `sirt`
97
+ and `tv_reconstruction` add no extra control collectives. Failed checkpoint
98
+ staging or publication attempts clean up only attempt-created directories so
99
+ clean aborts can be retried on the same step, and raise a chained
100
+ `RuntimeError` across all ranks naming leftover rank directory paths if
101
+ cleanup or its protected post-cleanup `os.lstat` check fails. Explicit
102
+ transfer pipeline and search worker lifecycle phases prevent stale re-entry
103
+ and duplicate loads ([#92](https://github.com/sypsyp97/diffct/pull/92)).
104
+ - The read-only check on a `cgls` callback no longer copies the whole iterate
105
+ to the host. It compares a checksum computed on the iterate's own device and
106
+ reads back one flag, so a CUDA solve with a callback makes at most three
107
+ small readbacks per iteration
108
+ ([#81](https://github.com/sypsyp97/diffct/pull/81)).
109
+ - Portable projector backward accepts undefined output gradients, including
110
+ the default `torch.autograd.gradcheck` checks, while keeping distributed
111
+ backward collectives in lockstep
112
+ ([#80](https://github.com/sypsyp97/diffct/pull/80)).
113
+ - Native 2D parallel projection and backprojection with scalar voxel spacing
114
+ now normalize ray directions, matching per-axis spacing and the portable
115
+ backend for non-unit directions. Ray-direction gradients have no radial
116
+ component, consistently differentiating only the direction of each ray
117
+ ([#79](https://github.com/sypsyp97/diffct/pull/79)).
118
+ - `cgls` and `cgls_into` report `converged=True` with reason
119
+ `"normal equations satisfied"` when the normal-equation residual `Aᵀr` is
120
+ exactly zero, reserving `"normal equation breakdown"` for nonzero `Aᵀr`
121
+ whose search direction projects to zero
122
+ ([#78](https://github.com/sypsyp97/diffct/pull/78)).
123
+ - `angular_integration_weights` integrates wrapped short scans over their
124
+ acquired arc rather than treating them as full turns when the unacquired
125
+ gap is clearly larger than the view spacing
126
+ ([#77](https://github.com/sypsyp97/diffct/pull/77)).
127
+ - Mayo 2020 folder discovery chooses deterministically when several candidate
128
+ folders match the same dose/kind classification
129
+ ([#88](https://github.com/sypsyp97/diffct/pull/88)).
130
+ - The CPU test suite runs against a plain wheel without a CUDA runtime. CI
131
+ checks the full suite both with and without the `cu12` extra
132
+ ([#76](https://github.com/sypsyp97/diffct/pull/76)).
133
+
134
+ ### Documentation
135
+
136
+ - Restructured the project README as a clinical CT reconstruction overview with
137
+ real DICOM-CT-PD examples ([#87](https://github.com/sypsyp97/diffct/pull/87)).
138
+ - Documentation search keeps the semantic toggle available, reports model cache
139
+ status accurately, eliminates layout shifts, resolves color schemes before
140
+ first paint and prefetches documentation pages
141
+ ([#85](https://github.com/sypsyp97/diffct/pull/85),
142
+ [#90](https://github.com/sypsyp97/diffct/pull/90),
143
+ [#91](https://github.com/sypsyp97/diffct/pull/91)).
144
+ - Documented `Projector.last_execution`, distributed mapped-solver I/O gating,
145
+ checkpoint cleanup and retry guarantees, and added TLA+ protocol models for
146
+ report ownership, mapped solver I/O and the search worker
147
+ ([#92](https://github.com/sypsyp97/diffct/pull/92)).
148
+
8
149
  ## [2.5.2] - 2026-11-15
9
150
 
10
151
  ### Added
@@ -14,8 +14,8 @@ authors:
14
14
  given-names: Yipeng
15
15
  email: yipeng.sun@fau.de
16
16
  alias: sypsyp97
17
- version: 2.5.2
18
- date-released: "2026-11-15"
17
+ version: 2.5.4
18
+ date-released: "2026-12-06"
19
19
  license: Apache-2.0
20
20
  repository-code: "https://github.com/sypsyp97/diffct"
21
21
  url: "https://sypsyp97.github.io/diffct/"
diffct-2.5.4/PKG-INFO ADDED
@@ -0,0 +1,218 @@
1
+ Metadata-Version: 2.5
2
+ Name: diffct
3
+ Version: 2.5.4
4
+ Summary: Differentiable CT projection and reconstruction: precision modes, streaming, distributed execution and geometry gradients
5
+ Project-URL: Homepage, https://github.com/sypsyp97/diffct
6
+ Project-URL: Documentation, https://sypsyp97.github.io/diffct/
7
+ Project-URL: Changelog, https://github.com/sypsyp97/diffct/blob/main/CHANGELOG.md
8
+ Project-URL: Issues, https://github.com/sypsyp97/diffct/issues
9
+ Author-email: Yipeng Sun <yipeng.sun@fau.de>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: Apple Silicon,CT reconstruction,CUDA,MPS,PyTorch,ROCm,computed tomography,differentiable programming
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Environment :: GPU :: NVIDIA CUDA
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
20
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: numba
23
+ Requires-Dist: numba-cuda
24
+ Requires-Dist: numpy<2.5
25
+ Requires-Dist: torch
26
+ Provides-Extra: cu12
27
+ Requires-Dist: numba-cuda[cu12]; extra == 'cu12'
28
+ Provides-Extra: cu13
29
+ Requires-Dist: numba-cuda[cu13]; extra == 'cu13'
30
+ Provides-Extra: dicom
31
+ Requires-Dist: pydicom; extra == 'dicom'
32
+ Description-Content-Type: text/markdown
33
+
34
+ <h1 align="center">diffct</h1>
35
+
36
+ <p align="center">English · <a href="https://github.com/sypsyp97/diffct/blob/main/README.zh.md">简体中文</a></p>
37
+
38
+ <p align="center">
39
+ <strong>Differentiable CT operators for measured scanner geometry.</strong><br>
40
+ Project volumes, backproject measurements, reconstruct images and calibrate scanner geometry in PyTorch, from CPU experiments to multi-node CUDA execution.
41
+ </p>
42
+
43
+ <p align="center">
44
+ <a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg?style=flat-square" alt="License"></a>
45
+ <a href="https://doi.org/10.5281/zenodo.14999333"><img src="https://img.shields.io/badge/DOI-10.5281%2Fzenodo.14999333-blue.svg?style=flat-square" alt="DOI"></a>
46
+ <a href="https://pypi.org/project/diffct/"><img src="https://img.shields.io/pypi/v/diffct.svg?style=flat-square&logo=pypi&logoColor=white" alt="PyPI version"></a>
47
+ <a href="https://sypsyp97.github.io/diffct/"><img src="https://img.shields.io/github/actions/workflow/status/sypsyp97/diffct/docs.yml?branch=main&label=docs&style=flat-square" alt="Documentation"></a>
48
+ <a href="https://github.com/sypsyp97/diffct/actions"><img src="https://img.shields.io/github/actions/workflow/status/sypsyp97/diffct/ci.yml?branch=main&label=CI&style=flat-square" alt="CI/CD"></a>
49
+ <a href="https://deepwiki.com/sypsyp97/diffct"><img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/assets/deepwiki-badge.svg" alt="Ask DeepWiki"></a>
50
+ </p>
51
+
52
+ <p align="center">
53
+ <img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/assets/diffct_intro.gif" width="100%" alt="diffct intro: projection, sinogram, trajectories, multi-GPU split, reconstruction and geometry calibration">
54
+ </p>
55
+
56
+ <p align="center">
57
+ The video shows trajectories, autograd, geometry gradients, multi-GPU execution and reconstruction from measured walnut data · <a href="https://github.com/sypsyp97/diffct/blob/main/docs/assets/diffct_intro.mp4">MP4</a>.<br>
58
+ Walnut data: Meaney 2022, Zenodo 6986012, CC BY 4.0; see <a href="https://github.com/sypsyp97/diffct/blob/main/examples/data/NOTICE">examples/data/NOTICE</a>.
59
+ </p>
60
+
61
+ <p align="center">
62
+ <a href="#ct-operators">Operators</a> ·
63
+ <a href="#reconstruction-methods">Reconstruction</a> ·
64
+ <a href="#measured-helical-ct">Clinical CT</a> ·
65
+ <a href="#multi-gpu-scaling">Scaling</a> ·
66
+ <a href="#installation">Installation</a> ·
67
+ <a href="https://musetee.org/playgrounds/diffct.html">Playground</a> ·
68
+ <strong><a href="https://sypsyp97.github.io/diffct/">Documentation</a></strong>
69
+ </p>
70
+
71
+ > **Version 2.x** uses per-view trajectories. Code written for 1.x needs [migration](https://sypsyp97.github.io/diffct/migration.html). This README tracks the source checkout. Features under [Unreleased](https://github.com/sypsyp97/diffct/blob/main/CHANGELOG.md#unreleased) require installation from source.
72
+
73
+ ## CT operators
74
+
75
+ diffct gives PyTorch a matched pair of CT projection operators. The trajectory tensors specify a ray direction or source position for each view, together with the detector centre and axes. Circular, helical, saddle, calibrated and measured clinical trajectories use the same tensor format.
76
+
77
+ To our knowledge, diffct is the only open-source GPU CT library with arbitrary per-view trajectories, autograd through the volume, first-order geometry gradients, and multi-node execution. We checked LEAP, TIGRE, ASTRA/tomosipo, DiffDRR and other libraries in October 2026.
78
+
79
+ - **Matched adjoint.** `project()` and `backproject()` implement the cell-constant Siddon model as an exact adjoint pair. `project()` supports gradients with respect to the input volume, and `backproject()` with respect to the input measurements. Both support Hessian-vector products.
80
+ - **Measured geometry.** Per-view source positions can include flying focal spot offsets. `ParameterizedSurface` describes cylindrical and other curved detectors without rebinning.
81
+ - **Reconstruction.** `cgls`, `sirt`, `tv_reconstruction`, differentiable FBP/FDK and gradient-based optimization share the same operators. Differentiable FBP/FDK can learn filters and weights. The projection operators can supply volume gradients for optimization.
82
+ - **Scale.** Automatic chunking, disk-backed state and distributed execution let diffct reconstruct scans that exceed one GPU's memory.
83
+
84
+ Technical report: [diffct: Differentiable CT Operators from Circular Orbits to Arbitrary Trajectories](https://doi.org/10.20944/preprints202605.1446.v2).
85
+
86
+ ## Reconstruction methods
87
+
88
+ The figure compares analytical and iterative reconstruction. The input is a noiseless 120-view fan-beam scan simulated from a clinical abdominal slice of Mayo liver case L213. The reference panel is the vendor image. The other panels show FBP and three iterative methods. SIRT uses 200 iterations, CGLS 30 iterations and TV-regularized reconstruction 300 iterations with weight 0.3.
89
+
90
+ <p align="center">
91
+ <picture>
92
+ <source srcset="docs/source/_static/gallery/readme_methods.png">
93
+ <img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/source/_static/gallery/readme_methods.png" width="100%" alt="Reference patient slice and FBP, SIRT, CGLS and TV reconstructions">
94
+ </picture>
95
+ </p>
96
+
97
+ <p align="center">
98
+ Patient image source: Mayo Clinic LDCT-and-Projection-data, liver case L213, CC BY 4.0.
99
+ </p>
100
+
101
+ ## Measured helical CT
102
+
103
+ diffct reconstructs the measured helical scan of liver case L213. The GE scan has 7,140 full-dose projection views on an 888 × 64 cylindrical detector. The rows show axial, coronal and sagittal sections. The columns compare the vendor image, Adam least-squares reconstruction, SIRT, CGLS and TV-regularized reconstruction. Adam and TV use 150 iterations, SIRT 100 iterations and CGLS 15 iterations. TV uses weight 3. The reconstruction grid uses 0.652 mm voxels in plane and 3 mm voxels along the scan axis.
104
+
105
+ <p align="center">
106
+ <picture>
107
+ <source srcset="docs/source/_static/gallery/readme_clinical.png">
108
+ <img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/source/_static/gallery/readme_clinical.png" width="100%" alt="Measured helical CT case L213: vendor reference, Adam, SIRT, CGLS and TV">
109
+ </picture>
110
+ </p>
111
+
112
+ Patient data: McCollough et al., *Low Dose CT Image and Projection Data (LDCT-and-Projection-data)*, Version 7, The Cancer Imaging Archive, 2020, [10.7937/9npb-2637](https://doi.org/10.7937/9npb-2637). Dataset paper: Moen et al., Medical Physics, 2020, [10.1002/mp.14594](https://doi.org/10.1002/mp.14594). Chest and Liver subsets: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/); see [docs/assets/gallery/NOTICE](https://github.com/sypsyp97/diffct/blob/main/docs/assets/gallery/NOTICE).
113
+
114
+ ## Multi-GPU scaling
115
+
116
+ The benchmark uses a 512³ FP32 volume, A100 64 GB GPUs, a circular cone beam, 360 views, a 1024 × 768 detector and pitch 1.25.
117
+
118
+ | 512³ volume | 1 GPU | 4 GPUs, 1 node | 8 GPUs, 2 nodes |
119
+ |---|---:|---:|---:|
120
+ | Forward projection | 566.79 ms | 150.76 ms (3.8×) | 81.58 ms (6.9×) |
121
+ | Adjoint (backprojection) | 1060.77 ms | 279.37 ms (3.8×) | 224.04 ms (4.7×) |
122
+ | CGLS iteration | 1753.73 ms | 468.09 ms (3.7×) | 337.39 ms (5.2×) |
123
+
124
+ The [performance guide](https://sypsyp97.github.io/diffct/performance.html) gives the methodology, chart and raw samples. For more reconstructions, see the [examples](https://sypsyp97.github.io/diffct/examples.html).
125
+
126
+ ## Installation
127
+
128
+ diffct needs Python 3.10 or newer. Install PyTorch for your device.
129
+
130
+ For native NVIDIA CUDA execution, check the CUDA version of the PyTorch build:
131
+
132
+ ```bash
133
+ python -c "import torch; print(torch.version.cuda)"
134
+ ```
135
+
136
+ When `torch.version.cuda` is 12.x, run:
137
+
138
+ ```bash
139
+ pip install "diffct[cu12]"
140
+ ```
141
+
142
+ When `torch.version.cuda` is 13.x, run:
143
+
144
+ ```bash
145
+ pip install "diffct[cu13]"
146
+ ```
147
+
148
+ For CPU, PyTorch ROCm or Apple Silicon, install diffct without an extra:
149
+
150
+ ```bash
151
+ pip install diffct
152
+ ```
153
+
154
+ Select `backend="torch"` for the portable backend. Apple Silicon uses the built-in MPS support. A community [MLX port by Linda-Sophie Schneider](https://github.com/Linda-SophieSchneider/DiffCT-MLX) also exists. CUDA compatibility notes and source installation: [installation guide](https://sypsyp97.github.io/diffct/installation.html).
155
+
156
+ ## Quickstart
157
+
158
+ Create one projector. Project the image and backproject the measurements. Then compute the loss gradient with respect to the image estimate:
159
+
160
+ ```python
161
+ import torch
162
+ from diffct import Projector, circular_trajectory_2d_parallel
163
+
164
+ trajectory = circular_trajectory_2d_parallel(180, device="cpu")
165
+ A = Projector(trajectory, (64, 64), 96, beam="parallel",
166
+ detector_spacing=1.0, voxel_spacing=1.0)
167
+
168
+ image = torch.zeros(A.volume_shape, device="cuda", dtype=torch.float32)
169
+ image[20:44, 20:44] = 1.0
170
+ measurements = A.project(image) # (180, 96)
171
+ adjoint = A.backproject(measurements) # (64, 64), not an inverse
172
+
173
+ estimate = torch.zeros_like(image, requires_grad=True)
174
+ loss = 0.5 * (A.project(estimate) - measurements).square().sum()
175
+ loss.backward()
176
+ print(measurements.shape, estimate.grad.shape)
177
+ ```
178
+
179
+ Expected output: `torch.Size([180, 96]) torch.Size([64, 64])`. CPU and Apple Silicon variants are in the [quickstart guide](https://sypsyp97.github.io/diffct/quickstart.html).
180
+
181
+ ## Documentation
182
+
183
+ [Quickstart](https://sypsyp97.github.io/diffct/quickstart.html) · [Trajectories and geometry](https://sypsyp97.github.io/diffct/trajectories.html) · [Clinical helical CT](https://sypsyp97.github.io/diffct/clinical_helical_example.html) · [Mayo public datasets](https://sypsyp97.github.io/diffct/mayo_datasets_example.html) · [Multi-GPU](https://sypsyp97.github.io/diffct/multi_gpu.html) · [API reference](https://sypsyp97.github.io/diffct/api.html) · [Examples](https://sypsyp97.github.io/diffct/examples.html) · [Interactive playground](https://musetee.org/playgrounds/diffct.html)
184
+
185
+ ## Citation
186
+
187
+ If you use diffct in your research, cite both the software and the technical report. Machine-readable metadata is in [CITATION.cff](https://github.com/sypsyp97/diffct/blob/main/CITATION.cff).
188
+
189
+ <details open>
190
+ <summary>BibTeX</summary>
191
+
192
+ ```bibtex
193
+ @software{diffct2025,
194
+ author = {Yipeng Sun},
195
+ title = {diffct: Differentiable Computed Tomography Reconstruction with CUDA},
196
+ year = 2025,
197
+ publisher = {Zenodo},
198
+ doi = {10.5281/zenodo.14999333},
199
+ url = {https://doi.org/10.5281/zenodo.14999333}
200
+ }
201
+
202
+ @article{202605.1446,
203
+ doi = {10.20944/preprints202605.1446.v2},
204
+ url = {https://doi.org/10.20944/preprints202605.1446.v2},
205
+ year = 2026,
206
+ month = {Oct},
207
+ publisher = {Preprints},
208
+ author = {Yipeng Sun and Linda-Sophie Schneider and Chengze Ye and Andreas Maier},
209
+ title = {diffct: Differentiable CT Operators from Circular Orbits to Arbitrary Trajectories},
210
+ journal = {Preprints}
211
+ }
212
+ ```
213
+
214
+ </details>
215
+
216
+ ## License and acknowledgements
217
+
218
+ Apache 2.0, see [LICENSE](https://github.com/sypsyp97/diffct/blob/main/LICENSE). The project draws on [PYRO-NN](https://github.com/csyben/PYRO-NN) and [geometry_gradients_CT](https://github.com/mareikethies/geometry_gradients_CT). Issues and pull requests are welcome.
diffct-2.5.4/README.md ADDED
@@ -0,0 +1,185 @@
1
+ <h1 align="center">diffct</h1>
2
+
3
+ <p align="center">English · <a href="https://github.com/sypsyp97/diffct/blob/main/README.zh.md">简体中文</a></p>
4
+
5
+ <p align="center">
6
+ <strong>Differentiable CT operators for measured scanner geometry.</strong><br>
7
+ Project volumes, backproject measurements, reconstruct images and calibrate scanner geometry in PyTorch, from CPU experiments to multi-node CUDA execution.
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg?style=flat-square" alt="License"></a>
12
+ <a href="https://doi.org/10.5281/zenodo.14999333"><img src="https://img.shields.io/badge/DOI-10.5281%2Fzenodo.14999333-blue.svg?style=flat-square" alt="DOI"></a>
13
+ <a href="https://pypi.org/project/diffct/"><img src="https://img.shields.io/pypi/v/diffct.svg?style=flat-square&logo=pypi&logoColor=white" alt="PyPI version"></a>
14
+ <a href="https://sypsyp97.github.io/diffct/"><img src="https://img.shields.io/github/actions/workflow/status/sypsyp97/diffct/docs.yml?branch=main&label=docs&style=flat-square" alt="Documentation"></a>
15
+ <a href="https://github.com/sypsyp97/diffct/actions"><img src="https://img.shields.io/github/actions/workflow/status/sypsyp97/diffct/ci.yml?branch=main&label=CI&style=flat-square" alt="CI/CD"></a>
16
+ <a href="https://deepwiki.com/sypsyp97/diffct"><img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/assets/deepwiki-badge.svg" alt="Ask DeepWiki"></a>
17
+ </p>
18
+
19
+ <p align="center">
20
+ <img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/assets/diffct_intro.gif" width="100%" alt="diffct intro: projection, sinogram, trajectories, multi-GPU split, reconstruction and geometry calibration">
21
+ </p>
22
+
23
+ <p align="center">
24
+ The video shows trajectories, autograd, geometry gradients, multi-GPU execution and reconstruction from measured walnut data · <a href="https://github.com/sypsyp97/diffct/blob/main/docs/assets/diffct_intro.mp4">MP4</a>.<br>
25
+ Walnut data: Meaney 2022, Zenodo 6986012, CC BY 4.0; see <a href="https://github.com/sypsyp97/diffct/blob/main/examples/data/NOTICE">examples/data/NOTICE</a>.
26
+ </p>
27
+
28
+ <p align="center">
29
+ <a href="#ct-operators">Operators</a> ·
30
+ <a href="#reconstruction-methods">Reconstruction</a> ·
31
+ <a href="#measured-helical-ct">Clinical CT</a> ·
32
+ <a href="#multi-gpu-scaling">Scaling</a> ·
33
+ <a href="#installation">Installation</a> ·
34
+ <a href="https://musetee.org/playgrounds/diffct.html">Playground</a> ·
35
+ <strong><a href="https://sypsyp97.github.io/diffct/">Documentation</a></strong>
36
+ </p>
37
+
38
+ > **Version 2.x** uses per-view trajectories. Code written for 1.x needs [migration](https://sypsyp97.github.io/diffct/migration.html). This README tracks the source checkout. Features under [Unreleased](https://github.com/sypsyp97/diffct/blob/main/CHANGELOG.md#unreleased) require installation from source.
39
+
40
+ ## CT operators
41
+
42
+ diffct gives PyTorch a matched pair of CT projection operators. The trajectory tensors specify a ray direction or source position for each view, together with the detector centre and axes. Circular, helical, saddle, calibrated and measured clinical trajectories use the same tensor format.
43
+
44
+ To our knowledge, diffct is the only open-source GPU CT library with arbitrary per-view trajectories, autograd through the volume, first-order geometry gradients, and multi-node execution. We checked LEAP, TIGRE, ASTRA/tomosipo, DiffDRR and other libraries in October 2026.
45
+
46
+ - **Matched adjoint.** `project()` and `backproject()` implement the cell-constant Siddon model as an exact adjoint pair. `project()` supports gradients with respect to the input volume, and `backproject()` with respect to the input measurements. Both support Hessian-vector products.
47
+ - **Measured geometry.** Per-view source positions can include flying focal spot offsets. `ParameterizedSurface` describes cylindrical and other curved detectors without rebinning.
48
+ - **Reconstruction.** `cgls`, `sirt`, `tv_reconstruction`, differentiable FBP/FDK and gradient-based optimization share the same operators. Differentiable FBP/FDK can learn filters and weights. The projection operators can supply volume gradients for optimization.
49
+ - **Scale.** Automatic chunking, disk-backed state and distributed execution let diffct reconstruct scans that exceed one GPU's memory.
50
+
51
+ Technical report: [diffct: Differentiable CT Operators from Circular Orbits to Arbitrary Trajectories](https://doi.org/10.20944/preprints202605.1446.v2).
52
+
53
+ ## Reconstruction methods
54
+
55
+ The figure compares analytical and iterative reconstruction. The input is a noiseless 120-view fan-beam scan simulated from a clinical abdominal slice of Mayo liver case L213. The reference panel is the vendor image. The other panels show FBP and three iterative methods. SIRT uses 200 iterations, CGLS 30 iterations and TV-regularized reconstruction 300 iterations with weight 0.3.
56
+
57
+ <p align="center">
58
+ <picture>
59
+ <source srcset="docs/source/_static/gallery/readme_methods.png">
60
+ <img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/source/_static/gallery/readme_methods.png" width="100%" alt="Reference patient slice and FBP, SIRT, CGLS and TV reconstructions">
61
+ </picture>
62
+ </p>
63
+
64
+ <p align="center">
65
+ Patient image source: Mayo Clinic LDCT-and-Projection-data, liver case L213, CC BY 4.0.
66
+ </p>
67
+
68
+ ## Measured helical CT
69
+
70
+ diffct reconstructs the measured helical scan of liver case L213. The GE scan has 7,140 full-dose projection views on an 888 × 64 cylindrical detector. The rows show axial, coronal and sagittal sections. The columns compare the vendor image, Adam least-squares reconstruction, SIRT, CGLS and TV-regularized reconstruction. Adam and TV use 150 iterations, SIRT 100 iterations and CGLS 15 iterations. TV uses weight 3. The reconstruction grid uses 0.652 mm voxels in plane and 3 mm voxels along the scan axis.
71
+
72
+ <p align="center">
73
+ <picture>
74
+ <source srcset="docs/source/_static/gallery/readme_clinical.png">
75
+ <img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/source/_static/gallery/readme_clinical.png" width="100%" alt="Measured helical CT case L213: vendor reference, Adam, SIRT, CGLS and TV">
76
+ </picture>
77
+ </p>
78
+
79
+ Patient data: McCollough et al., *Low Dose CT Image and Projection Data (LDCT-and-Projection-data)*, Version 7, The Cancer Imaging Archive, 2020, [10.7937/9npb-2637](https://doi.org/10.7937/9npb-2637). Dataset paper: Moen et al., Medical Physics, 2020, [10.1002/mp.14594](https://doi.org/10.1002/mp.14594). Chest and Liver subsets: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/); see [docs/assets/gallery/NOTICE](https://github.com/sypsyp97/diffct/blob/main/docs/assets/gallery/NOTICE).
80
+
81
+ ## Multi-GPU scaling
82
+
83
+ The benchmark uses a 512³ FP32 volume, A100 64 GB GPUs, a circular cone beam, 360 views, a 1024 × 768 detector and pitch 1.25.
84
+
85
+ | 512³ volume | 1 GPU | 4 GPUs, 1 node | 8 GPUs, 2 nodes |
86
+ |---|---:|---:|---:|
87
+ | Forward projection | 566.79 ms | 150.76 ms (3.8×) | 81.58 ms (6.9×) |
88
+ | Adjoint (backprojection) | 1060.77 ms | 279.37 ms (3.8×) | 224.04 ms (4.7×) |
89
+ | CGLS iteration | 1753.73 ms | 468.09 ms (3.7×) | 337.39 ms (5.2×) |
90
+
91
+ The [performance guide](https://sypsyp97.github.io/diffct/performance.html) gives the methodology, chart and raw samples. For more reconstructions, see the [examples](https://sypsyp97.github.io/diffct/examples.html).
92
+
93
+ ## Installation
94
+
95
+ diffct needs Python 3.10 or newer. Install PyTorch for your device.
96
+
97
+ For native NVIDIA CUDA execution, check the CUDA version of the PyTorch build:
98
+
99
+ ```bash
100
+ python -c "import torch; print(torch.version.cuda)"
101
+ ```
102
+
103
+ When `torch.version.cuda` is 12.x, run:
104
+
105
+ ```bash
106
+ pip install "diffct[cu12]"
107
+ ```
108
+
109
+ When `torch.version.cuda` is 13.x, run:
110
+
111
+ ```bash
112
+ pip install "diffct[cu13]"
113
+ ```
114
+
115
+ For CPU, PyTorch ROCm or Apple Silicon, install diffct without an extra:
116
+
117
+ ```bash
118
+ pip install diffct
119
+ ```
120
+
121
+ Select `backend="torch"` for the portable backend. Apple Silicon uses the built-in MPS support. A community [MLX port by Linda-Sophie Schneider](https://github.com/Linda-SophieSchneider/DiffCT-MLX) also exists. CUDA compatibility notes and source installation: [installation guide](https://sypsyp97.github.io/diffct/installation.html).
122
+
123
+ ## Quickstart
124
+
125
+ Create one projector. Project the image and backproject the measurements. Then compute the loss gradient with respect to the image estimate:
126
+
127
+ ```python
128
+ import torch
129
+ from diffct import Projector, circular_trajectory_2d_parallel
130
+
131
+ trajectory = circular_trajectory_2d_parallel(180, device="cpu")
132
+ A = Projector(trajectory, (64, 64), 96, beam="parallel",
133
+ detector_spacing=1.0, voxel_spacing=1.0)
134
+
135
+ image = torch.zeros(A.volume_shape, device="cuda", dtype=torch.float32)
136
+ image[20:44, 20:44] = 1.0
137
+ measurements = A.project(image) # (180, 96)
138
+ adjoint = A.backproject(measurements) # (64, 64), not an inverse
139
+
140
+ estimate = torch.zeros_like(image, requires_grad=True)
141
+ loss = 0.5 * (A.project(estimate) - measurements).square().sum()
142
+ loss.backward()
143
+ print(measurements.shape, estimate.grad.shape)
144
+ ```
145
+
146
+ Expected output: `torch.Size([180, 96]) torch.Size([64, 64])`. CPU and Apple Silicon variants are in the [quickstart guide](https://sypsyp97.github.io/diffct/quickstart.html).
147
+
148
+ ## Documentation
149
+
150
+ [Quickstart](https://sypsyp97.github.io/diffct/quickstart.html) · [Trajectories and geometry](https://sypsyp97.github.io/diffct/trajectories.html) · [Clinical helical CT](https://sypsyp97.github.io/diffct/clinical_helical_example.html) · [Mayo public datasets](https://sypsyp97.github.io/diffct/mayo_datasets_example.html) · [Multi-GPU](https://sypsyp97.github.io/diffct/multi_gpu.html) · [API reference](https://sypsyp97.github.io/diffct/api.html) · [Examples](https://sypsyp97.github.io/diffct/examples.html) · [Interactive playground](https://musetee.org/playgrounds/diffct.html)
151
+
152
+ ## Citation
153
+
154
+ If you use diffct in your research, cite both the software and the technical report. Machine-readable metadata is in [CITATION.cff](https://github.com/sypsyp97/diffct/blob/main/CITATION.cff).
155
+
156
+ <details open>
157
+ <summary>BibTeX</summary>
158
+
159
+ ```bibtex
160
+ @software{diffct2025,
161
+ author = {Yipeng Sun},
162
+ title = {diffct: Differentiable Computed Tomography Reconstruction with CUDA},
163
+ year = 2025,
164
+ publisher = {Zenodo},
165
+ doi = {10.5281/zenodo.14999333},
166
+ url = {https://doi.org/10.5281/zenodo.14999333}
167
+ }
168
+
169
+ @article{202605.1446,
170
+ doi = {10.20944/preprints202605.1446.v2},
171
+ url = {https://doi.org/10.20944/preprints202605.1446.v2},
172
+ year = 2026,
173
+ month = {Oct},
174
+ publisher = {Preprints},
175
+ author = {Yipeng Sun and Linda-Sophie Schneider and Chengze Ye and Andreas Maier},
176
+ title = {diffct: Differentiable CT Operators from Circular Orbits to Arbitrary Trajectories},
177
+ journal = {Preprints}
178
+ }
179
+ ```
180
+
181
+ </details>
182
+
183
+ ## License and acknowledgements
184
+
185
+ Apache 2.0, see [LICENSE](https://github.com/sypsyp97/diffct/blob/main/LICENSE). The project draws on [PYRO-NN](https://github.com/csyben/PYRO-NN) and [geometry_gradients_CT](https://github.com/mareikethies/geometry_gradients_CT). Issues and pull requests are welcome.
@@ -15,6 +15,11 @@ from .projectors import (
15
15
  )
16
16
 
17
17
  from .operators import Projector
18
+ from .clinical import (ClinicalScan, ClinicalScanProbe, ClinicalGeometry, read_dicom_ct_pd,
19
+ probe_dicom_ct_pd, clinical_geometry)
20
+ from .mayo import (CTImageSeries, Mayo2020Case, MayoChallenge2016Case, attenuation_to_hu,
21
+ hu_to_attenuation, discover_mayo_2020_cases, discover_mayo_challenge_2016_cases,
22
+ load_mayo_case, read_dicom_ct_images)
18
23
  from .storage import TensorStore, NpyStore
19
24
  from .surfaces import ParameterizedSurface
20
25
  from .reconstruction import (
@@ -64,10 +69,25 @@ try:
64
69
  except ImportError:
65
70
  pass
66
71
 
67
- __version__ = '2.5.2'
72
+ __version__ = '2.5.4'
68
73
 
69
74
  __all__ = [
70
75
  'Projector',
76
+ 'ClinicalScan',
77
+ 'ClinicalScanProbe',
78
+ 'ClinicalGeometry',
79
+ 'read_dicom_ct_pd',
80
+ 'probe_dicom_ct_pd',
81
+ 'clinical_geometry',
82
+ 'CTImageSeries',
83
+ 'Mayo2020Case',
84
+ 'MayoChallenge2016Case',
85
+ 'attenuation_to_hu',
86
+ 'hu_to_attenuation',
87
+ 'discover_mayo_2020_cases',
88
+ 'discover_mayo_challenge_2016_cases',
89
+ 'load_mayo_case',
90
+ 'read_dicom_ct_images',
71
91
  'TensorStore',
72
92
  'NpyStore',
73
93
  'ParameterizedSurface',