Module ImportFrom alias alias Import alias identifier ImportFrom alias identifier ImportFrom alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If Call NameLoad AttributeLoad NameLoad attr NameLoad body Return Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If BoolOpAnd UnaryOpNot Call NameLoad NameLoad NameLoad CompareIsNot NameLoad NameLoad body Expr Call NameLoad Str NameLoad keyword Str keyword Str Assign AttributeStore NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str If Call NameLoad AttributeLoad NameLoad attr NameLoad body Return Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If BoolOpAnd UnaryOpNot Call NameLoad NameLoad NameLoad CompareIsNot NameLoad NameLoad body Expr Call NameLoad Str NameLoad keyword Str keyword Str Assign AttributeStore NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If CompareIsNot NameLoad NameLoad body Expr Call NameLoad Str NameLoad keyword Str Assign AttributeStore NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If CompareIsNot NameLoad NameLoad body Expr Call NameLoad Str NameLoad keyword Str Assign AttributeStore NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str If CompareIsNot AttributeLoad NameLoad attr NameLoad body Return AttributeLoad NameLoad attr orelse If CompareIs AttributeLoad NameLoad attr NameLoad body Return NameLoad orelse Expr Call AttributeLoad NameLoad attr Assign NameStore BinOpAdd Num AttributeLoad NameLoad attr Assign NameStore BinOpMult BinOpDiv AttributeLoad NameLoad attr NameLoad BinOpDiv BinOpMult BinOpMult Num NameLoad BinOpSub BinOpPow AttributeLoad NameLoad attr NameLoad BinOpPow AttributeLoad NameLoad attr NameLoad BinOpPow AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If CompareIsNot NameLoad NameLoad body Expr Call NameLoad Str NameLoad keyword Str If CompareIsNot AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str If CompareIsNot AttributeLoad NameLoad attr NameLoad body Return AttributeLoad NameLoad attr orelse If CompareIs AttributeLoad NameLoad attr NameLoad body Return NameLoad orelse Expr Call AttributeLoad NameLoad attr Assign NameStore BinOpAdd Num AttributeLoad NameLoad attr Assign NameStore BinOpDiv BinOpMult AttributeLoad NameLoad attr NameLoad BinOpDiv BinOpMult BinOpMult Num NameLoad BinOpSub BinOpPow AttributeLoad NameLoad attr NameLoad BinOpPow AttributeLoad NameLoad attr NameLoad BinOpPow AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If CompareIsNot NameLoad NameLoad body Expr Call NameLoad Str NameLoad keyword Str If CompareIsNot AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If CompareIs NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad orelse If UnaryOpNot Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore AttributeLoad NameLoad attr attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If Call NameLoad NameLoad NameLoad body Assign AttributeStore NameLoad attr Call NameLoad NameLoad orelse Assign AttributeStore NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body If CompareIs AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Str If CompareIs AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Str If CompareIs AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Str If CompareIs AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Str If Call NameLoad AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Str If Call NameLoad AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Return CompareGt AttributeLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If Call NameLoad NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Raise Call NameLoad Str Expr Call AttributeLoad NameLoad attr If CompareLtE AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore BinOpMult AttributeLoad NameLoad attr BinOpPow BinOpDiv NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index CompareLt NameLoad AttributeLoad NameLoad attr Num Assign SubscriptStore NameLoad Index CompareGt NameLoad AttributeLoad NameLoad attr Num If CompareIs AttributeLoad NameLoad attr NameLoad body Assign NameStore BinOpDiv AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpMult NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Assign NameStore BinOpMult NameLoad NameLoad If BoolOpAnd UnaryOpNot NameLoad CompareIsNot AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign SubscriptStore NameLoad Index UnaryOpInvert NameLoad Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return BinOpMult AttributeLoad NameLoad attr BinOpPow BinOpDiv NameLoad AttributeLoad NameLoad attr BinOpDiv Num AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr If CompareLtE AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return BinOpDiv BinOpMult AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr BinOpPow AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If CompareIsNot AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Str orelse Assign AttributeStore NameLoad attr Call NameLoad Return AttributeLoad NameLoad attr decorator_list decorator_list
N/A __future__ print_function division N/A numpy np astropy log logger dust SphericalDust grid SphericalPolarGrid CylindricalPolarGrid util.constants pi util.convenience OptThinRadius util.integrate integrate_powerlaw util.validator validate_scalar core Envelope bipolar_cavity BipolarCavity PowerLawEnvelope N/A Envelope N/A N/A 
    This class implements the density structure for a spherically symmetric
    power-law envelope, with a density given by:

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

    Once the :class:`~hyperion.densities.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

    :class:`~hyperion.densities.PowerLawEnvelope` instances can only be used
    with spherical polar grids at this time.
     __init__ N/A N/A self N/A N/A N/A N/A self rmin None N/A N/A self rmax None N/A N/A self power None N/A N/A self r_0 None N/A N/A self rho_0 None N/A N/A self mass None N/A N/A self cavity None N/A N/A self star None N/A N/A self dust None N/A N/A N/A self _freeze N/A rmin N/A N/A self N/A N/A N/A inner radius (cm) N/A N/A isinstance N/A self _rmin OptThinRadius N/A N/A N/A N/A N/A self _rmin evaluate N/A self star N/A self dust N/A N/A N/A self _rmin N/A property rmin N/A N/A self value N/A N/A N/A N/A N/A N/A isinstance value OptThinRadius N/A value None N/A N/A N/A validate_scalar rmin value domain positive extra  or an OptThinRadius instance N/A N/A self _rmin value N/A N/A rmin setter rmax N/A N/A self N/A N/A N/A outer radius (cm) N/A N/A isinstance N/A self _rmax OptThinRadius N/A N/A N/A N/A N/A self _rmax evaluate N/A self star N/A self dust N/A N/A N/A self _rmax N/A property rmax N/A N/A self value N/A N/A N/A N/A N/A N/A isinstance value OptThinRadius N/A value None N/A N/A N/A validate_scalar rmax value domain positive extra  or an OptThinRadius instance N/A N/A self _rmax value N/A N/A rmax setter power N/A N/A self N/A N/A N/A density power-law exponent N/A N/A self _power N/A property power N/A N/A self value N/A N/A N/A N/A value None N/A N/A N/A validate_scalar power value domain real N/A N/A self _power value N/A N/A power setter r_0 N/A N/A self N/A N/A N/A radius at which ``rho_0`` is defined (cm) N/A N/A self _r_0 N/A property r_0 N/A N/A self value N/A N/A N/A N/A value None N/A N/A N/A validate_scalar r_0 value domain positive N/A N/A self _r_0 value N/A N/A r_0 setter mass N/A N/A self N/A N/A N/A total mass (g) N/A N/A N/A self _mass None N/A N/A N/A self _mass N/A N/A N/A N/A self _rho_0 None N/A N/A None N/A N/A N/A N/A self _check_all_set N/A alpha N/A 3.0 N/A self power N/A mass N/A N/A N/A self rho_0 alpha N/A N/A N/A 4.0 pi N/A N/A N/A self rmax alpha N/A N/A self rmin alpha N/A N/A self r_0 N/A self power N/A mass N/A property mass N/A N/A self value N/A N/A N/A N/A value None N/A N/A N/A validate_scalar mass value domain positive N/A N/A N/A self _rho_0 None N/A N/A N/A N/A logger warn Overriding value of rho_0 with value derived from mass N/A N/A self _rho_0 None N/A N/A self _mass value N/A N/A mass setter rho_0 N/A N/A self N/A N/A N/A density at ``r_0`` (g/cm^3) N/A N/A N/A self _rho_0 None N/A N/A N/A self _rho_0 N/A N/A N/A N/A self _mass None N/A N/A None N/A N/A N/A N/A self _check_all_set N/A alpha N/A 3.0 N/A self power N/A rho_0 N/A N/A N/A self mass alpha N/A N/A N/A 4.0 pi N/A N/A N/A self rmax alpha N/A N/A self rmin alpha N/A N/A self r_0 N/A self power N/A rho_0 N/A property rho_0 N/A N/A self value N/A N/A N/A N/A value None N/A N/A N/A validate_scalar rho_0 value domain positive N/A N/A N/A self _mass None N/A N/A N/A N/A logger warn Overriding value of mass with value derived from rho_0 N/A N/A self _mass None N/A N/A self _rho_0 value N/A N/A rho_0 setter cavity N/A N/A self N/A N/A N/A BipolarCavity instance N/A N/A self _cavity N/A property cavity N/A N/A self value N/A N/A N/A N/A value None N/A N/A N/A self _cavity None N/A N/A N/A N/A isinstance value BipolarCavity N/A N/A N/A ValueError cavity should be an instance of BipolarCavity N/A N/A self _cavity value N/A N/A N/A self _cavity _envelope self N/A N/A cavity setter dust N/A N/A self N/A N/A N/A dust properties (filename or dust object) N/A N/A self _dust N/A property dust N/A N/A self value N/A N/A N/A N/A isinstance value basestring N/A N/A N/A self _dust N/A SphericalDust value N/A N/A N/A self _dust value N/A N/A dust setter _check_all_set N/A N/A self N/A N/A N/A N/A N/A self r_0 None N/A N/A N/A Exception r_0 is not set N/A N/A N/A self rmin None N/A N/A N/A Exception rmin is not set N/A N/A N/A self rmax None N/A N/A N/A Exception rmax is not set N/A N/A N/A self power None N/A N/A N/A Exception power is not set N/A N/A isinstance N/A self rmin OptThinRadius N/A N/A N/A Exception Inner envelope radius needs to be computed first N/A N/A isinstance N/A self rmax OptThinRadius N/A N/A N/A Exception Outer envelope radius needs to be computed first N/A exists N/A N/A self N/A N/A N/A N/A N/A self rho_0 0.0 N/A density N/A N/A self grid ignore_cavity N/A False N/A N/A 
        Return the density grid

        Parameters
        ----------
        grid : :class:`~hyperion.grid.SphericalPolarGrid` or :class:`~hyperion.grid.CylindricalPolarGrid` instance.
            The spherical 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 envelope
            inside each cell. The shape of this array is the same as
            ``grid.shape``.
         N/A N/A isinstance grid SphericalPolarGrid N/A N/A r N/A grid gr N/A N/A N/A isinstance grid CylindricalPolarGrid N/A N/A r N/A N/A np hypot N/A grid gw N/A grid gz N/A N/A N/A TypeError grid should be a SphericalPolarGrid or CylindricalPolarGrid instance N/A N/A N/A self _check_all_set N/A N/A N/A self rmax N/A self rmin N/A N/A N/A N/A logger warn Ignoring power-law envelope, since rmax < rmin N/A N/A N/A np zeros N/A grid shape N/A rho N/A N/A self rho_0 N/A N/A r N/A self r_0 N/A self power N/A N/A rho N/A N/A r N/A self rmin 0.0 N/A N/A rho N/A N/A r N/A self rmax 0.0 N/A N/A N/A self _rho_0 None N/A N/A norm N/A N/A self mass N/A N/A np sum N/A rho N/A grid volumes N/A N/A N/A logger info N/A Normalization factor for envelope mass: %5.2f norm N/A rho N/A rho norm N/A N/A N/A ignore_cavity N/A N/A self cavity None N/A N/A mask N/A N/A N/A self cavity mask grid N/A N/A rho N/A N/A mask 0.0 N/A rho N/A outermost_radius N/A N/A self rho N/A N/A N/A 
        Find the outermost radius at which the density of the envelope has
        fallen to `rho`.

        Parameters
        ----------
        rho : float
            The density for which to determine the radius

        Returns
        -------
        r : float
            The radius at which the density has fallen to ``rho``
         N/A N/A N/A self r_0 N/A N/A rho N/A self rho_0 N/A 1.0 N/A self power N/A midplane_cumulative_density N/A N/A self r N/A N/A N/A 
        Find the cumulative column density as a function of radius.

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

        Parameters
        ----------
        r : np.ndarray
            Array of values of the radius up to which to tabulate the
            cumulative density.

        Returns
        -------
        rho : np.ndarray
            Array of values of the cumulative density.
         N/A N/A N/A self _check_all_set N/A N/A N/A self rmax N/A self rmin N/A N/A N/A N/A logger warn Ignoring power-law envelope, since rmax < rmin N/A N/A N/A np zeros N/A r shape N/A N/A N/A N/A self rho_0 N/A integrate_powerlaw N/A self rmin N/A N/A r clip N/A self rmin N/A self rmax N/A self power N/A N/A self r_0 N/A self power N/A add_bipolar_cavity N/A N/A self N/A N/A N/A 
        Add a bipolar cavity to the envelope.

        Returns
        -------
        cavity : :class:`BipolarCavity` instance
            The bipolar cavity instance, which can then be used to set the
            parameters of the cavity.
         N/A N/A N/A self cavity None N/A N/A N/A Exception Envelope already has a bipolar cavity N/A N/A N/A self cavity N/A BipolarCavity N/A N/A self cavity N/A N/A