Note
Click here to download the full example code
Examples in 1D¶
This section contains several examples on how to generate 1D data with
pyclugen. To run the examples we first need to import the
clugen()
function:
To plot these examples we use the plot_examples_1d
function:
Out:
/home/runner/work/pyclugen/pyclugen/docs/docs/examples/plot_functions.py:15: DeprecationWarning:
Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
(to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
but was not found to be installed on your system.
If this would cause problems for you,
please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466
import pandas as pd
Basic 1D example with density plot¶
# Custom proj_dist_fn: point projections placed using the Weibull distribution
def proj_weibull(len, n, rng):
return len / 2 * rng.weibull(1.5, size=n)
e082 = clugen(1, 3, 1000, [1], 0, [10], 6, 1.5, 0, rng=seed)
e083 = clugen(1, 3, 1000, [1], 0, [10], 6, 1.5, 0, rng=seed, proj_dist_fn="unif")
e084 = clugen(1, 3, 1000, [1], 0, [10], 6, 1.5, 0, rng=seed, proj_dist_fn=proj_weibull)
plot_examples_1d(
e082, "e082: proj_dist_fn = 'norm' (default)",
e083, "e083: proj_dist_fn = 'unif'",
e084, "e084: custom proj_dist_fn (Weibull)")
Total running time of the script: ( 0 minutes 1.484 seconds)
Download Python source code: plot_1_1d_examples.py