arXiv:2604.24838astro-ph.COastro-ph.IM2026-04被引 1

AI辅助编写宇宙微波背景谱畸变计算代码,精度获物理专家验证。

spectroxide: A code package for computing cosmic microwave background spectral distortions

  • 用AI生成1.45万行代码,实现从高红移到现在的光子演化求解。
  • 可计算任意热和光子注入引起的谱畸变,与已有结果一致。
  • 适合粒子宇宙学、数值模拟研究者参考人机协作开发范式。

我们介绍 spectroxide,一个用于计算宇宙微波背景谱畸变的代码包,其中约14,500行Rust代码、Python接口及约400个自动化测试均由人工智能助手Claude Code在人类物理学家监督下编写。求解器在康普顿散射、双康普顿辐射和轫致辐射作用下演化光子玻尔兹曼方程,从红移z ~ 5×10⁶演进至现在,计算该红移范围内任意热和光子注入引发的谱畸变。目前尚无同类完全开源代码公开可用;我们通过解析极限、已发表谱图及公开预计算格林函数表进行了验证。本文将开发过程作为人工智能辅助科学计算的案例研究,强调领域知识如何发现自动测试未捕获的物理错误(如量纲因子错误、近抵消误差),并提出人机协作开发的最佳实践建议。spectroxide 已在GitHub上公开。

原文摘要 · Abstract (English)

We present spectroxide, a code package for computing cosmic microwave background spectral distortions in which all ${\sim}14{,}500$ lines of Rust code, Python interface, and ${\sim}400$ automated tests were written by an AI assistant (Claude Code) under human physicist supervision. The solver evolves the photon Boltzmann equation under Compton scattering, double Compton emission, and Bremsstrahlung from $z \sim 5 \times 10^6$ to the present, computing spectral distortions from arbitrary heat and photon injection within this redshift range. No fully open-source code of this kind is publicly available; we validate against analytic limits, published spectra, and publicly available precomputed Green's function tables. We document the development as a case study in AI-assisted scientific computing, highlighting how domain expertise caught physics bugs (incorrect dimensional prefactors, near-cancellation errors) that evaded the full automated test suite, and provide recommendations for best practices in human--AI collaborative development of scientific software. We make spectroxide publicly available on GitHub.

宇宙学代码生成谱畸变人机协作

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。