hyperion.densities.BipolarCavity

class hyperion.densities.BipolarCavity(theta_0=None, power=None, r_0=None, rho_0=None, rho_exp=0.0, cap_to_envelope_density=False, dust=None)

This class implements the density structure for a bipolar cavity in an envelope, with a density given by:

\rho(r) = \rho_0\,\left(\frac{r}{r_0}\right)^{-e} \\

inside a volume defined by two parabolic surfaces with half-opening angle theta_0 at r_0.

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

>>> from hyperion.densities.bipolar_cavity import BipolarCavity
>>> cavity = BipolarCavity()
>>> cavity.theta_0 = 10.
>>> cavity.power = 0.

In most cases however, you should not have to instantiate a BipolarCavity class directly, but instead you should use the add_bipolar_cavity method on the Envelope classes (see for example UlrichEnvelope or PowerLawEnvelope classes).

Attributes

r_0 radius at which theta_0 and rho_0 are defined (cm)
theta_0 Cavity half-opening angle at r_0
rho_0 density at r_0 (g/cm^3)
power Power of the cavity shape
rho_exp density power-law exponent
dust dust properties (filename or dust object)

Methods

density(grid) Return the density grid
mask(grid) Compute the shape of the bipolar cavity.

Methods (detail)

density(grid)

Return the density grid

Parameters:

grid : SphericalPolarGrid or CylindricalPolarGrid instance.

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

Returns:

rho : np.ndarray

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

mask(grid)

Compute the shape of the bipolar cavity.

Parameters:

grid : SphericalPolarGrid or CylindricalPolarGrid instance.

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

Returns:

mask : np.ndarray

A 3-dimensional booleand array indicating whether we are inside or outside the bipolar cavity (True is inside). The shape of this array is the same as grid.shape.