Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add code to calculate an approximate (1-eps) quantile
We seek to calculate an approximate 1-eps quantile for the maximum of N chi2_1 random variables. It turns out a pretty good approximation is to use a (1-eps/N) quantile of the chi2_1 distribution. This commit introduces a function, get_transition(), which takes as a mandatory argument the number of chi2_1 random variables (computed as the length of the array of non-infinite chi2_1 values being plotted), and (currently) returns a 90% quantile for the maximum of those variables, using the formula above. To do so, we make use of the scipy.stats chi2 class, which comes with a handy ppf() method, which computes the inverse of the CDF. (Thus, ppf(.95, 1) computes the 95% quantile of the chi2_1 distribution.) After returning this quantile, we then use it to define the transition point for the LinLogNorm class(). What this does is ensure that the chi2_1 variables which are substantially outside the (1-eps) quantile are mapped into the interval [.5, 1] in the norm, which, using our current colormap, ensures they are a brighter red (instead of a greyscale). Importantly, this change allows the transition point to depend on the number of variables being plotted. Particularly for plots with large numbers of variables (such as those whose maximum sequence length is large), this ensures we do not accidentally mark values as being "too high", when they are in fact completely consistent with drawing many chi2_1 random variables.
- Loading branch information