Adds an spherical basis that is an exact deprojection of an exponential surface density#199
Open
Adds an spherical basis that is an exact deprojection of an exponential surface density#199
Conversation
added 10 commits
February 3, 2026 11:07
…l disk as an option to EmpCylSL
Contributor
There was a problem hiding this comment.
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
ExpDeprojprofile implementation (density + tabulated enclosed-mass) and exposes it as a selectableEmpCylSLmodel (ExpSphere). - Switches the default spherical model for
EmpCylSLEOF generation to the new deprojected exponential-sphere option and updates cache validation to include the model label. - Adds a
biasconfiguration parameter to rescale the effective disk scale length used for basis construction; adds atestEDexecutable.
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.
Co-authored-by: Copilot <175728472+Copilot@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>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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}$$ $R>0$ deprojects to
$$\qquad\rho(r)=\frac{\Sigma_0}{\pi a} K_0\left(\frac{r}{a}\right).$$
for
Implementation
The exact deprojected spherical basis is the default in this branch and has the ascii tag
ExpDeproj. The previous default wasExponential. The cumulative mass needed bySLGridSphis 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
ExpDeprojtoExponentialand delete the older, original implementation. I've left both for testing.