text stringlengths 0 828 |
|---|
+ https://en.wikipedia.org/wiki/Error_function#Inverse_functions |
+ http://functions.wolfram.com/GammaBetaErf/InverseErf/ |
Examples |
-------- |
>>> round(erfinv(0.1), 12) |
0.088855990494 |
>>> round(erfinv(0.5), 12) |
0.476936276204 |
>>> round(erfinv(-0.5), 12) |
-0.476936276204 |
>>> round(erfinv(0.95), 12) |
1.38590382435 |
>>> round(erf(erfinv(0.3)), 3) |
0.3 |
>>> round(erfinv(erf(0.5)), 3) |
0.5 |
>>> erfinv(0) |
0 |
>>> erfinv(1) |
inf |
>>> erfinv(-1) |
-inf |
"""""" |
if abs(z) > 1: |
raise ValueError(""`z` must be between -1 and 1 inclusive"") |
# Shortcut special cases |
if z == 0: |
return 0 |
if z == 1: |
return inf |
if z == -1: |
return -inf |
# otherwise calculate things. |
return _ndtri((z + 1) / 2.0) / math.sqrt(2)" |
1034,"def get_cmap(name, lut=None): |
"""""" |
Returns the specified colormap. |
Parameters |
---------- |
name: str or :class:`matplotlib.colors.Colormap` |
If a colormap, it returned unchanged. |
%(cmap_note)s |
lut: int |
An integer giving the number of entries desired in the lookup table |
Returns |
------- |
matplotlib.colors.Colormap |
The colormap specified by `name` |
See Also |
-------- |
show_colormaps: A function to display all available colormaps |
Notes |
----- |
Different from the :func::`matpltolib.pyplot.get_cmap` function, this |
function changes the number of colors if `name` is a |
:class:`matplotlib.colors.Colormap` instance to match the given `lut`."""""" |
if name in rcParams['colors.cmaps']: |
colors = rcParams['colors.cmaps'][name] |
lut = lut or len(colors) |
return FixedColorMap.from_list(name=name, colors=colors, N=lut) |
elif name in _cmapnames: |
colors = _cmapnames[name] |
lut = lut or len(colors) |
return FixedColorMap.from_list(name=name, colors=colors, N=lut) |
else: |
cmap = mpl_get_cmap(name) |
# Note: we could include the `lut` in the call of mpl_get_cmap, but |
# this raises a ValueError for colormaps like 'viridis' in mpl version |
# 1.5. Besides the mpl_get_cmap function does not modify the lut if |
# it does not match |
if lut is not None and cmap.N != lut: |
cmap = FixedColorMap.from_list( |
name=cmap.name, colors=cmap(np.linspace(0, 1, lut)), N=lut) |
return cmap" |
1035,"def _get_cmaps(names): |
""""""Filter the given `names` for colormaps"""""" |
import matplotlib.pyplot as plt |
available_cmaps = list( |
chain(plt.cm.cmap_d, _cmapnames, rcParams['colors.cmaps'])) |
names = list(names) |
wrongs = [] |
for arg in (arg for arg in names if (not isinstance(arg, Colormap) and |
arg not in available_cmaps)): |
if isinstance(arg, str): |
similarkeys = get_close_matches(arg, available_cmaps) |
if similarkeys != []: |
warn(""Colormap %s not found in standard colormaps.\n"" |
""Similar colormaps are %s."" % (arg, ', '.join(similarkeys))) |
else: |
warn(""Colormap %s not found in standard colormaps.\n"" |
""Run function without arguments to see all colormaps"" % arg) |
names.remove(arg) |
wrongs.append(arg) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.