Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "from_r0" to Burkert potential #370

Merged
merged 6 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ New Features
computing basis function coefficients for the SCF potential from discrete particles.

- Added the Burkert potential as a built-in cpotential.
- Added a method to generate the Burkert potential with just r0 as an input

Bug fixes
---------
Expand Down
17 changes: 17 additions & 0 deletions gala/potential/potential/builtin/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,23 @@ class BurkertPotential(CPotentialBase):

Wrapper = BurkertWrapper


@classmethod
def from_r0(cls, r0, units=None):
r"""
from_r0(r0, units=None)

Initialize a Burkert potential from the core radius, ``r0``.
See Equations 4 and 5 of Mori & Burkert.

Parameters
----------
r0 : :class:`~astropy.units.Quantity`, numeric [length]
The core radius of the Burkert potential.
"""
rho_d0 = 1.46e-24 * (r0 / (3.07 * u.kpc))**(-2/3) * (u.g / u.cm**3)
adrn marked this conversation as resolved.
Show resolved Hide resolved
return cls(rho=rho_d0, r0=r0, units=units)


# ============================================================================
# Flattened, axisymmetric models
Expand Down
11 changes: 11 additions & 0 deletions gala/potential/potential/tests/test_all_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,3 +553,14 @@ def test_against_sympy(self):
@pytest.mark.skip(reason="Hessian not implemented for Burkert potential")
def test_hessian(self):
pass

def test_from_r0(self):
# Test against values from Zhu+2023
pot = p.BurkertPotential.from_r0(r0=11.87 * u.kpc, units=galactic)

rho = pot.parameters['rho'].to(u.g / u.cm ** 3)
rho_check = 5.93e-25 * u.g / u.cm ** 3

# Check a 1% tolerance on inferred density against published values
assert abs(rho - rho_check) / rho_check < 0.01

Loading