class hyperion.densities.AmbientMedium(rho=None, rmin=None, rmax=None, subtract=[])

This class implements the density structure for an ambient density medium defined by a constant density, and an inner and outer radius.

Once the AmbientMedium class has been instantiated, the parameters for the density structure can be set via attributes:

>>> from hyperion.util.constants import au, pc
>>> from hyperion.densities.ambient_medium import AmbientMedium
>>> ambient = AmbientMedium()
>>> ambient.rho = 1.e-20  # cgs
>>> ambient.rmin = 0.1 * au  # cm
>>> ambient.rmax = pc  # cm

AmbientMedium instances can only be used with spherical polar grids at this time.

By default, the ambient medium simply adds a constant density rho of dust to the whole model between the inner and outer radius. However, it is possible to pass components that should be subtracted from the constant density using the subtract= argument. In the following example:

>>> e = PowerLawEnvelope()
>>> AmbientMedium(subtract=[e])

the ambient medium does not simply add a constant density rho of dust everywhere, but it adds dust such that the density never falls below rho between rmin and rmax - that is, it subtracts the density of component e from the rho, with a minimum of zero. In regions where the density of component of e is larger than rho, no dust is added.


rho Density of the ambient medium (g/cm^3)
rmin inner radius (cm)
rmax outer radius (cm)


density(grid) Return the density grid

Methods (detail)


Return the density grid

grid : SphericalPolarGrid instance.

The spherical polar grid object containing information about the position of the grid cells.

rho : np.ndarray

A 3-dimensional array containing the density of the envelope inside each cell. The shape of this array is the same as grid.shape.