#NEWLINE# def _mass_to_density( self , mass ) : #NEWLINE# #INDENT# "\n        Convert the specified mass level value into a density level value.\n\n        Parameters\n        ----------\n        mass : float\n            Float in the interval [0.0, 1.0], with the desired fraction of all\n            points.\n\n        Returns\n        -------\n        level: float\n            Density level corresponding to the 'mass' fraction of background\n            points.\n        " #NEWLINE# density_order = _np . argsort ( self . density ) #NEWLINE# n = len ( self . density ) #NEWLINE# mass_fraction = max ( 0 , ( int ( round ( ( mass * n ) ) ) - 1 ) ) #NEWLINE# level_index = density_order [ mass_fraction ] #NEWLINE# level = mass_fraction . density [ level_index ] #NEWLINE# return level