#NEWLINE# def quantile( self , q ) : #NEWLINE# #INDENT# ' \n        Computes the quantile of a specific value, ie. computes F(q) where F denotes\n        the CDF of the distribution. \n\n        ' #NEWLINE# t = 0 #NEWLINE# N = float ( self . n ) #NEWLINE# for ( i , key ) in enumerate ( self . C . keys ( ) ) : #NEWLINE# #INDENT# c_i = self . C [ key ] #NEWLINE# if ( i == ( len ( self ) - 1 ) ) : #NEWLINE# #INDENT# delta = ( ( c_i . mean - self . C . prev_item ( key ) [ 1 ] . mean ) / 2.0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# delta = ( ( self . C . succ_item ( key ) [ 1 ] . mean - c_i . mean ) / 2.0 ) #NEWLINE# #UNINDENT# z = max ( ( - 1 ) , ( ( q - c_i . mean ) / delta ) ) #NEWLINE# if ( z < 1 ) : #NEWLINE# #INDENT# return ( ( t / N ) + ( ( ( c_i . count / N ) * ( z + 1 ) ) / 2 ) ) #NEWLINE# #UNINDENT# t += c_i . count #NEWLINE# #UNINDENT# return 1