hyperion.densities.PowerLawEnvelope

class hyperion.densities.PowerLawEnvelope

This class implements the density structure for a spherically symmetric power-law envelope, with a density given by:

\rho(r) = \rho_0^{\rm env}\,\left(\frac{r}{r_0}\right)^\gamma \\

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

>>> from hyperion.util.constants import msun, au, pc
>>> from hyperion.densities.power_law_envelope import PowerLawEnvelope
>>> envelope = PowerLawEnvelope()
>>> envelope.mass = msun
>>> envelope.rmin = 0.1 * au
>>> envelope.rmax = pc

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

Attributes

mass

total mass (g)

rho_0

density at r_0 (g/cm^3)

r_0

radius at which rho_0 is defined (cm)

rmax

outer radius (cm)

rmin

inner radius (cm)

power

density power-law exponent

dust

dust properties (filename or dust object)

Methods

density(self, grid[, ignore_cavity])

Return the density grid

outermost_radius(self, rho)

Find the outermost radius at which the density of the envelope has fallen to rho.

midplane_cumulative_density(self, r)

Find the cumulative column density as a function of radius.

add_bipolar_cavity(self)

Add a bipolar cavity to the envelope.

Methods (detail)

density(self, grid, ignore_cavity=False)

Return the density grid

Parameters
gridSphericalPolarGrid or CylindricalPolarGrid instance.

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

Returns
rhonp.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.

outermost_radius(self, rho)

Find the outermost radius at which the density of the envelope has fallen to rho.

Parameters
rhofloat

The density for which to determine the radius

Returns
rfloat

The radius at which the density has fallen to rho

midplane_cumulative_density(self, r)

Find the cumulative column density as a function of radius.

The cumulative density is measured outwards from the origin, and in the midplane.

Parameters
rnp.ndarray

Array of values of the radius up to which to tabulate the cumulative density.

Returns
rhonp.ndarray

Array of values of the cumulative density.

add_bipolar_cavity(self)

Add a bipolar cavity to the envelope.

Returns
cavityBipolarCavity instance

The bipolar cavity instance, which can then be used to set the parameters of the cavity.