Skip to content

Commit

Permalink
adds working code-sample to quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
jlnav committed Aug 14, 2023
1 parent 8117090 commit a0de876
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ def __getattr__(cls, name):
# documentation.
#
html_theme_options = {
"navigation_depth": 3,
"collapse_navigation": False,
"light_logo": "libE_logo.png",
"dark_logo": "libE_logo_white.png",
}
Expand Down
36 changes: 35 additions & 1 deletion docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,41 @@ Basic Usage

.. basic_usage
See the :doc:`tutorial<tutorials/local_sine_tutorial>` to try out libEnsemble.
Create an ``Ensemble``, then customize with general settings, simulation and generator parameters,
and an exit condition. Run the following via ``python this_file.py --comms local --nworkers 4``:

.. code-block:: python
:linenos:
import numpy as np
from libensemble import Ensemble
from libensemble.gen_funcs.sampling import latin_hypercube_sample as gen_f
from libensemble.sim_funcs.one_d_func import one_d_example as sim_f
from libensemble.specs import ExitCriteria, GenSpecs, SimSpecs
if __name__ == "__main__":
sampling = Ensemble()
sampling.sim_specs = SimSpecs(sim_f=sim_f, inputs=["x"], out=[("f", float)])
sampling.gen_specs = GenSpecs(
gen_f=gen_f,
out=[("x", float, (1,))],
user={
"gen_batch_size": 500,
"lb": np.array([-3]),
"ub": np.array([3]),
},
)
sampling.add_random_streams()
sampling.exit_criteria = ExitCriteria(gen_max=501)
sampling.run()
if sampling.is_manager:
sampling.save_output(__file__)
See the :doc:`tutorial<tutorials/local_sine_tutorial>` for a step-by-step beginners guide.

See the `user guide`_ for more information.

Expand Down

0 comments on commit a0de876

Please sign in to comment.