Skip to content

Commit

Permalink
Added demo figure to docstring of bijective_distribution_matching
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Hearin committed Mar 30, 2018
1 parent ffa4b78 commit 53522d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions halotools/utils/distribution_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ def resample_x_to_match_y(x, y, bins, seed=None):


def bijective_distribution_matching(x_in, x_desired):
""" Replace the values in ``x_in`` with ``x_desired``,
preserving the rank-order of ``x_in``
""" Replace the values in ``x_in`` with ``x_desired``, preserving the rank-order of ``x_in``
Parameters
----------
Expand All @@ -149,6 +148,12 @@ def bijective_distribution_matching(x_in, x_desired):
>>> x_in = np.random.normal(loc=0, scale=0.5, size=npts)
>>> x_desired = np.random.normal(loc=2, scale=1, size=npts)
>>> x_out = bijective_distribution_matching(x_in, x_desired)
In the figure below, the left hand panel shows that the output distribution
is in exact agreement with the desired distribution. The right hand panel
shows that the rank-order of the input distribution is preserved.
.. image:: /_static/bijective_distribution_matching_demo.png
"""
x_in = np.atleast_1d(x_in)
x_desired = np.atleast_1d(x_desired)
Expand Down

0 comments on commit 53522d9

Please sign in to comment.