@doc_sub(_doc_make_rank)<EOL>def _make_rank(dist_obj, n, mu, sigma, crit=<NUM_LIT:0.5>, upper=<NUM_LIT>, xtol=<NUM_LIT:1>):
qs = (np.arange(<NUM_LIT:1>, n + <NUM_LIT:1>) - <NUM_LIT:0.5>) / n<EOL>rank = np.empty(len(qs))<EOL>brute_ppf = lambda val, prob: prob - dist_obj.cdf(val, mu, sigma)<EOL>qs_less = qs <= crit<EOL>ind = np.sum(qs_less)<EOL>rank[qs_less] = dist_obj.ppf(qs[qs_less], mu, sigma)<EOL>for i, tq in enumerate(qs[~qs_less]):<EOL><INDENT>j = ind + i<EOL>try:<EOL><INDENT>rank[j] = np.abs(np.ceil(optim.brentq(brute_ppf, -<NUM_LIT:1>, upper,<EOL>args=(tq,), xtol=xtol)))<EOL><DEDENT>except ValueError:<EOL><INDENT>rank[j:] = np.repeat(rank[j - <NUM_LIT:1>], len(rank[j:]))<EOL>break<EOL><DEDENT><DEDENT>return rank<EOL>
Make rank distribution using both ppf and brute force.

Setting crit = 1 is equivalent to just using the ppf

Parameters
----------
{0}