nefi 0.1.0__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 (232) hide show
  1. nefi-0.1.0/LICENSE +21 -0
  2. nefi-0.1.0/PKG-INFO +268 -0
  3. nefi-0.1.0/README.md +229 -0
  4. nefi-0.1.0/nefi/__init__.py +126 -0
  5. nefi-0.1.0/nefi/auto.py +1477 -0
  6. nefi-0.1.0/nefi/autotune/__init__.py +114 -0
  7. nefi-0.1.0/nefi/autotune/_common.py +399 -0
  8. nefi-0.1.0/nefi/autotune/acquisition.py +536 -0
  9. nefi-0.1.0/nefi/autotune/convergence.py +587 -0
  10. nefi-0.1.0/nefi/autotune/gauge.py +1047 -0
  11. nefi-0.1.0/nefi/autotune/orchestrate.py +714 -0
  12. nefi-0.1.0/nefi/autotune/regularization.py +526 -0
  13. nefi-0.1.0/nefi/autotune/search.py +459 -0
  14. nefi-0.1.0/nefi/baselines/__init__.py +276 -0
  15. nefi-0.1.0/nefi/baselines/_common.py +133 -0
  16. nefi-0.1.0/nefi/baselines/admm.py +386 -0
  17. nefi-0.1.0/nefi/baselines/deep_decoder.py +198 -0
  18. nefi-0.1.0/nefi/baselines/direct.py +136 -0
  19. nefi-0.1.0/nefi/baselines/gaussian_splat.py +585 -0
  20. nefi-0.1.0/nefi/baselines/lbfgs.py +76 -0
  21. nefi-0.1.0/nefi/baselines/thermography.py +214 -0
  22. nefi-0.1.0/nefi/bench/__init__.py +13 -0
  23. nefi-0.1.0/nefi/bench/ablation.py +582 -0
  24. nefi-0.1.0/nefi/bench/base.py +127 -0
  25. nefi-0.1.0/nefi/bench/protocol.py +1147 -0
  26. nefi-0.1.0/nefi/bench/report.py +327 -0
  27. nefi-0.1.0/nefi/bench/sweep.py +94 -0
  28. nefi-0.1.0/nefi/cli.py +1448 -0
  29. nefi-0.1.0/nefi/config.py +103 -0
  30. nefi-0.1.0/nefi/diagnostics/__init__.py +105 -0
  31. nefi-0.1.0/nefi/diagnostics/_common.py +351 -0
  32. nefi-0.1.0/nefi/diagnostics/filtering.py +348 -0
  33. nefi-0.1.0/nefi/diagnostics/landscape.py +368 -0
  34. nefi-0.1.0/nefi/diagnostics/plots.py +246 -0
  35. nefi-0.1.0/nefi/diagnostics/report.py +533 -0
  36. nefi-0.1.0/nefi/diagnostics/sensitivity.py +150 -0
  37. nefi-0.1.0/nefi/diagnostics/spectrum.py +177 -0
  38. nefi-0.1.0/nefi/domain.py +156 -0
  39. nefi-0.1.0/nefi/errors.py +27 -0
  40. nefi-0.1.0/nefi/fields/__init__.py +58 -0
  41. nefi-0.1.0/nefi/fields/adaptive/__init__.py +90 -0
  42. nefi-0.1.0/nefi/fields/adaptive/annealing.py +661 -0
  43. nefi-0.1.0/nefi/fields/adaptive/capacity.py +282 -0
  44. nefi-0.1.0/nefi/fields/adaptive/selection.py +683 -0
  45. nefi-0.1.0/nefi/fields/adaptive/spectrum.py +949 -0
  46. nefi-0.1.0/nefi/fields/base.py +55 -0
  47. nefi-0.1.0/nefi/fields/encoding.py +202 -0
  48. nefi-0.1.0/nefi/fields/geometric/__init__.py +124 -0
  49. nefi-0.1.0/nefi/fields/geometric/_utils.py +369 -0
  50. nefi-0.1.0/nefi/fields/geometric/composite.py +582 -0
  51. nefi-0.1.0/nefi/fields/geometric/layered.py +542 -0
  52. nefi-0.1.0/nefi/fields/geometric/shape.py +636 -0
  53. nefi-0.1.0/nefi/fields/geometric/spectral.py +462 -0
  54. nefi-0.1.0/nefi/fields/geometric/warp.py +722 -0
  55. nefi-0.1.0/nefi/fields/grid.py +87 -0
  56. nefi-0.1.0/nefi/fields/hashgrid.py +265 -0
  57. nefi-0.1.0/nefi/fields/heads.py +273 -0
  58. nefi-0.1.0/nefi/fields/levelset.py +188 -0
  59. nefi-0.1.0/nefi/fields/lowrank.py +184 -0
  60. nefi-0.1.0/nefi/fields/modifiers.py +374 -0
  61. nefi-0.1.0/nefi/fields/neural.py +152 -0
  62. nefi-0.1.0/nefi/fields/parametric.py +311 -0
  63. nefi-0.1.0/nefi/fields/symmetric.py +180 -0
  64. nefi-0.1.0/nefi/instances/__init__.py +39 -0
  65. nefi-0.1.0/nefi/instances/_elliptic_common.py +209 -0
  66. nefi-0.1.0/nefi/instances/_volumetric.py +424 -0
  67. nefi-0.1.0/nefi/instances/_wave_family.py +132 -0
  68. nefi-0.1.0/nefi/instances/base.py +155 -0
  69. nefi-0.1.0/nefi/instances/ct3d/__init__.py +350 -0
  70. nefi-0.1.0/nefi/instances/ct3d/radon3d.py +296 -0
  71. nefi-0.1.0/nefi/instances/ct3d/scenes.py +132 -0
  72. nefi-0.1.0/nefi/instances/current_density/__init__.py +387 -0
  73. nefi-0.1.0/nefi/instances/current_density/scenes.py +167 -0
  74. nefi-0.1.0/nefi/instances/darcy_flow/__init__.py +321 -0
  75. nefi-0.1.0/nefi/instances/darcy_flow/operator.py +206 -0
  76. nefi-0.1.0/nefi/instances/darcy_flow/scenes.py +132 -0
  77. nefi-0.1.0/nefi/instances/deconvolution/__init__.py +372 -0
  78. nefi-0.1.0/nefi/instances/deconvolution/data.py +90 -0
  79. nefi-0.1.0/nefi/instances/deconvolution/phantoms.py +147 -0
  80. nefi-0.1.0/nefi/instances/deconvolution/psf.py +99 -0
  81. nefi-0.1.0/nefi/instances/deconvolution/scenes.py +105 -0
  82. nefi-0.1.0/nefi/instances/deconvolution/wiener.py +106 -0
  83. nefi-0.1.0/nefi/instances/deconvolution3d/__init__.py +435 -0
  84. nefi-0.1.0/nefi/instances/deconvolution3d/classical.py +152 -0
  85. nefi-0.1.0/nefi/instances/deconvolution3d/scenes.py +158 -0
  86. nefi-0.1.0/nefi/instances/diffraction_tomography/__init__.py +279 -0
  87. nefi-0.1.0/nefi/instances/dot3d/__init__.py +488 -0
  88. nefi-0.1.0/nefi/instances/dot3d/data.py +110 -0
  89. nefi-0.1.0/nefi/instances/dot3d/operator.py +343 -0
  90. nefi-0.1.0/nefi/instances/dot3d/scenes.py +122 -0
  91. nefi-0.1.0/nefi/instances/eit/__init__.py +340 -0
  92. nefi-0.1.0/nefi/instances/eit/operator.py +342 -0
  93. nefi-0.1.0/nefi/instances/eit/scenes.py +134 -0
  94. nefi-0.1.0/nefi/instances/holography/__init__.py +276 -0
  95. nefi-0.1.0/nefi/instances/nv_relaxometry/__init__.py +648 -0
  96. nefi-0.1.0/nefi/instances/nv_relaxometry/data.py +100 -0
  97. nefi-0.1.0/nefi/instances/nv_relaxometry/losses.py +80 -0
  98. nefi-0.1.0/nefi/instances/nv_relaxometry/operator.py +271 -0
  99. nefi-0.1.0/nefi/instances/nv_relaxometry/physics.py +227 -0
  100. nefi-0.1.0/nefi/instances/nv_relaxometry/scenes.py +247 -0
  101. nefi-0.1.0/nefi/instances/photoacoustic3d/__init__.py +374 -0
  102. nefi-0.1.0/nefi/instances/photoacoustic3d/scenes.py +119 -0
  103. nefi-0.1.0/nefi/instances/photoacoustic3d/sensor.py +86 -0
  104. nefi-0.1.0/nefi/instances/poisson_source/__init__.py +243 -0
  105. nefi-0.1.0/nefi/instances/poisson_source/data.py +135 -0
  106. nefi-0.1.0/nefi/instances/poisson_source/operator.py +246 -0
  107. nefi-0.1.0/nefi/instances/poisson_source/scenes.py +71 -0
  108. nefi-0.1.0/nefi/instances/reaction_diffusion/__init__.py +262 -0
  109. nefi-0.1.0/nefi/instances/sparse_view_ct/__init__.py +268 -0
  110. nefi-0.1.0/nefi/instances/sparse_view_ct/radon.py +292 -0
  111. nefi-0.1.0/nefi/instances/sparse_view_ct/scenes.py +113 -0
  112. nefi-0.1.0/nefi/instances/thermal_tomography/__init__.py +728 -0
  113. nefi-0.1.0/nefi/instances/thermal_tomography/pinn.py +235 -0
  114. nefi-0.1.0/nefi/instances/thermal_tomography/projection.py +187 -0
  115. nefi-0.1.0/nefi/instances/thermal_tomography/realdata.py +307 -0
  116. nefi-0.1.0/nefi/instances/thermal_tomography/scenes.py +236 -0
  117. nefi-0.1.0/nefi/instances/toy1d/__init__.py +175 -0
  118. nefi-0.1.0/nefi/instances/wave_fwi/__init__.py +419 -0
  119. nefi-0.1.0/nefi/instances/wave_fwi/losses.py +89 -0
  120. nefi-0.1.0/nefi/losses/__init__.py +49 -0
  121. nefi-0.1.0/nefi/losses/base.py +168 -0
  122. nefi-0.1.0/nefi/losses/data.py +155 -0
  123. nefi-0.1.0/nefi/losses/physics.py +357 -0
  124. nefi-0.1.0/nefi/losses/reg.py +170 -0
  125. nefi-0.1.0/nefi/measurement.py +95 -0
  126. nefi-0.1.0/nefi/metrics/__init__.py +38 -0
  127. nefi-0.1.0/nefi/metrics/basic.py +170 -0
  128. nefi-0.1.0/nefi/metrics/localization.py +225 -0
  129. nefi-0.1.0/nefi/metrics/segmentation.py +192 -0
  130. nefi-0.1.0/nefi/operators/__init__.py +60 -0
  131. nefi-0.1.0/nefi/operators/base.py +188 -0
  132. nefi-0.1.0/nefi/operators/conv.py +213 -0
  133. nefi-0.1.0/nefi/operators/function.py +281 -0
  134. nefi-0.1.0/nefi/operators/linear.py +522 -0
  135. nefi-0.1.0/nefi/operators/nonlinear.py +227 -0
  136. nefi-0.1.0/nefi/operators/pde/__init__.py +62 -0
  137. nefi-0.1.0/nefi/operators/pde/adjoint.py +494 -0
  138. nefi-0.1.0/nefi/operators/pde/heat.py +637 -0
  139. nefi-0.1.0/nefi/operators/pde/linear_solvers.py +152 -0
  140. nefi-0.1.0/nefi/operators/pde/stencil.py +834 -0
  141. nefi-0.1.0/nefi/operators/timestepping.py +474 -0
  142. nefi-0.1.0/nefi/physics/__init__.py +81 -0
  143. nefi-0.1.0/nefi/physics/elliptic.py +1389 -0
  144. nefi-0.1.0/nefi/physics/magnetostatics.py +801 -0
  145. nefi-0.1.0/nefi/physics/optics.py +462 -0
  146. nefi-0.1.0/nefi/physics/reaction_diffusion.py +402 -0
  147. nefi-0.1.0/nefi/physics/scattering.py +634 -0
  148. nefi-0.1.0/nefi/physics/timestep.py +225 -0
  149. nefi-0.1.0/nefi/physics/wave.py +968 -0
  150. nefi-0.1.0/nefi/priors.py +1176 -0
  151. nefi-0.1.0/nefi/problem.py +148 -0
  152. nefi-0.1.0/nefi/py.typed +0 -0
  153. nefi-0.1.0/nefi/registry.py +78 -0
  154. nefi-0.1.0/nefi/solve/__init__.py +44 -0
  155. nefi-0.1.0/nefi/solve/balancing.py +142 -0
  156. nefi-0.1.0/nefi/solve/batched.py +794 -0
  157. nefi-0.1.0/nefi/solve/callbacks.py +150 -0
  158. nefi-0.1.0/nefi/solve/curriculum.py +142 -0
  159. nefi-0.1.0/nefi/solve/ensemble.py +53 -0
  160. nefi-0.1.0/nefi/solve/postprocess.py +107 -0
  161. nefi-0.1.0/nefi/solve/refine.py +1907 -0
  162. nefi-0.1.0/nefi/solve/result.py +85 -0
  163. nefi-0.1.0/nefi/solve/solver.py +690 -0
  164. nefi-0.1.0/nefi/utils/__init__.py +27 -0
  165. nefi-0.1.0/nefi/utils/compat.py +82 -0
  166. nefi-0.1.0/nefi/utils/device.py +44 -0
  167. nefi-0.1.0/nefi/utils/seed.py +30 -0
  168. nefi-0.1.0/nefi/utils/tensor.py +92 -0
  169. nefi-0.1.0/nefi/utils/timing.py +20 -0
  170. nefi-0.1.0/nefi/viz/__init__.py +313 -0
  171. nefi-0.1.0/nefi/viz/_instances.py +274 -0
  172. nefi-0.1.0/nefi/viz/assets/volume_viewer.css +70 -0
  173. nefi-0.1.0/nefi/viz/assets/volume_viewer.js +1271 -0
  174. nefi-0.1.0/nefi/viz/fields.py +1960 -0
  175. nefi-0.1.0/nefi/viz/hints.py +314 -0
  176. nefi-0.1.0/nefi/viz/interactive.py +949 -0
  177. nefi-0.1.0/nefi/viz/isosurface.py +1076 -0
  178. nefi-0.1.0/nefi/viz/measurement.py +1670 -0
  179. nefi-0.1.0/nefi/viz/multiphysics.py +1799 -0
  180. nefi-0.1.0/nefi/viz/performance.py +1289 -0
  181. nefi-0.1.0/nefi/viz/qualitative.py +651 -0
  182. nefi-0.1.0/nefi/viz/report.py +621 -0
  183. nefi-0.1.0/nefi/viz/style.py +997 -0
  184. nefi-0.1.0/nefi/viz/training.py +1030 -0
  185. nefi-0.1.0/nefi/viz/volume.py +728 -0
  186. nefi-0.1.0/nefi.egg-info/PKG-INFO +268 -0
  187. nefi-0.1.0/nefi.egg-info/SOURCES.txt +230 -0
  188. nefi-0.1.0/nefi.egg-info/dependency_links.txt +1 -0
  189. nefi-0.1.0/nefi.egg-info/entry_points.txt +2 -0
  190. nefi-0.1.0/nefi.egg-info/requires.txt +21 -0
  191. nefi-0.1.0/nefi.egg-info/top_level.txt +1 -0
  192. nefi-0.1.0/pyproject.toml +74 -0
  193. nefi-0.1.0/setup.cfg +4 -0
  194. nefi-0.1.0/tests/test_adaptive.py +353 -0
  195. nefi-0.1.0/tests/test_autotune.py +469 -0
  196. nefi-0.1.0/tests/test_balancing.py +45 -0
  197. nefi-0.1.0/tests/test_baselines.py +255 -0
  198. nefi-0.1.0/tests/test_bench.py +172 -0
  199. nefi-0.1.0/tests/test_bench_strata.py +52 -0
  200. nefi-0.1.0/tests/test_cli.py +188 -0
  201. nefi-0.1.0/tests/test_core_domain_fields.py +123 -0
  202. nefi-0.1.0/tests/test_core_operators_losses.py +155 -0
  203. nefi-0.1.0/tests/test_core_solver.py +214 -0
  204. nefi-0.1.0/tests/test_ct3d.py +174 -0
  205. nefi-0.1.0/tests/test_deconvolution.py +170 -0
  206. nefi-0.1.0/tests/test_deconvolution3d.py +155 -0
  207. nefi-0.1.0/tests/test_diagnostics.py +236 -0
  208. nefi-0.1.0/tests/test_dot3d.py +209 -0
  209. nefi-0.1.0/tests/test_field_zoo.py +285 -0
  210. nefi-0.1.0/tests/test_geometric_fields.py +391 -0
  211. nefi-0.1.0/tests/test_heat_solver.py +574 -0
  212. nefi-0.1.0/tests/test_instances_elliptic_family.py +169 -0
  213. nefi-0.1.0/tests/test_instances_wave_family.py +139 -0
  214. nefi-0.1.0/tests/test_nv_relaxometry.py +518 -0
  215. nefi-0.1.0/tests/test_operator_zoo.py +360 -0
  216. nefi-0.1.0/tests/test_performance.py +724 -0
  217. nefi-0.1.0/tests/test_photoacoustic3d.py +133 -0
  218. nefi-0.1.0/tests/test_physics_elliptic.py +495 -0
  219. nefi-0.1.0/tests/test_physics_losses.py +124 -0
  220. nefi-0.1.0/tests/test_physics_magnetostatics.py +232 -0
  221. nefi-0.1.0/tests/test_physics_reaction_diffusion.py +112 -0
  222. nefi-0.1.0/tests/test_physics_scattering_optics.py +198 -0
  223. nefi-0.1.0/tests/test_physics_wave.py +221 -0
  224. nefi-0.1.0/tests/test_poisson_source.py +166 -0
  225. nefi-0.1.0/tests/test_priors_auto.py +362 -0
  226. nefi-0.1.0/tests/test_refine.py +483 -0
  227. nefi-0.1.0/tests/test_sparse_view_ct.py +167 -0
  228. nefi-0.1.0/tests/test_thermal_realdata.py +67 -0
  229. nefi-0.1.0/tests/test_thermal_tomography.py +354 -0
  230. nefi-0.1.0/tests/test_thermography_baselines.py +83 -0
  231. nefi-0.1.0/tests/test_viz.py +682 -0
  232. nefi-0.1.0/tests/test_viz_interactive.py +508 -0
nefi-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CAB Lab, Princeton University
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
nefi-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,268 @@
1
+ Metadata-Version: 2.4
2
+ Name: nefi
3
+ Version: 0.1.0
4
+ Summary: Neural-field inversion: physics-faithful, label-free inverse problems via coordinate neural fields and differentiable forward operators
5
+ Author: CAB Lab, Princeton University
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/ContinuumCoder/NEFI
8
+ Project-URL: Documentation, https://continuumcoder.github.io/NEFI/
9
+ Project-URL: Repository, https://github.com/ContinuumCoder/NEFI
10
+ Project-URL: Issues, https://github.com/ContinuumCoder/NEFI/issues
11
+ Keywords: inverse problems,neural fields,differentiable physics,scientific machine learning
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Scientific/Engineering
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: torch>=2.1
21
+ Requires-Dist: numpy>=1.24
22
+ Requires-Dist: scipy>=1.10
23
+ Requires-Dist: pyyaml>=6
24
+ Requires-Dist: tqdm>=4.60
25
+ Provides-Extra: viz
26
+ Requires-Dist: matplotlib>=3.7; extra == "viz"
27
+ Provides-Extra: cli
28
+ Requires-Dist: typer>=0.9; extra == "cli"
29
+ Requires-Dist: rich>=13; extra == "cli"
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=7; extra == "dev"
32
+ Requires-Dist: ruff>=0.4; extra == "dev"
33
+ Requires-Dist: mypy>=1.5; extra == "dev"
34
+ Requires-Dist: scikit-image>=0.21; extra == "dev"
35
+ Requires-Dist: matplotlib>=3.7; extra == "dev"
36
+ Requires-Dist: typer>=0.9; extra == "dev"
37
+ Requires-Dist: rich>=13; extra == "dev"
38
+ Dynamic: license-file
39
+
40
+ <p align="center">
41
+ <picture>
42
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/brand/nefi-wordmark-dark.svg">
43
+ <img alt="nefi" src="docs/assets/brand/nefi-wordmark.svg" width="280">
44
+ </picture>
45
+ </p>
46
+
47
+ <p align="center">
48
+ <b>Neural-Field Inversion</b>: physics-faithful, label-free inverse problems.<br>
49
+ A coordinate neural field is fitted through your instrument's physics, from a single measurement, with no training data.
50
+ </p>
51
+
52
+ <p align="center">
53
+ <a href="https://github.com/ContinuumCoder/NEFI/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/ContinuumCoder/NEFI/actions/workflows/ci.yml/badge.svg"></a>
54
+ <a href="https://github.com/ContinuumCoder/NEFI/actions/workflows/pages.yml"><img alt="Docs build" src="https://github.com/ContinuumCoder/NEFI/actions/workflows/pages.yml/badge.svg"></a>
55
+ <a href="https://continuumcoder.github.io/NEFI/"><img alt="Documentation" src="https://img.shields.io/badge/docs-continuumcoder.github.io%2FNEFI-5a3bd6"></a>
56
+ <a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
57
+ <img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-3776ab.svg">
58
+ <img alt="PyTorch 2.1+" src="https://img.shields.io/badge/pytorch-2.1%2B-ee4c2c.svg">
59
+ <a href="https://arxiv.org/abs/2605.13988"><img alt="arXiv NeTMY" src="https://img.shields.io/badge/arXiv-2605.13988-b31b1b.svg"></a>
60
+ <a href="https://arxiv.org/abs/2603.11045"><img alt="arXiv NeFTY" src="https://img.shields.io/badge/arXiv-2603.11045-b31b1b.svg"></a>
61
+ </p>
62
+
63
+ <p align="center">
64
+ <a href="https://continuumcoder.github.io/NEFI/"><b>Documentation</b></a> ·
65
+ <a href="https://continuumcoder.github.io/NEFI/getting-started/">Get started</a> ·
66
+ <a href="https://continuumcoder.github.io/NEFI/gallery/">Gallery</a> ·
67
+ <a href="https://continuumcoder.github.io/NEFI/gallery/3d/">Interactive 3-D</a> ·
68
+ <a href="https://continuumcoder.github.io/NEFI/research/papers/">Papers</a>
69
+ </p>
70
+
71
+ <p align="center">
72
+ <img src="docs/assets/hero.png" width="820" alt="Four inverse problems solved by nefi: NV noise spectra to spin sources, a 16-view sinogram to an attenuation map, an NV stray-field image to a sheet current, acoustic traces to a sound-speed map">
73
+ </p>
74
+
75
+ ## Why nefi
76
+
77
+ - **The physics stays exact.** Every candidate field passes through a differentiable model of
78
+ your instrument, whether FFT optics, PDE solvers with exact adjoints, wave propagation or
79
+ scattering, so the answer is always consistent with the physics rather than a soft penalty
80
+ away from it.
81
+ - **No training data.** The unknown is optimized for the measurement at hand with a
82
+ coarse-to-fine, frequency-annealed schedule. There is nothing to collect, nothing to amortize
83
+ and nothing to go stale.
84
+ - **It adapts itself.** Noise level, budget, learning rate, regularization strength and even the
85
+ representation can be chosen automatically, and gauge freedoms that the data cannot resolve
86
+ are detected and fixed.
87
+ - **The representation is the prior.** Neural fields, grids, level sets, layered media and
88
+ coordinate warps are interchangeable, and the library measures which one matches your
89
+ operator.
90
+ - **It tells you how far to trust the result.** Noise-floor verdicts, ill-posedness
91
+ diagnostics, a benchmark protocol with confidence intervals and an inverse-crime guard, and
92
+ refinements that are refused when the data do not support them.
93
+
94
+ <picture>
95
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/recipe-dark.svg">
96
+ <img alt="The nefi recipe: coordinates, annealed Fourier encoding and a field with value heads (the prior), a differentiable operator (the physics), losses against the measurement and a multiscale solver (the fit), diagnostics (the trust)" src="docs/assets/recipe.svg">
97
+ </picture>
98
+
99
+ ## Quickstart
100
+
101
+ ```bash
102
+ pip install nefi # torch, numpy, scipy, pyyaml, tqdm ("nefi[viz]": + matplotlib)
103
+ nefi run toy1d # generate → invert → evaluate → runs/toy1d-<hash>/
104
+ nefi bench toy1d --methods neural,grid --n 4 --seeds 0,1
105
+ nefi diagnose toy1d # sensitivity, iter-0 gradient, filter rows, spectrum
106
+ ```
107
+
108
+ ```python
109
+ import nefi
110
+ from nefi.instances.toy1d import make_problem
111
+
112
+ problem, gt, meas = make_problem(n=128, seed=0) # 1-D deblurring, seconds on a CPU
113
+ result = nefi.invert(problem) # neural field + annealed two-stage curriculum
114
+ print(nefi.metrics.psnr(result.fields["x"], gt["x"]))
115
+ ```
116
+
117
+ **Bring your own problem** — any measurement process you can write in PyTorch, no subclassing:
118
+
119
+ ```python
120
+ import torch
121
+ import nefi
122
+
123
+ k = torch.tensor([1.0, 4.0, 6.0, 4.0, 1.0])
124
+ k = (k[:, None] * k[None]) / 256
125
+
126
+ def forward(x): # your physics: a blurred, saturating camera
127
+ blurred = torch.nn.functional.conv2d(x[None, None], k[None, None], padding=2)[0, 0]
128
+ return torch.tanh(1.5 * blurred)
129
+
130
+ x_true = torch.zeros(64, 64); x_true[20:44, 16:40] = 1.0
131
+ y = forward(x_true) + 0.01 * torch.randn(64, 64) # your data
132
+
133
+ problem = nefi.from_forward(forward, y, shape=(64, 64),
134
+ prior="nonnegative + piecewise_constant") # what you know
135
+ result = nefi.invert(problem)
136
+ print(nefi.quick_report(result, problem, gt=x_true)) # did the fit reach the noise floor?
137
+ ```
138
+
139
+ `from_forward` chooses the representation, initialization, noise level, loss weights, learning
140
+ rate and curriculum; every decision is logged and overridable
141
+ ([guide](https://continuumcoder.github.io/NEFI/byop/)).
142
+
143
+ ## Gallery
144
+
145
+ <p align="center">
146
+ <img src="docs/assets/gallery/overview-2d.png" width="880" alt="Twelve 1-D and 2-D systems, each as ground truth, measurement and reconstruction with PSNR, solve time and steps">
147
+ </p>
148
+ <p align="center"><sub>Twelve of the 17 registered systems as ground truth · measurement · reconstruction — one gallery run on a CPU. <a href="https://continuumcoder.github.io/NEFI/gallery/">Browse the gallery →</a></sub></p>
149
+
150
+ ## What's inside
151
+
152
+ | | |
153
+ |---|---|
154
+ | **Representations** | neural fields with annealed Fourier features, grids, hash grids, low-rank, level sets, Gaussian splats, Deep Decoder; geometric fields (layered media, anomalies, star shapes, warps) with adaptive annealing, capacity growth and held-out selection — [geometry](https://continuumcoder.github.io/NEFI/geometry/) |
155
+ | **Operators & physics** | FFT convolution, NV dipolar spectra, magnetostatics, Radon, Poisson, elliptic PDEs with implicit-function adjoints, implicit-Euler heat with a discrete adjoint, waves with PML and checkpointing, Born and Lippmann–Schwinger scattering, angular-spectrum optics, Gray–Scott — [physics](https://continuumcoder.github.io/NEFI/physics/) |
156
+ | **Losses & priors** | MSE, log-MSE, Poisson NLL, Huber, TV, ℓ1, Laplacian, physics penalties; value heads as hard priors; a prior DSL (`"nonnegative + sparse"`) — [zoo](https://continuumcoder.github.io/NEFI/zoo/) |
157
+ | **Curriculum & solver** | multiscale stages, annealing resets, LR schedules, discrepancy stopping, NaN guard with rollback, EMA, restarts, time budgets, checkpoints |
158
+ | **Diagnostics** | sensitivity maps, iter-0 gradient and center bias, filter-kernel rows G<sub>θ</sub>e<sub>i</sub>, singular values, energy barriers, the data-fit paradox — [diagnostics](https://continuumcoder.github.io/NEFI/tutorials/05_diagnostics/) |
159
+ | **Benchmarking** | paired samples × seeds, 95 % confidence intervals, runtime and memory, ablations, sweeps, inverse-crime guard, sharded cluster campaigns — [benchmarking](https://continuumcoder.github.io/NEFI/tutorials/06_benchmarking/) |
160
+ | **Auto-tuning** | gauges, budgets and learning rates against the noise floor, Morozov regularization, an acquisition report — [auto-tuning](https://continuumcoder.github.io/NEFI/autotune/) |
161
+ | **Edge refinement** | multi-phase level sets, phase fields, TV sharpening, with a data-fit acceptance test and a control run — [refinement](https://continuumcoder.github.io/NEFI/refinement/) |
162
+ | **Visualization** | comparison figures, measurement viewers, training dynamics, 3-D slices and isosurfaces, a dependency-free interactive 3-D viewer — [visualization](https://continuumcoder.github.io/NEFI/visualization/) |
163
+ | **Performance** | batched multi-measurement solving (`vmap`), whole-step `torch.compile`, CUDA graphs, mixed precision, a fast heat stencil — [performance](https://continuumcoder.github.io/NEFI/performance/) |
164
+ | **CLI** | `nefi list · run · bench · bench-merge · diagnose · autotune · ablate · sweep` — [reference](https://continuumcoder.github.io/NEFI/reference/cli/) |
165
+
166
+ ## Instances
167
+
168
+ Seventeen registered problems, each runnable end to end with `nefi run <name> --smoke` and
169
+ documented on its own [page](https://continuumcoder.github.io/NEFI/instances/).
170
+
171
+ | group | instance | problem | physics |
172
+ |---|---|---|---|
173
+ | papers | `nv_relaxometry` | spin sources + Larmor field from NV noise spectra (**NeTMY**) | dipolar tensor kernel × Lorentzian |
174
+ | | `thermal_tomography` | 3-D diffusivity from pulsed-thermography frames (**NeFTY**) | implicit-Euler heat, discrete adjoint |
175
+ | classic imaging | `toy1d` | 1-D deblurring (tutorial, CI) | FFT blur |
176
+ | | `deconvolution` | image deblurring, Gaussian or Poisson noise | FFT convolution |
177
+ | | `sparse_view_ct` | sparse-view and limited-angle CT | differentiable Radon transform |
178
+ | elliptic | `poisson_source` | sources from sparse potentials | spectral Poisson solver |
179
+ | | `eit` | conductivity from boundary voltages | elliptic PDE, implicit-function adjoint |
180
+ | | `darcy_flow` | log-permeability from well pressures | elliptic PDE, implicit-function adjoint |
181
+ | | `current_density` | sheet current from its NV stray field | planar magnetostatics |
182
+ | wave · optics · reaction | `wave_fwi` | sound speed from acoustic traces | wave equation, leapfrog + PML |
183
+ | | `diffraction_tomography` | scattering contrast from scattered fields | Born / Rytov |
184
+ | | `holography` | phase from multi-distance intensities | angular-spectrum propagation |
185
+ | | `reaction_diffusion` | Gray–Scott feed rate from snapshots | reaction–diffusion time stepping |
186
+ | volumetric | `ct3d` | 3-D sparse-view CT | slice-stacked Radon transform |
187
+ | | `deconvolution3d` | fluorescence z-stack deconvolution | 3-D FFT convolution |
188
+ | | `dot3d` | diffuse optical tomography | diffusion equation, Robin boundaries |
189
+ | | `photoacoustic3d` | photoacoustic tomography, planar array | 3-D wave equation |
190
+
191
+ ## Interactive 3-D
192
+
193
+ <p align="center">
194
+ <a href="https://continuumcoder.github.io/NEFI/gallery/3d/"><img src="docs/assets/gallery/viewer-ct3d.png" width="820" alt="Interactive viewer: ground truth, smooth and edge-refined isosurfaces of a 3-D CT reconstruction, with IoU and Dice"></a>
195
+ </p>
196
+ <p align="center"><sub>Ground truth · smooth · edge-refined, one camera, IoU and Dice computed in the browser — a self-contained HTML file written by <code>nefi.viz.save_volume_viewer</code>. <a href="https://continuumcoder.github.io/NEFI/gallery/3d/">Rotate it live →</a></sub></p>
197
+
198
+ ## Reproducing the papers
199
+
200
+ `configs/nv_relaxometry_paper.yaml` and `configs/thermal_tomography_paper.yaml` hold the papers'
201
+ settings table by table. The [server runbook](https://continuumcoder.github.io/NEFI/reproduce_papers/)
202
+ lists the exact commands for the headline tables, their GPU cost and the caveats to check
203
+ first, and the [paper → code map](https://continuumcoder.github.io/NEFI/paper_mapping/) traces
204
+ every equation to the code.
205
+
206
+ ```bash
207
+ nefi bench configs/nv_relaxometry_paper.yaml --methods netmy,f1,grid,grid_f1 \
208
+ --classes all --by-class --n 64 --seeds 0,1,2 --device cuda # NeTMY Tab. 1
209
+ nefi run configs/thermal_tomography_paper.yaml --device cuda # one NeFTY specimen
210
+ ```
211
+
212
+ ## Development
213
+
214
+ ```bash
215
+ git clone https://github.com/ContinuumCoder/NEFI.git && cd NEFI
216
+ pip install -e ".[dev]" # + pytest, ruff, mypy, scikit-image, matplotlib, typer, rich
217
+ make test # fast CPU suite; make lint, make smoke
218
+ ```
219
+
220
+ The latest development version installs with
221
+ `pip install git+https://github.com/ContinuumCoder/NEFI.git`; see [CONTRIBUTING.md](CONTRIBUTING.md).
222
+
223
+ ## Documentation
224
+
225
+ [Get started](https://continuumcoder.github.io/NEFI/getting-started/) ·
226
+ [Tutorials](https://continuumcoder.github.io/NEFI/getting-started/#the-tutorials) ·
227
+ [Guides](https://continuumcoder.github.io/NEFI/guides/) ·
228
+ [Gallery](https://continuumcoder.github.io/NEFI/gallery/) ·
229
+ [Physics](https://continuumcoder.github.io/NEFI/physics/) ·
230
+ [Instances](https://continuumcoder.github.io/NEFI/instances/) ·
231
+ [Research](https://continuumcoder.github.io/NEFI/research/) ·
232
+ [API](https://continuumcoder.github.io/NEFI/api/) ·
233
+ [CLI](https://continuumcoder.github.io/NEFI/reference/cli/) ·
234
+ [Contributing](CONTRIBUTING.md) · [Changelog](CHANGELOG.md)
235
+
236
+ Every page is also readable as markdown under [`docs/`](docs/).
237
+
238
+ ## Citation
239
+
240
+ If you use nefi, please cite the papers it implements:
241
+
242
+ ```bibtex
243
+ @article{zhao2026netmy,
244
+ title = {Neural Fields for {NV}-Center Inverse Sensing},
245
+ author = {Zhao, Zhixuan and Zhong, Tao and Hu, Yixun and de Leon, Nathalie P. and
246
+ Allen-Blanchette, Christine},
247
+ journal = {arXiv preprint arXiv:2605.13988},
248
+ year = {2026}
249
+ }
250
+
251
+ @article{zhong2026nefty,
252
+ title = {Neural Field Thermal Tomography: A Differentiable Physics Framework for
253
+ Non-Destructive Evaluation},
254
+ author = {Zhong, Tao and Hu, Yixun and Zheng, Dongzhe and Sood, Aditya and
255
+ Allen-Blanchette, Christine},
256
+ journal = {arXiv preprint arXiv:2603.11045},
257
+ year = {2026}
258
+ }
259
+ ```
260
+
261
+ ## License
262
+
263
+ MIT © 2026 CAB Lab, Princeton University — see [LICENSE](LICENSE).
264
+
265
+ ## Acknowledgements
266
+
267
+ nefi is developed and maintained by the **CAB Lab at Princeton University**. It generalizes the
268
+ lab's NeTMY and NeFTY papers into one library, and we thank the authors of both papers.
nefi-0.1.0/README.md ADDED
@@ -0,0 +1,229 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/brand/nefi-wordmark-dark.svg">
4
+ <img alt="nefi" src="docs/assets/brand/nefi-wordmark.svg" width="280">
5
+ </picture>
6
+ </p>
7
+
8
+ <p align="center">
9
+ <b>Neural-Field Inversion</b>: physics-faithful, label-free inverse problems.<br>
10
+ A coordinate neural field is fitted through your instrument's physics, from a single measurement, with no training data.
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://github.com/ContinuumCoder/NEFI/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/ContinuumCoder/NEFI/actions/workflows/ci.yml/badge.svg"></a>
15
+ <a href="https://github.com/ContinuumCoder/NEFI/actions/workflows/pages.yml"><img alt="Docs build" src="https://github.com/ContinuumCoder/NEFI/actions/workflows/pages.yml/badge.svg"></a>
16
+ <a href="https://continuumcoder.github.io/NEFI/"><img alt="Documentation" src="https://img.shields.io/badge/docs-continuumcoder.github.io%2FNEFI-5a3bd6"></a>
17
+ <a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
18
+ <img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-3776ab.svg">
19
+ <img alt="PyTorch 2.1+" src="https://img.shields.io/badge/pytorch-2.1%2B-ee4c2c.svg">
20
+ <a href="https://arxiv.org/abs/2605.13988"><img alt="arXiv NeTMY" src="https://img.shields.io/badge/arXiv-2605.13988-b31b1b.svg"></a>
21
+ <a href="https://arxiv.org/abs/2603.11045"><img alt="arXiv NeFTY" src="https://img.shields.io/badge/arXiv-2603.11045-b31b1b.svg"></a>
22
+ </p>
23
+
24
+ <p align="center">
25
+ <a href="https://continuumcoder.github.io/NEFI/"><b>Documentation</b></a> ·
26
+ <a href="https://continuumcoder.github.io/NEFI/getting-started/">Get started</a> ·
27
+ <a href="https://continuumcoder.github.io/NEFI/gallery/">Gallery</a> ·
28
+ <a href="https://continuumcoder.github.io/NEFI/gallery/3d/">Interactive 3-D</a> ·
29
+ <a href="https://continuumcoder.github.io/NEFI/research/papers/">Papers</a>
30
+ </p>
31
+
32
+ <p align="center">
33
+ <img src="docs/assets/hero.png" width="820" alt="Four inverse problems solved by nefi: NV noise spectra to spin sources, a 16-view sinogram to an attenuation map, an NV stray-field image to a sheet current, acoustic traces to a sound-speed map">
34
+ </p>
35
+
36
+ ## Why nefi
37
+
38
+ - **The physics stays exact.** Every candidate field passes through a differentiable model of
39
+ your instrument, whether FFT optics, PDE solvers with exact adjoints, wave propagation or
40
+ scattering, so the answer is always consistent with the physics rather than a soft penalty
41
+ away from it.
42
+ - **No training data.** The unknown is optimized for the measurement at hand with a
43
+ coarse-to-fine, frequency-annealed schedule. There is nothing to collect, nothing to amortize
44
+ and nothing to go stale.
45
+ - **It adapts itself.** Noise level, budget, learning rate, regularization strength and even the
46
+ representation can be chosen automatically, and gauge freedoms that the data cannot resolve
47
+ are detected and fixed.
48
+ - **The representation is the prior.** Neural fields, grids, level sets, layered media and
49
+ coordinate warps are interchangeable, and the library measures which one matches your
50
+ operator.
51
+ - **It tells you how far to trust the result.** Noise-floor verdicts, ill-posedness
52
+ diagnostics, a benchmark protocol with confidence intervals and an inverse-crime guard, and
53
+ refinements that are refused when the data do not support them.
54
+
55
+ <picture>
56
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/recipe-dark.svg">
57
+ <img alt="The nefi recipe: coordinates, annealed Fourier encoding and a field with value heads (the prior), a differentiable operator (the physics), losses against the measurement and a multiscale solver (the fit), diagnostics (the trust)" src="docs/assets/recipe.svg">
58
+ </picture>
59
+
60
+ ## Quickstart
61
+
62
+ ```bash
63
+ pip install nefi # torch, numpy, scipy, pyyaml, tqdm ("nefi[viz]": + matplotlib)
64
+ nefi run toy1d # generate → invert → evaluate → runs/toy1d-<hash>/
65
+ nefi bench toy1d --methods neural,grid --n 4 --seeds 0,1
66
+ nefi diagnose toy1d # sensitivity, iter-0 gradient, filter rows, spectrum
67
+ ```
68
+
69
+ ```python
70
+ import nefi
71
+ from nefi.instances.toy1d import make_problem
72
+
73
+ problem, gt, meas = make_problem(n=128, seed=0) # 1-D deblurring, seconds on a CPU
74
+ result = nefi.invert(problem) # neural field + annealed two-stage curriculum
75
+ print(nefi.metrics.psnr(result.fields["x"], gt["x"]))
76
+ ```
77
+
78
+ **Bring your own problem** — any measurement process you can write in PyTorch, no subclassing:
79
+
80
+ ```python
81
+ import torch
82
+ import nefi
83
+
84
+ k = torch.tensor([1.0, 4.0, 6.0, 4.0, 1.0])
85
+ k = (k[:, None] * k[None]) / 256
86
+
87
+ def forward(x): # your physics: a blurred, saturating camera
88
+ blurred = torch.nn.functional.conv2d(x[None, None], k[None, None], padding=2)[0, 0]
89
+ return torch.tanh(1.5 * blurred)
90
+
91
+ x_true = torch.zeros(64, 64); x_true[20:44, 16:40] = 1.0
92
+ y = forward(x_true) + 0.01 * torch.randn(64, 64) # your data
93
+
94
+ problem = nefi.from_forward(forward, y, shape=(64, 64),
95
+ prior="nonnegative + piecewise_constant") # what you know
96
+ result = nefi.invert(problem)
97
+ print(nefi.quick_report(result, problem, gt=x_true)) # did the fit reach the noise floor?
98
+ ```
99
+
100
+ `from_forward` chooses the representation, initialization, noise level, loss weights, learning
101
+ rate and curriculum; every decision is logged and overridable
102
+ ([guide](https://continuumcoder.github.io/NEFI/byop/)).
103
+
104
+ ## Gallery
105
+
106
+ <p align="center">
107
+ <img src="docs/assets/gallery/overview-2d.png" width="880" alt="Twelve 1-D and 2-D systems, each as ground truth, measurement and reconstruction with PSNR, solve time and steps">
108
+ </p>
109
+ <p align="center"><sub>Twelve of the 17 registered systems as ground truth · measurement · reconstruction — one gallery run on a CPU. <a href="https://continuumcoder.github.io/NEFI/gallery/">Browse the gallery →</a></sub></p>
110
+
111
+ ## What's inside
112
+
113
+ | | |
114
+ |---|---|
115
+ | **Representations** | neural fields with annealed Fourier features, grids, hash grids, low-rank, level sets, Gaussian splats, Deep Decoder; geometric fields (layered media, anomalies, star shapes, warps) with adaptive annealing, capacity growth and held-out selection — [geometry](https://continuumcoder.github.io/NEFI/geometry/) |
116
+ | **Operators & physics** | FFT convolution, NV dipolar spectra, magnetostatics, Radon, Poisson, elliptic PDEs with implicit-function adjoints, implicit-Euler heat with a discrete adjoint, waves with PML and checkpointing, Born and Lippmann–Schwinger scattering, angular-spectrum optics, Gray–Scott — [physics](https://continuumcoder.github.io/NEFI/physics/) |
117
+ | **Losses & priors** | MSE, log-MSE, Poisson NLL, Huber, TV, ℓ1, Laplacian, physics penalties; value heads as hard priors; a prior DSL (`"nonnegative + sparse"`) — [zoo](https://continuumcoder.github.io/NEFI/zoo/) |
118
+ | **Curriculum & solver** | multiscale stages, annealing resets, LR schedules, discrepancy stopping, NaN guard with rollback, EMA, restarts, time budgets, checkpoints |
119
+ | **Diagnostics** | sensitivity maps, iter-0 gradient and center bias, filter-kernel rows G<sub>θ</sub>e<sub>i</sub>, singular values, energy barriers, the data-fit paradox — [diagnostics](https://continuumcoder.github.io/NEFI/tutorials/05_diagnostics/) |
120
+ | **Benchmarking** | paired samples × seeds, 95 % confidence intervals, runtime and memory, ablations, sweeps, inverse-crime guard, sharded cluster campaigns — [benchmarking](https://continuumcoder.github.io/NEFI/tutorials/06_benchmarking/) |
121
+ | **Auto-tuning** | gauges, budgets and learning rates against the noise floor, Morozov regularization, an acquisition report — [auto-tuning](https://continuumcoder.github.io/NEFI/autotune/) |
122
+ | **Edge refinement** | multi-phase level sets, phase fields, TV sharpening, with a data-fit acceptance test and a control run — [refinement](https://continuumcoder.github.io/NEFI/refinement/) |
123
+ | **Visualization** | comparison figures, measurement viewers, training dynamics, 3-D slices and isosurfaces, a dependency-free interactive 3-D viewer — [visualization](https://continuumcoder.github.io/NEFI/visualization/) |
124
+ | **Performance** | batched multi-measurement solving (`vmap`), whole-step `torch.compile`, CUDA graphs, mixed precision, a fast heat stencil — [performance](https://continuumcoder.github.io/NEFI/performance/) |
125
+ | **CLI** | `nefi list · run · bench · bench-merge · diagnose · autotune · ablate · sweep` — [reference](https://continuumcoder.github.io/NEFI/reference/cli/) |
126
+
127
+ ## Instances
128
+
129
+ Seventeen registered problems, each runnable end to end with `nefi run <name> --smoke` and
130
+ documented on its own [page](https://continuumcoder.github.io/NEFI/instances/).
131
+
132
+ | group | instance | problem | physics |
133
+ |---|---|---|---|
134
+ | papers | `nv_relaxometry` | spin sources + Larmor field from NV noise spectra (**NeTMY**) | dipolar tensor kernel × Lorentzian |
135
+ | | `thermal_tomography` | 3-D diffusivity from pulsed-thermography frames (**NeFTY**) | implicit-Euler heat, discrete adjoint |
136
+ | classic imaging | `toy1d` | 1-D deblurring (tutorial, CI) | FFT blur |
137
+ | | `deconvolution` | image deblurring, Gaussian or Poisson noise | FFT convolution |
138
+ | | `sparse_view_ct` | sparse-view and limited-angle CT | differentiable Radon transform |
139
+ | elliptic | `poisson_source` | sources from sparse potentials | spectral Poisson solver |
140
+ | | `eit` | conductivity from boundary voltages | elliptic PDE, implicit-function adjoint |
141
+ | | `darcy_flow` | log-permeability from well pressures | elliptic PDE, implicit-function adjoint |
142
+ | | `current_density` | sheet current from its NV stray field | planar magnetostatics |
143
+ | wave · optics · reaction | `wave_fwi` | sound speed from acoustic traces | wave equation, leapfrog + PML |
144
+ | | `diffraction_tomography` | scattering contrast from scattered fields | Born / Rytov |
145
+ | | `holography` | phase from multi-distance intensities | angular-spectrum propagation |
146
+ | | `reaction_diffusion` | Gray–Scott feed rate from snapshots | reaction–diffusion time stepping |
147
+ | volumetric | `ct3d` | 3-D sparse-view CT | slice-stacked Radon transform |
148
+ | | `deconvolution3d` | fluorescence z-stack deconvolution | 3-D FFT convolution |
149
+ | | `dot3d` | diffuse optical tomography | diffusion equation, Robin boundaries |
150
+ | | `photoacoustic3d` | photoacoustic tomography, planar array | 3-D wave equation |
151
+
152
+ ## Interactive 3-D
153
+
154
+ <p align="center">
155
+ <a href="https://continuumcoder.github.io/NEFI/gallery/3d/"><img src="docs/assets/gallery/viewer-ct3d.png" width="820" alt="Interactive viewer: ground truth, smooth and edge-refined isosurfaces of a 3-D CT reconstruction, with IoU and Dice"></a>
156
+ </p>
157
+ <p align="center"><sub>Ground truth · smooth · edge-refined, one camera, IoU and Dice computed in the browser — a self-contained HTML file written by <code>nefi.viz.save_volume_viewer</code>. <a href="https://continuumcoder.github.io/NEFI/gallery/3d/">Rotate it live →</a></sub></p>
158
+
159
+ ## Reproducing the papers
160
+
161
+ `configs/nv_relaxometry_paper.yaml` and `configs/thermal_tomography_paper.yaml` hold the papers'
162
+ settings table by table. The [server runbook](https://continuumcoder.github.io/NEFI/reproduce_papers/)
163
+ lists the exact commands for the headline tables, their GPU cost and the caveats to check
164
+ first, and the [paper → code map](https://continuumcoder.github.io/NEFI/paper_mapping/) traces
165
+ every equation to the code.
166
+
167
+ ```bash
168
+ nefi bench configs/nv_relaxometry_paper.yaml --methods netmy,f1,grid,grid_f1 \
169
+ --classes all --by-class --n 64 --seeds 0,1,2 --device cuda # NeTMY Tab. 1
170
+ nefi run configs/thermal_tomography_paper.yaml --device cuda # one NeFTY specimen
171
+ ```
172
+
173
+ ## Development
174
+
175
+ ```bash
176
+ git clone https://github.com/ContinuumCoder/NEFI.git && cd NEFI
177
+ pip install -e ".[dev]" # + pytest, ruff, mypy, scikit-image, matplotlib, typer, rich
178
+ make test # fast CPU suite; make lint, make smoke
179
+ ```
180
+
181
+ The latest development version installs with
182
+ `pip install git+https://github.com/ContinuumCoder/NEFI.git`; see [CONTRIBUTING.md](CONTRIBUTING.md).
183
+
184
+ ## Documentation
185
+
186
+ [Get started](https://continuumcoder.github.io/NEFI/getting-started/) ·
187
+ [Tutorials](https://continuumcoder.github.io/NEFI/getting-started/#the-tutorials) ·
188
+ [Guides](https://continuumcoder.github.io/NEFI/guides/) ·
189
+ [Gallery](https://continuumcoder.github.io/NEFI/gallery/) ·
190
+ [Physics](https://continuumcoder.github.io/NEFI/physics/) ·
191
+ [Instances](https://continuumcoder.github.io/NEFI/instances/) ·
192
+ [Research](https://continuumcoder.github.io/NEFI/research/) ·
193
+ [API](https://continuumcoder.github.io/NEFI/api/) ·
194
+ [CLI](https://continuumcoder.github.io/NEFI/reference/cli/) ·
195
+ [Contributing](CONTRIBUTING.md) · [Changelog](CHANGELOG.md)
196
+
197
+ Every page is also readable as markdown under [`docs/`](docs/).
198
+
199
+ ## Citation
200
+
201
+ If you use nefi, please cite the papers it implements:
202
+
203
+ ```bibtex
204
+ @article{zhao2026netmy,
205
+ title = {Neural Fields for {NV}-Center Inverse Sensing},
206
+ author = {Zhao, Zhixuan and Zhong, Tao and Hu, Yixun and de Leon, Nathalie P. and
207
+ Allen-Blanchette, Christine},
208
+ journal = {arXiv preprint arXiv:2605.13988},
209
+ year = {2026}
210
+ }
211
+
212
+ @article{zhong2026nefty,
213
+ title = {Neural Field Thermal Tomography: A Differentiable Physics Framework for
214
+ Non-Destructive Evaluation},
215
+ author = {Zhong, Tao and Hu, Yixun and Zheng, Dongzhe and Sood, Aditya and
216
+ Allen-Blanchette, Christine},
217
+ journal = {arXiv preprint arXiv:2603.11045},
218
+ year = {2026}
219
+ }
220
+ ```
221
+
222
+ ## License
223
+
224
+ MIT © 2026 CAB Lab, Princeton University — see [LICENSE](LICENSE).
225
+
226
+ ## Acknowledgements
227
+
228
+ nefi is developed and maintained by the **CAB Lab at Princeton University**. It generalizes the
229
+ lab's NeTMY and NeFTY papers into one library, and we thank the authors of both papers.
@@ -0,0 +1,126 @@
1
+ """nefi — Neural-Field Inversion.
2
+
3
+ Physics-faithful, label-free inverse problems solved by per-measurement optimization of a
4
+ coordinate neural field through a differentiable forward operator.
5
+
6
+ Quick start::
7
+
8
+ import nefi
9
+ from nefi.instances.toy1d import make_problem
10
+
11
+ problem, gt, meas = make_problem()
12
+ result = nefi.invert(problem) # default: 2-stage multiscale curriculum
13
+ print(nefi.metrics.psnr(result.fields["x"], gt["x"]))
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ import logging as _logging
19
+
20
+ from . import fields, losses, metrics, operators, solve
21
+ from .config import config_hash, load_config, save_config
22
+ from .domain import Domain
23
+ from .errors import NefiError
24
+ from .fields import Bounded, GatedSoftplus, GridField, Heads, NeuralField, Softplus, SupportMasked
25
+ from .losses import L1, MSE, TV, LogMSE, LossSet, NormalizedMSE
26
+ from .measurement import Measurement
27
+ from .operators import FFTConvolution, Nuisance, Operator
28
+ from .problem import InverseProblem
29
+ from .registry import build, list_registered, register
30
+ from .solve import (
31
+ Curriculum,
32
+ EnergyScaleCorrection,
33
+ OptimConfig,
34
+ RefineReport,
35
+ Result,
36
+ Solver,
37
+ Stage,
38
+ batch_invert,
39
+ ensemble,
40
+ refine_edges,
41
+ )
42
+
43
+ __version__ = "0.1.0"
44
+
45
+ _logging.getLogger("nefi").addHandler(_logging.NullHandler())
46
+
47
+ from . import instances # noqa: E402 (registers built-in instances)
48
+
49
+
50
+ def invert(problem: InverseProblem, curriculum: Curriculum | None = None, **solver_kw) -> Result:
51
+ """One-call entry point: run ``Solver(problem, curriculum, **solver_kw).run()``."""
52
+ return Solver(problem, curriculum, **solver_kw).run()
53
+
54
+
55
+ def enable_logging(level: int = _logging.INFO) -> None:
56
+ """Send nefi logs to stderr (idempotent)."""
57
+ logger = _logging.getLogger("nefi")
58
+ if not any(
59
+ isinstance(h, _logging.StreamHandler) and not isinstance(h, _logging.NullHandler)
60
+ for h in logger.handlers
61
+ ):
62
+ h = _logging.StreamHandler()
63
+ h.setFormatter(_logging.Formatter("%(asctime)s %(levelname)s %(message)s", "%H:%M:%S"))
64
+ logger.addHandler(h)
65
+ logger.setLevel(level)
66
+
67
+
68
+ __all__ = [
69
+ "L1",
70
+ "MSE",
71
+ "TV",
72
+ "Bounded",
73
+ "Curriculum",
74
+ "Domain",
75
+ "EnergyScaleCorrection",
76
+ "FFTConvolution",
77
+ "GatedSoftplus",
78
+ "GridField",
79
+ "Heads",
80
+ "InverseProblem",
81
+ "LogMSE",
82
+ "LossSet",
83
+ "Measurement",
84
+ "NefiError",
85
+ "NeuralField",
86
+ "NormalizedMSE",
87
+ "Nuisance",
88
+ "Operator",
89
+ "OptimConfig",
90
+ "RefineReport",
91
+ "Result",
92
+ "Softplus",
93
+ "Solver",
94
+ "Stage",
95
+ "SupportMasked",
96
+ "batch_invert",
97
+ "build",
98
+ "config_hash",
99
+ "enable_logging",
100
+ "ensemble",
101
+ "fields",
102
+ "instances",
103
+ "list_registered",
104
+ "load_config",
105
+ "losses",
106
+ "metrics",
107
+ "operators",
108
+ "register",
109
+ "save_config",
110
+ "invert",
111
+ "refine_edges",
112
+ "solve",
113
+ ]
114
+
115
+ # --- bring-your-own-problem layer: prior catalogue + adaptive defaults -------------------------
116
+ from . import auto, priors # noqa: E402
117
+ from .auto import from_forward, quick_report # noqa: E402
118
+ from .priors import Prior # noqa: E402
119
+
120
+ __all__ += ["Prior", "auto", "from_forward", "priors", "quick_report"]
121
+
122
+ # --- auto-tuning layer: gauges, acquisition report, budget / LR, regularization, search --------
123
+ from . import autotune # noqa: E402
124
+ from .autotune import autotune_problem # noqa: E402
125
+
126
+ __all__ += ["autotune", "autotune_problem"]