Skip to content

Adds an spherical basis that is an exact deprojection of an exponential surface density#199

Open
The9Cat wants to merge 29 commits intodevelfrom
SphericalExact
Open

Adds an spherical basis that is an exact deprojection of an exponential surface density#199
The9Cat wants to merge 29 commits intodevelfrom
SphericalExact

Conversation

@The9Cat
Copy link
Member

@The9Cat The9Cat commented Feb 3, 2026

Summary

Adds an spherical basis that is an exact deprojection of an exponential surface density. Specifically, using the Abel inversion, the exponential surface density
$$\qquad\Sigma(R)=\Sigma_0 e^{-R/a}$$
for $R>0$ deprojects to
$$\qquad\rho(r)=\frac{\Sigma_0}{\pi a} K_0\left(\frac{r}{a}\right).$$

Implementation

The exact deprojected spherical basis is the default in this branch and has the ascii tag ExpDeproj. The previous default was Exponential. The cumulative mass needed by SLGridSph is analytic but only in terms of modified Bessel and Struve functions. The latter is not available in the stdlib. The cumulative mass is computed using brute-force quadrature instead.

Note

I would recommend renaming ExpDeproj to Exponential and delete the older, original implementation. I've left both for testing.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new spherical “exponential deprojection” density model (based on the Abel inversion / modified Bessel (K_0)) and wires it into the cylindrical EOF basis generation as the new default option, with an additional configurable scale-length bias factor and a small test driver.

Changes:

  • Introduces ExpDeproj profile implementation (density + tabulated enclosed-mass) and exposes it as a selectable EmpCylSL model (ExpSphere).
  • Switches the default spherical model for EmpCylSL EOF generation to the new deprojected exponential-sphere option and updates cache validation to include the model label.
  • Adds a bias configuration parameter to rescale the effective disk scale length used for basis construction; adds a testED executable.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
utils/Test/testED.cc Adds a small executable to numerically re-project the deprojected density and compare against an exponential surface density.
utils/Test/CMakeLists.txt Builds the new testED utility.
src/Cylinder.cc Adds bias config support and applies it to the scale length passed into the cylindrical basis constructor.
src/Cylinder.H Documents and stores the new bias parameter.
include/ExpDeproj.H Declares the new ExpDeproj profile helper.
include/EmpCylSL.H Adds ExpSphere to EmpModel and stores a precomputed ExpDeproj instance.
exputil/ExpDeproj.cc Implements ExpDeproj density and tabulated/interpolated enclosed mass.
exputil/EmpCylSL.cc Makes ExpSphere the default model, routes densR/massR to ExpDeproj, adds debug output, and tightens HDF5 cache validation via model.
exputil/CMakeLists.txt Compiles ExpDeproj.cc into exputil.
expui/BiorthBasis.cc Adds bias, changes default mtype, and expands mtype parsing to include the new model.
expui/BiorthBasis.H Stores the new bias parameter in the cylindrical basis configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The9Cat and others added 2 commits February 4, 2026 10:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

Copilot AI commented Feb 4, 2026

@The9Cat I've opened a new pull request, #201, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI commented Feb 4, 2026

@The9Cat I've opened a new pull request, #202, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI commented Feb 4, 2026

@The9Cat I've opened a new pull request, #203, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 6 commits February 4, 2026 15:11
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Copilot AI and others added 9 commits February 4, 2026 15:16
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Fix divide-by-zero in ExpDeproj::initialize() when ngrid < 2
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Revert incorrect naming changes - ExpSphere is the correct model name
Add input validation for bias parameter in cylindrical basis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants